 |
|  |
 |
|
Brizey
|
 |
The Republic of Texas
Apr 2002 time: 23:23
|
|
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?
|
|
|  |
 |
|  |
 |
|
Brizey
|
 |
The Republic of Texas
Apr 2002 time: 23:23
|
|
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!
Last edited by Brizey on 26-11-2002 at 03:12
|
|
|  |
 |
|
Brizey
|
 |
The Republic of Texas
Apr 2002 time: 23:23
|
|
Oops! I posted a bad version. Give me a few more hours. This is the one without a fortified bonus!
Last edited by Brizey on 26-11-2002 at 03:11
|
|
|  |
All times are GMT. The time now is 05:23. Apolyton Time is 00:23. |
top of page
|
| archivepost |
|
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
|
|
|
|
|
|