Made Attacker Win Probability Page

Valant2

Chieftain
Joined
Nov 1, 2001
Messages
43
*Attention read the post below this one in this thread before downloading my program*


Well actually its a binomial calculator page that I quickly swiped, hacked and edited.

Remember:
Conscripted units have 2 hp
Regular have 3 hp
Vetrans have 4 hp
Elite have 5 hp

Note:
Q is NOT the overall probability of the attacker winning the battle. The value of Q is 1 - P. It should be ignored...the program only calculates Q for you because it needs Q to determine the probability of the attacker winning the battle which appears *****In The Box At The Bottom Of The Screen When You Click On Calculate**** also you need to multiply the number in that box by 100 ***To Change The Value From Decimal To Percentage Format****

Note:
Do not forget to add the defensive bonuses to the defensive power of the defensing unit before using it to determine P

Note:
Once again I updated my program to be a little more clear,.
 

Attachments

With Xerxes314 incorporating the above equation program into his combat determination program and him making some final tweaks....I wholly support his program over mine. His program has more functionality and is more user friendly. Truly, a job well done.

The link to his program is dis:

http://www.columbia.edu/~sdc2002/civulator.html
 
valant, nice program! :goodjob:

I did a little experiement using your program:

Attacker: Veteran Immortal (4/2/1): 4 HP
Defender: Veteran Spearman (1/2/1): 4 HP

n = 4 + 4 - 1 = 7
k = 4
p = 4 / (4 + 2) = 2/3 = 0.67

-----------
Probability of the attacker winning = q = 0.33

This is lower than I thought! Is that probability for a defender fortified in a city?

-----
Xeres, are you going to add all the units to your calculator program?
 
I just want to know why you have the avatar of the battleship???

I day ago, I have send you a e-mail for include the battleship in list of the avatars.
You are a traitor!!!!!!:mad:
P.S.: don't banned me (I say this because you have banned poeple for less than that):D

...
This message is for if I am banned:
Boycut Civfanatics for let me free and for the liberty of expression
(and for you Thunderfall, you have rub my AVATAR!!!)
Ha Ha Ha!!!!
How have the power now!!!!:p
 
Originally posted by Traquenard-fx
I just want to know why you have the avatar of the battleship???

Thunderfall's "THE MAN"

The Battleship is HIS Avatar. Always has and always will. :)

Those who don't like it should get their own Civilization Web Page and Forum. :)
 
Originally posted by Thunderfall
valant, nice program! :goodjob:

I did a little experiement using your program:

Attacker: Veteran Immortal (4/2/1): 4 HP
Defender: Veteran Spearman (1/2/1): 4 HP

n = 4 + 4 - 1 = 7
k = 4
p = 4 / (4 + 2) = 2/3 = 0.67

-----------
Probability of the attacker winning = q = 0.33

This is lower than I thought! Is that probability for a defender fortified in a city?

-----
Xeres, are you going to add all the units to your calculator program?

No way...Im the persians in my current game and I ran thru the babylonians bowman(2-2-1) and spearmen(1-2-1) like were yeilding wooden spoons, on defended hills, towns, towns with walls, cities, mountains and anything else you could think of, and by no means did i only win 33% of the battles...i was more like 60-80%...and most of my were only with regular immortals, with some getting upgraded in the process...either Valants calculator is broken, your experiement is flawed or Im just astronomically lucky :)

-edit-...their units were of regular and vet status...this was afterall, quite an early war...
 
I'll add more units if there's popular demand. There's a real usability problem when you add 16 more units to the list. In the meantime, you can just type the attack or defense value directly into the box containing that value. The pullmenu just sets that value.

Xer*X*es :p
 
Bulletsponge:
Thunder made a few boo-boos when trying to use my program...so your No Way statement is correct.

Thunderfall:
You made a mistake of plugging in the incorrect value for P. You need to change the defensive power of the spearman depending if its fortified, terrain its located on, city cize its in, if the city has walls, etc...etc...etc. So chances are the defensive power of the spearman is 2.5 or more.

Also you are not looking for nor interested in Q. After entering N, K and P....clicking on calculate then determines 2 values for your. One is Q (which you do not give a damn about) and the other is the number entered in the last box at the bottom.

This number is the probability of getting >= K successes in N trials. In lamens terms its the probability of killing the defending unit. (Remember to multiply this number in the box by 100 to get the percentage value insted of decimal)

What you are doing for P is detemring the probability per turn in battle that the attacker will win that turn and take 1p off the defender.

Q is the probability per turn in battle for the attacker will fail that turn a lose 1 hp.....remember P = 1 - Q and Q = 1 - P

Long story short just use Xerxes314's program because he has incorporated my program into it and its has much more functionality and its more user friendly.
 
Thunderfall:

Will do a runthrough of my program for you using your example

Attacker: Veteran Immortal (4/2/1): 4 HP
Defender: Veteran Spearman (1/2/1): 4 HP

Since you do not state if the spearman is fortified, is or is not in a city, city does or does not have walls, is or is not in a fortress, if the attacker is crossing a river to attack, nor what terrain the unit is defending on in your experiment I will pick something for you for my walkthrough.

Hmm...lets say the defender is stationed in a city of a population of less than 7, which has city walls and the city is build on grassland but the defending unit is not fortified. Also the defending unit does not have the great wall wonder built. Also the attacker is not crossing a river to get to the defending unit.

So the defending spearman gets the following bonuses to its defensive power:
+50% city walls
+0% city (since its less than 7)
+10% terrain (grassland)
+0% defending unit not fortified
+0% attacker is not crossing a river

Which results in +60% bonus for the spearman. So the spearmans defense power is 3.2

So we enter these values.......
n = 4 + 4 - 1 = 7
k = 4
p = 4 / (4 + 3.2) = 4/7.2 = 0.556

Now click on calculate and then check the value in the box at the bottom of the screen...which is.....give me a second typing it in.... okay the result is 0.621

Now we multiply this value by 100 to get 62.1%

So the probability of the attacker winning and the defending dying is 62.1%
 
Thunderfall:

Are you ok on how to use my program now? If you have any questions let me know.
 
If the Civ-ulator is correct then my battle of:
Veteran Longbowman (4/1/1) vs Regular Swordsman (3/2/1) went really bad. The Swordsman didn't take any damage at all and completely made my Bow-dude his boy I itch.
I was attacking from position #1 nto a Grasslands over a river and the calculations came out to 81.665% for me to win.
For poops and giggles I took a Veteran Calvary over there and won without taking any damage. I attacked from position #2 but still over a river. Then I took a Veteran Rifleman (same attack as Longbowman) attacked from position #1 and lost but did do 2 points of damage. Weird.
Red is position #1
Yellow is possition #2
This is a great page. Was wondering if you can set it up to show the probability of your unit winning with each amount of hit points? ;)
 
PaleHorse76:
Making the program yield the probability of each HP outcome would be quite horrendous and I will never get around to creating that. I do not think Xerxes314 would either.

One thing you have to know is that the battle predictor that Xerxes and I made uses the binomial probability formula. This formula predicts the probability outcome in PURE random trials.

The problem is Civ3, like any other computer game, uses a random number generator. There are different types of RNGs...some good...some bad. Even the best RNG a computer uses is not 100% PURE. In fact....I think the RNG that Civ3 is using is kinda sucky. This is why I am guessing that improbable battle results are happening in Civ3 more often that they should.

Hope I was able to word this correctly. Kinda hard to explain.
 
Here's another version of the combat calculator, modified somewhat to incorporate air, sea and unique units. It also shows the odds of each possible outcome as well as the overall odds of victory.

Hope this helps.
 

Attachments

One thing that may be apt to comment, WRT the random number generator - it isn't really random! And that's intentional! The outcomes are predetermined, in the sense that when you make an attack the "game master" doesn't roll the dice - he just leans over and grabs the next random number off the top of the pile. So tests like "I attacked that *&^#$ knight with my armour 30 times in a row (reloading) and every stinking time he killed me taking only one hit" have a predictable outcome! Actually, that was my first clue - but it's been confirmed by Dan M. of Firaxis. They did it to discourage people from using the reload cheat all the time. So now you just have to be a little more creative! :p
 
I added the calculator to the <a href="http://forums.civfanatics.com/forumdisplay.php?s=&forumid=54">Utility Programs</a> sub-forum inside the Creation forum. I also uploaded FortyJ's version of the calculator to http://www.civfanatics.com/civ3combatcalc.html so people can use it more easily. :)
 
Originally posted by FortyJ
Here's another version of the combat calculator, modified somewhat to incorporate air, sea and unique units. It also shows the odds of each possible outcome as well as the overall odds of victory.

Hope this helps.


Very nice page. I did notice the following, however. For example...

Regular Greek Hoplite (1/3/1) attacks Regular Warrior (1/1/1) on grassland w/ no improvements gives an attacker strength of 1 and a defender strength of 1.1.

If you modify the defender to be a barbarian, however, it shows the attacker strength to be 5 and the defender is at 1.1.

I tried this out with a few other combinations and attacker v. barbarian always gets a 5x modifier. Is this correct or an error? If that's correct I was completely unaware of that but it WOULD explain my stellar record against the raging hordes.

Also, I was wondering as to why a defender in that situation would be a 1.1 as opposed to a 1.

Excellent page though. Thanks for the effort! :)
 
Originally posted by Peteus
One thing that may be apt to comment, WRT the random number generator - it isn't really random! And that's intentional! The outcomes are predetermined, in the sense that when you make an attack the "game master" doesn't roll the dice - he just leans over and grabs the next random number off the top of the pile. So tests like "I attacked that *&^#$ knight with my armour 30 times in a row (reloading) and every stinking time he killed me taking only one hit" have a predictable outcome! Actually, that was my first clue - but it's been confirmed by Dan M. of Firaxis. They did it to discourage people from using the reload cheat all the time. So now you just have to be a little more creative! :p

That makes sense since they dont want cheap-asses to just reload thier game whenever they loose a battle. What is even more likely however is that the list is generated anew with the creation of a new game - or perhaps something a bit more complex then that. Perhaps woth looking into

"Not only does God place dice, but the dice are loaded.

I loved the way that quote is read in SMAC :)
 
Just a bit of info for the people who want to know the exact chance of winning or think they get too few wins.

According to the editor Civilians and buildings each add 4% defense bonus, and since most people will play Chieftain the first game they probably attack enemy cities and find themselves losing, because they forgot to take bonuses in account.

Example, Cavalry vs Pikeman, normally you would think it's easy for the cavalry to win (6 A vs 3 D, wins 67% of the rounds), however if the pikeman is fortified in a city he will get a bonus, size 8 city with 5 buildings will give +50% for city, +25% for fortified, +32% for size, +20% for buildings and possibly +10% for plains/grassland defense. Defense would be 7.11 if terrain counts or 6.81 if terrain doesn't count. Suddenly the chance to win each round is less than half.
 
Interesting...

Does anybody know how exactly the computer decides which
unit wins a combat hit after the attack defense bonuses are
calculated?. I mean, once the computer knows the winning
probability for a hit is p (0 lower than p lower than 1), there are many ways to do it. For example one of them is to choose a random number between 1 and 1000. If 1000p is lower than that random number you win, if 1000p is equal or bigger than the random number you loose the hit. This process is repeated so many times as the hit points of the attacking unit (or stops if you win without the need of all the hit points). Can anybody tell how
exactly it is done???? I am very curious about it.

What is clear to me, is that whatever is the system used,
the random numbers for the combats are chosen at the
beginning of the game, as a long sequence of numbers
to decide all the fights that will take place, and they are
kept together with the saved game when you save. That
explains the fact that the old trick of reloading does not
work. As an example of this, I had a situation where
two archers in the same circumstances attacked a spearman.
The first attack always lost, leaving the spearman exactly the same affected and the second archer always won,
again leaving my surviving archer in the same situation,
INDEPENDENTLY of the archer you chose to fight first.
I reloaded many times and the result was always the
same, first archer lost, second wins, with exactly the same
results.

I very much hope these random numbers are really random
and created by the game different for every game, and not fixed.
In any case, for a given game, there must be a way to
find out these numbers and to know exactly who is going
to win every combat !!!

I hope somebody can help with my question of the first
paragraph.
 
Back
Top Bottom