|
Post by jonblend on Oct 1, 2023 18:08:51 GMT
Welcome to the WC4 damage formula. I'll start with it right away after pointing out the difference between damage (dmg) which is the white or red digits we see briefly appear during gameplay and attack stat (atk) from the info and recruitment windows. More on the atk stat later.
dmg= ({unit_atk(random[min; max]) * stacks * health * morale * crit_m + tech + xp + stars + medal} * f(def) * inc_m * red_m + flat) * terrain
explanation
unit_atk(random[min; max]) This is a unit's base attack value without the effects of any upgrades or other enhancements. During damage calculation, a random number between the unit's minimum and maximum is picked. Here's the unit_atk list for non-Elite Force: (provided by Erich von Manstein ) Light inf: 16-22 Assault inf: 18-24 Motorized inf: 18-28 Mechanized inf: 20-30 Japanese commando: 36-42 Italian, Greek, Romanian commando: 36-42 Chinese commando: 34-38 Egyptian, Iraqi, Iranian commando: 34-40 Polish, Australian, Hungarian commando: 35-41 Finnish, Yugoslavian commando: 38-44 Armored car: 20-34 Light tank: 24-40 Medium tank: 28-44 Heavy tank: 32-50 German super tank: 54-70 American super tank: 60-74 Soviet super tank: 56-72 Field arty: 30-42 Howitzer: 32-46 Rocket arty: 34-50 German super arty: 55-75 French super arty: 60-70 Soviet super rocket: 50-85 British super rocket: 55-80 Submarine: 28-48 Destroyer: 32-52 Cruiser: 40-60 Carrier: 32-52 Italian super submarine: 48-60 British super battleship: 56-80 Japanese super battleship: 52-72 American super carrier: 32-52 Fighter: 24-32 Bomber: 26-40 Strategic bomber: 32-50 French stealth fighter: 30-50 Soviet stealth bomber: 40-60 American stealth strategic bomber: 45-65 SRB: 50-70 MRB: 60-85 LRB: 70-100 ICB: 80-120 Bunker: 24-38 Land fort, coastal gun: 32-46 Rocket launcher: 36-52 stacks has to be considered when we stack units. unit_atk is multiplied by: single 1 double 1.25 triple 1.5 quadruple 1.75 health is only relevant when a unit has lost a certain amount of hit points. Once HP is below 50% of it's (current) maximum, unit_atk is halved (0.5 when below 50%). morale depending on the morale status, unit_atk is multiplied by: normal 1 high 1.25 low 0.75 very low 0.5 crit_m It's the critical hit multiplier, which is only applied if we trigger a critical hit. The basic multiplier is 1.5 and it is increased by +0.1 for every level in case a red ribbon is equipped:
no red ribbon 1.5 lv1 red ribbon 1.6 lv2 red ribbon 1.7 lv3 red ribbon 1.8 lv4 red ribbon 1.9 lv5 red ribbon 2.0
[leader skills, medals that boost the leader skills, red ribbons and some biography bonuses all increase the chances for critical hits to occur] tech Your current tech bonus is added for corresponding units. At max tech, we can have: inf 9 tank 15 arty 18 ship 16 air 16 missile 40 xp This refers to the leveling up during missions and represented by chevrons and stars. The cumulative effect is: ^ +4 ^^ +8 ^^^ +12 * +16 ** +20 stars When a general is deployed, his unit becomes stronger. The more stars a general has, the higher the atk boost: none 0 ★ 4 ★★ 8 ★★★ 13 ★★★★ 18 ★★★★★ 24 ★★★★★★ 30 medals Atk boost from the medals that were introduced with the frontier update. At their maximum (lv8 and 9), they provide: great soldier: +18 for inf royal navy: +24 for navy imperial eagle: +25 for air artillery legend: +30 for artillery
f(def) this is the effect that the defending unit's defense stat has on damage taken. Thanks to Erich von Manstein , we know that it's 62.5/(62.5+def). To illustrate, here are a few defense-based dmg multipliers: def=10 (mech inf) --> 0.862 def=24 (heavy tank) --> 0.722 def=35 (fortress) --> 0.641 inc_m multiplication of all effects that increase damage by a percentage. This could be generals skills like explosive, inspiration, armored assault and unit abilities like machine gun, naval artillery, torpedo, commando's terrain skills and so on. red_m multiplication of all effects that reduce damage, such as unit effects, generals' skills, blue ribbons, etc. flat fixed bonus damage such as plain/jungle/mountain/desert/street fighting, crowd tactics, tide of iron, ... terrain This last category is applied to all damage no matter what. Examples are the terrain effect we see in the top left corner (desert, mountain, forest) and city walls (the city receives 0.7 and the unit positioned in the city 0.5 as multiplier for incoming damage).
So, what about the number we see in the info/recruitment window?
It's for you, the player and serves as an estimation of the damage you can deal based on the unit's current status. To calculate it, only the part within the { } brackets of the damage formula is used.
Furthermore, to eliminate random effects, a mean unit_atk is calcuated by (min+max)/2 and crit_m is set to 1. Continue reading for some clarifying examples.
|
|
|
Post by jonblend on Oct 4, 2023 22:06:16 GMT
Reality check
Now that we have the formula, we have to see how good it compares to reality For this purpose, I used Yamamoto (6 stars, air leader5 with lv4 red ribbon, imperial eagle +25) in Marshall's Bio5 and launched srb missiles at land forts with 18 def.
I also calculated minimum and maximum damage (based on min and max unit_atk) using the formula and we can see that the test results lie within the calculated limits thus confirming the theory.
Example1
Here we can see the effect of high morale on atk. Even though the description says it's 25% extra atk, this is not reflected in the numbers. But if we take the normal morale atk of 107 and subtract +30 (general stars) and +15 (max tank tech) we arrive at 62 which is the mean unit_atk of the M26 Pershing. 62*1.25 is 77 after round down, then +15 and +30 for stars and tech and it's 122 just like in the second picture.
Now, the atk has dropped because of HP<50%. This means unit_atk is halved , the rest is the same, leading to [62*0.5*1.25]+15+30=83
Example2
A triple stacked unit with full HP and normal morale. It's atk comes from unit_atk of single stack, formation and tech_bonus: 25*1.5+9=46
Now Yamashita has been added, this would mean +30 from his six inf stars. And he's also wearing the great soldier medal (lv7) so that's +15 inf atk: 25*1.5+9+30+15=91
A few turn have passed, and he has low morale, less than 50% HP but also more experience (^^ two chevrons) which we have to consider: 25*0.5*1.5*0.75+9+2*4+30+15=76
Thanks to experience and/or logistics ribbon again above 50% HP and no longer flanked: 25*1*1.5*1+9+3*4+30+15=103
And again below 50% HP but this time normal morale: 25*0.5*1.5*1+9+3*4+30+15=84
Example3
This damaged cruiser has an atk of 55 and attacks an enemy with 28 def. How is it possible that it deals 54 damage??
Well, the answer lies in wolf pack from Donitz, providing 20 extra dmg to nearby units. It's a flat_bonus, so we can't see it in the info window which only shows atk
Example4
Finding the unit_atk of M26 Pershing
First, we need to attack the same target several times (just the tank, no general) in order to generate data. I did it with lv3 pershing in rommel bio1 against 18 def land fort. This is what I recorded and the numbers in brackets are how often each value appeared.
62 (2) 63 (3) 64 (2) 65 (12) 66 (4) 67 (3)
68 (4)
69 (6)
70 (6)
Morale was normal, health > 50%, no crits -> all we have to worry about is tech. For this, we use a general and get the unit to high morale as can be seen in Exampe1. Note that there, the pershing was lv1 and had 62 as mean unit_atk.
Now, we have 133=71*1.25+15+30, which means that the atk upgrades for elite forces are not tech upgrades. Instead, they directly affect unit_atk and thus also the critical hit mechanics.
But back to our original problem: We need to solve 62= ({unit_atk[min]) * 1 * 1 * 1 * 1 + 15 + 0 + 0 + 0} * f(def=18) * 1 * 1 + 0) * 1 and 70= ({unit_atk[max]) * 1 * 1 * 1 * 1 + 15 + 0 + 0 + 0} * f(def=18) * 1 * 1 + 0) * 1
which (after doing some back and forth confirmations to account for rounddown) leads to unit_atk(pershing lv3) = 66-76 unit_atk(pershing lv1) = 57-67 unit_atk(pershing lv3) = 66-76 unit_atk(pershing lv5) = 78-88
|
|
|
Post by Erich von Manstein on Oct 8, 2023 0:00:30 GMT
Defense formula in WC4 is dmg = 62.5 / (62.5 + def)
|
|
|
Post by jonblend on Oct 8, 2023 17:39:56 GMT
Defense formula in WC4 is dmg = 62.5 / (62.5 + def) Thank you,
do you happen to know if the random range (attack float coefficient in other formulas) is global or unit specific in WC4?
|
|
|
Post by Erich von Manstein on Oct 15, 2023 20:57:17 GMT
unit_atk for non-Elite Force: Light inf: 16-22 Assault inf: 18-24 Motorized inf: 18-28 Mechanized inf: 20-30 Japanese commando: 36-42 Italian, Greek, Romanian commando: 36-42 Chinese commando: 34-38 Egyptian, Iraqi, Iranian commando: 34-40 Polish, Australian, Hungarian commando: 35-41 Finnish, Yugoslavian commando: 38-44 Armored car: 20-34 Light tank: 24-40 Medium tank: 28-44 Heavy tank: 32-50 German super tank: 54-70 American super tank: 60-74 Soviet super tank: 56-72 Field arty: 30-42 Howitzer: 32-46 Rocket arty: 34-50 German super arty: 55-75 French super arty: 60-70 Soviet super rocket: 50-85 British super rocket: 55-80 Submarine: 28-48 Destroyer: 32-52 Cruiser: 40-60 Carrier: 32-52 Italian super submarine: 48-60 British super battleship: 56-80 Japanese super battleship: 52-72 American super carrier: 32-52 Fighter: 24-32 Bomber: 26-40 Strategic bomber: 32-50 French stealth fighter: 30-50 Soviet stealth bomber: 40-60 American stealth strategic bomber: 45-65 SRB: 50-70 MRB: 60-85 LRB: 70-100 ICB: 80-120 Bunker: 24-38 Land fort, coastal gun: 32-46 Rocket launcher: 36-52
Also, I think terrain applies to flat_bonus as well. So it should be dmg = ( atk * f(random) * f(def) * crit_m * bonus_m * reduction_m + flat_bonus ) * terrain_reduction
|
|
|
Post by jonblend on Oct 16, 2023 20:41:51 GMT
unit_atk for non-Elite Force: Submarine: 30-42 Also, I think terrain applies to flat_bonus as well. So it should be dmg = ( atk * f(random) * f(def) * crit_m * bonus_m * reduction_m + flat_bonus ) * terrain_reduction Thanks, looks like a lot of time and effort went into this And it helps tremendously in understanding the game's mechanics and I now see some flaws in my model which can be better explained with the min_atk and max_atk. And you're right about the terrain_reduction (city wall effect probably also falls into this category, but haven't tested yet), I'll edit the opening post accordingly with this new information .
One thing I found weird: The value that is displayed in the recruitment window which I called unit_atk is always (min_atk+max_atk)/2. This was consistent for all units except for submarine. It says 54 atk with max navy tech (+16), so it should be 38 without, but (30+42)/2=36
|
|
|
Post by Erich von Manstein on Oct 16, 2023 23:25:30 GMT
unit_atk for non-Elite Force: Submarine: 30-42 Also, I think terrain applies to flat_bonus as well. So it should be dmg = ( atk * f(random) * f(def) * crit_m * bonus_m * reduction_m + flat_bonus ) * terrain_reduction Thanks, looks like a lot of time and effort went into this And it helps tremendously in understanding the game's mechanics and I now see some flaws in my model which can be better explained with the min_atk and max_atk. And you're right about the terrain_reduction (city wall effect probably also falls into this category, but haven't tested yet), I'll edit the opening post accordingly with this new information .
One thing I found weird: The value that is displayed in the recruitment window which I called unit_atk is always (min_atk+max_atk)/2. This was consistent for all units except for submarine. It says 54 atk with max navy tech (+16), so it should be 38 without, but (30+42)/2=36
The formula was out in 2017 and I somehow forgot to transfer it here. My bad. Yeah I messed up the submarine one. It should be 28-48. City effect falls into that category as well yes. It's 0.7 to the city and 0.5 to the unit inside. Moving into water will also reduce unit_atk by half.
|
|
|
Post by resiphius on Oct 18, 2023 10:10:16 GMT
unit_atk for non-Elite Force: Submarine: 30-42 Also, I think terrain applies to flat_bonus as well. So it should be dmg = ( atk * f(random) * f(def) * crit_m * bonus_m * reduction_m + flat_bonus ) * terrain_reduction Thanks, looks like a lot of time and effort went into this And it helps tremendously in understanding the game's mechanics and I now see some flaws in my model which can be better explained with the min_atk and max_atk. And you're right about the terrain_reduction (city wall effect probably also falls into this category, but haven't tested yet), I'll edit the opening post accordingly with this new information .
One thing I found weird: The value that is displayed in the recruitment window which I called unit_atk is always (min_atk+max_atk)/2. This was consistent for all units except for submarine. It says 54 atk with max navy tech (+16), so it should be 38 without, but (30+42)/2=36
Just saying, Artillery Legend medal atk is 30
|
|
|
Post by jonblend on Oct 19, 2023 12:46:37 GMT
Just saying, Artillery Legend medal atk is 30 Thanks, it's added
|
|
|
Post by Erich von Manstein on Oct 26, 2023 8:48:48 GMT
Formula correction: ( atk(random[min_unit_atk; max_unit_atk] * crit_m * f(HP) * formation * morale + tech_bonus + xp_bonus + gen_stars + medal_atk) * f(def) * bonus_m * reduction_m + flat_bonus ) * terrain_reduction
Crit only applies to unit_atk.
|
|
|
Post by jonblend on Oct 26, 2023 18:58:48 GMT
Formula correction: ( atk(random[min_unit_atk; max_unit_atk] * crit_m * f(HP) * formation * morale + tech_bonus + xp_bonus + gen_stars + medal_atk) * f(def) * bonus_m * reduction_m + flat_bonus ) * terrain_reduction Crit only applies to unit_atk. It makes sense and I believe you're right as usual
but then the formula (or my understanding of it) wouldn't match with the first column of one of the tests I did recently with Guderian (no explosive) on American super tank (all details in post)
([64;74]*(1.25+0.40)*1*1*1.25+15+8+30+0) * f(def=18) * 1.48 *1*1+0)*1 = [203;236]
Or is it the critical hit multiplier?
|
|
|
Post by Erich von Manstein on Oct 26, 2023 21:13:06 GMT
Formula correction: ( atk(random[min_unit_atk; max_unit_atk] * crit_m * f(HP) * formation * morale + tech_bonus + xp_bonus + gen_stars + medal_atk) * f(def) * bonus_m * reduction_m + flat_bonus ) * terrain_reduction Crit only applies to unit_atk. It makes sense and I believe you're right as usual
but then the formula (or my understanding of it) wouldn't match with the first column of one of the tests I did recently with Guderian (no explosive) on American super tank (all details in post)
([64;74]*(1.25+0.40)*1*1*1.25+15+8+30+0) * f(def=18) * 1.48 *1*1+0)*1 = [203;236]
Or is it the critical hit multiplier?
The base crit multiplier is 1.5 for all but air force, which I forgot but should be around 1.25-1.3.
|
|
|
Post by jonblend on Oct 27, 2023 13:10:33 GMT
It makes sense and I believe you're right as usual
but then the formula (or my understanding of it) wouldn't match with the first column of one of the tests I did recently with Guderian (no explosive) on American super tank (all details in post)
([64;74]*(1.25+0.40)*1*1*1.25+15+8+30+0) * f(def=18) * 1.48 *1*1+0)*1 = [203;236]
Or is it the critical hit multiplier?
The base crit multiplier is 1.5 for all but air force, which I forgot but should be around 1.25-1.3. That's a revelation, it fits even better for my older damage tests.
The one I mentioned now becomes
([64;74]*(1.5+0.40)*1*1*1.25+15+8+30+0) * f(def=18) * 1.48 *1*1+0)*1 = [224;262]
This includes all test results except for 223 dmg which can not be explained with minimal unit_atk and rounddown alone; at least we would need more rounddown brackets in order to separate the multiplication of f(def=18) and 1.48
I tested Rokossovsky (0 stars, air force leader) against land fort (18 def) with fighter air attacks ([24-32] plus 16 from tech) and got
33; 31; 36; 37; 36; 34; 32; 37; 33; 36 as non crits and 47; 40; 41; 49; 41; 42; 49; 40; as critical hits meaning that 1.5 would also perfectly match air attacks in that basic example.
|
|
|
Post by jwissmart on Nov 21, 2023 19:13:12 GMT
|
|
|
Post by Erich von Manstein on Nov 23, 2023 6:04:24 GMT
|
|