# How to resolve combat of stacks of units to mitigate numerical advantage

I just started designing an strategy game where player's armies consist of stacks of units. For my design I was aiming to reproduce the following behaviour for a full combat of multiple turns (for simplicity assume both stacks are the same unit):

• 1 vs full stack: the single unit is killed, the full stack hardly notices.
• half stack vs full stack: the half stack is killed, the full stack sustain noticeable damage.
• almost full stack vs full stack: full stack wins but gets almost wiped out. If randomness is involved, any of both may win, although the bigger one has statistical advantage.

My first approach was to add up the stats and treat each stack as a single unit, resolve the combat and then calculate how many units are killed.

That didn't produced the expected results, as even the slight numerical advantage in one side produced it to win by a huge margin.

The reason is that after each turn, the bigger stack would kill more enemies than the smaller, widening the power difference for the next turn. This different increases exponentially until the smaller stack is quickly obliterated.

As a second approach I treated each unit in a stack individually for the combat (something that I wanted to avoid), which produces much better results. However now I have many choices about how to resolve the combat.

Should it be a series of 1 vs 1 or should I allow units to gang up on others?

Should I pair each evenly or randomly?

Should I leave extra units unpaired as "reserve", or all units should fight at least once?

• In your half-stack example, what's "noticeable damage"? 50% loss? 25% loss? 5% loss? Jul 21, 2016 at 21:21

What you've described is the difference between Lanchester's linear and square laws. These are formulas estimating the rate of attrition between a battle between two military forces.

The linear law says that the two forces suffer a constant rate of attrition, regardless of the size of the forces. This is used as an approximation of ancient combat, between largely infantry formations with melee weapons. The reasoning is: it doesn't matter how many men you have in total, there is still a limited front line of actual men doing the fighting, so the larger force simply outlasts the smaller force while suffering the same casualties. So a full size force will wipe out a half size enemy but lose half their men. This appears to be the outcome you want.

The square law says that two forces deal damage at a rate equal to the number of weapons firing. At the extreme, every one can fire at and be fired by every enemy. This is used as an approximation of firearms combat. Unlike ancient combat, with modern firearms infantry can engage targets both close and far, so every one can potentially be in combat at the same time, greatly enhancing numerical advantages. So a full size force will be dealing twice the damage as a half size enemy, and over time the half size enemy will be losing men at a greater rate and deal less subsequent damage. The result is that the full size force will annihilate the enemy while suffering only a fraction of the casualties. This appears to be the model you currently have.

But if you read on the Lanchester laws, you'll notice that the same formula (which also includes a variable for firepower) applies to both linear and square cases, but with a different exponent:

• The linear law has the exponent at 1
• The square law has the exponent at 2
• For modern warfare, an exponent of 1.5 is often used

So you can try different exponents between 1 and 2 to see what makes sense for your game. One thing to note: when commanders like Hannibal attempt flanks, or when some RTS games talk about a "concave", they are effectively enhancing their exponent at the cost of the enemy's - allowing more of their forces to engage than the enemy:

• Indeed my game is fantasy themed so the linear model fits better. I will try implementing the formula and tweaking around the numbers to see how the outcome varies. Thanks! Jul 26, 2016 at 11:38

Of course you expect the smaller army to lose most of the time, but they should still have a chance to do some damage. Which history shows is usually the case - quality matters more than quantity unless it's overwhelming.

There's many ways you can accomplish this but here are a few ideas:

1. Allow everyone in the small stack to attack, don't let the larger side take out half their force before they do anything. That is, even casualties should get a parting shot at their attacker - though perhaps one with reduced effectiveness. After all they were not standing still as they died.

2. If there is a wide numerical advantage, don't let all the units in the larger stack attack. Just let perhaps 2 units for each unit in the other stack attack at most. It's unrealistic for a whole huge army to engage a tiny force all at once anyway.

3. Give bonuses for terrain and for defending if they are the ones attacked.

4. I would choose each attacker in random order, perhaps with a stat like initiative involved in determining who goes when.

5. Consider some negative stat maluses for very large armies, or a hard limit on size of armies based on some kind of leadership or logistics stat. It's not easy to control a large army and ensure everyone does what they should.

I hope some of these ideas help a bit, but of course it's a bit subjective.

• I especially like #5. In a small group, you can keep in your head where everyone is. In a large group, there's bound to be friendly fire. Adding some sort of "own goal" or "obstruction" debuff makes a lot of sense. Jul 24, 2016 at 10:59
• Of course there are no hard answers, so I really appreciate your points. I think #5 is brilliant, and can help to even out the odd a little bit when stacks with a very large difference fight. Jul 26, 2016 at 11:35