Author Topic: No damage dealt and silly armour penetration  (Read 11834 times)

Offline czarek7711

  • Squaddie
  • *
  • Posts: 5
    • View Profile
No damage dealt and silly armour penetration
« on: December 02, 2014, 06:23:38 pm »
Hello,
My problem is that when my soldier is shot with for example laser rifle, than depending on what armor he wears (?), he will die OR lose some health and a little bit of armor OR receive no damage at all.
I remember that in original version, you were losing your armor first, and than your health. But here armor is completly useless if it doesn't have 100% protection against e.g. laser tech or plasma if such statistic even exists, because you are losing hp no matter what.
I consider it a bug since there are situations when my soldier receives no damage from 2 shots, but third one kills him.
Also the same happens for either TFTD or Ufo Defense damage formulas.
Am I missing some crucial information about how armor works in OpenXcom or is it some strange bug?
I use latest nightly and for the tests no mods.
Thanks

Offline Arthanor

  • Commander
  • *****
  • Posts: 2488
  • XCom Armoury Quartermaster
    • View Profile
Re: No damage dealt and silly armour penetration
« Reply #1 on: December 02, 2014, 06:43:26 pm »
Armor in XCom doesn't work the way you describe.

The way damage works is:
1- Take the average damage of the weapon
2- multiply by 0 to 200% (or 50% to 150% with the TftD formula)
3- Apply the damage modifier of the armor
4- Substract armor
5- If anything is left, remove HP.
6- If HP was removed, also remove 10% of damage, rounded up, from the armor value.

Say you have a plasma pistol shooting at an operative in personal armor in the chest.
1- Plasma pistol deals 52 damage
2- you roll for the damage modifier, say you get 110%. The damage becomes 57 (1.1*52, rounded)
3- The Personal Armor's damage modifier is 100%, so 100%*57 = 57;
4- Personal armor has 50 armor in the front: 57-50 = 7
5- The operative takes 7 damage to its HP.
6- Since damage was applied, armor is reduced by: 10%*7 = 0.7, rounded up is 1. So the front facing of the soldier's personal armor now only protects for 49.

Don't worry, things do work as expected.

If the first few shots do no damage it means that their modified damage (from step 3) was less than the armor on that facing, so at step 4 the armor absorbed everything, taking no damage (and of course no hp damage).

Then for the last shot, the damage roll (step 2) was high, so the penetrating damage (step 4) was more than the operative's HP, so he died (step 5).

In the early game, with soldiers with low health and personal armor being fired upon by plasma pistols, it is rather common to either escape without harm (poor damage roll at step 2, meaning no penetrating damage) or die. There is only a narrow range of values that do damage but not enough of it to kill the operative.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9106
    • View Profile
Re: No damage dealt and silly armour penetration
« Reply #2 on: December 02, 2014, 06:45:12 pm »
@czarek: I don't remember this from the original... actually I am pretty sure it wasn't there (at least in the Steam version). As far as I can say, OpenXcom works exactly like the original in this aspect.
« Last Edit: December 02, 2014, 06:47:38 pm by Meridian »

Offline yrizoud

  • Commander
  • *****
  • Posts: 1014
    • View Profile
Re: No damage dealt and silly armour penetration
« Reply #3 on: December 02, 2014, 06:45:54 pm »
czarek7711, maybe you're mistaking with UFO2000 which used the behavior your describe.

Offline czarek7711

  • Squaddie
  • *
  • Posts: 5
    • View Profile
Re: No damage dealt and silly armour penetration
« Reply #4 on: December 02, 2014, 07:10:35 pm »
@Arthanor
Thank you very much for this deep explanation ;]
However, how to explain situation, when I lose only armor? Because I'm pretty sure this is what happend to me most of the time in the original version.
I only played UFO Defense, and I remember turning HWP's in place to different sides so it would tank as many damage as it can (as damage to armor).

Offline Arthanor

  • Commander
  • *****
  • Posts: 2488
  • XCom Armoury Quartermaster
    • View Profile
Re: No damage dealt and silly armour penetration
« Reply #5 on: December 02, 2014, 08:49:50 pm »
Damage to armor is 10% of penetrating damage (ie HP damage). In most cases it is a rather negligible concept (the main exception being mutons who have much higher health than armor).

As far as I know, there is no way to lose armor without losing hp and the best ratio you can get is when losing 1 hp and also 1 armor (10% of 1, rounded up).

Maybe what you did was turn your strongest armor towards the enemy? Or your HWP got armor damage on a facing enough that another facing got better? That's especially possible with the hover tank since it has 130 armor on all sides so as soon as one side gets damaged, you are better off turning the hover tank to expose a different side.

Offline czarek7711

  • Squaddie
  • *
  • Posts: 5
    • View Profile
Re: No damage dealt and silly armour penetration
« Reply #6 on: December 02, 2014, 11:04:25 pm »
Maybe what you did was turn your strongest armor towards the enemy? Or your HWP got armor damage on a facing enough that another facing got better? That's especially possible with the hover tank since it has 130 armor on all sides so as soon as one side gets damaged, you are better off turning the hover tank to expose a different side.
Yes, that's exactly what I did and what I meant to say. So maybe I was losing hp at 1 to 1 ratio but I haven't noticed it, I don't know. Anyway thanks once more for explanation, I wouldn't have figured that out myself.
« Last Edit: December 02, 2014, 11:06:01 pm by czarek7711 »

Offline MrFrustrated

  • Colonel
  • ****
  • Posts: 104
    • View Profile
Re: No damage dealt and silly armour penetration
« Reply #7 on: December 03, 2014, 03:18:06 am »
Armor in XCom doesn't work the way you describe.

The way damage works is:
1- Take the average damage of the weapon
2- multiply by 0 to 200% (or 50% to 150% with the TftD formula)
3- Apply the damage modifier of the armor
4- Substract armor
5- If anything is left, remove HP.
6- If HP was removed, also remove 10% of damage, rounded up, from the armor value.

Say you have a plasma pistol shooting at an operative in personal armor in the chest.
1- Plasma pistol deals 52 damage
2- you roll for the damage modifier, say you get 110%. The damage becomes 57 (1.1*52, rounded)
3- The Personal Armor's damage modifier is 100%, so 100%*57 = 57;
4- Personal armor has 50 armor in the front: 57-50 = 7
5- The operative takes 7 damage to its HP.
6- Since damage was applied, armor is reduced by: 10%*7 = 0.7, rounded up is 1. So the front facing of the soldier's personal armor now only protects for 49.

Don't worry, things do work as expected.

Arthanor, does that hold true for the enemy mutons sectopods etc?

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: No damage dealt and silly armour penetration
« Reply #8 on: December 03, 2014, 03:51:58 am »
Arthanor's explanation holds true for every damage calculation in xcom since 1994. anything else is just confirmation bias or whatever you kids are calling it these days.

except the damage roll:

2- multiply by 0 to 200% (or 50% to 150% with the TftD formula)

2- you roll for the damage modifier, say you get 110%. The damage becomes 57 (1.1*52, rounded)

that's incorrect.
the percentages dictate the upper and lower bounds for the RNG.
it's a random number generated between Dmg - x and Dmg + x, where x is either 50% or 100% of Dmg, depending on damage model,
not Dmg * x where x is a random number between 0.5 and 1.5 or 0.0 and 2.0.

it should read:

2- a random value is generated from 0 to 104 (from 0% to 200% of the weapon's power) let's assume we rolled a 57.

« Last Edit: December 03, 2014, 12:40:29 pm by Warboy1982 »

Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
Re: No damage dealt and silly armour penetration
« Reply #9 on: December 03, 2014, 11:35:30 am »
except the damage roll:

that's incorrect.
the percentages dictate the upper and lower bounds for the RNG.
it's a random number generated between Dmg - x and Dmg + x, where x is either 50% or 100%, depending on damage model,
not Dmg * x where x is a random number between 0.5 and 1.5 or 0.0 and 2.0.
But thats just implementation specifica the result is the same with both approaches (as far as i understood it) :)

Offline yrizoud

  • Commander
  • *****
  • Posts: 1014
    • View Profile
Re: No damage dealt and silly armour penetration
« Reply #10 on: December 03, 2014, 12:08:41 pm »
Current formula guarantees an equal distribution over all integers of the [min - max] range.

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: No damage dealt and silly armour penetration
« Reply #11 on: December 03, 2014, 12:42:50 pm »
Current formula guarantees an equal distribution over all integers of the [min - max] range.

yeah, that's what i'm trying to illustrate.

Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
Re: No damage dealt and silly armour penetration
« Reply #12 on: December 03, 2014, 12:57:25 pm »
so there is a (significant) difference between

out=round(random(dmg*0.5,dmg*1.5))
and
out=round(dmg*random(0.5,1.5))

interesting

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: No damage dealt and silly armour penetration
« Reply #13 on: December 03, 2014, 01:04:12 pm »
yes, assuming you only go out to 1 or 2 decimal places...

200 * 0.9 = 180
200 * 1.00 = 200
200 * 1.01 = 202

with 1 decimal place, there's no chance of the weapon doing 190 damage, with 2 decimals, there's no chance of it doing 201 damage.
whereas RNG::generate(power * 0, power * 2) has an equal chance to return any integer ranging from 0 to 400, inclusive.

not to mention the whole floating point precision thing where 1.5 isn't actually 1.5, it's like 1.4999999999997.
« Last Edit: December 03, 2014, 01:09:49 pm by Warboy1982 »

Offline yrizoud

  • Commander
  • *****
  • Posts: 1014
    • View Profile
Re: No damage dealt and silly armour penetration
« Reply #14 on: December 03, 2014, 01:13:00 pm »
The most significant change is if the rounding rules makes it 2x less likely to obtain the maximum and minimum values.
It would be like the following D6 roll:
1: 10%
2: 20%
3: 20%
3: 20%
3: 20%
6: 10%