Who’s on First?

A short update…

I’m about done with the control system. There’s some item controls I will need to finish later, but the bulk of the targeting and order selection is done, more than enough to test with. Debugging wasn’t too bad… most of the errors were simple; wrong register in a bad place or a number off, that caused spectacular crashes but once fixed were quite sedate. I suppose I’m getting better at the code design. :)

Now comes the tricky bit… putting the orders into an actionable form.

All the units on the screen can have up to four orders. These are processed to determine how “fast” each order is. This depends on external factors, such as the relative base speed of the unit (with armor penalties applied), weapon speeds, spell speeds, haste or slow spells, and so forth.

Since I want first actions to take place before last actions, each action gets a “base” value added for speed, to indicate sequential order. The base is reduced for each action in turn, so that for a single unit, all actions occur one after another in sequence. Each order also has a random value added or subtracted from the speed.

After all speed values for all orders have been fully calculated, I then sort to get the highest values in order, and build an array containing the exact number and sequence of actions to occur in the round.

Coding this is turning out to be a lot more of a headache than I thought. Since I’m working in vintage assembly on a tight-memory constraint, I have to do things carefully.

I realized last night that I should pre-prepare the speed values before the players even go with the random values, and actually put the order speed changes directly in when a player selects them. This means I don’t have to reprocess orders later to get speeds. After all players have gone, I know exactly how many actions each took, and I can add the base values.

So, that’s what I’m working on now… testing it will be tricky, I may want to disable the random factor at first so I know exactly what order to expect.

After this, it’s action results! I expect some redesign to occur at this stage, because I don’t have all my combat mechanics worked out in totality. This was deliberate, as I wanted to leave myself some elbow room to play with concepts.

  1. Stu says:

    Hmm I’m not understanding the orders thing. Can you explain in more detail? Each unit gets 4 orders per round? can you give examples? what is the extent of different orders a unit can do in a single round?

    Does this mean everyone puts in their orders before any unit makes any moves, then once all orders are in, everyone moves at the same time? so you could swing and hit an enemy no longer there?

    does the speed/sorting mean if I give a unit 4 orders, they wont be executed in the order I entered them?

  2. adamantyr says:

    Each unit has up to 4 orders per round. Standard for the player is 2 orders, he can increase this through spells and items.

    Orders include: Move in a cardinal direction, attack (staying put) in a cardinal direction, use an item, cast a spell, fire a ranged weapon at an enemy target, or stand guard.

    You enter all your orders before the combat round begins. All enemy unit actions are also pre-determined before the action starts.

    Actions don’t occur simultaneously, but in a sequence determined by various factors. Fighters are faster with melee weapons than other classes, so they tend to strike first. Some spells are slower than others to cast. Heavier armor slows you down when moving as well.

    For a given unit, orders entered occur in the order given… you don’t know how in relation to other units they’ll move, though.

    When I have the engine actions mostly finished, I plan to write out a short narrative of a complete combat round, and supply a video showing it in action.

  1. There are no trackbacks for this post yet.

Leave a Reply