Thread Tools
Old November 20, 2002, 12:10   #1
Brizey
Civilization III PBEM
Prince
 
Brizey's Avatar
 
Local Time: 06:19
Local Date: November 1, 2010
Join Date: Apr 2002
Location: The Republic of Texas
Posts: 305
Complete combat rules needed
I am currently working on a combat calculator that will calculate the odds for each outcome of a given combat. To do so I need to know all the combat rules precisely.

Here is what I know:

The combat is divided into rounds. These round continue until one of the following outcomes happens:

-Attacker hp reduced to zero
-Defender hp reduced to zero
-Attacker retreats
-Defender retreats

For each round, the following results are possible:

-Attacker damages defender by one hp
-Defender damages attacker by one hp
-Attacker retreats (if possible)
-Defender reatreats (if possible)

Known: Attacker has a chance to retreat if it has a movement rating > 1 and the defender has a movement rating = 1. The chance of retreating is dependent only on the attackers rank.

Question: I am pretty sure that the attacker can never retreat on the opening round. Also, I am pretty sure that the attacker must have one hp left, and the defender must have more than one. Is this right?

Question: how does defender retreat work? I know that you have to have the defender movement >1 and attacker movement = 1. Does the defender have to have a movement point left? A full movement point? In other words, suppose the defender, a cavalry, had used 2 full movement points plus two road movements the previous turn. Can it retreat into mountains when attacked on the next turn?

Known: Assuming that a retreat did not occur, either the attacker or the defender takes one hp of damage. The chance of the attacker taking damage is:

D/(A+D)

where A=modified attacker attack rating, and D=modified defender defend rating.

Similarly, the chance of a defender taking damage is

A/(A+D).

Let chance of attacker retreat be AR, and chance of defender retreat be DR. If I am right about the rules of defender retreat, then only one of these is not zero. So the chance of retreat is AR+DR.

Now we have all the odds for each round:

Attacker damages defender: A/(A+D)*(1-(AR+DR))
Defender damages attacker: D/(A+D)*(1-(AR+DR))
Attacker retreats: AR
Defender retreats: DR

The modified attack and defense ratings are pretty straightforward. I am aware of that the bonuses are added linearly, not geometrically. I have included things like advantages vs. barbarians based on playing level.

Another question: how does rank effect the combat. Here is what I think I know:

-Higher rank = higher potential hp
-Higher rank = better chance of retreat

Anything else?

I know that this is a bit disjointed, so sorry in advance. Any clarifications and additions are welcome.

By the way, I am only doing it for land battles without armies. Armies seriously complicate things, and are not used as much anyway. I also am not taking into account the artillery shot at this time. I realize that is a shortcoming. Anyone know the rules for it?
__________________
Got my new computer!!!!
Brizey is offline  
Old November 20, 2002, 12:51   #2
alexman
PtWDG Gathering StormCivilization IV CreatorsInterSite Democracy Game: Apolyton TeamApolyton UniversityIron CiversCivilization IV: MultiplayerApolytoners Hall of FameCivilization IV PBEMApolyCon 06 Participants
Firaxis Games Software Engineer
 
alexman's Avatar
 
Local Time: 07:19
Local Date: November 1, 2010
Join Date: Mar 1998
Posts: 5,360
I like your initiative, so I hate to inform you that most of that has already been done. At least without the retreat odds. As for Armies, I once wrote one, but it doesn't deal with armies versus armies.

I'm attaching both in a zip file.

Answers to your questions:
Quote:
Question: I am pretty sure that the attacker can never retreat on the opening round. Also, I am pretty sure that the attacker must have one hp left, and the defender must have more than one. Is this right?
The mobile unit (which can be the attacker or the defender) cannot retreat if the other unit has 1HP left, or if the combat started with the mobile unit already at only 1 HP.

Quote:
Question: how does defender retreat work?
Exactly like the attacker retreat. The MP left don't matter. The defender can't be fortified to retreat though.

Quote:
Another question: how does rank effect the combat. Here is what I think I know:

-Higher rank = higher potential hp
-Higher rank = better chance of retreat

Anything else?
Nothing else, except that elites give leaders.
Attached Files:
File Type: zip calculators.zip (70.7 KB, 10 views)
alexman is offline  
Old November 20, 2002, 14:47   #3
Brizey
Civilization III PBEM
Prince
 
Brizey's Avatar
 
Local Time: 06:19
Local Date: November 1, 2010
Join Date: Apr 2002
Location: The Republic of Texas
Posts: 305
a-man:

Thanks!

I was quite sure it had been done before. I am doing it for my own edification. I'm doing an Excel VBA program, with all of the tables in worksheets so that the data can be easily modified for patches and mods, and so that all the source code can be viewed and modified. Also, Excel is ubiquitous and stable.

I will post it here when I am done for comments on, and ridicule of, my spaghetti code.

Haven't looked at your calculators yet, will do so now.
__________________
Got my new computer!!!!
Brizey is offline  
Old November 20, 2002, 14:51   #4
alexman
PtWDG Gathering StormCivilization IV CreatorsInterSite Democracy Game: Apolyton TeamApolyton UniversityIron CiversCivilization IV: MultiplayerApolytoners Hall of FameCivilization IV PBEMApolyCon 06 Participants
Firaxis Games Software Engineer
 
alexman's Avatar
 
Local Time: 07:19
Local Date: November 1, 2010
Join Date: Mar 1998
Posts: 5,360
You're welcome.

BTW, the HTML single-unit calculator is not mine (I got if from CivFanatics I think), just the Army one.
alexman is offline  
Old November 20, 2002, 14:58   #5
Brizey
Civilization III PBEM
Prince
 
Brizey's Avatar
 
Local Time: 06:19
Local Date: November 1, 2010
Join Date: Apr 2002
Location: The Republic of Texas
Posts: 305
The HTML one seems to be missing several things:

-Artillery shot (still need to dig up the rules for this one!)
-Retreat
-Sub-optimal hit points (previously damaged units)

One of the problems with artillery shot is that you might not know the artillery is there. Since the whole point is to predict the odds of the outcome BEFORE the battle...

It also needs to be updated for PTW.
__________________
Got my new computer!!!!
Brizey is offline  
Old November 20, 2002, 15:05   #6
alexman
PtWDG Gathering StormCivilization IV CreatorsInterSite Democracy Game: Apolyton TeamApolyton UniversityIron CiversCivilization IV: MultiplayerApolytoners Hall of FameCivilization IV PBEMApolyCon 06 Participants
Firaxis Games Software Engineer
 
alexman's Avatar
 
Local Time: 07:19
Local Date: November 1, 2010
Join Date: Mar 1998
Posts: 5,360
For previously damaged units, you just use a lower rank unit. Since it doesn't deal with retreat anyway, it's the same.

That calculator doesn't attempt to deal with combined units, so of course there's nothing for artillery...

Also, check CFS to see if they have anything more recent.
alexman is offline  
Old November 21, 2002, 20:37   #7
Theseus
PtWDG Gathering StormApolyton UniversityApolytoners Hall of FameBtS Tri-LeagueC4DG Gathering StormApolyCon 06 Participants
Emperor
 
Theseus's Avatar
 
Local Time: 07:19
Local Date: November 1, 2010
Join Date: Apr 2002
Location: The warmonger formerly known as rpodos. Gathering Storm!
Posts: 8,907
Brizey:

PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE....

include Mixed-Unit Armies!!
__________________
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  
Old November 21, 2002, 21:53   #8
GhengisFarb™
lifer
Civilization III Democracy GamePtWDG Glory of WarCivilization II Democracy GameCivilization III PBEMC3C IDG: Apolyton TeamCiv4 SP Democracy Game
Deity
 
GhengisFarb™'s Avatar
 
Local Time: 05:19
Local Date: November 1, 2010
Join Date: May 2002
Posts: 11,289
Yes, mixed unit armies. This will be so useful.
GhengisFarb™ is offline  
Old November 22, 2002, 10:40   #9
alexman
PtWDG Gathering StormCivilization IV CreatorsInterSite Democracy Game: Apolyton TeamApolyton UniversityIron CiversCivilization IV: MultiplayerApolytoners Hall of FameCivilization IV PBEMApolyCon 06 Participants
Firaxis Games Software Engineer
 
alexman's Avatar
 
Local Time: 07:19
Local Date: November 1, 2010
Join Date: Mar 1998
Posts: 5,360
Quote:
Originally posted by GhengisFarb
Yes, mixed unit armies. This will be so useful.
ArmyCombat.exe in the zip file above.
alexman is offline  
Old November 25, 2002, 17:34   #10
Brizey
Civilization III PBEM
Prince
 
Brizey's Avatar
 
Local Time: 06:19
Local Date: November 1, 2010
Join Date: Apr 2002
Location: The Republic of Texas
Posts: 305
I have attached my calculator. It is an Excel VBA, which hopefully makes it portable and easy to modify. I plan to clean it up a bit, but it should be functional in its current form. All of the data is stored in worksheets, so it can be modified when playing mods, or if a patch changes standard attributes.

The only tricky Excel stuff is adaptive named ranges using the OFFSET function. (If you are an Excel geek, check out how I did it. It's cool.) Everything else is simple Excel functions and VBA.

Please test this for accuracy. For example, the PTW editor had values for the barbarian bonuses that I thought looked too high.

And please, I am not a pro code slinger, so bear with my poor coding skills. It is not very well commented, but the "AddStatus" function calls tell you what is going on.

It does not yet include artillery shots or armies. Also, it is ground combat only. Give me some time, and I hope ot at least include artillery shots and armies.


EDIT: I HAVE DELETED THIS ATTACHMENT...LOOK DOWN A FEW POSTS FOR THE CORRECT FILE!
__________________
Got my new computer!!!!

Last edited by Brizey; November 25, 2002 at 18:12.
Brizey is offline  
Old November 25, 2002, 17:39   #11
Brizey
Civilization III PBEM
Prince
 
Brizey's Avatar
 
Local Time: 06:19
Local Date: November 1, 2010
Join Date: Apr 2002
Location: The Republic of Texas
Posts: 305
Some more comments:

The "Results by Round" tab shows every possible result of every possible round. Each column of results is every result that could have occured in that round. The "pred" field is the predecessor result to the result in question. In other words, it is a probability tree.

The "Results to Final" tab shows every possible path from the root to an end node through the probability tree.

The "Status" tab tells you what the code was doing as it went about its business. It is mostly for troubleshooting purposes.

This whole thing is intentionally open source. Have at it.
__________________
Got my new computer!!!!
Brizey is offline  
Old November 25, 2002, 18:05   #12
Brizey
Civilization III PBEM
Prince
 
Brizey's Avatar
 
Local Time: 06:19
Local Date: November 1, 2010
Join Date: Apr 2002
Location: The Republic of Texas
Posts: 305
Oops! I posted a bad version. Give me a few more hours. This is the one without a fortified bonus!
__________________
Got my new computer!!!!

Last edited by Brizey; November 25, 2002 at 18:11.
Brizey is offline  
Old November 25, 2002, 18:09   #13
Brizey
Civilization III PBEM
Prince
 
Brizey's Avatar
 
Local Time: 06:19
Local Date: November 1, 2010
Join Date: Apr 2002
Location: The Republic of Texas
Posts: 305
...or a few minutes.

USE THIS ONE!
Attached Files:
__________________
Got my new computer!!!!
Brizey is offline  
 

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 07:19.


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