Combat Formula

No prob, god knows I'v made more then my share here. Probably 320 of 'em so far.
 
I tried it with a warrior attacking a spearmen. Both have 2 hit points and no modifiers. The real values are warrior 7/27 chance of winning and spearmen 20/27. With the formula both seem to get 4 out of 27. ??? Did I do it correctly with the variables A=1,D=2,hpl=2,dhp=2,n=3?
 
Without doing the calculation I can see that D can't be 2.

D is probably 2.2, since the base terrain gives a +10 defense if it is grass, plains, floodplains, desert or tundra.

Other types give more defense, water terrain and air gives 0% IIRC.
 
That's what it would be in a real game but if you have a modded game the results aren't the same.
 
So you made new terrain in the editor to do the tests? I guess I should have guessed that. :confused:
 
Originally posted by slothman
I tried it with a warrior attacking a spearmen. Both have 2 hit points and no modifiers. The real values are warrior 7/27 chance of winning and spearmen 20/27. With the formula both seem to get 4 out of 27. ??? Did I do it correctly with the variables A=1,D=2,hpl=2,dhp=2,n=3?

(1/1+2)^2 * (1- (1/(1 + 2))^1 * [2!/1! * (2-1)!]

1/3^2 * 2/3 * 2 = 0.14814 = 14.814%

14.814% chance of the warrior winning the battle AND losing 1 hp

(1/1+2)^2 * (1- (1/(1 + 2))^0 * [1!/0! * (1-0)!]

1/3^2 * 1 * 1 = 0.11111 = 11.111%

11.111% chance of the warrior winning the battle AND losing 0 hp

Therefore the warrior has 11.111% + 14.814% = 25.925% chance of winning the battle in these circumstances. Download my program here. It does all the calculations for you. It also gives you the chances of the defender winning with his hit points remaining.

But yes, 7/27 is the fractional equivalent...

The values you listed are for the Warrior, the spearmen would be A=1, D=1 (assuming no bonuses), hpl=0 or 1, dhp = 2, n = 3

You must do a sum for each possibility, calculate hpl from 0 to attackershp-1 and add up these results. This will be the total chance of winning. If you just do it for one calculation you get the chance of winning with those exact hit points lost only, not the total battle. Since in your variables hpl = 2, with conscript units, the formula will not work right, because it is calculating the chance of winning the fight with 0hp remaining for the attacker... The attackers hit points lost can never be greater than or equal to his total hit points (if you are calculating the attackers chance of winning, as this formula is)

Also, I will re-edit the first post to reflect this constraint...

The total outcome matrix for the attacker winning with...
0 hit points lost - 11.111%
1 hit point lost - 14.815%
WINNING Chance - 25.926%
LOSING Chance - 74.074%

The total outcome matrix for the defender winning with...
0 hit points lost - 44.444%
1 hit point lost - 29.630%
WINNING Chance - 74.074%
LOSING Chance - 25.926%
(Note: This is calculated with a different formula, and is on my spreadsheet noted above, I will post it later for any who are interested)
 
Back
Top Bottom