January 6, 2023

Combat Simulation III

Let's continue with movement selection.

We're still only considering melee. I'll address ranged movement next, and then move on to the actual attack.

The following considerations are taken into account:

  1. Distance to target. A closer target is better, or considered a higher threat. For now, I'll consider all enemies to be of equal threat all things considered. I have a planned upgrade to allow creatures of higher intelligence to weight threats based on the enemy's HD
  2. Required AP. Again, closer is better, in this case because the character can move there with AP to spare and possibly attack
  3. Flanking. Could possibly make this available only to higher intelligence creatures also

This generates the following maps. I'm still using the constrained movement but I'm thinking through strategies for a freer (and therefore more efficient) system. The darker the hex, the higher the movement score. Notice in the second image that the preferred move would flank Blue.

Blue guy (right)

Red guy (top right)

This is probably fine for now. There's always more things that come up, but I'm in a move-fast-break-things mood so we'll fix those as they become problems.

January 2, 2023

Combat Simulation II

Previously, I discussed basic, unhindered movement. But movement is rarely unhindered, and so we'll need to add constraints and obstacles.

The trickiest part of this was figuring out how to represent a battle map in memory. I want to use an inefficient format like JSON because its human readable and we can check it into source control easily. As I was going over old combats, I realized that this tool could be very helpful to review both your own historical fights but also those of others, like a quarterback going over old game film.

For now, I'll try to use the simplest possible case. Map hexes are flat-topped and have an equal movement cost. To represent buildings or other structures, one of the sides of the hex is denoted "blocked": that is, no movement may take place through that side. If all 6 sides are blocked, the entire hex is impassable: perhaps a large tree. If two or more sides are blocked, the hex is considered a partial hex and movement/combat buffs may apply.

The following diagram shows two groups of combatants: blue and red. The thick black lines show the outline of a small keep, with several broken walls providing gaps.

Let us say that the blue combatant entering the keep at the bottom wishes to move elsewhere. He'll have to spend 1 AP disengaging from combat, leaving him with 1 or 2 AP for movement. His possible moves are then as follows:

For our purposes here, we'll ignore certain moves that would end in an opponent's hex, such as charging or overbearing.

Later, we can make the map more complex by introducing travel costs for each hex, but this will be fine for now.