1. Firaxis celebrates the "Asian American and Pacific Islander Heritage Month", and offers a give-away of a Civ6 anthology copy (5 in total)! For all the details, please check the thread here. .
    Dismiss Notice

[Vanilla] Hans Lemurson figures out the Combat Formula

Discussion in 'Civ6 - Strategy & Tips' started by Hans Lemurson, Nov 25, 2016.

  1. deathpickle

    deathpickle Chieftain

    May 4, 2016
    Doing the lords work hans, thanks. This is gonna help me out so much. Now I can figure out how much better each melee unit is compared to each other for a balance mod i'm considering making. Much appreciated.
  2. Victoria

    Victoria Regina Supporter

    Apr 11, 2011
    The formula is great but I struggled with some of the finer points
    Based on the intuitive forumula you guys have brilliantly come together I came up with a different look with the view of creating a damage guide discussing all scenarios.
    I thought I would post it here first just to make sure the experts are happy.

    1. To guarantee a unit kill (100 HP) you need a strength difference of 36
    2. To guarantee a garrison kill (200 HP with a seige tower) you need a strength difference of 54
    3. Same unit corps/fleet vs standard unit the corps will do a range between 35-53 HP damage while taking 16-26 damage in return - A 10 difference is roughly double/half damage of the opponent
    4. Same unit army/armada vs standard unit the army will do a range between 47-71 HP damage while taking 12-18 damage in return roughly 1/4 the damage of the opponent
    5. An army has a much higher difference in damage at 24% variation its important to keep in mind when attacking
    6. Ignoring flanking 3 units will on average (random value of 30) do 42 HP of damage to a unit while an army will do 61 HP. I am not convinced a single army is better than 3 units but a few armies would be.

    While a difference of -80gives no damage the setting COMBAT_MINIMUM_DAMAGE=1 always makes this 1

    Last edited: Dec 23, 2017
    meistereckhart and peddroelm like this.
  3. Raptorous

    Raptorous Chieftain

    Jan 20, 2013
    I'm little bit confused how to count the damage of the attacker and defender.
    At first page there is information about the rules of thumb but I can't understand it.
    What is that chart.
    If someone could explain the mechanism for example
    knight level1 100 hp vs crossbowman level 2 100 hp
    attacker str 48 defender 30 + 4 support 2 unit.
    differance is 48-34=14
    I know that I can't kill the crossbowman on 1 hit
    How I should count the damage of attacker and defender
  4. Victoria

    Victoria Regina Supporter

    Apr 11, 2011
    Knight attacks crossbow and the difference is 14
    This means the Knight is +14 and the crossbow is -14

    If you look at the table in the post above yours you can see that
    +14 gives a range of damage between 42 and 63 hit points (random decision)
    -14 gives a range of damage between 13 and 20 hit points (random decision)
    If both units did average damage the knight would get 17 HP of damage and the crossbow would get 52 HP of damage.

    The formula shows you how its worked out. The table just makes it clearer to look at and use examples with.
  5. Raptorous

    Raptorous Chieftain

    Jan 20, 2013
    That is cleared for me.
    Thank you .
  6. Hauptman

    Hauptman Chieftain

    Jan 25, 2015
    Just want to say... this thread is awesome. You guys rock.

    Sometimes the game does things that just feel wrong, and I want to know why!
    Last night... my Legion failed to one shot a scout. Now I know why.

    Spear of Fion +5
    Oligarchy +4

    Makes for a 49 strength unit. My legions were very busy so knock 2 off for a most likely sliver of damage and it's all explained. 47 vs 18 ( emperor level + wooded hill scout) and I was one single strength point shy of a 1 shot that 30 difference gives.

    This all explains why I always fealt like I did it wrong if I didnt take defender of the faith as my first religion pick. That +10 really is as important as it feels. It is after all the equivalent as a free Corps. Army it up, get a spear and you'll one shot same era units that enter your borders.

    Thanks guys!
    Last edited: Dec 23, 2017
  7. kayser79

    kayser79 Chieftain

    Dec 28, 2008
    I think this is actually the definition; i.e. that the "traditional strength" is 150%^(Str./10). The "odd number" +17 for +200% is actually not exactly 17 but 17.0951129... = 10 * (log 200% / log 150%).
    Last edited: May 20, 2018
    Barking Iguana likes this.
  8. Tiramisu

    Tiramisu Warlord

    Aug 16, 2013
    Leonberg (BW, Germany)
    Is this formula still accurate in Rise and Fall?

    I am trying to express the damage formula with the values from GlobalParameters.xml. After reading this thread I believe the formula looks like this:


    In the current version of the game we have the following values:

    Can anyone confirm this?! I am just a little bit uncertain about COMBAT_DAMAGE_MULTIPLIER_MINIMUM in this formula, because the entry COMBAT_DAMAGE_MULTIPLIER_MAXIMUM does not exist in GlobalParameters.xml.
    Furthermore there are some entries in GlobalParameters.xml that are not used in the formula above:
    <Replace Name="COMBAT_MAX_EXTRA_DAMAGE" Value="12" />
    <Replace Name="COMBAT_DEFENSE_DAMAGE_PERCENT_BOMBARD" Value="100" />
    <Replace Name="COMBAT_DEFENSE_DAMAGE_PERCENT_MELEE" Value="15" />
    <Replace Name="COMBAT_DEFENSE_DAMAGE_PERCENT_RANGED" Value="50" />
    Also I wonder which exceptions exist for the damage calculation. E.g. how do you calculate the damage for cities with walls if it is attacked by a normal melee unit?

    Edit: After reading another thread and trying it out myself I am pretty sure now that the damage of outer defenses in cities like walls is calculated as followed:

    OuterDefenseDamage = NormalDamage * COMBAT_DEFENSE_DAMAGE_PERCENT_ * (1 / 100)
    can be looked up in GlobalParameters and is dependent on the unit type.

    So if the attacker is a non-ranged unit then this value is COMBAT_DEFENSE_DAMAGE_PERCENT_MELEE = 15. E.g. if a melee unit would do 20 damage to a city, then its damage to the city walls would be 20*15/100=3.
    For ranged units we have COMBAT_DEFENSE_DAMAGE_PERCENT_RANGED = 50 and for bombard units COMBAT_DEFENSE_DAMAGE_PERCENT_BOMBARD = 100.

    The damage to the city garrison (i.e. "the green bar") is proportional to the damage of the outer defense of the city:
    CityGarrisonDamage = max( NormalDamage * (OuterDefenseDamage / OuterDefenseMaxHitpoints), 1 )

    So if the city has full outer defense health, then its garrison damage will always be 1, even if the attacking unit has much more combat strength than the city.
    Last edited: Aug 21, 2018
    Infixo, FearSunn and Karmah like this.
  9. PapaAtHome

    PapaAtHome Chieftain

    Feb 25, 2019
    Nice result, but how dit you get it from the data provided?
    I just bumped in this discussion and I try to understand how you do it.

    I'm not afraid of a little statistics nor is the notation e^x a strange one for me. As a matter of facts in daytime I regularly calculate with the square root from -1 [offtopic]

    As far as I can follow the discussion it is about a function
    f(sa, sd) -> (da, dd)
    or in words
    "a function, given the strenght of an attacker and a defender that calculates the damage to the attacker and the defender".

    The headers in the first line of CombatLog.cvs do support that idea.
    But I can't see how you get this information from it.

    Please let me explain what I do understand (using line one from the CombatLog by Hans Lemurson in the first message).

    After reshuffling the header and line one I get the following values:
    Game Turn = 135
    Attacking Civ = 3
    DefendingCiv = 63
    AttackerObjType = 1:1
    DefenderObjType = 1966092:17694989
    Attacker Type = UNIT_HORSEMAN
    Defender Type = UNIT_SCOUT
    AttackerID = 35
    DefenderID = 10
    AttackerStr = -1
    DefenderStr = -4
    AttackerStrMod = 9
    DefenderStrMod = 71
    AttackerDmg =
    DefenderDmg =

    The way I see it:

    Game turn, clear.
    Attacker/defender Civ make sense to me, first counting the major civs (from 0) then the city states, 3 is most likely a major civ, no game can have 63 major civs active (as far as I know) so it is most likely a city state.

    Attacker/defender ObjType does not make sense to me, attecker/defender Type does. (assuming that it is the same information in these two fields).

    Attacker/defender ID is nice to know but for calculating the damage it is not relevant, it is for assigning the damage but that is not what I'm looking for.

    Attacker/defender strength is relavent but why is it negative?

    Attacker/defender strength modifier, is this on top of the strength value (being only the modifier value) or is this the strength after modification (being the end result of calculating the strength).

    Attacker/defender damage... is always empty!

    A horseman belonging to (major Civ) 3 is attacking a scout belonging to (minor Civ) 63.
    What the actual strength is of each of the two is not directly clear to me.

    I expect the horseman (in healthy condition) to be much stronger thatn a scout (in healthy condition) but the data provided does not give me an idea of the actual strengths.
    And the damage each combatant gets is not given at all as far as I can see.

    Clearly I completely mis some understanding of the data given.
    Can somebody explain it to me?

    Kind regards.
  10. PapaAtHome

    PapaAtHome Chieftain

    Feb 25, 2019
    A good night sleep can do wonders. :crazyeye:

    Assume that the colon should be seen as a comma, reinterperting the data...
    Game Turn = 135
    Attacking Civ = 3
    DefendingCiv = 63
    AttackerObjType = 1:1
    DefenderObjType =
    Attacker Type = 1966092:17694989
    Defender Type =
    AttackerID = UNIT_HORSEMAN
    DefenderID = UNIT_SCOUT
    AttackerStr = 35
    DefenderStr = 10
    AttackerStrMod = -1
    DefenderStrMod = -4
    AttackerDmg = 9
    DefenderDmg = 71

    Now I have someting to look at.

    From Hans Lemursom's findings.
    Damage = 30 * e^(StrengthDifference / 25) * Random(0.75, 1.25)

    Which suggest to me:
    UnmodifiedDamage = 30 * e^(StrengthDifference / 25)
    StrengthDifference = (AttackerStr + AttackerStrMod ) - (DefenderStr + DefenderStrMod )
    RandomFactorDmg = (Dmg/UnmodifiedDamage - 1)*100 in %

    StrengthDifference = (35 - 1) - (10 - 4) = 28
    UnmodifiedDefenderDamage 30 * exp(28/25) = 30 * 3.06485 = 91.9
    UnmodifiedAttackerDamage 30 * exp(-28/25) = 30 / 3.06485 = 9.8

    RandomFactorDefenderDmg = (71/91.9 - 1)*100 = -22.7%
    RandomFactorAttackerDmg = (9/9.8 - 1)*100 = -8.2%

    Both random factors I find are within the +/-25% as quoted before.
    This interpretation looks acceptable to me.
    Is that right? :)

    Kind regards,
    Last edited: Feb 27, 2019
  11. Browd

    Browd Dilettante Administrator

    Aug 5, 2012
    Rural Vermont
    Note that the OP has not been on CFC since last summer, so it may be a while before you get a response from him.
  12. Victoria

    Victoria Regina Supporter

    Apr 11, 2011
    Yes, the columns are mis-aligned
    Not sure what you are now asking or are you just validating it looks acceptable to you?
  13. PapaAtHome

    PapaAtHome Chieftain

    Feb 25, 2019
    More or less the last bit. I'm happy with the results the way I found out now.
  14. sudhanshu arora

    sudhanshu arora Chieftain

    May 2, 2019
    Thank you so much for sharing this information.
  15. Victoria

    Victoria Regina Supporter

    Apr 11, 2011
    So a couple of things I thought I would just add to this venerable and revered thread.

    1. @Lily_Lancer identified a cap at 200 HP attacking a city. Seems limited by garrison strength 200 but will check more
    2. I think I have seem some inaccurate numbers in the past so will check some of the values for any issues. Proper validation - for example at +8 I have a value of 40 which does not match the formula.
    Last edited: Oct 7, 2019
    CoconutTank likes this.

Share This Page