Apolyton Archive  |  Preserved copy of the Apolyton Civilization Site and its forums as they stood in September 2005. Read-only; nothing here can be posted to or replied to.  |  Forum index |  About this archive |  The 1998–2001 UBB forums
Today on Apolyton WARDELL INTERVIEW PROMO A.C.S. HISTORY CHAPTER 4 GET CIV4 /w FREE PLUS! A.C.S. PHOTO GALLERY GET A.O.M. V1.1
Apolyton Civilization Forums
main| civ2| civ3| civ4| smac| ctp2| ron| moo3| galciv| galciv2| alt| about|
ApolytonPLUS | register | search | faq | new posts | pm (-/-) | upload | members
hall of fame new! | civgroups | civgroups news | interviews | the column | radio | chat | directory | news | store | PLUS
Apolyton Civilization Forums : Powered by vBulletin version 2.0.3 Apolyton Civilization Forums > Miscellaneous > Archive > Civ3-Strategy-Archive > Civ 3 combat calculations - with retreat odds...
Show a Printable Version | Email This Page to Someone! | Receive updates to this thread | Report this to Apolyton news!

bottom of page
  
Author
Thread    < Last Thread     Next Thread > Post New Thread     Post A Reply
vulture is offline vulture
King
Leeds, UK
Jun 2001
time: 05:20
  Old Post 10-06-2002 20:01
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
Civ 3 combat calculations - with retreat odds... Inflate your Upload Space

Just for the heck of it, I've written a C program to calculate the odds of combat outcomes in Civ 3, including the effects of retreat for fast units. Hopefully, the program will be an attachment to this post... Compile with any C compiler, linking with the math library (if you have the gnu C compiler then the command is 'gcc comcal.c -lm -o comcal' to produce an exectuable called comcal). Unit statistics can either be edited in the program or specified on the command line. Read the comments at the start of the program for some explanations. 'comcal -h' prints out brief help information.

To specify unit stats on the command line, use the following options:

-a, to specify the stats for unit A (if one of the units is capable of retreat then this must be unit A). two number are given after -a. The first is the relevant combat strength (attack or terrain modified defence), the second is the number of hitpoint the unit has. So a healthy veteran cavalry on the attack would be specified by '-a 6.0 4', while the same cavalry being attacked whilst on plains (10% terrain defence bonus) would be '-a 3.3 4' (cavalry 6 attack, 3 base defence).

-b, to specify the stats for unit B. Unit B never retreats, but it doesn't matter if you make the attacker unit A or B. Stats are given in the same way as for A.

retreat probabilities are given in either of two ways:

-e followed by a single integer value from 0 to 4 incusive. '-e 0' means no retreat is possible (2 slow units, 2 fast units, fast unit fortified in town etc.). Values 1 to 4 indicate the experience level of the unit (1 = conscipt, 4 = elite). THIS ONLY AFFECT RETREAT CHANCES, NOT HIT POINTS.

or -

-r followed by a number between 0.0 and 1.0. This is the retreat probability. Since (for example) elite units have a 0.66 probability of succesful retreat, '-e 4' and '-r 0.66' are completely equivalent.

So, as an example, an elite cavalry (6 attack) attackes a regular infantry (10 base defense) on open ground (10% defense bonus), with both units initially on max hit points. The command specification would be:

comcal -a 6.0 5 -b 11.0 3 -e 4
or
comcal -a 6.0 5 -b 11.0 3 -r 0.66
and the output is:
=====================

A:
hp: 5 combat strenth: 6.00
retreat chance: 0.66
B:
hp: 3 combat strenth: 11.00

Hit points remaining:
A \ B 0 1 2 3
0 - 16.5 6.8 3.9
1 9.0 - 16.3 11.6
2 11.9 - - -
3 11.0 - - -
4 8.5 - - -
5 4.4 - - -

A wins: 44.9 %
A retreats: 27.9 %
B wins: 27.2 %

=====================

The first bit summarises the stats you put in. The table in the middle gives the percentage chance of each possible outcome in terms of hit points remaining for each unit (useful for working out the probability that you do at least 1hp damage to a defender, so you can estimate how many attackers you need to bring to the party), and then there is the summary at the end. I hope the output is pretty self explanatory.

IIRC when attacking a unit with only 1 hp left, fast units NEVER retreat. I've assumed this in the calculation, so if it's wrong, please let me know.

As mentioned in the source code file, I'm not actually sure whether a retreat-capable unit gets more than one chance to run away (in the example above, suppose the cavalry loses the first 4 rounds of combat (so the cavalry has 1 hp left, the infantry 3 hp). The cavalry at this point tries to retreat. If this fails, and the cavalry wins the next round of combat (now on 1 hp, with the infantry on 2 hp) does it get a second chance to retreat? I've assumed not, mostly because it is easier to calculate. It doesn't make much difference in the cases where I've calculated both. If anyone has any Firaxian quotes on this subject I'll be glad to hear a definitive answer.

(NOTE: I'm not allowed to have a file ending with a .c extension, so I've given it a .txt one. Rename to comcal.c once you've downloaded it)

EDIT: proportional spacing has mangled the table output. It's designed for fixed width characters.

Attachment: comcal.txt
This has been downloaded 7 time(s).

vulture is offline vulture
King
Leeds, UK
Jun 2001
time: 05:20
  Old Post 11-06-2002 19:13
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
new version Get a bigger avatar today!

Attatched is a newer version of the combat calculator. It now also gives information relevant to attacking cities. An example to illustrate: Consider the annoying example of a veteran cavalry unit attacking a fortified infantry in a size 7-12 city on a plain. Attack strength is 6, defense strength for the infantry is 6 * 1.1 * 1.1 * 1.5 = 18.15 (10% from being on plains, 10% from being fortified, 50% from being in a city, IIRC. I believe the factors combine together as I've done above, rather than adding together to give a 70% increase). So we type:

comcal -a 6.0 5 -b 18.15 4 -r 0.66

which gives:


A:
hp: 5 combat strenth: 6.00
retreat chance: 0.66
B:
hp: 4 combat strenth: 18.15

Hit points remaining:
A \ B 0 1 2 3 4
0 - 9.2 7.5 10.1 8.2
1 3.1 - 13.0 20.9 21.1
2 3.2 - - - -
3 2.2 - - - -
4 1.1 - - - -
5 0.4 - - - -

A wins: 10.0 %
A retreats: 55.0 %
B wins: 35.1 %

Victory chance for n of unit A vs 1 unit B:
(with expected no. of A units killed)
n prob losses
1: 10.0 % (0.35)
2: 33.5 % (0.67)
3: 59.3 % (0.90)
4: 78.2 % (1.04)
5: 89.4 % (1.12)
6: 95.2 % (1.16)

Victory chance for n of unit B vs 1 unit A:
(with expected no. of B units killed)
n prob losses
1: 35.1 % (0.10)
2: 99.3 % (0.16)


====================

Look at the 'Victory chance for n of unit A vs 1 unit B:' section. This shows that, for example, with 4 veteran cavalry attacking, you have a 60.9% chance of taking down a single infantry, and on average will lose 1.16 of your cavalry in the process. If you want to be 90% certain of taking the city, you need about 7 attackers per defending infantry (this all ignores unit promotions for the defender, which gives it extra hit points).

For a comparison of the benefits of retreat, compare that with a stack of elite infantry attacking the same fortified infantry in a city. The stats are the same, apart from the lack of retreat ability. (comcal -a 6.0 5 -b 18.15 4 -r 0.0).

cavalry infantry
n prob losses n prob losses
1: 10.0 % (0.35) 1: 11.2 % (0.89)
2: 33.5 % (0.67) 2: 41.1 % (1.68)
3: 59.3 % (0.90) 3: 68.9 % (2.20)
4: 78.2 % (1.04) 4: 85.9 % (2.48)
5: 89.4 % (1.12) 5: 94.3 % (2.60)
6: 95.2 % (1.16) 6: 97.8 % (2.65)

You actually need a slightly lower number of infantry,
but (no surprises) more of them get killed.

Attachment: comcal.txt
This has been downloaded 5 time(s).

  < Last Thread     Next Thread > Post New Thread     Post A Reply
All times are GMT. The time now is 05:20.
Apolyton Time is 00:20.
    top of page
Rate This Thread:
archivepost
Forum Jump:
Forum 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
vB code is ON
Smilies are ON
[IMG] code is ON
 




Contact Us - Apolyton Civilization Site - Support Us!

Building a better Apolyton through better information. Click here and take our poll!
Non-US visitors, click here!

Powered by: vBulletin Version 2.0.3
Copyright ©2000, 2001, Jelsoft Enterprises Limited.

Page generated in 0.0318 seconds (83.23% PHP - 16.77% MySQL) with 30 queries
Page Loading Time:

Support Apolyton: Amazon USA | Amazon UK | Amazon DE | Amazon FR |
Support Apolyton and get FREE PLUS, Buy from Chips&Bits: Galactic Civilizations | Galactic Civilizations: Deluxe Edition | Call to Power 2 | Civilization: The Boardgame | GURPS/ Alpha Centauri | Alpha Centauri | Civilization IV | Civilization III: Complete |


Front Page | Civilization IV | Civilization III | Civilization II | Call to Power II | Alpha Centauri | Master of Orion III
Rise of Nations | Galactic Civilizations | Galactic Civilizations II | Misc
Alt.Civs | Civ I | C:CtP I | About | News | Directory | Apolyton Store | Forums | Chat | Columns | Interviews | Newsletter
Scenario League | CSC | Clash of Civs | Spanish Site | CtP Maps | Cradle of Civ | WesW's Ctp1/2 Site | Civ3 Haven

apolyton.net | apolyton.com | civilization2.net | civilization3.net | civilization4.net | civilizationiv.info | calltopower.net | galciv.net | galciv2.net | moo3.net