# Combat Statistical Analysis

Discussion in 'Civ3 - Utility Programs' started by RangerFalcon, Nov 15, 2001.

1. ### RangerFalconNew Member

Joined:
Nov 12, 2001
Messages:
14
Location:
Dallas, TX
OK... it has been way too long since college Statistics. :grad:

Does anyone know the formula for what the probability of an attacking unit winning a fight is, based on attack strength, modified defender strength, and the HPs of each unit?

Also... does anyone know what the defense modifier is when an attacking unit is attacking over a river? 50%??

I am trying to put together a nifty little file that can, based on the units involved, terrain, fortresses, etc., tell me if a certain attack is a good idea, or how many units I might need to throw at something to hopefully win.

2. ### RangerFalconNew Member

Joined:
Nov 12, 2001
Messages:
14
Location:
Dallas, TX
Actually... I have been able to figure out fairly easily the odds of the attacker winning each round. I just have to figure out, using this, how to factor in differing amounts of HP.

3. ### LoopyNew Member

Joined:
Nov 15, 2001
Messages:
202
I threw together an Excel file that does something close to this. I believe I did it correctly -- at least I get the same win/loss percentages when I do a simple simulation. I'll post it when I get home.

4. ### lwchenNew Member

Joined:
Nov 12, 2001
Messages:
20
It's binomial. Set up a matrix for attacker and defender, from 2 to 5 hit points, with the probability of winning each discrete encounter mapped across the matrix.

For example. If an regular unit fought a conscript unit, the total range of possible outcomes would be ...

2 rounds
reg wins 2/2

3 rounds
reg wins 2/3
conscript wins 3/3

4 rounds
reg wins 2/4
conscript wins 3/4

5 rounds
reg wins 2/5
conscript wins 3/5

6 rounds
conscript wins 3/6

Find the discrete probabilities for each outcome.

Joined:
Nov 3, 2001
Messages:
39
6. ### betheballdannyNew Member

Joined:
Oct 31, 2001
Messages:
57
Location:
Chicago, USA
Cool site, Xerxes314. Is it yours? If so, you should document the formula.

7. ### LoopyNew Member

Joined:
Nov 15, 2001
Messages:
202
I didn't look too carefully but I believe my numbers disagree slightly with the "civulator". I pretty much do something similar to what lwchen describes.

No guarantees my numbers are "right", but when I wrote a quick-n-dirty program that "simulated" battles and recorded outcomes, I got essentially the same percentages after looping a million times.

Feel free to point out any mistakes I might have made.

File size:
3.7 KB
Views:
1,638
8. ### RangerFalconNew Member

Joined:
Nov 12, 2001
Messages:
14
Location:
Dallas, TX
This is exactly what I am looking for. Civulator has great interface, the Excel file gets me the calculations I was looking for.

I am putting one together that allows to choose how many HP's each units have (i.e. attacking a unit that has been bombarded, damaged attacker in enemy territory - unable to heal w/o BFM -, etc.). I will post when finsh and let everyone use/pick apart.

9. ### RangerFalconNew Member

Joined:
Nov 12, 2001
Messages:
14
Location:
Dallas, TX
OK. Here it is. Used a modified version of Loopy's "engine," and format was inspired by Xerxes314's website.

I also included a little suggestion line for how many attacking units (of the same type and strength) it would take to get rid of the defending unit. Very basic: took 1 over the probablility of winning and rounded up.

Interesting to run some scenarios:
- Foritified, Mechanized Infantry in Mountains are about unbeatable. Take a look at how many Warriors it would take to dislodge one!
- Emphasizes the importance of bombardment. In close strength battles (i.e. Knight vs. Pikeman in city w/ walls), a one HP difference makes a big difference in the odds.
- Shows that submarines are basically good for killing transports, other submarines, and earlier naval units. Not too good at getting rid of Destroyers and greater. I guess arguments for this can be varied.

File size:
36.6 KB
Views:
1,890
10. ### FortyJNew Member

Joined:
Nov 2, 2001
Messages:
2,186
Location:
South Florida
Try this one out for size...

File size:
19.3 KB
Views:
1,580
11. ### bakantNew Member

Joined:
Dec 3, 2001
Messages:
146
Will you update this combat predictor to account for the changes in attack skill of privateers and subs in the patch.

12. ### MummyManNew Member

Joined:
May 9, 2001
Messages:
1,094
Hey, I'm trying to make my own program on my TI-83 calculator to calculate Battle odds. The only thing I can't get past is the HP. How would that work? The often troublesome percentages like 4/7 (Knight vs. Pikeman) are hard to get a good number out of 10. For ex. a warrior vs. a warrior has roughly a 50% chance of winning a battle round. I can easily do a Random Integer program with 5 out of every 10 numbers being a won battle round for the attacker. But with a percentage like 57.14285714 (4/7), it is much more complicated to get a number of winning rounds. Anybody have an answer? Or at least understand my incoherent babble?

13. ### zyxwyvuNew Member

Joined:
Jan 6, 2002
Messages:
10
I would like to write a program for my ti-83 plus too...

The problem is I dont know the exact calculations... if someone could post them, it would help greatly.

14. ### RufRydyrQSC Map Maker

Joined:
Mar 26, 2002
Messages:
584
Location:
Ft. Walton Beach, FL USA
cool program ranger. thx

15. ### explodin dog.....

Joined:
May 29, 2002
Messages:
77
man, i've seen so many of these (only four, ha ha), and all i want is a simple program that asks you for the input and stuff, and then it figures it out. i don't need no pretty interface, all i want is a program written in c++ that uses a dos prompt! sorry about being old fashioned about it but i don't really like looking at something that basically tells you what to do with all the little graphics and stuff, i'm an uncertified expert with computers. heh, could anyone or would anyone be so kind to do this for me? i know some vb, but not very much of it. the formula would also be nice to have written out, i wouldn't care about doing the math myself.
still a great program though, very good work ^^