Do the Split

So it turns out that 12k was NOT enough for both combat encounter generation and management. I had 1K left and still a ton of things to write. So I’m splitting the encounter portion into a separate module.

Fortunately, this is easy to do. The “encounter” module will do the following:

  • Load monster data from disk
  • Load monster graphics from disk
  • Load player graphic data from extended memory
  • Determine how many monster types are present and how many of each type
  • Populate the data arrays for monsters with their randomly determined health and stamina
  • Determine the terrain type of the battle map and set it up
  • Load all graphic data from extended memory to support battlemap
  • Place all units on battlemap
  • Populate all necessary maps with unit and obstruction data
  • Create encounter text to display

It then immediately shifts to the Combat module.

Doing so has already freed up nearly 4K which should be enough to get the job done. It also nicely separates the encounter work (which has a large amount of influence from content) from the actual battle management.

This means I have to increase the base size of my program file to accommodate another module. I may add another 24K just so I have a little extra data space; I already load in 8K segments from disk so it doesn’t hurt to add extra for graphics space, sound data, or other data needs that may come up.

I had to restructure some basic models for how player data was stored as well, as it turned out it was better for combat determination to have the system treat players and monsters as agnostic entities. This required moving some data around, which will probably create some fun regression errors for me to fix elsewhere. 😛

Funny enough, I found myself nearly repeating the same mistake that Richard Garriott did in Ultima III, which was to forget to include weapon/armor values in attack/damage calculations! 😀 A big change from the prior design is now it adds in all the calculations dynamically rather than trying to store them in arrays ahead of time.

I’ve updated my Progress page to reflect the new module as well.

This entry was posted in Coding, CRPG, Design, TI-99/4a. Bookmark the permalink.

Leave a Reply

Your email address will not be published.