Environmental Damage How it Works - long-war-2/lwotc GitHub Wiki
This page explains how environmental damage should work in the game.
Destructible objects.
There are 3 types of destructible objects. All objects in Unreal Engine are actors.
-
Simple destructible actors like a table. It has only one parameter - toughness. If this object takes
damage >= toughness
- it destroyed completely. Simple. -
Fractional destructible actor - usually floors or walls. It's similar to the Simple destructible actor, but can be destroyed by parts.
-
Annihilation actors. They have two stages of destruction - damaged and annihilated. They also have two toughness parameters. A common example is Cars - they're damaged, they're put on fire and take some amount of damage each turn. When they annihilated - car explodes.
How environmental damage should work:
First - Destructible actor cannot be destroyed or damaged by multiple hits. Not enough damage means none is dealt. There is one exception for now - targetable objects like gas barrels, they can be destroyed with multiple shots.
Every weapon has a environmental damage parameter, every object hit causes a calculation. If the Enviroment damage is enough to change the actor state, the actor will be damaged or destroyed. If the damage is not above the threshold, damage is only cosmetic and only textures and models will change.
AOE damage has falloff reduction mechanics for both character damage and environment damage. For now this mechanic is applied to Grenades, Rockets and Shredgun/Shredstorm.
How It Works Mathematically:
Grenadier throw grenade into the car. Car has damaged threshold of 5 and annihilation of threshold 10. Grenade has 9 environmental damage.
- Game checks perks of the grenadier. Sapper and combat engineer have bonus environmental damage. Sapper add 4, combat engineer add 8. Those numbers adds to the grenade environmental damage.
- Random grace. There is a random +-20%, calculated after skills
- Falloff check. Environmental damage falls down at distance from the center of the explosion. Combat Engineer perk negates this check. For multishot abilities like MEC cluster rockets, the game will take nearest rocket for falloff damage modification.
Now we can calculate environmental damage: damage = (base_damage + perks) * random_modifier * range_modifier
Actor toughness
There is 4 values of the toughness in the game except indestructible.
- Decorative. Destroyed by any damage.
- Standard = 5. Wooden dining tables, wooden fences, trash bags, some walls between rooms and such things.
- Strong = 10. Covers most objects in the game. Walls, plant pots, solid chairs and even trash barrels.
- Reinforced = 15?. Some walls in ADVENT buildings, walls of prison cells, etc.
For example : A Car, with a toughness of Strong
or 10.
If damage < 5
- No Damage Visible
If 5 <= damage < 10
- Car will be damaged and lit on fire, and as fire does 5 damage a turn, the car will be destroyed on the next turn.
If damage >= 10
- Car explodes.