Reply
 
Thread Tools
Old December 22, 2003, 11:42   #1
vulture
PtWDG Gathering StormPtWDG2 Mohammed Al-SahafC4DG Gathering Storm
King
 
vulture's Avatar
 
Local Time: 15:59
Local Date: November 2, 2010
Join Date: Jun 2001
Location: Leeds, UK
Posts: 1,257
How to calculate n-roll combat results
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.
vulture is offline   Reply With Quote
Old December 22, 2003, 12:19   #2
vulture
PtWDG Gathering StormPtWDG2 Mohammed Al-SahafC4DG Gathering Storm
King
 
vulture's Avatar
 
Local Time: 15:59
Local Date: November 2, 2010
Join Date: Jun 2001
Location: Leeds, UK
Posts: 1,257
Some results from playing around with ancient era combat odds to compare 1 and 2 roll combat:

Warriors become about half as useful for fighting which they were never much good for anyway. With vanilla combat, you'd lose roughly 3 warriors for every spearman you killed (going against spearmen fortified in towns on plains - 2.70 defense). With 2-roll, that becomes 6.3 warriors lost per spearman (16.9 for 4-roll combat!) I don't think this causes too many problems though, since warriors are primarily built for exploration, military police or upgrading to swordsmen (or barb control, where they've become a little weaker for human players). The AI rarely attacks with warriors either, so this doesn't pose a big problem.

The balance between horsemen and swordsmen is thrown a bit, even with two roll combat. Before, on average, you'd lose 0.68 swordsmen, 0.79 horsemen or 1.29 archers for every spear killed (that's 20, 24 and 26 shields worth of losses respectively). With 2-roll combat, these become 0.56 for swordsmen, 0.98 for horsemen, 1.81 for archers (that's 17, 30 and 36 shields worth of losses). By this criteria, swordsmen are a factor of two better than the ancient alternatives now (not that this is necessarily the best criteria). Previously, swordsmen were the best attackers, horsemen were a bit worse since you needed more of them, to start with (due to retreats) and lost slightly more of them, but they were faster and upgraded to knights and archers were a distant third due to the highest losses and worse speed (which was the plan - they are the tolerable but not brilliant fallback plan if you have no horses or iron). With 2-roll combat, swordsmen are the attackers of choice. Horsemen become relegated to second place - still useful for fast defence units, but not strong enough to attack enemy cities that well, and archers are weak enough that any civ without iron is going to have great difficultly winning a war. This will hurt the AI particularly, since an attacker will have to mass lots of archers to make an impression (not an AI strong point in the ancient era), and still lose twice as many archers as it kills spearmen. Humans will recognise the benefit of building mostly spears and sitting around in towns with walls under such circumstances, while the AI will waste much of its production bouncing off walls.

2-roll combat is something that would need playtesting. The role of horsemen would certainly change, as would the balance of unique units - hoplites become very strong, even just on small towns with no walls (a horse wuold have a 4% chance of beating one, a sword a 22% chance). Immortals become pretty powerful too, and will chew through spearmen quite easily (84% chance of winning, 0.2 immortals lost per spearman). Jag warriors become virtually useless. Mounted warriors are unchanged, legions are very hard to kill, bowmen become tougher vs archers and horses, weaker vs spears and swordsmen. Even 2-roll would produce large changes.

What might be a better solution would be to skip the averaging thing, and just use a simple mapping of probability as per above (you can get the results two ways - by averaging n random numbers for each round, or using 1 random number and feeding it through a formula to produce the same distribution as averaging n numbers). Something simple like:

0.00 < x < 0.25 ==> y = 4 x^2
0.25 < x < 0.75 ==> y = x
0.75 < x < 1.00 ==> y = -4 x^2 + 8 x - 3

This leaves x unchanged between 0.25 and 0.75 (ratio of attack and defence strength is less than 3), while beyond that unlikely results become even more unlikely (10% chance becomes 4% chance for a single combat round). This would keep balance between units of similar strengths (units that are meant to be around at the same time) while allowing strong units to be better vs obsolete units, and reduces the spearman-tank 'problem' for example. Might still short-change jaguar warriors for example though, at least for some of their uses.
vulture is offline   Reply With Quote
Old December 22, 2003, 13:46   #3
Tall Stranger
PtWDG Gathering StormApolyton University
Warlord
 
Tall Stranger's Avatar
 
Local Time: 10:59
Local Date: November 2, 2010
Join Date: Nov 2002
Location: Northern Virginia
Posts: 273
Vulture,

Great job! I can't pretend to understand the math you laid out (it's been a long time since my senior year of high school, and I didn't understand this stuff too well back then!) But the analysis you laid out was very interesting, and reinforces my concerns that this approach could seriously wreck the balance of the ancient age (and possibly later ages as well). I'm wondering about Knight-replacement UUs vs. pikes, and whether that matchup could get really ugly.

I'm intrigued by your suggested approach. If I understand you correctly, under this new approach only when the A/D ratio is greater than 3 do the combat outcomes change from what would currently happen. Is that right?

Even so, I still really feel like this is a solution in search of a meaningful problem. If people with tanks are beating up some pathetic AI that still has spearmen, they can afford to have an occasional loss.
__________________
They don't get no stranger.
Do not taunt Happy Fun Ball.
"We will not tire, we will not falter, and we will not fail." George W. Bush
Tall Stranger is offline   Reply With Quote
Old December 22, 2003, 15:24   #4
vondrack
lifer
InterSite Democracy Game: Apolyton TeamCivilization III PBEMCivilization IV PBEMPtWDG Legoland
Emperor
 
vondrack's Avatar
 
Local Time: 15:59
Local Date: November 2, 2010
Join Date: Jan 2002
Location: Praha, Czech Republic
Posts: 5,581
While I do not care about tanks being defeated by spears (never happened to me anyway), I do care about MedInfs (sometimes even cavalry! doh!) losing to, say, defending longbows (which I've seen too many times). What vulture suggests (the mapping function) sounds like a pretty good idea and one that would be quite easy to "feel".

(combat bonus modified) A : D ratio less than 3 : 1 (or 1 : 3)? Cool - whatever you were used to still applies. (combat bonus modified) A : D ratio over that threshold? The overwhelmed unit is much more likely to lose than it used to be (and the bigger the gap, the more dramatic the likelihood change).

This would, for the majority of at least remotely "even" battles introduce no change at all, but would likely fairly reduce the "quirks" that drive so many people (me included) plain crazy.

I like the idea, vulture!

...though I might go for a slightly narrower interval, considering 2.5:1 (combat bonus modified) the "breaking point", where the "special" formulas would be applied from
vondrack is offline   Reply With Quote
Old December 22, 2003, 15:34   #5
Nor Me
Apolyton University
Prince
 
Local Time: 14:59
Local Date: November 2, 2010
Join Date: Oct 2002
Posts: 689
I did quick, back of the envelope, calculation for this formula the day we first heard of the system and came up with the attached excel spreadsheet to find out this probability and what the equivalent A/D values would have been under the old system.

I've yet to check that it agrees with your formula but I checked a few values and it appears to.

EDIT: I have now. I had the same formula.
Attached Files:
File Type: zip part.zip (2.1 KB, 6 views)

Last edited by Nor Me; December 22, 2003 at 15:55.
Nor Me is offline   Reply With Quote
Old December 23, 2003, 20:13   #6
Theseus
PtWDG Gathering StormApolyton UniversityApolytoners Hall of FameBtS Tri-LeagueC4DG Gathering StormApolyCon 06 Participants
Emperor
 
Theseus's Avatar
 
Local Time: 10:59
Local Date: November 2, 2010
Join Date: Apr 2002
Location: The warmonger formerly known as rpodos. Gathering Storm!
Posts: 8,907
So, vulture's proposal creates a sort of bell curve with a flattened top?

Perfect.
__________________
The greatest delight for man is to inflict defeat on his enemies, to drive them before him, to see those dear to them with their faces bathed in tears, to bestride their horses, to crush in his arms their daughters and wives.

Duas uncias in puncta mortalis est.
Theseus is offline   Reply With Quote
Old December 24, 2003, 15:56   #7
RobC
Warlord
 
RobC's Avatar
 
Local Time: 06:59
Local Date: November 2, 2010
Join Date: Aug 2001
Location: Franky's Cellar
Posts: 241
Quote:
[SIZE=1]
What might be a better solution would be to skip the averaging thing, and just use a simple mapping of probability as per above (you can get the results two ways - by averaging n random numbers for each round, or using 1 random number and feeding it through a formula to produce the same distribution as averaging n numbers). Something simple like:

0.00 < x < 0.25 ==> y = 4 x^2
0.25 < x < 0.75 ==> y = x
0.75 < x < 1.00 ==> y = -4 x^2 + 8 x - 3

This leaves x unchanged between 0.25 and 0.75 (ratio of attack and defence strength is less than 3), while beyond that unlikely results become even more unlikely (10% chance becomes 4% chance for a single combat round). This would keep balance between units of similar strengths (units that are meant to be around at the same time) while allowing strong units to be better vs obsolete units, and reduces the spearman-tank 'problem' for example. Might still short-change jaguar warriors for example though, at least for some of their uses.
This seems like a very good idea, and it is more flexible than my idea of having the 'penalties' for weaker units be based on era. Basically, since non-UU ancient era units have at best a defense of 2, they become really obsolete once cavalry (6 attack) come around. Pikemen (3 defense) and musketmen (4 defense) become useless when tanks (16 attack) or marines (12 attack) become available, while riflemen/guerillas (6 defense) are only obsolete in the face of modern armor (24 attack). Infantry (10 defense) and TOW infantry (14 defense) never become obsolete, which I think is correct. Similarly, the best non-UU ancient era attackers (3 attack) become useless against infantry, medieval infantry and knights are obsolete against TOW infantry, while cavalry and guerrillas are only worthless against mech infantry. I like it!
RobC is offline   Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 10:59.


Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Apolyton Civilization Site | Copyright © The Apolyton Team