For those who are interested in how to implement n-roll combat in civ3 combat calculations, here are some pointers. By n-roll combat, I mean that instead of generating a single random number uniformly from 0 to 1 for each round of combat, n such numbers are generated, and the average is taken. Cases for n = 1 (the current system), 2, 3 and 4 (initially in the beta patch - now dropped) are examined.
I'm not going to go into how the calculations are done here - I outlined the method on another thread, so if you care, look there.
Following are some sets of functions. To use them, you first calculate the probability of winning one round of combat for the scenario you are looking at. For example, a swordsman attacking a fortified spearman on a plain, 3 attack vs 2.70 defense. The probability of the swordsman winning one round of combat is 3.0 / (2.7 + 3.0) = 0.526315789...
Then, find the approprite formula below (for the number of rolls averaging over), plug this number in for the value of x, and get out a new number y. This is the number yuo want to use as the probability of winning a single round when averaging over n rolls (if you've used the right formula). To use our sword-spear example, in the case of averaging over 4 rolls, we get the value y=0.569802001... So the swordsman will win 56.98% of combat rounds, instead of 52.63% of combat rounds. (This can be used to work backwards, and find that a 3 attack vs a 2.7 defense, averaging over 4 rolls, is the same as a 3.576 attack vs a 2.7 defense using single-roll combat). Then you just carry on to calculate the probability of winning and losing as before.
The formulae
(x^4 = x * x * x * x; x^3 = x * x * x; x^2 = x * x)
For n = 2 (2-roll combat):
0.0 < x < 0.5 ==> y = 2 x^2
0.5 < x < 1.0 ==> y = -2 x^2 + 4 x - 1
For n = 3 (3-roll combat):
0.0 < x < 1/3 ==> y = (9/2) x^3
1/3 < x < 2/3 ==> y = -9 x^3 + (27/2) x^2 - (9/2) x + (1/2)
2/3 < x < 1.0 ==> y = (9/2) x^3 - (27/2)x^2 + (27/2) x - (7/2)
For n = 4 (4-roll combat)
0.00 < x < 0.25 ==> y = (32/3) x^4
0.25 < x < 0.50 ==> y = -32 x^4 + (128/3) x^3 - 16 x^2 + (8/3) x - (1/6)
0.50 < x < 0.75 ==> y = 32 x^4 - (256/3) x^3 + 80 x^2 - (88/3) x + (23/6)
0.75 < x < 1.00 ==> y = -(32/3) x^4 + (128/3) x^3 - 64 x^2 + (128/3) x - (29/3)
Obviously, for the example case above, we used the third of the n = 4 formulae, since x=0.5263.. falls in the 0.50->0.75 range.
Having never used Excel spreadsheets or whatever, I have no idea whether it is possible to implement this in one of the spreadsheet based combat calculators. I've got a short c program that calculates combat odds for 1-4 roll combat. If anyone is interested in getting hold of it, PM me.
I'm not going to go into how the calculations are done here - I outlined the method on another thread, so if you care, look there.
Following are some sets of functions. To use them, you first calculate the probability of winning one round of combat for the scenario you are looking at. For example, a swordsman attacking a fortified spearman on a plain, 3 attack vs 2.70 defense. The probability of the swordsman winning one round of combat is 3.0 / (2.7 + 3.0) = 0.526315789...
Then, find the approprite formula below (for the number of rolls averaging over), plug this number in for the value of x, and get out a new number y. This is the number yuo want to use as the probability of winning a single round when averaging over n rolls (if you've used the right formula). To use our sword-spear example, in the case of averaging over 4 rolls, we get the value y=0.569802001... So the swordsman will win 56.98% of combat rounds, instead of 52.63% of combat rounds. (This can be used to work backwards, and find that a 3 attack vs a 2.7 defense, averaging over 4 rolls, is the same as a 3.576 attack vs a 2.7 defense using single-roll combat). Then you just carry on to calculate the probability of winning and losing as before.
The formulae
(x^4 = x * x * x * x; x^3 = x * x * x; x^2 = x * x)
For n = 2 (2-roll combat):
0.0 < x < 0.5 ==> y = 2 x^2
0.5 < x < 1.0 ==> y = -2 x^2 + 4 x - 1
For n = 3 (3-roll combat):
0.0 < x < 1/3 ==> y = (9/2) x^3
1/3 < x < 2/3 ==> y = -9 x^3 + (27/2) x^2 - (9/2) x + (1/2)
2/3 < x < 1.0 ==> y = (9/2) x^3 - (27/2)x^2 + (27/2) x - (7/2)
For n = 4 (4-roll combat)
0.00 < x < 0.25 ==> y = (32/3) x^4
0.25 < x < 0.50 ==> y = -32 x^4 + (128/3) x^3 - 16 x^2 + (8/3) x - (1/6)
0.50 < x < 0.75 ==> y = 32 x^4 - (256/3) x^3 + 80 x^2 - (88/3) x + (23/6)
0.75 < x < 1.00 ==> y = -(32/3) x^4 + (128/3) x^3 - 64 x^2 + (128/3) x - (29/3)
Obviously, for the example case above, we used the third of the n = 4 formulae, since x=0.5263.. falls in the 0.50->0.75 range.
Having never used Excel spreadsheets or whatever, I have no idea whether it is possible to implement this in one of the spreadsheet based combat calculators. I've got a short c program that calculates combat odds for 1-4 roll combat. If anyone is interested in getting hold of it, PM me.
Comment