Author Topic: How is the damage calculated?  (Read 179 times)

Alibaba

  • Newbie
  • *
  • Posts: 12
    • View Profile
How is the damage calculated?
« on: March 02, 2020, 06:37:06 am »
CNEI mod shows me the following characteristics for ammos:
- damage,
- armor piercing,
- final damage multiplier,
- Kinetic, Impact, Chemical, Heat etc.

In addition, the armor has its own characteristics Kinetic, Impact, Chemical, Heat etc.

How is the damage calculated?

ai_enabled

  • AtomicTorch Founder
  • Hero Member
  • *****
  • Posts: 1493
    • View Profile
Re: How is the damage calculated?
« Reply #1 on: March 02, 2020, 08:31:58 am »
It's fairly complicated. Due to this, it's not yet possible to include stats such as DPS into the weapon tooltips but eventually, we're planning to figure this out and display more info in the tooltips.


Damage calculation algorithm
1. Prepare weapon damage for the current ammo type:
    • take damage from the ammo and multiple it on the damage multiplier from the weapon itself (for example, rifle .300 cal has x1.25 damage multiplier).
    • multiply the damage on the "damage bonus" stat for the attacking character (for example, level 20 of "Conventional weapons" skill provides +10% damage bonus)

2. For each damage type (Kinetic, Impact, Chemical, etc) calculate its damage component:
    • get target's defense against that damage type and clamp it between 0 and 1 (0 is 0% defense, 1 is 100% defense, so 0.5 is 50% defense)
    • calculate the damage component by formula:
Code: [Select]
damageComponent = (damage - (10 * defense * (1 - AP)) * (1 - 0.75 * defense * (1 - AP))        (where damage is the actual damage specified by the )
    • multiply damage value on the damage proportion for this damage type
       
3. Sum each damage component to get the total damage.

4. Multiple total damage on the final damage multiplier for the used ammo type (as specified in the ammo type)

5. Multiple total damage on the final coefficient depending on the target—currently for balancing purposes it's x0.5 for PvP damage but x1.0 for PvE damage.


Example of damage calculation
Let's use a Heavy machine gun with .300 cal AP (armor-piercing) ammo against a player in Pragmium armor:

1. .300 AP ammo has damage value 30 and only a single damage component—Kinetic. So it's dealing 30 Kinetic damage.
     However, the Heavy machine gun has x0.8 damage multipier (as a balancing measure, it's a high-rate of fire weapon).
     Assume the character skill level is 0 so no damage bonus (1.0).
     So: 30 * 0.8 * 1.0 = 24 damage

2. Pragmium armor has 70% defense against Kinetic damage—so its "defense" stat is 0.7.
    .300 cal AP ammo has 50% armor penetration—so it's "AP" stat is 0.5.
    • Calculate damage component:
Code: [Select]
damageComponent = (24 - (10 * 0.7 * (1 - 0.5)) * (1 - 0.75 * 0.7 * (1 - 0.5)) = (24 - 7 * 0.5) * (1 - 0.525 * 0.5) = 20.5 * 0.7375 = 15.11875    • there is only a single damage component so 1*15.11875=15.11875

3. Sum each damage component to get the total damage.
    • There is only a single component so the total damage is 15.11875

4. Final damage multiplier of .300 cal AP ammo is 1.0 so the total damage is again 15.11875

5. As we're damaging a player the damage needs to be multiplied on the PvP damage server rate (configurable in server rages config but the default value is 0.5): 0.5 * 15.11875 = 7.559375

So, a single hit by .300 cal ammo from a Heavy machine gun to a player in Pragmium armor will result in ~7.56 damage (so ~7.56 HP will be deducted) if the attacker player has no damage bonus for this weapon from a skill (or anything else).

Regards!
     
     

Alibaba

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: How is the damage calculated?
« Reply #2 on: March 03, 2020, 02:05:00 am »
Thanks! I have a couple more questions.

1. Where can I find out the damage multiplier for each weapons? In the game and CNEI mod don't show this parameter.
2. Final damage multiplier for a 12-Gauge Pellets Charge is 5 and five shots are graphically displayed. Is it enough that one of them hits the target, so that the multiplier 5 is used?

ai_enabled

  • AtomicTorch Founder
  • Hero Member
  • *****
  • Posts: 1493
    • View Profile
Re: How is the damage calculated?
« Reply #3 on: March 03, 2020, 05:20:26 am »
Quote
1. Where can I find out the damage multiplier for each weapons? In the game and CNEI mod don't show this parameter.
I've contacted the CNEI mod developer regarding this a few days ago so he may release an update to include this info right in the mod. It's available right in the game source code—for example, here is the range multiplier for .300 cal rifle https://github.com/AtomicTorchStudio/CryoFall/blob/master/Core.cpk/Scripts/Items/Weapons/Ranged/ItemRifle300.cs#L30 in the same file at line 20 you can find the damage multiplier. In the same folder, you can find other ranged weapon classes.

Quote
2. Final damage multiplier for a 12-Gauge Pellets Charge is 5 and five shots are graphically displayed. Is it enough that one of them hits the target, so that the multiplier 5 is used?
The configured damage is simply split according to the number of projectiles. E.g. if there are 5 pellets there are 5 rays dealing the damage and each of them has 1/5 final multiplier (after all the damage calculation is done). This way we can easily set any number of projectiles per shot and the resulting damage (if all of them hit the target) would always stay the same as configured.

Regards!