Elegant, math-based solution to Attack/Defense issues with squad size.

There’s been a lot of debate around the issue of applying Attack and Defense between unit that are single troops vs. units that are composed of multiple troops. I’d like to take a fairly straightforward, mathematically sound approach to show what the equations “should” look like. I’m going to add two new stats I think are necessary to model the situation. In the next few sections, I'm basically just going to "show my work" for this equation:

Expected Damage = Expected number of hits * Expected damage per hit

Modelling the concepts of "Attack" and "Defense"
  Pretend that we host a crazy tournament where everyone fights everyone else in 1-on-1 combat, and we keep records. Not great records, mind you – all we’re recording is, over the course of all of your exchanges, how many times did you launch a successful attack (whether or not it did damage or was deflected), and how many times did you deflect incoming attacks (that would have been successful).

  At this point, anyone who never landed a single attack would have Attack = 0, right? The worst attacker who wasn’t useless (who scored a single hit only), would have Attack = 1, and so on. We could think about everyone’s Attack score as being a factor of how much better they are than the guy with the 1. So if my Attack is 10, I’m launching successful attacks 10x more often than the worst guy during my exchanges. Do the same thing with Defense.

  Now take two opponents: Pair them together in some large number of exchanges. If one dies, replace him and continue the experiment. The attacker will launch attacks at a rate of “Attack” and the defender will parry those attacks at rate “Defense.” Over a long period, the attacker would successfully land Attack / (Attack + Defense) strikes.   [Math Alert: This is based on the equilibrium equation for a two state system that enters the “hit” state with rate Attack*c and returns to the “not hit” state with rate Defense*c. The c cancels out, so we can ignore it]

  Neat. What if I have two attackers (and still one defender)? Well, there will be twice as many attacks, but the defender is still only able to defend against them at the same rate. What about 1 attacker and 2 defenders? Without some concept of “teamwork,” each attack the attacker launches is only defended at the rate of the single unit he attacked. What about 2 attackers and 2 defenders? In that case, let’s say they’d pair off, so it would be like having 1-on-1 combat. That means we need to incorporate how many atackers are attacking each defender. We'll define it like this: Overwhelm Factor = Max(1, Num Attackers / Num Defenders). This lets a large number of attackers gang up on a smaller number of defenders, but doesn’t give them fewer attacks when there are more defenders*. The final “Hit Percent” looks like this:
   Overwhelm = Max(1, Num Attackers / Num Defenders)
   Hit Percent = Overwhelm * Attack / (Overwhelm * Attack + Defense)

*Defenders' number advantage comes into play when calculating hit points.

Incorporating the idea of damage per attack
What this doesn’t talk about yet is damage. To avoid getting too long winded, pretend I did the same thing as above to justify the following definitions:
  Armor = The number of times your armor protected you from 1 Hit point of damage.
  Damage = The number of Hit points of damage you offered.

From similar logic, we see that the percent of offered damage that gets through the unit's armor is Damage / (Damage + Armor). The actual damage per hit is Damage^2 / (Damage + Armor). Damage and Armor are all about 1 hit, 1 target. Attacker/Defender numbers don’t factor in at all (without additional assumptions).

Adding in bonuses from Morale
Last, let’s look at morale. I’m going to pretend that units with higher morale attack/defend with a higher rate. That would let me define Attacker Morale Factor = Attacker Current Morale / Average Morale and the same for the defender. I could then multiply the Attack and Defense values by the appropriate morale factor. The nice thing is, this clearly means that the balance of power remains the same between two unit that have the same current morale, no matter what the value is.

The unified formula(s)
So here’s the final equation for the average damage inflicted on the defender by the attacker:

Overwhelm = Max(1, Num Attackers / Num Defenders)
Effective Attack = Max(1, Overwhelm * Attack * Attacker Morale / Average Morale)
Effective Defense = Max(0, Defense * Defender Morale / Average Morale)
Hit Percent = Effective Attack / (Effective Attack + Effective Defense)
Successful Attacks =  Effective Attacks * Hit Percent
Damage Per Hit = Damage * Damage / (Damage + Armor)
Total damage = Successful Attacks * Damage Per Hit

If I were going to implement this, per attack pass I’d randomly generate an effective value for both Attack and Defense pretending that the base scores were the rates of Poisson distributed random variables. I wouldn’t do that with armor/defense. Then I’d plug and chug and report the final damage.

Obvious extensions
  Swarming. These guys get a bonus to attack when they outnumber the defenders. Increase the Overwhelm factor when it’s > 1.
  Coordinated Defense. These guys fight as a unit, watching each other’s backs. Reduces overwhelm factor (toward 1) when they’re defending.
  Armor piercing. Reduces the Armor value of the target (min 0) in the calculation above.
  Frenzy (Special Attack) This unit makes 2 attacks per model, but each attack is at 50% Damage. This would be tactically awesome against large numbers of weaker foes. 
  Cowards. These guys' have -X morale when they're outnumbered.
  Berserkers. These guys' have +X morale when outnumbered. 
  Dodge. Really it’s just Defense now – no need to specify if you parried/blocked/dodged.
 And many, many more.

Gnilbert

6,699 views 4 replies
Reply #1 Top

You've modeled the system, but I suspect you're not going to get many responses without actually demonstrating why this is superior to the current system - I'd suggest including some actual gameplay examples using in-game units (and some custom/summoned units) in a few different situations to show the difference.

Reply #2 Top

Goodmorning, 

Your method is quite mathematically well thought out,  but it is not very transparent.   You've added Defense, armour, and damage but now have to calculate 7 things to solve a combat roll, and i can follow the math and work it out, but I'm a physics grad student.

From a pure mathematical sense I really like your model but from a Gameplay sense I find it a bit heavy.

I would really like to see a full worked out battle using your system, or just a few rounds. I think you'll find that the transparency goes away quickly. and that it is hard to get an intuitive sense of how much damage you're going to do.

I suggested a similarly motivated adaptation which also takes into account being swarmed, [but interestingly can be used to give a benefit to the lone fighter against mobs of untrained minions].  Give a look at it at  https://forums.elementalgame.com/394023 and tell me what you think. I'd really appreciate the opinion of somebody else who doesn't shy from a few equations.

If you see any error in my simulated battle please highlight them for me.

Robbie Price

Reply #3 Top

You might get more response in the ideas forum, there's been a bunch of discussion about these issues there. :)

Reply #4 Top

Effectively, you're modeling DPS within a turn-based system and using that as damage. :)

 

Any way, as others have said, I'd really like to see some numbers in practice using a variety of different scenarios. At the least, two types of easy enemies, a medium enemy, and a hard enemy. How long does it take for them to kill each other, how much damage does the victor sustain, how many hits does it take to kill something, how does changing various stats affect the system in practice (especially things -not- in the system like health and such).

 

And in defense of people who aren't physics grad students, I can follow the math and figure it all out. :)