1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Your experience with combat odds...?

Discussion in 'Civ4 - Strategy & Tips' started by Tobiyogi, Oct 21, 2019.

  1. TheMeInTeam

    TheMeInTeam Top Logic

    Joined:
    Jan 26, 2008
    Messages:
    25,236
    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.
     
  2. Tobiyogi

    Tobiyogi Prince

    Joined:
    Nov 23, 2018
    Messages:
    456
    Gender:
    Male
    Location:
    Berlin, GE
    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)?
     
  3. TheMeInTeam

    TheMeInTeam Top Logic

    Joined:
    Jan 26, 2008
    Messages:
    25,236
    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.
     
  4. dankok

    dankok Chieftain

    Joined:
    Sep 2, 2006
    Messages:
    93
    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.
     
  5. Tobiyogi

    Tobiyogi Prince

    Joined:
    Nov 23, 2018
    Messages:
    456
    Gender:
    Male
    Location:
    Berlin, GE
    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: Oct 25, 2019
  6. TheMeInTeam

    TheMeInTeam Top Logic

    Joined:
    Jan 26, 2008
    Messages:
    25,236
    If it fights a unit with FS immunity nobody gets first strikes.
     
    Tobiyogi likes this.
  7. dankok

    dankok Chieftain

    Joined:
    Sep 2, 2006
    Messages:
    93
    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.
     
  8. Tobiyogi

    Tobiyogi Prince

    Joined:
    Nov 23, 2018
    Messages:
    456
    Gender:
    Male
    Location:
    Berlin, GE
    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...
     
  9. f1rpo

    f1rpo plastics

    Joined:
    May 22, 2014
    Messages:
    528
    Location:
    Germany
    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.
     
  10. dankok

    dankok Chieftain

    Joined:
    Sep 2, 2006
    Messages:
    93
    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.
     
  11. dankok

    dankok Chieftain

    Joined:
    Sep 2, 2006
    Messages:
    93
    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: Oct 28, 2019
  12. gavenkoa

    gavenkoa Warlord

    Joined:
    Jun 11, 2019
    Messages:
    225
    Gender:
    Male
    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.
     
  13. gavenkoa

    gavenkoa Warlord

    Joined:
    Jun 11, 2019
    Messages:
    225
    Gender:
    Male
    That's true.

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

    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)
     
  14. gavenkoa

    gavenkoa Warlord

    Joined:
    Jun 11, 2019
    Messages:
    225
    Gender:
    Male
    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.
     
  15. TheMeInTeam

    TheMeInTeam Top Logic

    Joined:
    Jan 26, 2008
    Messages:
    25,236
    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.
     
  16. gavenkoa

    gavenkoa Warlord

    Joined:
    Jun 11, 2019
    Messages:
    225
    Gender:
    Male
    I believe it is in CvRandom.cpp CvRandom::get:

    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.

    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 ((
     
  17. Wrathful

    Wrathful Warlord

    Joined:
    Oct 7, 2016
    Messages:
    146
    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.)
     
  18. gavenkoa

    gavenkoa Warlord

    Joined:
    Jun 11, 2019
    Messages:
    225
    Gender:
    Male
    What is the use of small extra icons above command buttons on your screenshot?
     
  19. Wrathful

    Wrathful Warlord

    Joined:
    Oct 7, 2016
    Messages:
    146
    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.
     
    gavenkoa likes this.
  20. gavenkoa

    gavenkoa Warlord

    Joined:
    Jun 11, 2019
    Messages:
    225
    Gender:
    Male
    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...
     

Share This Page