Your experience with combat odds...?

Speaking of odds is not only about being death or alive. Winning a fight can injure you so heavily that the counter-attack means your death sentence. Again, I tend to believe that AI is more gifted here, they damage more heavily even when they lose and they have less of a scratch when they win a borderline fight. I CAN win 70/80% fights but sometimes at a very high cost. Don't know if THAT is linked to the difficulty, maybe not, I really don't know.

It's linked to the first strike mechanic. Be very careful with tests involving this, as some units/promotions ignore first strikes too. They make victories with full HP significantly more likely.
 
It's linked to the first strike mechanic. Be very careful with tests involving this, as some units/promotions ignore first strikes too. They make victories with full HP significantly more likely.

So being immune to a first strike means basically that you have a chance to finish the fight even before the opponent could scratch you?

In my example, when I test knights (immune) against longbows (having 1. strike), doesn't that mean all their bonuses neutralize each other and it's purely 10 against 6 (+ city garrison)?
 
So being immune to a first strike means basically that you have a chance to finish the fight even before the opponent could scratch you?

No, it means your opponent doesn't get "free" rounds where they damage you if they roll well, but don't take damage if you roll well.

Knight vs longbow ignores first strike phases entirely, so it's just strength vs strength. Don't forget that archery units have an inherent city bonus, in addition to CG promotions, city defense, and fortification bonuses however.
 
I still remember a game with Ethiopia long ago when I was a Prince player. I had about 10 Drill IV Oromos fortified in a city and got dogpiled by 3 backwards AI's with classical era troops. I killed like 40 units in one turn and a few of my Oromos weren't even scratched during the battles. Didn't understand how that could happen then I looked into FS mechanics. Of course Drill IV also comes with 60% reduction in collateral damage. If those guys brought even HA's though I wouldn't have held out and if they Knights they would have massacred me but it was loads of melee and a few Catapults.
 
I looked up that unit. Having one first strike and being immune to other first strikes means that you have a free round that no unit whatsoever can contest you? What if you face some unit with the same properties?
And what is, btw, a first strike "chance"? Again such a RNG thing?
I don't think that knights would have really harmed you with 2 first strikes, fortification and +10% vs. mounted, maybe even on a hill?

I also remember a reverse thing where I had choked Charly and suddenly he got longbows while I had really bad economy and could not reach construction. I desperately tried to take his fortified longbows with swordsmen. You cannot even scratch them, nothing. They simply remain at 6 strength.
 
Last edited:
I looked up that unit. Having one first strike and being immune to other first strikes means that you have a free round that no unit whatsoever can contest you? What if you face some unit with the same properties?

If it fights a unit with FS immunity nobody gets first strikes.
 
I looked up that unit. Having one first strike and being immune to other first strikes means that you have a free round that no unit whatsoever can contest you? What if you face some unit with the same properties?
And what is, btw, a first strike "chance"? Again such a RNG thing?
I don't think that knights would have really harmed you with 2 first strikes, fortification and +10% vs. mounted, maybe even on a hill?

I also remember a reverse thing where I had choked Charly and suddenly he got longbows while I had really bad economy and could not reach construction. I desperately tried to take his fortified longbows with swordsmen. You cannot even scratch them, nothing. They simply remain at 6 strength.

A FS chance has a 50% probability of becoming a FS. So a unit with 1 FS and one FS chance can be thought of as having 1.5 FS.

The first knight will redline an Oromo and the second will kill it. Knights are immune to FS so all the Drill promos are useless against them except the +10% vs. mounted which isn't much. I doubt I built a castle in that game. Probably a wall and yes the city was on a hill. Say my Oromo gets 40% from culture, 25% from hills, 25% from hills, 25% from fortify, +10% vs. mounted so total 125% bonus modified strength 20.25. A Knight with CI has 11.0. Oromo still has very good odds of winning probably 95% but no FS means it will take big damage.
 
20 vs. 11 doesn't sound to me as if one should take too much damage but I usually fail to interprete this correctly. Would you do the same damage to a strong hill defender while attacking with knights (and no siege)? Probably not...
 
My idea for an implementation that allows for some variability due to RNG while not too much is making it that fights are certain wins and losses past certain thresholds. Say, any battle below 10% is an auto-loss and a "win" rolled would leave the defender within 1 hit of death while killing the attacker, while any battle above 90% with a "loss" rolled will leave the attacker within 1 hit of death while the defender still dies.
I've implemented pretty much just that in a small mod a few years ago. The mod lets both units survive when a unit is about to win against all odds. I found that this made wars of conquest with a tech advantage even cheaper than they already are in BtS, so I've abandoned that mod. I still think that high-stakes success/ failure dice rolls don't belong in strategy games though. Ultimately, I see free healing as the culprit because it makes combat essentially winner-take-all.
 
20 vs. 11 doesn't sound to me as if one should take too much damage but I usually fail to interprete this correctly. Would you do the same damage to a strong hill defender while attacking with knights (and no siege)? Probably not...

Since the defender with strength 20 has no first strike against the strength 11 unit, the odds of it not being damaged are fairly low. In many cases the Oromos will get damaged quite significantly. A stack of 10 Oromos could kill ~15 or so Knights but probably not more than that. Whereas if the Oromos are attacked by say Maces (even with CRII) instead of Knights which have no FS immunity I would expect the Oromos to absolutely clean up.

A good mod to try is the Advanced Combat Mod. It gives the probabilities of all battle outcomes including the hit points of the units involved.
 
Just ran a test for a CI Knight (11) vs. the aforementioned Drill IV Oromo (20.25) in a hill city with walls. There is a 96.5% chance the Oromo wins the battle but only 16.0% chance of escaping unscathed. The Oromo has about a 50% chance of ending up with >70 HP which is quite good so it could kill the second Knight as well. Just as a point of reference though if we use a CI Cataphract which is a much stronger unit like a Cuirassier (13.2) but with no FS immunity, the Oromo has an 98.5% chance of winning which is only a bit better than against the Knight but has a whopping 46% chance of escaping unscathed and 90% chance of ending up with >70 HP which is amazing. 10 Oromos could maybe only kill 15-17 Knights but they could kill double the number of say Maces.

What the combat odds in the standard game don't tell you is the expected HP of the victorious unit to give you an idea of how many consecutive battles the unit could win. For attack, this isn't so important because most cities are captured in one big battle and units can heal before the next fight but on defense preserving HP is very important when facing large stacks and Drill IV really excels at that. However, watch for mounted as HA's, Knights, and Cuirassiers all have FS immunity. In an Always War game, Drill IV units can be absolutely huge not to mention the -60% reduction in collateral damage which is big help when Monty suicides like 20 Catapults on you. With Drill IV, a large stack of defenders can survive the collateral damage quite well.
 
Last edited:
While all true, there have been 100% odds fights lost (i saw at least one myself).
Too late to the party, what you are saying is true.

I started to studied previous analysis of combt mechanic & validate it against code.

CvUnit::getDefenderCombatValues inside CvUnit.cpp file has lines (some lines stripped for brevity):

iTheirOdds = ((GC.getDefineINT("COMBAT_DIE_SIDES") * iTheirStrength) / (iOurStrength + iTheirStrength));

int iStrengthFactor = ((iOurFirepower + iTheirFirepower + 1) / 2);

iOurDamage = std::max(1, ((GC.getDefineINT("COMBAT_DAMAGE") * (iTheirFirepower + iStrengthFactor)) / (iOurFirepower + iStrengthFactor)));
iTheirDamage = std::max(1, ((GC.getDefineINT("COMBAT_DAMAGE") * (iOurFirepower + iStrengthFactor)) / (iTheirFirepower + iStrengthFactor)));

Inside XML "COMBAT_DIE_SIDES" = 1000. It is just for math trick to avoid float point numbers and back to integer area.

In order to always lose x/(x+y) should be less then 1/1000. If your STR is 100 and an opponent STR is 1, odds to miss: 1/(1+100) * 1000 = 9 times from dice with 1000 sides. Around 1%.

Damage is always no less than 1. There are several rounds kept until one die or withdraw, resulting is some probability distribution.

Only with STR 1 vs 1000 opponent will always lose (because of integer rounding in 1000*x/(x+y)).

UI shows 100% I believe due to the rounding. It actually can be 99.6 with "half" rounding up.
 
As far as I've experienced/witnessed Noble does not skew RNG results in the player's favor any more than Deity does (or doesn't, as the case may be).
That's true.

Difficulty level doesn't change combat parameters (unless you play with specially altered .dll by mod), except you mentioned:

Well, there's the two Mulligan fights against barbarians you get on Noble, but that's obviously a different case.

Spoiler Special Barberian case for combat :

Code:
    if (kDefender.isBarbarian())
    {
        if (GET_PLAYER(getOwnerINLINE()).getWinsVsBarbs() < GC.getHandicapInfo(GET_PLAYER(getOwnerINLINE()).getHandicapType()).getFreeWinsVsBarbs())
        {
            iTheirOdds = std::min((10 * GC.getDefineINT("COMBAT_DIE_SIDES")) / 100, iTheirOdds);
        }
    }
    if (isBarbarian())
    {
        if (GET_PLAYER(kDefender.getOwnerINLINE()).getWinsVsBarbs() < GC.getHandicapInfo(GET_PLAYER(kDefender.getOwnerINLINE()).getHandicapType()).getFreeWinsVsBarbs())
        {
            iTheirOdds =  std::max((90 * GC.getDefineINT("COMBAT_DIE_SIDES")) / 100, iTheirOdds);
        }
    }


Some few initial fights barbs win each round with probability 1/10 (or less if your power is 9 times larger or more).

iFreeWinsVsBarbs for each difficulty level can be found on page: https://civilization.fandom.com/wiki/Difficulty_level_(Civ4)
 
He loses regularly his >95% fights. He can compensate of course.
Not only because of skill but because he keeps enough spare parts to mitigate loses.

Sometimes I send unprotected Settler directly into waiting Barb. Who blame for that? I tried to start city growth earlier by avoiding building of Warrior for 5T before Settler.
 
UI shows 100% I believe due to the rounding. It actually can be 99.6 with "half" rounding up.

Does the UI still display 100%? I've never seen that even 1 time in 3.19. I've seen it say > 99.9%, but not 100%. I know in older patches it showed 100% wrongly.
 
I have honestly no idea how RNGs are programmed

I believe it is in CvRandom.cpp CvRandom::get:

m_ulRandomSeed = ((RANDOM_A * m_ulRandomSeed) + RANDOM_C);

unsigned short us = ((unsigned short)((((m_ulRandomSeed >> RANDOM_SHIFT) & MAX_UNSIGNED_SHORT) * ((unsigned long)usNum)) / (MAX_UNSIGNED_SHORT + 1)));

So it is almost https://en.wikipedia.org/wiki/Linear_congruential_generator

Usually it is called like GC.getASyncRand().get(200) - this simulate 200-side dice.

and if they follow the Law of Large numbers

https://en.wikipedia.org/wiki/Law_of_large_numbers

Law is true for any distribution. Some RNG can't contradict or comply with Law of Large numbers ((
 
Spoiler The greatest barb archer of all time :

RNG.png



(Sorry for the necro; I just wanted to share this. Made me laugh and then cry.)
 
What is the use of small extra icons above command buttons on your screenshot?
I believe those are used to filter the units that appear in the selection area just above. So, if you had a large stack of units, you could use the buttons to only show wounded units, air units, units ready to be promoted, units with movement points left, etc.
 
you could use the buttons to only show wounded units, air units, units ready to be promoted, units with movement points left, etc.
Interesting. I use Ctrl + H intensively to separate wounded from healthy. If I am correct Alt+Click selects with movement point left.

Sometimes I wanted to select siege units... I don't know if I need it.

Can you tell what kind of mod it is? Seems it is not a part of BUG/BULL...
 
Top Bottom