Jump to content

R&D Damage Mods


Amineri

Recommended Posts

 

Here are the steps that are taken for critical damage:

1) Add 1 to base damage

2) Multiple result by 1.5 (drop any fractions)

3) Randomize by Rand(3) -1

 

For an LPR, with 5 base damage, this results in:

1) 5+1 = 6

2) 6 * 1.5 = 9

3) 9 + Rand(3) -1 = [8, 9, 10]

 

So why does it come out as [7, 9, 9]? (or [4, 6, 6] for Assault Rifles)

 

Amineri, I've been trying to write a page about Damage but the info regarding Critical Damage here is contradictory. By, your own formula, regarding Assault Rifles, the possible CD is:

1) 3 + 1 = 4

2) 4 * 1.5 = 6

3) 6 + Rand(3) - 1 = [5,6,7]

 

However, you mention right at the end of the code that the Assault Rifle's CD only has a 4 or 6 value.

 

This issue also appears ingame on EW. The info box for the Assault Rifle shows a possible 5-7 values for CD, but actual results show the Critical Damage to be 4-6.

 

It looks rather that CD is calculated the following way during tactical game:

1) Multiply Base Damage by 1.5 (drop any fractions)

2) Randomize by Rand(3)

Edited by Hobbes77
Link to comment
Share on other sites

The problem arises because of some sort of issue in a native code function : XGAbility_Targeted.CalcDamageModFromPerk:

native simulated function int CalcOverallDamageModFromPerk(float BaseDamage);

I can't peek into what exactly this function is doing (since its native code), but removing it removes the issues with the critical damage on Assault Rifles and LPRs (or any base 3 or base 5 damage weapon).

 

My own damage mod I entirely replace this function, so by inference (having to replace such things) I can tell that is modifies for most of the perk-related damage effects, including pistol Foundry damage, gunslinger, bring em on, and even Will To Survive.

 

If I remove the call to CalcOverallDamageModFromPerk (but keep the other vanilla code), then Assault Rifles do indeed generate damage results of 5, 6, 7 (I've observed all 3 possibilities).

 

It's important to note that CalcOverallDamageModFromPerk is called after the damage randomization occurs, and is passed the randomized damage (converted to float). That means the function receives the 5, 6, or 7 damage and somehow maps them to 4, 6, 6 (hence the 1/3 chance of 4 and 2/3 chance of 6). Similarly for a 5 base damage weapon, the output from CalcOverallDamage is (5 + 1) * 1.5 + rand(3) -1 = 8, 9, 10, which the function maps somehow to 7, 9, 9.

 

I rather thought that this bug was noticable enough that it would have been fixed in Enemy Within, but it appears to not have been.

 

---------------

 

I have rebuilt my damage mod for Enemy Within (and am testing it with our internal test version of Long War), but it includes quite a few changes that we're adding for Long War, including new perks and a fairly large overhaul to the AbsorbDamage function :

  • Mechtoid shields still grant 50% DR while active (there are enough possible counters)
  • Assault MEC Shock absorbant armor still grants 33% DR within 4 tiles
  • Absorption Fields totally reworked to provide higher % based DR for higher damage attacks, using formula 0.5 + 0.5 * FMin(2.0 / fReturnDmg, 1.0) (so 0% DR for 1 or 2 damage, up to cap of 50% DR)
  • Aliens can get general damage reduction as part of their dynamic upgrades
  • IronSkin now grants 1.0 DR instead of 25%
  • Damage Control now grants 1.5 DR instead of 2
  • Cover now grants DR -- low cover grants 0.5 and full cover grants 1.0
  • Will to Survive grants additional 1.5 DR if an any form of cover
  • Combat Stims provide 40% DR
  • Chitin Plating provides 40% DR -- this is extended to Chryssalids gaining 40% DR against KSM (and XCOM melee attacks if added)
  • Fractional DR amounts are randomized up/down instead of being truncated
  • Damage reduction can reduce damage to 0 (minimum is no longer 1), so pistols are no longer effective at all against Sectopods

I've also re-implemented the same damage randomization system, where randomization is proportional to damage dealt (roughly +/- 25% of base damage). Criticals always deal +50% damage on average.

Link to comment
Share on other sites

I decided to test all the weapons to see what values I got. Laser Rifles have the same bug (only 7 and 9 criticals so far), Plasma RIfles are only giving me 10 and 12 crits (no 11s), and Laser Pistols 3 and 4 (no 5s). I've tried quite a few times these weapons, although it's possible that I've just gotten unlucky with the results distribution. Tomorrow I'll check the rest of the weapons.

Link to comment
Share on other sites

Testing finished. The only weapons I haven't tried were the Heavy LMG and its laser/plasma upgrades but it didn't seem necessary since the bug seems to apply to all weapons.

 

Base Damage - Critical Damage values

* 1 (Pistol) - 2,3

* 2 (Laser Pistol) - 3,4

* 3 (Assault Rifle, Plasma Pistol) - 4,6

* 4 (Shotgun, Sniper Rifle, LMG) - 6,7

* 5 (Laser Rifle, LPR, Minigun) - 7,9

* 6 (Scatter Laser, Heavy Laser, Laser Sniper) - 9,10

* 7 (Plasma Rifle, Railgun) - 10,12

* 9 (Alloy Cannon, Heavy Plasma, Plasma Sniper) - 13,15

* 10 (Particle Cannon) - 15,16

 

It seemed also that the distribution of the 2 results for critical damage was not 50%/50%, with 1 result being favored, although the sample should be too small. The interesting bit from the above info is the difference in the Critical Damage results between weapons with odd/even Base Damage.

Edited by Hobbes77
Link to comment
Share on other sites

That seems about right. My tests were compatible with the hypothesis of the higher result occurring 2/3 of the time and the lower result 1/3 of the time. This would be consistent with the 3 uniformly random results generated by XGTacticalGameCore.CalcOverallDamage which are passed into CalcOverallDamageModFromPerks.

 

I'm assuming the results were without the SW option Damage Roulette, which means the vanilla CalcOverallDamage formula for crits is (baseDamage + 1) * 1.5 + rand(3) - 1

 

base crit observed range

1 2-4 2, 3

2 3-5 3, 4

3 5-7 4, 6

4 6-8 6, 7

5 8-10 7, 9

6 9-11 9, 10

7 11-13 10, 12

8 12-14 NA

9 14-16 13, 15

10 15-17 15, 16

 

Under the assumption that the higher observed value is twice as likely for 3 and 5 damage weapons (based on earlier observations), and that this is because 2 of the 3 rolled value map to it, and assuming that the mapping function is monotonic nondecreasing, this would result in CalcOverallDamageModFromPerks mapping damage in the following way

 

input output

2 2

3 3

4 3

5 4

6 6

7 6

8 7

9 9

10 9

11 10

12 12

13 12

14 13

15 15

16 15

17 16

What's interesting about this sequence is that numbers that are divisible by 3 are left unchanged, but numbers that aren't divisible by 3 have 1 subtracted from their value (excepting 2).

This would result in the base damage to output damage (after CalcOverallDamageModFromPerks) of:

base crit equally likely outcomes

1 2-4 2, 3, 3 (mean 2.67)

2 3-5 3, 3, 4 (mean 3.33)

3 5-7 4, 6, 6 (mean 5.33)

4 6-8 6, 6, 7 (mean 6.33)

5 8-10 7, 9, 9 (mean 8.33)

6 9-11 9, 9, 10 (mean 9.33)

7 11-13 10, 12, 12 (mean 11.33)

8 12-14 12, 12, 13 (mean 12.33)

9 14-16 13, 15, 15 (mean 14.33)

10 15-17 15, 15, 16 (mean 15.33)

 

Under these hypotheses, even damage weapons would 2/3 get the low damage result, while odd damage weapons would 2/3 get the high damage result.

Link to comment
Share on other sites

Yes, all testing was made without Damage Roulette being activated (I used Tactical mode of the Developer Shell on the PierA map with Mutons).

 

As you mention on the last numbers, it wasn't always the higher number that was selected 66% of the times, I remember the more chosen numbers for a few weapons:

* Plasma Rifle 12

* Heavy Plasma 15

* Particle Cannon 15

 

What it looks to me is that CalcOverallDamageModFromPerks ends up performing a round down/up operation for the 3 possible values that ends up changing them into only 2 possible results.

Link to comment
Share on other sites

  • 1 month later...

Just discovered something interesting.

 

I've just ran a few tests with conventional and laser Sniper rifles to check the actual critical damage points added by Headshot. I used 6 Snipers, 5 were Squaddies/Corporals with Titan/Ghost armor and I only got 2 possible results from them (due to the bug, instead of 3 possible results).

 

But my 6th Sniper was a Colonel with Archangel armor (she was airborne), plus Gene Mods and a few unusual perks like HEAT Ammo (but I was firing at Thin Men) due to Training Roulette being used. With her I found that the bug that causes critical damage to only have 2 values was gone, so I got 3 damage values (8, 9 and 10 for conventional, 11, 12 and 13 for laser).

 

Also, the additional critical damage added by Headshot seems to be +2/2/3 rather than the +1/2/3 listed on the 1st post.

Edited by Hobbes77
Link to comment
Share on other sites

  • 11 months later...

Hello there.

 

I have a question. Is it possible to change the random value modifying the base damage ?
For example:
Laser Rifle - base damage 5 - random damage 4-6
Heavy Laser Rifle - base damage 6 - random damage 4-8
MEC Pulse Lance - base damage 10 - random damage 7-13

... to a maximum variation of +/- 1 up to base damage 14. Starting with base damage 15 I would like it to be +/- 2.

I am aware the modification that must be made is in XComGame.upk, XGTacticalGameCore, CalcOverallDamage (I hope I'm not completely wrong about this), but I just can't seem to figure out what to modify.
If you could help me I would be most grateful.

Kind regards,
Stefan

Link to comment
Share on other sites

Never mind, I figured EVERYTHING by myself. I gave it an almost perfect 10% deviation, it still bugs on dmg numbers ending with 5 (5, 15, 25, etc.) due to the fact it has a very small chance (dmg x 2 / 1000 %) of inflicting +1 max dmg but I can more than live with it.

Edited by shadowdancerrfw
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...