Jump to content

Randomized Environmental Damage


Amineri

Recommended Posts

I've figured out where to randomize to make environmental damage non-deterministic.

 

The correct location is in XComGame.upk >> XComDestructibleActor.ApplyDamageToMe

 

Seems so obvious in retrospect.

 

This function retrieves either the projectile damage (if it's a projectile hitting the destructible actor/cover) or the explosive damage.

 

DamageAmount = Dmg.DamageAmount;
// End:0x217
if((Dmg.DamageCauser != none) && Dmg.DamageCauser.IsA('XComProjectile'))
{
Proj = XComProjectile(Dmg.DamageCauser);
DamageAmount = Proj.WorldDamage;
}

 

The default behavior (DamageAmount = Dmg.DamageAmount) is for explosives. The conditional retrieves the projectiles environmental damage from a different stored location.

 

Damage is then applied to the DestructibleActor via:

Health -= DamageAmount;

 

In between these two points is the opportunity to randomize the damage dealt.

 

This would be an improvement over the explosive damage randomization in that each piece of terrain would get a different random roll for damage, so some terrain would be destroyed and some wouldn't.

 

The question is this: what sort of randomization would people like to see?

 

The easiest is just DamageAmount = Rand(DamageAmount), which would generate between 0 and DamageAmount damage (DamageAmount ultimately is derived from the iEnvironmentDamage set for each weapon in the DGC.ini). This would create a wide variation, although the range and average could still be adjusted in the DGC.ini.

 

An alternative is DamageAmount += Rand(DamageAmount * ##);

 

If ## were 1, this would generate between 1 and 2 times the amount set in the DGC.ini.

If ## were 2, this would generate between 1 and 3 times the amount set in the DGC.ini.

 

This would mean rebalancing all of the weapon iEnvironmentDamage values, but would provide a lower bound on environment damage.

 

Anyone have any feedback?

Link to comment
Share on other sites

I personally prefer very little damage to the environment, so if it was up to me to decide I would go for DamageAmount = Rand(DamageAmount).

But then again I can just decrease the environmental damage from the weapons via ini.file, so it really shouldn't be up to me to decide :)

 

However talking about the amount of damage explosives does to environment... If it was possible to modify the amount of soldier/alien-damage explosives does then I would be something like 30.000 times more interested.

 

Grenades dealing exactly the same amount of damage to anyone inside the blast area regardless of cover, distance to the center of explosion and no randomness or anything makes me sad every time I see a grenade in the game... which is a lot since I have to throw them all the time in early game...

Link to comment
Share on other sites

I thought a little bit about that. I was able to at least make the explosive damage randomized, but it only rolls once for each unit in the AoE.

 

I'm still trying to track down exactly where AoE damage is applied to units. This would help to fix the bug where Suppressing units can be immune to AoE damage, as well as do things like randomize explosive damage per unit and scale the damage based on distance from the center.

 

Sooner or later I'll find it, assuming that it isn't buried in some native code somewhere ...

Link to comment
Share on other sites

@Bertilsson

To be fair, if grenades weren't reliable for damage output, they'd be a lot less useful. As you point out, you use them early game. Later, it's better damage, safer, and doesn't destroy components to just shoot someone. With a larger effect radius, some damage falloff at the edges would probably be more acceptable.

 

@Amineri

The Frag Grenade Explode() notifies the stuff inside the splash radius that they're being attacked before calling the XComProjectile Explode. And that notifies event listeners of dealing damage, which is probably just using that specific UnitDamage value.

 

I THINK that a lot of the event stuff is hooking up to Kismet. I don't know that it HAS to, but that would explain why a lot of the code seems to go nowhere or not do much of anything. Regardless, if it's using a single notification to tell all the units what damage it would take, and that's what it looks like, I think you're stuck on that one. The only other option I can see is in XComUnitPawn TakeSplashDamage() where you might be able to remove the radial damage check, but about all you could do is randomize the value rather than basing it on anything like the actual explosion origin or anything.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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