September 22, 2002, 20:32
|
#1
|
Emperor
Local Time: 03:24
Local Date: November 1, 2010
Join Date: Sep 2002
Location: of the Free World
Posts: 7,296
|
Combat Results Math...
Ok, I went to the trouble of looking up how Civ3's combat probability works (to the best of anyone's knowledge online) and then used my handy-dandy probability spreadsheet (which I have used for other games where probabilities of this sort are required) and worked out the actual chances of stuff.
It turns out the the civulator created by a guy on CivFanatics (which I tested against my model) works exactly the same way and spits out the same result. By contrast, the equation Shriber was using is *not* accurate.
The reality is that you have to use either Pascal's triangle as a data set for a series of fairly complex calculations (my formula for each cell in the spreadsheet is below) or you have to use a series of factorials and other stuff like that (which is what the "Civulator" uses), essentially the same calculation.
First of all, the chance of the attacker winning any individual round of combat is the same as Civ1:
a = attacker's modified attack rating
d = defender's modified defense rating
% = a/(a+d)
To determine the result of an entire combat for two units with given hitpoints as well as modified attack/defense ratings is a hellishly complicated thing to do.
Just to give you a glimpse of how I set up my spreadsheet, here's the fomula for individual cells (each cell representing the chance that a certain number of hits will be scored by the attacker in a given number of rounds):
c = % chance of attacker winning a single round
r = maximum # of possible rounds for this combat
h = # of rounds won by attacker (of maximum # of rounds)
k = appropriate number from Pascal's triangle
% = [(c)^(h)]*[(1-c)^(r-h)]*k
------------
To give you an example... I'll use the combat we were debating about during the turnchat earlier today...
An Elite (5/5) Apolytonian Pikeman (1/3/1) attacks a Regular (3/3) Persian Archer (2/1/1) on a jungle tile. The jungle tile gives the Persian Archer a 25% bonus to defense, so its modified defense rating is 1.25, where the Apolytonian Pikeman's modified attack rating is 1, the same as its base attack rating.
a = 1
d = 1.25
c = a/(a+d) = .4444 (rounding)
c = .4444
The value of r is defender's hp + attacker's hp - 1
so r = (3)+(5)-1 = 7
r = 7
The values for h and k are determined case-by-case as we determine the chance for a specific number of attacker wins (h) -vs- the total number of possible rounds (r).
In this case, we have 8 different cases to examine, one each for values of h from 0 through 7. Now, It is not possible for the attacker to even *make* anything more than 3 hits, but for purposes of determining the probability of a "win" for the attacker, 3+ hits are a "win" since the extra "hits" simply represent that the combat might have ended more quickly than maximum possible 7 rounds.
Here's the calculation for each individual case:
c = % chance of attacker winning a single round
r = maximum # of possible rounds for this combat
h = # of rounds won by attacker (of maximum # of rounds)
k = appropriate number from Pascal's triangle
% = [(c)^(h)]*[(1-c)^(r-h)]*k
****0/7 attacker wins (defender victory)****
k = 1
% = [(.4444%)^(0)]*[(1-.4444)^(7-0)]*1
% = 1.63%
****1/7 attacker wins (defender victory)****
k = 7
% = [(.4444%)^(0)]*[(1-.4444)^(7-0)]*7
% = 9.15%
****2/7 attacker wins (defender victory)****
k = 21
% = [(.4444%)^(0)]*[(1-.4444)^(7-0)]*21
% = 21.96%
****3/7 attacker wins (attacker victory)****
k = 35
% = [(.4444%)^(0)]*[(1-.4444)^(7-0)]*35
% = 29.27%
****4/7 attacker wins (attacker victory)****
k = 35
% = [(.4444%)^(0)]*[(1-.4444)^(7-0)]*35
% = 23.41%
****5/7 attacker wins (attacker victory)****
k = 21
% = [(.4444%)^(0)]*[(1-.4444)^(7-0)]*21
% = 11.24%
****6/7 attacker wins (attacker victory)****
k = 7
% = [(.4444%)^(0)]*[(1-.4444)^(7-0)]*7
% = 3.00%
****7/7 attacker wins (attacker victory)****
k = 1
% = [(.4444%)^(0)]*[(1-.4444)^(7-0)]*1
% = 0.34%
Now, adding up the cases of defender victory and attacker victory seperately:
attacker victory: 67.26%
defender victory: 32.74%
----------------------------------
Now, the good news is that you don't have to do all that math on your own . The civulator that someone on CivFanatics created actually does these calculations for you (though in a different way than I have) and just spits out the results of each of those cases (you still have to tally the cases of attacker victory -vs- defender victory yourself). My spreadsheet is much the same, but it's significantly less user friendly (I designed it for my own use...).
The reason why Shriber's calculations didn't work was that his system for determining the victor of a full combat was too simple (he multiplied the modified attack rating by the attacker's hp and the modified defense rating by the defender's hp). The reality is that the multiple rounds of combat caused by having multiple hitpoints make the situation many times more complex.
I strongly suggest that at least one person who will be around for turnchats go take a visit to CivFanatics or somewhere else to pick up a copy of the Civulator spreadsheet (I think OPD apparently already has one). Conversely, if I'm around, I'll just use my spreadsheet (I like mine better, though it spits out the exact same results :-) ).
That's all for now. Sorry for the obsessively long post with all the mathy stuff...
|
|
|
|
September 22, 2002, 23:45
|
#2
|
Emperor
Local Time: 05:24
Local Date: November 1, 2010
Join Date: Jul 2002
Location: Botanic Garden, Rio
Posts: 5,124
|
It's great, Arnelos. Useful spreadsheet!
Btw, some of us like Mathy stuff...
|
|
|
|
September 23, 2002, 00:20
|
#3
|
King
Local Time: 03:24
Local Date: November 1, 2010
Join Date: Sep 2002
Location: Halloween town
Posts: 2,969
|
as long as integration by parts is involved....
__________________
:-p
|
|
|
|
September 23, 2002, 03:21
|
#4
|
Deity
Local Time: 20:24
Local Date: November 1, 2010
Join Date: Nov 2001
Location: That's DR WhereItsAt...
Posts: 10,157
|
What, no separation of variables? Dirac delta functions? Hilbert spaces?
NO FOURIER SERIES?!?!?!
Very interesting, though. I have read and at one time downloaded the Combat Calculator, but somehow you make it seem so much less boring to read, Arnelos.
Excellent thread.
|
|
|
|
September 23, 2002, 03:29
|
#5
|
Emperor
Local Time: 09:24
Local Date: November 1, 2010
Join Date: Feb 2002
Location: EMPEROR of Cats
Posts: 3,229
|
I have the impression that, during a fight, if you start losing individual rounds of battle, the probability of losing the next is higher (put in other words: the battle victories are clustered somehow).
Anyone can confirm this observation?
__________________
Greatest moments in cat:
__________________
"Miaooow..!"
|
|
|
|
September 23, 2002, 03:40
|
#6
|
King
Local Time: 09:24
Local Date: November 1, 2010
Join Date: Jun 2002
Location: AUERSTADT
Posts: 1,757
|
I confirm this impression, but I believe it is only an impression (psychology : Ah ! bad start ...).
Others impressions :
- a unit alone loose frequently battles against weaker units.
- elite units behave worse than veteran units.
But that is certainly due to psychology : we forget the percent of possible loss, and we expect too much of elite.
__________________
Statistical anomaly.
The only thing necessary for the triumph of evil is for good men to do nothing.
|
|
|
|
September 23, 2002, 05:45
|
#7
|
Emperor
Local Time: 10:24
Local Date: November 1, 2010
Join Date: Jul 2002
Location: Haifa, Israel
Posts: 5,474
|
Bah, I figured all along that my equation is inaccurate and I knew why, I just didn't know how to factor those elements of combat in. I'm still as far advanced as highschool math.
Anyway, thanks for providing us with a much more accurate system to predict combat results!
__________________
"Close your eyes, for your eyes will only tell the truth,
And the truth isn't what you want to see,
Close your eyes, and let music set you free..."
- Phantom of the Opera
|
|
|
|
September 23, 2002, 06:16
|
#8
|
King
Local Time: 04:24
Local Date: November 1, 2010
Join Date: Aug 2001
Location: Cincinnati
Posts: 2,015
|
Quote:
|
Originally posted by BigFurryMonster
I have the impression that, during a fight, if you start losing individual rounds of battle, the probability of losing the next is higher (put in other words: the battle victories are clustered somehow).
Anyone can confirm this observation?
|
it does seem like that, but it isnt true. neither is the 'hot hands' myth in basketball.
|
|
|
|
September 23, 2002, 06:30
|
#9
|
Emperor
Local Time: 10:24
Local Date: November 1, 2010
Join Date: Jul 2002
Location: Haifa, Israel
Posts: 5,474
|
Actually, I understand that some long-abandoned algorithms for generating random numbers did often spit out clusters of close numbers, but that's not what Civ III uses.
AFAIK Civ III's battles are fed by Windows' randomizer, which gives fairly spread results.
__________________
"Close your eyes, for your eyes will only tell the truth,
And the truth isn't what you want to see,
Close your eyes, and let music set you free..."
- Phantom of the Opera
|
|
|
|
September 23, 2002, 08:36
|
#10
|
Emperor
Local Time: 05:24
Local Date: November 1, 2010
Join Date: Jul 2002
Location: Botanic Garden, Rio
Posts: 5,124
|
Well, you are using Fourier series (not exactly you, but the numeric processor of your computer... ). Unfortunately, no complex variables. Some topology, maybe.
About Dirac... try some impulse functions... One integral here, another there...
Are you complaining about Hilbert? What about Riemann?
Here’s a little poem about my beloved zeta function:
Where are the zeros of zeta of s?
G.F.B. Riemann has made a good guess;
They're all on the critical line, saith he,
And their density's one over 2 pi log t.
This statement of Riemann's has been like a trigger,
And many good men, with vim and with vigour,
Have attempted to find, with mathematical rigour,
What happens to zeta as mod t gets bigger.
The efforts of Landau and Bohr and Cramer,
Littlewood, Hardy and Titchmarsh are there,
In spite of their effort and skill and finesse,
In locating the zeros there's been little success.
In 1914 G.H. Hardy did find,
An infinite number do lay on the line,
His theorem, however, won't rule out the case,
There might be a zero at some other place.
Oh, where are the zeros of zeta of s?
We must know exactly, we cannot just guess.
In order to strengthen the prime number theorem,
The integral's contour must never go near 'em.
Let P be the function minus Li,
The order of P is not known for x high,
If square root of x times log x we could show,
Then Riemann's conjecture would surely be so.
Related to this is another enigma,
Concerning the Lindelöf function mu sigma.
Which measures the growth in the critical strip,
On the number of zeros it gives us a grip.
But nobody knows how this function behaves,
Convexity tells us it can have no waves,
Lindelöf said that the shape of its graph,
Is constant when sigma is more than one-half.
There's a moral to draw from this sad tale of woe,
which every young genius among you should know:
If you tackle a problem and seem to get stuck,
Use R.M.T., and you'll have better luck.
Words by Tom Apostol (revised cph
They don't do math nowadays like they did yesterday...
Note: Math could be extremely literary…
Btw, excellent thread.
Note 2: Delicious nonsense....
Note 3: Tech spam is fun!
|
|
|
|
September 23, 2002, 08:57
|
#11
|
Emperor
Local Time: 05:24
Local Date: November 1, 2010
Join Date: Jul 2002
Location: Botanic Garden, Rio
Posts: 5,124
|
Quote:
|
Originally posted by BigFurryMonster
I have the impression that, during a fight, if you start losing individual rounds of battle, the probability of losing the next is higher (put in other words: the battle victories are clustered somehow).
Anyone can confirm this observation?
|
It's just an impression, BFM. However, this is the fun about statistics: one result don't depends of the other...
|
|
|
|
September 23, 2002, 09:03
|
#12
|
Emperor
Local Time: 09:24
Local Date: November 1, 2010
Join Date: Feb 2002
Location: EMPEROR of Cats
Posts: 3,229
|
Yes. Unless the random generator is somehow 'biased' towards clustered outcomes. In Computer Science, a lot of discussion has been going on on the 'randomness' of random generators.
__________________
Greatest moments in cat:
__________________
"Miaooow..!"
|
|
|
|
September 23, 2002, 09:13
|
#13
|
Emperor
Local Time: 05:24
Local Date: November 1, 2010
Join Date: Jul 2002
Location: Botanic Garden, Rio
Posts: 5,124
|
I don't really believe in an unbiased Universe. God not only plays dices with the universe, He cheats! See how the quantum mechanics works...
|
|
|
|
September 23, 2002, 09:17
|
#14
|
Prince
Local Time: 03:24
Local Date: November 1, 2010
Join Date: May 2001
Location: of Bananas
Posts: 998
|
I have to wonder about that as well.
I think some defenders of cities are granted unholy strength (or maybe that would be holy, I dunno, I'm the attacker).
I have lost so many tanks / modern armors to fighting a single city with a rifleman before, it just isn't funny. I'll be sweeping a nation, getting every city every time in the first shot, then I'll get to one city, and it will take ten tanks to bring it down even though their defense is no better.
Is this a bug in the game, or am I fighting william wallace?
|
|
|
|
September 23, 2002, 09:22
|
#15
|
Deity
Local Time: 02:24
Local Date: November 1, 2010
Join Date: May 2002
Posts: 11,289
|
Quote:
|
Originally posted by Epistax
I have to wonder about that as well.
I think some defenders of cities are granted unholy strength (or maybe that would be holy, I dunno, I'm the attacker).
I have lost so many tanks / modern armors to fighting a single city with a rifleman before, it just isn't funny. I'll be sweeping a nation, getting every city every time in the first shot, then I'll get to one city, and it will take ten tanks to bring it down even though their defense is no better.
Is this a bug in the game, or am I fighting william wallace?
|
I don't hear anyone complaining when its their William Wallace.
|
|
|
|
September 23, 2002, 09:25
|
#16
|
Emperor
Local Time: 05:24
Local Date: November 1, 2010
Join Date: Jul 2002
Location: Botanic Garden, Rio
Posts: 5,124
|
You can cheat with random generators, just introducing a counter in the function... after "x" victories, a new function replaces the old one; after a lot of damage in YOUR troops, the old functions comes back and the things seems "normal" again. There's a lot of other ways.
Btw, Firaxis is always cheating... Just kidding, Mike!
|
|
|
|
September 23, 2002, 09:28
|
#17
|
King
Local Time: 09:24
Local Date: November 1, 2010
Join Date: Jun 2002
Location: AUERSTADT
Posts: 1,757
|
You are right Aro, the Universe is biased, as all machines are. It produces only heavy atoms from pure energy, through a process in which we appear for a reason we have still to find. Are we designed to help the process, or are we just an inocuous defect ? And in all case are we able to perturb the process enough in order to bring the machine owner to let us go outside ?
__________________
Statistical anomaly.
The only thing necessary for the triumph of evil is for good men to do nothing.
|
|
|
|
September 23, 2002, 09:35
|
#18
|
Prince
Local Time: 03:24
Local Date: November 1, 2010
Join Date: May 2001
Location: of Bananas
Posts: 998
|
Quote:
|
Are we designed to help the process
|
no
Quote:
|
, or are we just an inocuous defect ?
|
yes
Quote:
|
? And in all case are we able to perturb the process enough in order to bring the machine owner to let us go outside ?
|
no
now may I please have some pop tarts?
|
|
|
|
September 23, 2002, 09:41
|
#19
|
Emperor
Local Time: 05:24
Local Date: November 1, 2010
Join Date: Jul 2002
Location: Botanic Garden, Rio
Posts: 5,124
|
Brillant, Davout. The Universe, our brains and Math have the same structure... This is why we are able to describe the "nature of things". IMO, we are designed as a part of this, maybe (I don't say "No" or "yes" to this) to understand. And, of course, to perturb the process. Knowledge is our punishment and our redemption.
|
|
|
|
September 23, 2002, 09:44
|
#20
|
Emperor
Local Time: 05:24
Local Date: November 1, 2010
Join Date: Jul 2002
Location: Botanic Garden, Rio
Posts: 5,124
|
Quote:
|
Originally posted by Epistax
now may I please have some pop tarts?
|
But, Epistax... we have a lot of geeks and nerds here, this is a pop tart!
|
|
|
|
September 23, 2002, 09:46
|
#21
|
Emperor
Local Time: 09:24
Local Date: November 1, 2010
Join Date: Feb 2002
Location: EMPEROR of Cats
Posts: 3,229
|
Uh-oh. Now it gets philosophical...
__________________
Greatest moments in cat:
__________________
"Miaooow..!"
|
|
|
|
September 23, 2002, 09:50
|
#22
|
Emperor
Local Time: 05:24
Local Date: November 1, 2010
Join Date: Jul 2002
Location: Botanic Garden, Rio
Posts: 5,124
|
Quote:
|
Originally posted by BigFurryMonster
Uh-oh. Now it gets philosophical...
|
You're right. Shoot the philosophers!
"Philosophers, think about yourselves"...
|
|
|
|
September 23, 2002, 09:52
|
#23
|
Prince
Local Time: 03:24
Local Date: November 1, 2010
Join Date: May 2001
Location: of Bananas
Posts: 998
|
No I meant a strawberry pop tart.
|
|
|
|
September 23, 2002, 10:58
|
#24
|
Emperor
Local Time: 05:24
Local Date: November 1, 2010
Join Date: Jul 2002
Location: Botanic Garden, Rio
Posts: 5,124
|
All we have are banana pop tarts and grape pop tarts. We're in Apolytonia...
|
|
|
|
September 23, 2002, 11:30
|
#25
|
King
Local Time: 03:24
Local Date: November 1, 2010
Join Date: Jun 2002
Location: Of GOW's half of BOB
Posts: 1,847
|
Actually this game gives us a golden opportunity so see if things work out pretty much as they should. We can keep track of not only individual battles but also of each "hit point fight". We can see if they do truly go in steaks and even see if successive battles go in streaks. We all have antedotal evidence that hit points tend to go like this attacker win(w),w,w,l,l,l,w or such. We now can verify it. Additionally It also seems that the overall battles go this way. Look at us here. We went through a period where we couldn't be beat, then we lose troops in the atatck on pasargadae. Also we can see if over the whole game we do get a GL on average 1/16 of the time an elite attacks. In short this game is the embodyment of a lab on civ3 statistics. Heck we can even be like they are in baseball and figure winning streaks etc. I have only scratched the surface.
Aggie
__________________
The 5th President, 2nd SMC and 8th VP in the Civ3 Demogame. Also proud member of the GOW team in the PTW game. Peace through superior firepower.
|
|
|
|
September 23, 2002, 11:53
|
#26
|
Emperor
Local Time: 05:24
Local Date: November 1, 2010
Join Date: Jul 2002
Location: Botanic Garden, Rio
Posts: 5,124
|
Great, Aggie! You really found something here.
|
|
|
|
September 23, 2002, 12:21
|
#27
|
Emperor
Local Time: 09:24
Local Date: November 1, 2010
Join Date: Feb 2002
Location: EMPEROR of Cats
Posts: 3,229
|
Which Statistician would take up such a challenging task?
__________________
Greatest moments in cat:
__________________
"Miaooow..!"
|
|
|
|
September 23, 2002, 12:29
|
#28
|
Emperor
Local Time: 05:24
Local Date: November 1, 2010
Join Date: Jul 2002
Location: Botanic Garden, Rio
Posts: 5,124
|
Quote:
|
Originally posted by BigFurryMonster
Which Statistician would take up such a challenging task?
|
Reddawg will have the same problem I have... Big requests and small staff...
|
|
|
|
September 23, 2002, 16:08
|
#29
|
Emperor
Local Time: 03:24
Local Date: November 1, 2010
Join Date: Sep 2002
Location: of the Free World
Posts: 7,296
|
It sounds like a project for a team of us... I don't think any of us want to even attempt that one alone due to the sheer amount of data you've have to be sloshing through.
|
|
|
|
September 23, 2002, 17:16
|
#30
|
King
Local Time: 08:24
Local Date: November 1, 2010
Join Date: Jun 2002
Location: Birmingham UK
Posts: 2,633
|
for anyone interested
I have studied stats a bit but at the end of the day you win some you loose some and thats about it.
__________________
Are we having fun yet?
|
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is On
|
|
|
All times are GMT -4. The time now is 04:24.
|
|