[Vanilla] Hans Lemurson figures out the Combat Formula

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.
 
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

upload_2017-7-6_15-3-10.png
 
Last edited:
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
 
How I should count the damage of attacker and defender

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.
 
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:
The best I can come up with is +10 Strength = 150% damage and resistance.

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:
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:

Damage = COMBAT_BASE_DAMAGE * e^(StrengthDifference * COMBAT_POWER_SCALING) * Random(1 - COMBAT_DAMAGE_MULTIPLIER_MINIMUM, 1 + COMBAT_DAMAGE_MULTIPLIER_MINIMUM)

In the current version of the game we have the following values:
COMBAT_BASE_DAMAGE = 24
COMBAT_POWER_SCALING = 0.04
COMBAT_DAMAGE_MULTIPLIER_MINIMUM = 0.25

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:
Code:
<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)
COMBAT_DEFENSE_DAMAGE_PERCENT_
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:
So, I've been searching a while to see if anybody had figured out the Civ6 combat formula and, finding nothing, I took it upon myself to have fun with spreadsheets so you don't have to.
...
Say hello to my little friend here: Documents/My Games/Sid Meier's Civilization VI/Logs/CombatLog.csv

And with that, I was off to the races.
A little bit of spreadsheet manipulation and...
...
Yep, looks exponential to me.
...
I have added the CombatLog.csv file that I used as my source of data.

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.
 
Nice result, but how dit you get it from the data provided?
...
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 =
...
Clearly I completely mis some understanding of the data given.
Can somebody explain it to me?

Kind regards.

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:
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.
 
So, I've been searching a while to see if anybody had figured out the Civ6 combat formula and, finding nothing, I took it upon myself to have fun with spreadsheets so you don't have to.

I have long suspected that the damage formula was Exponential in nature, given that the relative Power of units is based on their difference in strength rather than the ratio. But to actually test this I needed to gather a LOT of combat data from various unit-strength pairings in order get a large enough data set to yield believable answers. I would need to record the data from each and every combat in my game, minimizing after every battle so I could enter the data in a spreadsheet before I forgot what the message said. And do that 100 times. BOOORING!!!!.

Say hello to my little friend here: Documents/My Games/Sid Meier's Civilization VI/Logs/CombatLog.csv

And with that, I was off to the races.
A little bit of spreadsheet manipulation and...

Yep, looks exponential to me.

Also noteworthy is the fairly large variance, but also that it appears to be directly proportional to the amount of damage dealt, flaring out like a trumpet as the damage increases. This suggests that there is a simple random multiplier to the final damage. Judging by eyeball, the upper limit seems to be 125% and the lower limit 75%.

I tried to use clean and easy to understand numbers, and I arrived at this approximate formula for what each unit does to each other in combat:

Damage = 30 * e^(StrengthDifference / 25) * Random(0.75, 1.25)

The base damage is 30, doubles every ~17 strength, and then gets a +/-(0-25)% damage bonus/penalty.
The random factor is applied to each unit independently.

I might be wrong about the magnitude of the Random Factor, and may not have gotten the exponent exactly right (and I wish I could have converted it into more intuitive numbers), but this is probably close enough to get a picture of what's going on.

For the purposes of "rules of thumb" I will make a chart for the expected damage at various intervals.
Code:
 +0  30  30   1.00x
 +1  31  29   1.04x
 +3  34  27   1.13x
 +5  36  25   1.22x
+10  45  20   1.49x
+17  59  15   1.97x
+30  99  10   3.32x
From these bonuses, we can see what we already knew: Combat strength differences are only relevant from 0-30, after that it's all 1-hit kills.
+10 is a good solid bonus where you deal 150% damage and take only 67%.

An easier to use formula might be: 30 * 1.041^StrengthDifference
(since only nerds like me know that e = 2.71828)

I have added the CombatLog.csv file that I used as my source of data.
Thank you so much for sharing this information.
 
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:
Top Bottom