View Full Version : Combat Odds


Sarisin
Jul 10, 2008, 10:54 PM
I know much has been written about Combat Odds in Civ4/FFH. Many of us can remember that version in which the combat odds were really whacky.

Well, it seemed like in the latest version I was losing quite a few battles in which I was favored by what I would call overwhelming combat odds - 90% or greater. My definition.

Of course, you always tend to remember those losses and sometimes lose track of the many combat victories you are piling up.

Anyway, as a retiree, I have plenty of time on my hands, so I decided to run a small sample test during my current game. I charted 100 battles where I had combat odds of 90% or greater.

Care to guess how many of those battles I won?

How about 84?

Included in the 100 were 37 battles where the odds were 99.9%. A sure thing, right? I lost three of those.

It was a small sample size and I'm not sure you can conclude anything from the test. Honestly, I thought I would have more than 16 losses in the 100 battles. It just seemed like I was losing more battles when I was heavily favored to win in my games.

One thing I have noted is that if you win quite a few battles when the odds are high, you can bet your string will end, even with the high odds. I guess that makes sense. But, it is really annoying to win a few battles and then lose that veteran unit when the odds are 98.6% to win.

Of course, the flip side of this is how many battles you win when the odds are heavily against you. I find you win very few of those, perhaps less than even the low odds would indicate. But, really, I think most of us would avoid battles, especially with good units, when the combat odds are low. It does seem, though, that you often, and I mean often, lose the 60-70% battles a lot more than you win as the odds would indicate.

Anyway, maybe my next test will be to run a sample of battles where the odds are 10% or less and see how many I would win.

For the statistician purists out there, I apologize if my simple test and analysis offends you - just wanted to see if there was any kind of pattern with all those 90+% battles I was losing. :)

Kael
Jul 10, 2008, 11:04 PM
Cool analysis, Im very interested.

Keep in mind that combat odds are an estimation. The game approximates your chance of winning, but it isnt like it just roles those odds to determine the combat. The real combat is a whole series of attacks and defenses, with modifiers and bonuses adjusting the odds in different ways. So it may not be exact, but it should be pretty close in large samples.

For your tests I would recommend samples of identical units on each side and the same odds rather than just bunches of different units. You're probably tracking results in a game but it would be cool to see:

1. 100 swordsmen attacking 100 warriors with both in grasslands.
2. 100 swordsmen attacking 100 warriors on a hill (do terrain bonuses mess with the odds?).
3. 100 swordmen attacking 100 warriors with dance of blades (do first strikes mess with the odds?).

That kind of testing may help us if there a significant descrepancy is shown.

Zechnophobe
Jul 10, 2008, 11:13 PM
Only a few things currently seem wrong with the odds:

1) Resistences to damage types are being computed by the odds, but not actually effecting the game.

2) Effects which DECREASE the strength of a unit, seem to stack very very weirdly. Shock 2 should give -40% cumulative with shock ones -40%, but you don't end up with -80%. I haven't run the numbers, but I know that weird math is being done, so it seems much more likely the auto calculator could be mis-calibrated.

Minor Annoyance
Jul 11, 2008, 12:11 AM
A 6% discrepancy isn't much of a discrepancy. I don't know how margin of errors work in statistics, but that seems reasonable.

Fafnir13
Jul 11, 2008, 01:00 AM
My specters win more battles than they should, I'm thinking their heavy death damage isn't being calculated quite right. I've also learned the hard way that attack with anything below 99.9 with a hero unit is just asking for it. I'm leaey of even a 96 when it comes to my stronger units. I'm telling you, the odds are out to get me....
This extra caution has bred especially strong in me as I've sworn off loading saves just because I didn't like something. Makes it waaaay too easy otherwise, and annoying cause I'd always be loading at every goody hut just to get a tech....yeah, I'm compulsive that way.

DrStalker
Jul 11, 2008, 01:28 AM
Something that I know is calculated wrong: if you use go-to from more than one square away, and the attack path crosses a river, the river crossing modifier is ignored in the odds.

Something I think is calculated wrong, but don't really have any evidence: first strikes. I read somewhere that first strikes are assumed to hit 50% of the time, instead of actually using the proper hit chance. I'm not sure if that is the case, but combat odds do seem screwy when first strikes are involved.

DrStalker
Jul 11, 2008, 01:57 AM
My specters win more battles than they should, I'm thinking their heavy death damage isn't being calculated quite right.

That's the other thing I was trying to remember when I posted: +damage from affinities seems to be ignored.

Ecofarm
Jul 11, 2008, 02:42 AM
With a physically offensive hero/top unit, you will attack 100 times in a game easy; thus, 99% is not good enough by fair calculation.

People understimate how many times they attack and lack basic stat knowledge/understanding. Aside from first strikes being an estimation prior to displayed odds (creating an unseen range - even to the code that decides who defends :mad: kithra + blitz + defending vs many = dead fast), I think that is where most of the confusion comes from - not some 'bogus RNG'.

Sarisin
Jul 11, 2008, 05:24 AM
Cool analysis, Im very interested.

Keep in mind that combat odds are an estimation. The game approximates your chance of winning, but it isnt like it just roles those odds to determine the combat. The real combat is a whole series of attacks and defenses, with modifiers and bonuses adjusting the odds in different ways. So it may not be exact, but it should be pretty close in large samples.

For your tests I would recommend samples of identical units on each side and the same odds rather than just bunches of different units. You're probably tracking results in a game but it would be cool to see:

1. 100 swordsmen attacking 100 warriors with both in grasslands.
2. 100 swordsmen attacking 100 warriors on a hill (do terrain bonuses mess with the odds?).
3. 100 swordmen attacking 100 warriors with dance of blades (do first strikes mess with the odds?).

That kind of testing may help us if there a significant descrepancy is shown.

Yes, they are an estimate, but you would hope that the odds take into consideration ALL of the factors that can possibly be figured into the estimate. One really good change was to eliminate the 100% combat odds which proved to be wrong as battles with those odds were lost in the past. There are no sure things in the game now.

I realize my test was very simple, and, as I said, it didn't prove much. I was surprised that there were less losses as those odds than I expected.

I do play FFH quite a bit and have literally thousands of battles, but I don't think I would ever consider sitting down and charting very specific conditions and variables such as you mention. There are just too many possibilities and my chart would be overwhelming to say the least.

You really have to just accept the combat odds as estimates, and as long as they are not really wrong like in that previous version, live with those losses that can be unexpected and so upsetting. ;)

As I said, though, I would be interested to hear the thoughts of forum members on the battles with huge combat odds against you and how many you win. Somewhere in there, there might be an interesting correlation - just not statistical, mind you.

Vladesch
Jul 11, 2008, 05:53 AM
Withdrawal chances for catapaults seems way out as well.
Maybe I was unlucky last night but I was losing on average 50% of my catapaults with 80+% withdrawal odds.

PacoDeth
Jul 11, 2008, 06:26 AM
Me and my friend that plays FFH with me were just discussing putting up a thread about this today. We find that just about any unit vs any other unit, if you are attacking and have a success percentage in the 70's (73.3%, 79.8%, etc.) then we more often then not lose those battles. It seems like the 70's percentile range is really more like a 25%-35% chance. Anything in the mid to low 80's is also a pretty risky gamble, and something you NEVER do with a unit you don't want to lose. Even the high 80's to low 90's aren't worth the risk in FFH. I would say a 90% win chance feels alot more like a 75% chance, and it just isn't worth the risk for any good units.

As another poster mentioned, if your hero doesn't have at least a 97% or higher chance, then be prepared to bury your hero. Obviously in those really high percentages, there is supposed a very slim chance you will lose, but it just seems like it's a "fair" chance you will lose.

Just a game the other day, I had a level 10 Hunter with all strength promotions, and commando, and the shock-type promotions. I was sending him back to a city, and saw a normal unlevelled Wolf Rider nearby, my odds to beat the Wolf Rider in combat if I attacked was 99.9%. But I needed him back in a city, so I went on with my business and by the end of the turn he was holed up on a hills tile with a Castle on it. Needless to say, next turn that same Level 1 Wolf Rider attacked my Level 10 Hunter which was barricaded on a Hill Castle tile, and whooped him. Wolf Rider barely took any damage. Of course, these <0.1% deals happen, it still sucked big time.

Still tho, seems like we shouldn't be "expecting" to lose when its in the 70's. Vanilla Civ definately wasn't this bad with the win-losses compared to percentages. But for the time, I'm totally fine with the assumptions we can make now that 70's to mid 80's perctile range is only if your desperate, High 80's to mid 90's is fairly risky, and High 90's is generally safe.

Kael
Jul 11, 2008, 08:09 AM
Me and my friend that plays FFH with me were just discussing putting up a thread about this today. We find that just about any unit vs any other unit, if you are attacking and have a success percentage in the 70's (73.3%, 79.8%, etc.) then we more often then not lose those battles. It seems like the 70's percentile range is really more like a 25%-35% chance. Anything in the mid to low 80's is also a pretty risky gamble, and something you NEVER do with a unit you don't want to lose. Even the high 80's to low 90's aren't worth the risk in FFH. I would say a 90% win chance feels alot more like a 75% chance, and it just isn't worth the risk for any good units.

As another poster mentioned, if your hero doesn't have at least a 97% or higher chance, then be prepared to bury your hero. Obviously in those really high percentages, there is supposed a very slim chance you will lose, but it just seems like it's a "fair" chance you will lose.

Just a game the other day, I had a level 10 Hunter with all strength promotions, and commando, and the shock-type promotions. I was sending him back to a city, and saw a normal unlevelled Wolf Rider nearby, my odds to beat the Wolf Rider in combat if I attacked was 99.9%. But I needed him back in a city, so I went on with my business and by the end of the turn he was holed up on a hills tile with a Castle on it. Needless to say, next turn that same Level 1 Wolf Rider attacked my Level 10 Hunter which was barricaded on a Hill Castle tile, and whooped him. Wolf Rider barely took any damage. Of course, these <0.1% deals happen, it still sucked big time.

Still tho, seems like we shouldn't be "expecting" to lose when its in the 70's. Vanilla Civ definately wasn't this bad with the win-losses compared to percentages. But for the time, I'm totally fine with the assumptions we can make now that 70's to mid 80's perctile range is only if your desperate, High 80's to mid 90's is fairly risky, and High 90's is generally safe.

To test the theory that 70% odds lose way more than they should I setup 100 attacks between swordsmen and swordmen in desert (75% win probability). Statistically I should lose about 25 of the battles, I in fact lost 16. So in this sampling the odds can out a little in the attackers favor, but definitly still in a reasonable range.

I suspect, as Sarasin alluded, combat odds always seem to be lower than they are reported because we forget about all the battles we win but remember the one battle 2 weeks ago that we lost to 99% odds.

DemonMaster
Jul 11, 2008, 08:36 AM
You right Kael and how often do we attack at 0,1% chance of winning. I did some time ago in the original forum some testing about this (this is an old debate) and the figures that I came up with was all within a reasonble range. I tested all sorts of odds, even 1% chance of winning battles and I came pretty close (3 wins out of 100). The only types of battles that fell way out of a reasonble range was when I tested naval battles. But I was so bored with the testing (I did the naval tests last) so I didn't redo those tests to see if the test result came out the same.

And lastly. It is boring to loose a hero when he has 99% of winning but have laughed more than once when it is the other way around (and yes I have experienced that more than once as well).

PS
Do you remember the funny days of Civ I when those mighty spearmen could take out tank and even a battleship. I would have loved to see a debate about this back then (if internet had been fully developed that is);)

Darksaber1
Jul 11, 2008, 09:22 AM
Umm, I had a spearmen take out a tank once in Civ4 original.

smjjames
Jul 11, 2008, 09:52 AM
Umm, I had a spearmen take out a tank once in Civ4 original.

That is a famous bug, it dates back to Civ2 I believe.

Darksaber1
Jul 11, 2008, 10:13 AM
:spear:
See, it is Famous.

DemonMaster
Jul 11, 2008, 10:30 AM
That is a famous bug, it dates back to Civ2 I believe.

Then you havent played Civ I, I guess, when your Battleship attacked the city defended with a spearman and the horns of triumph sounds :goodjob: for the spearman :confused:, while the Battleship sunk :cry: I have always wondered what the spearman did to achieve that. Perhaps battleships (and tanks) have some critical points somewhere and if you can it with your spear at that point ... bang!

Skitters
Jul 11, 2008, 11:02 AM
I've always had the impression that if the odds are 70%, I will more often than not win the battle.

Conversely, I sometimes think I win more than my fair share of combat where the odds are against me - including just the other night where I defeated the Gilden Silveric at 30% odds, taking a city in the process. The plan had been to actually weaken him with a rank and filer so that Guybrush Threepwood would have better odds.

I quite often find myself considering odds of 20-30% worth a try if I have a decent sized stack.

There have certainly been times in the 90%+ odds where I've lost, but there are plenty of times where my troops have hung on longer than I expected too

Darksaber1
Jul 11, 2008, 12:02 PM
I railry suffer the 99%-yet still loss situation, but twice thaat I can remember I had a victory at <0.1.

Sensemann
Jul 11, 2008, 01:49 PM
i tested it with 600 combats, swordmen versus warriors on grassland.
the combatodds were 75,9%, so there should be 455,4 successful attackings.
i got 451, thats only a different of 4 and as percentage -0,73%. that sounds good enough.

DemonMaster
Jul 11, 2008, 03:48 PM
i tested it with 600 combats, swordmen versus warriors on grassland.
the combatodds were 75,9%, so there should be 455,4 successful attackings.
i got 451, thats only a different of 4 and as percentage -0,73%. that sounds good enough.

You tested 600 combats, that must have been boring?

Nicopol
Jul 11, 2008, 04:02 PM
there is no problem with normal units like swordmen.
the problem is with ÜBER UNITS with almost all promotions and a lot of unique equipment.
it's not seldom that they lose 99% battles therefore i alwasy give my "heros" the immortal promotion with wb because wb is way quicker than a reload.

maybe the first strike(s) killes the combat odds...

eerr
Jul 11, 2008, 04:07 PM
there is no problem with normal units like swordmen.
the problem is with ÜBER UNITS with almost all promotions and a lot of unique equipment.
it's not seldom that they lose 99% battles therefore i alwasy give my "heros" the immortal promotion with wb because wb is way quicker than a reload.

maybe the first strike(s) killes the combat odds...

full first strikes are not messing it up

first strike chances are what mess it up, as it is calculated only for the average number of first strikes, and not for each number individually

Sensemann
Jul 11, 2008, 04:09 PM
You tested 600 combats, that must have been boring?

nope, i have done it very quick. i created a line of 100 swordmen and warriors, saved it and turn quick combat on. after combat i looked at the statistic and load again. took me 10 min.
the difficult is to add the drill iv and commando promotion to the units, so that i can test it for this promotions. exist an easy method to do this? can i edit the xml, so that the standard warrior get drill iv and commando promotion?

eerr
Jul 11, 2008, 04:23 PM
nope, i have done it very quick. i created a line of 100 swordmen and warriors, saved it and turn quick combat on. after combat i looked at the statistic and load again. took me 10 min.
the difficult is to add the drill iv and commando promotion to the units, so that i can test it for this promotions. exist an easy method to do this? can i edit the xml, so that the standard warrior get drill iv and commando promotion?
i think its between <freepromotion><freepomotion> or something in the code, try comparing with a unit that does get certain promotions free
(i don't think its between <bfreepromotion> because thats boolean for the real magic-user, monument given deal)

Mithrus
Jul 11, 2008, 04:31 PM
Another issue that hasn't been explored (or at least openly discussed) is what condition is the winner in at the end? FAR too often, the victors that had a slim chance of winning are walking away nearly unscathed, and the victors that should have won with ease are near death. I would think the odds of winning would be a reasonable marker for what condition the unit could be expected to be at if they win. You have a 1% of winning, yeah, I think you shouldn't be near full health at the end.

I wonder, someone before had posted changing the max hitpoints from 100 to 1000, and it having a positive affect on the outcome (I think first strikes needed work IIRC). This topic hasn't been discussed in a while. Has anyone tested this lately to see if it improves combat odds accuracy?

Sensemann
Jul 11, 2008, 05:49 PM
ok i have done another test. this time the warriors have drill i-iv promotion and fight against swordmen. test result:

combats: 700
combatodds: 47,5 %
successful: 347
should be: 332,5
difference: 14,5 (2,07 %)

thats a greater gap, now i'll try it with firststrikechance only.

Adrogans
Jul 11, 2008, 05:52 PM
I have to say I am loving these test results.

Crazy_Ivan
Jul 11, 2008, 05:56 PM
So far the test results look normal enough to me, with the standard variance that happens with the randomXrandom effects of the actual combat.

Sensemann
Jul 11, 2008, 06:17 PM
yeah crazy_ivan is right. but one should calculate how often we have to try, so that the error falls beneath 1% or perhaps less. but here the result for warrios with 10 firststrikechance versus swordmen:

combats: 600
combatodds: 50,8 %
successful: 312
should be: 304,8
difference: 7,2 (1,20 %)

seems ok for me. last test i do, warriors with 5 first strikes.

cabbagemeister
Jul 11, 2008, 06:35 PM
Something that I know is calculated wrong: if you use go-to from more than one square away, and the attack path crosses a river, the river crossing modifier is ignored in the odds.

I have also noticed this, although I can't tell if it's just the odds display calculator that's leaving out the river crossing, or if it really isn't getting factored into the battle. This might be a good factor to include in the 100 swordsman/warrior tests.

Sensemann
Jul 11, 2008, 06:59 PM
done. result: (warriors with 5 firststrikes versus swordmen)

combats: 700
combatodds: 50,7 %
successful: 375
should be: 354,9
difference: 20,1 (2,87 %)

mmh it seems, that the firststrike and firststrikechance get little better odds. but to be sure, we have to calculate the error, first. if i have time tommorow, i'll try this.

Sensemann
Jul 11, 2008, 07:38 PM
I have also noticed this, although I can't tell if it's just the odds display calculator that's leaving out the river crossing, or if it really isn't getting factored into the battle. This might be a good factor to include in the 100 swordsman/warrior tests.

it is displayed wrong. tested it with monks versus swordmen. the combat odds say that there is a 90,1 % chance from 2 tiles away the river and 66,6 % directly beside the river. result:

combats: 500
combatodds: 90,1 %
successful: 339
should be: 450,5
difference: -111,5 (-22,30 %)

and 339/500 = 0,678 => 67,80 % combatodds, its close to 66, 60 %
so its a bug and should be posted in the bug report thread.

Sarisin
Jul 12, 2008, 02:18 AM
I agree that the 60-70% range for combat odds is no-man's land if you really want to keep that unit. It just seems like you get so many losses in that range, but the tests are saying otherwise.

Well, I started a test at the other end of the spectrum. The results so far have been not quite what I expected, but it is demoralizing in a game sending your troops off to known slaughter.

I have had 25 battles where the combat odds were 10% or less. I won only one of those - it happened to be a Baby Spider with odds of 3.5% against a Warrior. I lost 24 battles. This is early game too (Epic speed), so no fireballs and other throwaway summons.

Yes, you do win some unexpectedly as you throw cannon fodder at the enemy, but so far only one victory for the underdogs. ;)

DrStalker
Jul 12, 2008, 05:30 AM
I have replicable proof that first strikes are not always handled correctly when calculating combat odds.

Edit the XML so that warriors (strength 3) have 500 first strikes.
Use World Builder to create warriors and a Margalards (strength 22 orangutan , no special abilities) on adjacent grassland

The combat odds will display as <0.1%, but out of 100 attempts I won every one of them.


This is an extreme example, but it was designed to demonstrate a discrepancy in the way combat odds are calculated when first strikes are involved.

eerr
Jul 12, 2008, 07:21 AM
I agree that the 60-70% range for combat odds is no-man's land if you really want to keep that unit. It just seems like you get so many losses in that range, but the tests are saying otherwise.

Well, I started a test at the other end of the spectrum. The results so far have been not quite what I expected, but it is demoralizing in a game sending your troops off to known slaughter.

I have had 25 battles where the combat odds were 10% or less. I won only one of those - it happened to be a Baby Spider with odds of 3.5% against a Warrior. I lost 24 battles. This is early game too (Epic speed), so no fireballs and other throwaway summons.

Yes, you do win some unexpectedly as you throw cannon fodder at the enemy, but so far only one victory for the underdogs. ;)

on most of the easier difficulties, you auto-win the first time you attack the barbarians
(not the first defense against them, however)

TheJopa
Jul 12, 2008, 08:54 AM
You right Kael and how often do we attack at 0,1% chance of winning. I did some time ago in the original forum some testing about this (this is an old debate) and the figures that I came up with was all within a reasonble range. I tested all sorts of odds, even 1% chance of winning battles and I came pretty close (3 wins out of 100). The only types of battles that fell way out of a reasonble range was when I tested naval battles. But I was so bored with the testing (I did the naval tests last) so I didn't redo those tests to see if the test result came out the same.

And lastly. It is boring to loose a hero when he has 99% of winning but have laughed more than once when it is the other way around (and yes I have experienced that more than once as well).


I also noticed one another thing: When attacking with fireballs (and earlier, meteors), I, of course, just throw them in at any odds, even as low as 0.1%. What I have noticed is that I *WIN* many 0.3% or 4% fights. Anyone else noticed this?

Minor Annoyance
Jul 12, 2008, 09:32 AM
it is displayed wrong. tested it with monks versus swordmen. the combat odds say that there is a 90,1 % chance from 2 tiles away the river and 66,6 % directly beside the river. result:

combats: 500
combatodds: 90,1 %
successful: 339
should be: 450,5
difference: -111,5 (-22,30 %)

and 339/500 = 0,678 => 67,80 % combatodds, its close to 66, 60 %
so its a bug and should be posted in the bug report thread.

You didn't need to do 500 combats to find that out. I did an attack from 2 tiles away that didn't list a river crossing and then looked at the combat logs and saw the river modifier. Also it's in the standard civ:4 too.

Kael
Jul 12, 2008, 09:44 AM
it is displayed wrong. tested it with monks versus swordmen. the combat odds say that there is a 90,1 % chance from 2 tiles away the river and 66,6 % directly beside the river. result:

combats: 500
combatodds: 90,1 %
successful: 339
should be: 450,5
difference: -111,5 (-22,30 %)

and 339/500 = 0,678 => 67,80 % combatodds, its close to 66, 60 %
so its a bug and should be posted in the bug report thread.

Yeah, in my mind thats not a big deal. Im more concerned with combat odds of units that are right beside each other, "Long distance" combat odds wont take river crossing into account (afterall how does it know for sure if you'll cross a river along the way).

Minor Annoyance
Jul 12, 2008, 10:56 AM
Yeah, in my mind thats not a big deal. Im more concerned with combat odds of units that are right beside each other, "Long distance" combat odds wont take river crossing into account (afterall how does it know for sure if you'll cross a river along the way).

Well it does draw the line for you that crosses the river, but I've made my peace with that having the pathfinder connected to the combat system is probably more trouble than it's worth.

Vladesch
Jul 12, 2008, 11:18 AM
I often win at low odds.
When Im trying to soften up a mob with a skeleton so my adept can get the kill.

Sensemann
Jul 12, 2008, 12:06 PM
For your tests I would recommend samples of identical units on each side and the same odds rather than just bunches of different units. You're probably tracking results in a game but it would be cool to see:

1. 100 swordsmen attacking 100 warriors with both in grasslands.
2. 100 swordsmen attacking 100 warriors on a hill (do terrain bonuses mess with the odds?).


ok here the results (500 combats tested):

1. should be 78,3 % (got 79,4 %)
2. should be 66,4 % (got 66,8 %)

seems alright and slightly better than showed.

Vehem
Jul 12, 2008, 12:16 PM
Cool analysis, Im very interested.

Keep in mind that combat odds are an estimation. The game approximates your chance of winning, but it isnt like it just roles those odds to determine the combat. The real combat is a whole series of attacks and defenses, with modifiers and bonuses adjusting the odds in different ways. So it may not be exact, but it should be pretty close in large samples.

For your tests I would recommend samples of identical units on each side and the same odds rather than just bunches of different units. You're probably tracking results in a game but it would be cool to see:

1. 100 swordsmen attacking 100 warriors with both in grasslands.
2. 100 swordsmen attacking 100 warriors on a hill (do terrain bonuses mess with the odds?).
3. 100 swordmen attacking 100 warriors with dance of blades (do first strikes mess with the odds?).

That kind of testing may help us if there a significant descrepancy is shown.

Notably for the large scale tests of identical units - use "Stack Attack" and count the survivors to determine the number of victories.

PacoDeth
Jul 13, 2008, 06:40 AM
I'm not too convinced with the tests goin on, as most of them seem to be tests of base, non-upgraded units against eachother. I think alot of the "possible" problems have to do with all of the promotions a unit might recieve. It seems your heavily promoted units, or else heavily promoted targets/enemies are the ones where combats don't always seem to fit the percentages, and the computer units always seem to have a ton of promotions.

I will agree that you definately remember the combats you lose, but I'm totally fine with losing every once in a while with a 95%+ odd. But at the same time, it seems like when you have odds in the 70%'s, it's almost like a grand victory to actually win one. Seems like you get that 74% odd battle that you can't avoid starting, and if you win, it calls for a celebration as it's so rare. But again, I think my problems relate to heavily upgraded units, I would hope Civ4 would be able to calculate a simple Str5 unit vs a Str7 unit with no buffs.

All in all though, this is a problem that can be dealt with (if it really is a problem ;) ), you just don't do combats below 80%, and you don't do combats with hero or favored units under 96%. The current FFH mod is amazing, and all of the work done with recent patches and up and coming patches sound great, so this "possible problem" could take a back seat for all I care. Whatever free time you guys have to devote to working on the mod I'm sure could be put to better use for the time being, as said, there are ways to deal with this.

Sarisin
Jul 13, 2008, 07:47 AM
I'm not too convinced with the tests goin on, as most of them seem to be tests of base, non-upgraded units against eachother. I think alot of the "possible" problems have to do with all of the promotions a unit might recieve. It seems your heavily promoted units, or else heavily promoted targets/enemies are the ones where combats don't always seem to fit the percentages, and the computer units always seem to have a ton of promotions.

I will agree that you definately remember the combats you lose, but I'm totally fine with losing every once in a while with a 95%+ odd. But at the same time, it seems like when you have odds in the 70%'s, it's almost like a grand victory to actually win one. Seems like you get that 74% odd battle that you can't avoid starting, and if you win, it calls for a celebration as it's so rare. But again, I think my problems relate to heavily upgraded units, I would hope Civ4 would be able to calculate a simple Str5 unit vs a Str7 unit with no buffs.

All in all though, this is a problem that can be dealt with (if it really is a problem ;) ), you just don't do combats below 80%, and you don't do combats with hero or favored units under 96%. The current FFH mod is amazing, and all of the work done with recent patches and up and coming patches sound great, so this "possible problem" could take a back seat for all I care. Whatever free time you guys have to devote to working on the mod I'm sure could be put to better use for the time being, as said, there are ways to deal with this.

Excellent post. You state the problem well, and give a good solution.

I really haven't played vanilla civ/BtS much, but I tried not too long ago and I honestly didn't think there was as much of a problem with the combat odds as you see in FFH. Maybe it does have something to do with all the add-ons that bring that outstanding flavor of the mod to us.

It really is easy to write here how much this whole thing doesn't bother us, but if you lose a fully promoted Beastmaster to a lowly orc axeman like I just did...well, that has all happened to us and you just cuss, bang the table and move on. ;)

MondSemmel
Jul 13, 2008, 09:35 AM
The first time I used the WB and saw how annoying placing specific units/giving specific units specific promotions was, I kind of decided I wouldn't bother with WB any more.
But now that I've read you can edit maps via notepad, what would one have to do to give e.g. a stack of 100 warriors X specific promotions (always the same)?

Although intentional and a result of this combat system, the difference between e.g. str 3 v str 5 and str 10 vs str 19 is also rather counterintuitive, isn't it?

And I do agree that the remaining HP of a unit don't seem to make any sense whatsoever. If my hero wins with 99% odds and ends up with 10 HP or less, that not only means that these odds were a lot less certain (had he lost the final round, he would have lost, and losing one round is a lot more likely than 1%), but that they also don't make much sense. Likewise, it just seems counterintuitive to win really low% battles and the unit still has almost 100 HP.

First strikes could easily be bugged (and screw a lot with combat odds) - perhaps someone could test this between non-barbarians?

Ksi
Jul 13, 2008, 12:47 PM
84/100 is still an accurate distribution in the +- range. Your experimental results will approach the theoretical yields as the number of trials reaches infinity. I.e. do a couple thousand more of those trials and average the results and I guarantee you will get 90.x% =)

I know much has been written about Combat Odds in Civ4/FFH. Many of us can remember that version in which the combat odds were really whacky.

Well, it seemed like in the latest version I was losing quite a few battles in which I was favored by what I would call overwhelming combat odds - 90% or greater. My definition.

Of course, you always tend to remember those losses and sometimes lose track of the many combat victories you are piling up.

Anyway, as a retiree, I have plenty of time on my hands, so I decided to run a small sample test during my current game. I charted 100 battles where I had combat odds of 90% or greater.

Care to guess how many of those battles I won?

How about 84?

Included in the 100 were 37 battles where the odds were 99.9%. A sure thing, right? I lost three of those.

It was a small sample size and I'm not sure you can conclude anything from the test. Honestly, I thought I would have more than 16 losses in the 100 battles. It just seemed like I was losing more battles when I was heavily favored to win in my games.

One thing I have noted is that if you win quite a few battles when the odds are high, you can bet your string will end, even with the high odds. I guess that makes sense. But, it is really annoying to win a few battles and then lose that veteran unit when the odds are 98.6% to win.

Of course, the flip side of this is how many battles you win when the odds are heavily against you. I find you win very few of those, perhaps less than even the low odds would indicate. But, really, I think most of us would avoid battles, especially with good units, when the combat odds are low. It does seem, though, that you often, and I mean often, lose the 60-70% battles a lot more than you win as the odds would indicate.

Anyway, maybe my next test will be to run a sample of battles where the odds are 10% or less and see how many I would win.

For the statistician purists out there, I apologize if my simple test and analysis offends you - just wanted to see if there was any kind of pattern with all those 90+% battles I was losing. :)

Zechnophobe
Jul 14, 2008, 01:11 AM
Okay, so here's the monkey wrench:

These aren't huge samples, but are very... telling.

First take 28 Wraiths pitted vs 28 Iron Golems.
IG's are strength 10,and immune to death.
Wraiths are Strength 6 + 3 death.

Combat odds show Wraiths having about 4% chance of victory. They win 3 times out of 28. So we are about right there. Odds computed showed a strength 10 vs a strength 6 unit (Makes sense, they are immune to death).

Second, however, we have 43 Spectres vs 43 Wood Golems.

The spectres have death affinity, and 3 sources of Death, so show as have 6 Strength (3 + 3 Death)
Wood Golems are strength 6 and have immunity to death.

Combat odds show Spectres with .9% (!) to win against the Golems. IT shows a strength 6 Golem vs a strength 3 Spectre. This still looks right because the golems are immune to the death damage.

HOWEVER. When we fight these 43 combats, the spectres win 29 of 43 combats. Further more, checking the combat log shows them as strength 6 vs the golems. (Whereas the combat log for the wraiths showed them as strength 6 as well, which meant the death damage wasn't calculated).

Conclusion: I suspect that the effects which check for immunity in the combat code, trigger BEFORE the effects which check for affinity. So units with immunity are immune to only built in effects, not those based by affinity.

Kael
Jul 15, 2008, 02:06 PM
Okay, so here's the monkey wrench:

These aren't huge samples, but are very... telling.

First take 28 Wraiths pitted vs 28 Iron Golems.
IG's are strength 10,and immune to death.
Wraiths are Strength 6 + 3 death.

Combat odds show Wraiths having about 4% chance of victory. They win 3 times out of 28. So we are about right there. Odds computed showed a strength 10 vs a strength 6 unit (Makes sense, they are immune to death).

Second, however, we have 43 Spectres vs 43 Wood Golems.

The spectres have death affinity, and 3 sources of Death, so show as have 6 Strength (3 + 3 Death)
Wood Golems are strength 6 and have immunity to death.

Combat odds show Spectres with .9% (!) to win against the Golems. IT shows a strength 6 Golem vs a strength 3 Spectre. This still looks right because the golems are immune to the death damage.

HOWEVER. When we fight these 43 combats, the spectres win 29 of 43 combats. Further more, checking the combat log shows them as strength 6 vs the golems. (Whereas the combat log for the wraiths showed them as strength 6 as well, which meant the death damage wasn't calculated).

Conclusion: I suspect that the effects which check for immunity in the combat code, trigger BEFORE the effects which check for affinity. So units with immunity are immune to only built in effects, not those based by affinity.

We recently discovered in another thread that damage resistance isnt being calculated correctly. So if you attack with the Wraith that defending Iron Golem doesnt get to ignore the death damage. That could be a lot of the reson people are seeing odd combat results. It will be fixed in 0.33, until then any combat odds tests should be run without and resistance situations.

DrPepper836
Jul 16, 2008, 12:25 AM
I ran one using dance of blades on 100 warriors vs 100 normal warriors, no other mods. All on grassland. 56.8% victory chance. 62% win, or 62 warriors that I had left, 38 that Keelyn had left. That's a 5% deviation. I consider that pretty good, but make of it what you will. I hope that helps the first strike thing.

MondSemmel
Jul 16, 2008, 01:10 PM
I have replicable proof that first strikes are not always handled correctly when calculating combat odds.

Edit the XML so that warriors (strength 3) have 500 first strikes.
Use World Builder to create warriors and a Margalards (strength 22 orangutan , no special abilities) on adjacent grassland

The combat odds will display as <0.1%, but out of 100 attempts I won every one of them.


This is an extreme example, but it was designed to demonstrate a discrepancy in the way combat odds are calculated when first strikes are involved.

I repeated this test because nobody seemed to take it seriously/everybody thought it was due to difficulty settings and barbarian autowins.
The quoted post is correct. I've placed 15 stacks of 2 warriors each with 500 First Strikes (not First Strike chances) belonging to me as Sabathiel Bannor against 10 stacks of 2 Margalards each and 5 stacks of 2 Avatars of Wrath each, all of which belonged to Valledia of the Amurites.

First of all, displayed combat odds with alt + mouseover were 0.1%, and 0.0% in the combat logs. Not only did all of my warriors win with full hp (i.e. none of the 30 warriors received even one hit), which shows there's a serious problem (although the value of 500 First Strikes is extreme, that doesn't make the problem any less severe - 4-7 First Strikes is very possible with Drill I-IV, for example, although I don't know how First Strike Chances would work), but they also received respectively 234 XP against the Margalards and 352 XP against the Avatars, meaning that the calculated XP actually takes the displayed odds into account and not the real odds of (Close to? I never lost, but chance dictates that the number must be below 100% unless there's another bug somewhere...) 100%.

If you want to test this yourself, follow these steps:

1) All Warriors have been changed in the file Fall From Heaven 2 032\Assets\XML\Units\CIV4UnitInfos.xml to have 500 First Strikes. To do this manually, you have to search for <type>unit_warrior and then for <iFirstStrikes>. Then change <iFirstStrikes>0</iFirstStrikes> to <iFirstStrikes>500</iFirstStrikes>. Remember to make a backup of the file beforehand and change this back afterwards or your games will go very, very quickly from now on :P.
You have done this correctly if the Warriors ingame have 500 First Strikes.
2) Start FFH II after doing changes. (it may be possible to reload the XMLs without restarting FFH, but I have 0 experience with modding, so I don't know how to do that)
3) Take this save file: http://www.sendspace.com/file/m9dq6e and place it in your BTS saves folder, then load it normally as a Singleplayer game. It's not perfect as I still have my normal starting units etc., but otherwise it gets the job done :P.

Basically, the two bugs are #1 that the displayed combat odds are the calculated combat odds (this is different to i.e. the damage resistance bug) - displayed as 0.0%, really nearly 100%. #2 that the calculated experience also takes these combat odds into account; you get totally absurd amounts of experience.

The only thing changed from normal FFH to this case is the number of First Strikes, so there's a (possibly huge) bug with First Strikes (and probably not related to FFH, but a general Civ4/BTS bug). It's really quite logical to win every fight with so many First Strikes, though - the Warriors basically get 500 shots at winning combat rounds without enemy retaliation, and they apparently deal 8 damage per round, so they only have to win 13 of 500 rounds to win unharmed.
According to this article (http://www.civfanatics.com/civ4/strategy/combat_explained.php), the chance to win a combat round is A/(A+D), or modified strength of attacker divided by (modified strength of attackers + modified strength of defender), therefore 3/(33+3) for Warriors against Avatars, or 1/12. We were supposed to learn this at school, but I completely forgot the formula needed for this - in any case, it's basically guaranteed to win 13 out of 500 combat rounds with a chance per round of about 8.3%.

Great job finding that out, DrStalker! I wonder whether this problem can be fixed easily, though...

EDIT: I don't know why, but if you press next turn and let the AI do the attacking, it only (sometimes) attacks the warriors with the Avatars and never with the Margalards. I have no idea why that is, though - neither Avatars nor Margalards nor the summoned Iras have any chance of winning whatsoever.

xienwolf
Jul 16, 2008, 01:41 PM
Could you guys go a bit further with the massive First Strike tests please?

Set the warrior to 1 Strength, and his opponent to 100. See if you still always win with 500 First strikes.

If you do (yikes!) try it at a Warrior Strength of 0. Hopefully you lose then. If so, go back to Warrior Strength of 1, and start reducing the number of first strikes, see how close to 20 you can get.


My fear is that a First Strike might be an automatic hit, rather than a "you can't hit me if I lose" like it is supposed to be. Cause realistically in 500 hits it should be pretty hard for a 3 strength warrior to succeed at the 18 or so that he needs against a 18 strength opponent so consistently

MondSemmel
Jul 16, 2008, 02:18 PM
Could you guys go a bit further with the massive First Strike tests please?

Set the warrior to 1 Strength, and his opponent to 100. See if you still always win with 500 First strikes.

If you do (yikes!) try it at a Warrior Strength of 0. Hopefully you lose then. If so, go back to Warrior Strength of 1, and start reducing the number of first strikes, see how close to 20 you can get.


My fear is that a First Strike might be an automatic hit, rather than a "you can't hit me if I lose" like it is supposed to be. Cause realistically in 500 hits it should be pretty hard for a 3 strength warrior to succeed at the 18 or so that he needs against a 18 strength opponent so consistently

I'll test that, too. As I said, though, even against a 33 str target (Avatar of Wrath), the Warrior still dealt 8 damage per won round (and according to the linked article, this value is capped at 6 damage, so you'd never need to win more than 17 rounds against an opponent with the maximum of 100 HP), so he still only needed to win 13 rounds at 1/12 = 8.33% winning chances.
Can a strength 0 warrior even attack?
EDIT: In any case, all I know about how combat works comes from the article I linked above. If it is correct, then it's completely obvious that the Warriors would win, and there's just a problem with the combat odds.

I'll report back after I've tested this. Can you tell me how to reload the XML without restarting the game?

Sensemann
Jul 16, 2008, 02:33 PM
i tested it too.
warrior strength 1 and 500 first strikes vs axeman strength 100.
the displayed combatchance was < 0.1 and all warriors lose the combat (tested 35). the axeman with the worst hp has 36 health left.

so i'll try to set the strength of the axeman down until the first warrior win a battle.

xienwolf
Jul 16, 2008, 02:47 PM
Unfortunately you can't reload the XML unless you restart the game.

I forgot you had linked an article on the details for combat. Was going off nearly 1 year old memory from a similar article :)

As long as it makes sense that the warrior CAN win in those combats, no worries about going any further. It has accurately portrayed that the combat odds just come out wrong for large quantities of first strikes.

Mayhaps the combat odds could be re-written to account for first strikes, then re-calculate probable strength values based on assumed damage, THEN run the rest of the non-first strike odds calculations.

Though it'd need all those other odds in order to calculate the probable outcome of the first strikes anyway, so it could get tricky to make that work out at all...

MondSemmel
Jul 16, 2008, 02:56 PM
Set the warrior to 1 Strength, and his opponent to 100. See if you still always win with 500 First strikes.

If you do (yikes!) try it at a Warrior Strength of 0. Hopefully you lose then. If so, go back to Warrior Strength of 1, and start reducing the number of first strikes, see how close to 20 you can get.


My fear is that a First Strike might be an automatic hit, rather than a "you can't hit me if I lose" like it is supposed to be. Cause realistically in 500 hits it should be pretty hard for a 3 strength warrior to succeed at the 18 or so that he needs against a 18 strength opponent so consistently

~40 Str 1 Warriors with 500 First Strikes vs ~40 Str 100 Margalards: 0 wins, all of them have between 34 (once) and 100 (once) HP left.
10 Str 1 Warriors with 500 First Strikes vs 10 Str 22 Margalards: 10 wins, all Warriors unharmed. Oh, and all of them received 704 XP.

I tried Warriors with Strength 0, but they couldn't even attack (same as e.g. Workers). According to the article about combat, their chance of winning a round would be 0/strength of defender, or 0, so they wouldn't be able to win combat in any case.

I won't test to see how many First Strikes make a win reasonably certain or impossible, that involves too much changing in the XML (and I had to place new Warriors in WB everytime I changed something in the XML, and I have no clue why/what I'd have to do differently). At the very least I'll wait with that until someone can tell me why the game doesn't display the correct odds.
In any case, damage per turn is indeed capped, which is why the Warriors in the Str 1 vs Str 100 fight still dealt 6 damage per won combat round. (I think the Margalards dealt ~58 damage, so 60 sounds like a reasonable cap for the other side).

Oh, and the savegame I linked sadly didn't have "New random seed on reload" activated, so bear that in mind. I had to save the game in WB and load it as a custom scenario to activate this option (which is absolutely necessary for this sort of testing, although it doesn't make my test in my last post any less valid).

Artan
Jul 17, 2008, 01:01 PM
The problem CIV4 has in determining combat chances in view of a large number of first strikes might be due to memory limitations and, possibly, rounding errors. A CIV4 combat never lasts longer than (17+first strikes) rounds --- in the most extreme case, the stronger unit needs 2 hits and the weaker unit 16 hits for a kill. This normally small number of rounds makes it easy to compute the winning chance exactly. If the number of first strikes is high, then an exact calculation is not feasible any more, because it would need to much time and memory (and the possibility to avoid rounding errors).

It is very probable that the programmers of CIV4 have (strongly) limited the amount of memory (or number of calculation steps) the combat chance calculator is granted, so exact calculations for high number of first strikes might not be possible.


Ad first strikes/first strike chances/automatic hits:

400 Str 1 Warriors with 500 first strikes vs. 400 Str 100 Bloodpets with 0 first strikes: no kills -> so, very probably first strikes are treated correctly and not as automated hits.


And for all those of you who always wanted to know how first strike chances are treated I've tried the following experiment:
2000 Str 4 Warriors with 45 first strike chances vs. 2000 Str 7 Bloodpets with 32 first strikes.

Basically, there are two possibilities (at least, they are the most obvious ones):
i) the warriors randomly have any number between 0 and 45 first strikes, every number has the same probability. Using the combat chance calculator at http://c4combat.narod.ru/c4c.htm, one finds that in this case the winning chance for the warriors should be well above 5% (7.1% are displayed by the combat chance calculator).
ii) Every first strike chance gives you a 50% chance for a first strike (so a chance of 2^{-45} for no/45 first strikes, 45*2^{-45} for 1 or 44 first strikes, and so on). In this case, chances are high (more than 99%) that the warriors have 30 or less first strikes - and therefore their winning probability as well should be below 1%.

In the test 135 warriors (6.75%) survived, which strongly favors the first first possibility.

Kael
Jul 17, 2008, 01:15 PM
Yeah I dont have a lot of interest in the massive first strikes test. All it does is magnify the deviation that may exist, but Im okay with some deviation as it is only an estimation. For example if a unit with first strike shows 10% to win a battle but its actually 11% thats not a huge deal to me. Even if we are able to exacerbate that deviation by giving the unit 100 first strikes and showing that the displayed 11% is actually 100%.

So tests of extreme nmumbers are only valuable if we assume that these numbers are exact. And we know that they aren't.

eerr
Jul 18, 2008, 03:25 PM
the only problem with +-5% deviation is when a unit like a hero has 94% chance to win, when it is really 89% is almost double the chance for the hero to be lost
with 45-55% it actually isn't that significant
of course, heros on the attack are the ones that matter most to people so go figure...

Zechnophobe
Jul 19, 2008, 11:18 PM
the only problem with +-5% deviation is when a unit like a hero has 94% chance to win, when it is really 89% is almost double the chance for the hero to be lost
with 45-55% it actually isn't that significant
of course, heros on the attack are the ones that matter most to people so go figure...

+-5% is more just the standard deviation for a test that is inconclusive. That is, if we do 100 or 200 trials and only get a 5% discrepency, it's probably just luck of the draw, not an actual problem with the odds calculation.

The only fudge that appears to be happening is with really large numbers of first strike... numbers that aren't actually doable in the game. 4-7 just isn't going to make almost any difference, though it is regrettable the calculator doesn't seem to take them into quite the proper effect.

MondSemmel
Jul 20, 2008, 05:15 AM
+-5% is more just the standard deviation for a test that is inconclusive. That is, if we do 100 or 200 trials and only get a 5% discrepency, it's probably just luck of the draw, not an actual problem with the odds calculation.

The only fudge that appears to be happening is with really large numbers of first strike... numbers that aren't actually doable in the game. 4-7 just isn't going to make almost any difference, though it is regrettable the calculator doesn't seem to take them into quite the proper effect.

But wouldn't a 5% discrepancy be between e.g. a displayed chance to lose of 4% (i.e. 96% win chance) and a real chance to lose of 4.2%?
The numbers you quoted (89% and 94%) are almost a 100% deviation...


That being said, I'd have to agree that pursuing the First Strike test in this form doesn't make any sense because nothing in the game has so many First Strikes.
What would I have to do to test whether the 4-7 First Strikes and things like that are calculated properly?

Ecofarm
Jul 20, 2008, 10:05 AM
For a simple look at the impact of first strikes:

1) The game assumes 50% of strikes hit, right?

2) WB. Create 2 units. Give one two strikes more than the other and create a target. Exit worldbuilder.

3) Check combat odds.

4) The difference between the two represents:

The increased percentage of winning assuming one extra strikes hit.

Now, the percentage on the guy with 2 less strikes are what your percentage is if you miss both of your extras.

It will give you an idea of the range we are talking about when the code gives you percentages for a striker. Sometimes, missing all your strikes can result in a percentage 15 or 20 less than displayed.

That's why strikers die so much. They flip coins that change percentages or, actually, move it deviations away from the percentage displayed - which is actually the median of a range. The percentage might say ">99%" but if you miss all your strikes it's more like 80%. There will be a few times you miss all your strikes, and you can't do 80% too often...

Thus, I don't promote Kithra drill4 anymore. He dies fast like that.

Nicopol
Jul 20, 2008, 10:38 AM
that sounds interesting.
is it possible to display a range (e.g. 80% - 97% chance) if u (or enemy) have first strikes?

edit:
nevermind - there must be a better solution

xienwolf
Jul 20, 2008, 12:45 PM
I still find myself always looking at the strength numbers instead of the percentages anyway. Takes a deliberate effort to look at the odds instead of guessing for myself that I am willing to risk a 3.8 vs 4.2, or a 10.0 vs 9.8

MondSemmel
Jul 20, 2008, 01:52 PM
I'm willing to conduct further tests, but could anyone post the code of how combat is calculated and how the odds are calculated beforehand/tell me where I can find those?
I imagine it would make it much easier to understand whether a discrepancy between odds and results is possible in general (it is, as shown in the extreme number of first strikes example)/can actually occur with normal values in a real FFH game.


On a different note, creating a promotion that makes units survive all fights above, say, 98% or 99% odds, but then with 1 (or 0, if that doesn't instantly kill them) HP (perhaps by giving them 100% withdrawal if and only if their combat odds are this high) - that way, heroes wouldn't be as dependent on luck/the odds anymore, but in the cases where you should have died but didn't die due to the promotion, your hero would still be weak until healed fully (which can take some time in an opponent's territory)...
This would be different to the immortal promotion in that it would really only help you in the cases where you should win in any case. Losing heroes at 99% odds is annoying though still possible - the whole odds system is fine for normal units (losing one of one hundred champions at 99% odds isn't nearly as bad as losing one hero in hundred 99% fights), but "super" units (heroes, world units, perhaps national units) should probably be able to manipulate odds from 98% or 99% to a 100% survival rate via promotions or something like that.

EDIT: If First Strike chances are a problem, and they probably are, why not get rid of these altogether (change them to normal First Strikes)? Perhaps Drill with 7 First Strikes would be a bit much, so one could reduce the number to 6 or so, but in general First Strike chances are more trouble than they are worth. They basically give you a chance to have a chance to deal damage...

sixs_monkey
Jul 20, 2008, 03:32 PM
I would certainly use an available promotion slot on "The James R. Kirk school of not losing" He may not be the best example, but being able to have my legendary units escape by the skin of their teeth with only the shirts on their back and those not quite intact would be much more palatable than "We had it all over those guys! What is it with the Yamato, anyway?!"

Having no idea if the combat code has a step where an auto-success retreat, conditional on the inital odds of battle would fit nicely in, I'd also buy one that depended on initial hits. Then you could have select units or even unit-types that could be beaten back but never killed on the first try.

For me, this option would remove the frustration of having no way to prevent my enemy from winning the lotto. :)