Cataclysm-DDA icon indicating copy to clipboard operation
Cataclysm-DDA copied to clipboard

[CR] Reign in the damage from items dropped from height, with math

Open RenechCDDA opened this issue 1 year ago • 3 comments

Summary

Balance "Damage from dropped items scales with kinetic energy"

Purpose of change

  • Closes #67785

Describe the solution

Implemented @ampersand55's suggestion of using kinetic energy... while game_balance.md specifically warns against using that as a comparison, the results seemed reasonable enough in repeat testing. Better than "wasp lands on you, you take 450 damage, do not pass go, do not collect 200 NPCs, go directly to dead". I personally think this is a good basis for future adjustments, although I will note it does give up the density calculation.

Implemented my own reasoning that the first-z-level distance should be scaled by size of the impacted creature. This halves the impact energy(not the damage) for something falling on a medium-sized creature(default character size) 1 z-level above. For a creature in the huge class (occupies 100% of the tile) it completely nullifies it. If there's no distance for the object to gain speed as it falls, it just can't.

Completely removed the throwing skill adjustment, recalculated hit chance based on dodge differential of velocity at time of impact. Throwing skill and dropping an object 'real good' are just... not the same thing? How would you even get more skilled at this? Plus as noted by @Kamayana it always used the player character. I did not see any merit in maintaining this broken reasoning.

Ripped out the hardcoded messages claiming that hit monsters have limbs, used the bodypart accessors to get the actual body parts and message/damage them accordingly.

Describe alternatives you've considered

@Brambor had a pretty good point in their comment. I wanted to scale the damage according to dodge, so that basically any willful dodging ability meant a glancing hit from an object that wasn't the size of the tile. But by the point I got there I was tired of doing math, so I did the above instead.

Testing

I hit a lot of dogs(in the appendix) with rocks thrown at z+4

Before PR, damage from a 87.5kg wasp falling on a character from 1 z-level above: 5 * 87.5 * 1 * 1.1 = 481.25 damage After PR, the same wasp falling on a default character from 1 z-level above: ~1071.875J impact energy = ~32.74 damage

Before PR, damage from a 87.5kg wasp falling on a character from 10 z-level above: 5 * 87.5 * 1 * 1.1 = 4812.5 damage After PR, the same wasp falling on a default character from 10 z-level above: ~20,365J impact energy = ~142.7 damage

Additional context

@kevingranade I imagine you will have some opinion on this new iteration

Known issue: The game consider bp_null to be valid, so very often you will hit monsters (anything without defined limbs) in "the appendix".

...I do not know why. I tried to block it by specifically excluding bp_null but even that didn't work.

RenechCDDA avatar Mar 25 '24 16:03 RenechCDDA

I'd appreciate some sanity checking on the math here.

RenechCDDA avatar Mar 25 '24 16:03 RenechCDDA

What happens when sand/water falls on you? Note: sand as dust vs sand in a bag. Relevant comment: https://github.com/CleverRaven/Cataclysm-DDA/issues/67785#issuecomment-1693845762

EDIT: I wanna make sure this doesn't address it so that an issue is created tracking this problem.

Brambor avatar Mar 25 '24 21:03 Brambor

Seems sensible given the lack of a better model for damage caused by a large falling object (compared to i.e. a bullet). The previous numbers are so out of whack that I think what you've done already is enough for merging, so the below is optional.

The main thing I'd like to see is a test checking the above scenarios, mostly in just a "kill/injure/unharmed" bucketing.

I think density might make a return for some kind of terminal velocity determination. Most items you want to throw aren't going to hit their terminal velocity or be meaningfully slowed by air resistance in the distances we're dealing with, but many others that are intuitively useless for this are useless specifically because of a combination of drag and some kind of cushioning effect from soft projectiles. For example dropping a pillow vs a baseball, the pillow is going to have its damage potential almost nullified by drag, then completely eliminated by the pillow failing to transfer energy rapidly.

kevingranade avatar Mar 25 '24 23:03 kevingranade

some kind of cushioning effect from soft projectiles

A simple check if an item is soft and then just ignoring it for damage calculations might be enough for a start? Although it would give weird results for a backpack filled with bricks.

mqrause avatar Mar 27 '24 10:03 mqrause

some kind of cushioning effect from soft projectiles

A simple check if an item is soft and then just ignoring it for damage calculations might be enough for a start? Although it would give weird results for a backpack filled with bricks.

~Are items flagged if they are soft?~ Oh! SOFT and HARD. (Used in item cleaning etc.)

You could recursively check if items inside are soft.

It is a question what should pillow case with pillow and a brick do. I guess deal dmg only for the brick?

So recursively ask for hard items and then those hard items deal dmg. It still wouldn't be quite right for cushioned backpack with bricks, it should deal less damage than the bricks alone.

But also a barel of water should deal damage... Once you find hard container, don't check its insides, take the weight of it and its insides as one hard item.

Brambor avatar Mar 27 '24 20:03 Brambor

~Are items flagged if they are soft?~ Oh! SOFT and HARD. (Used in item cleaning etc.)

Items are also soft if all their materials are soft. But I don't think we have enough data to make proper calculations for all kinds of item combinations.

mqrause avatar Mar 27 '24 21:03 mqrause

This is probably still too damaging. I've always had a preference for empiricism in these contexts. Do we have ready examples of 87.5kg objects falling on people from a few meters? We do, of course, but in particular I would draw attention to pro wrestling. I am not a viewer, but as I understand it nearly every match features large wrestlers - often larger than 100 kg when male - deliberately leaping onto often prone or supine people from the ring posts or ropes. These techniques are referred to as "diving" or "flying" attacks.

800px-Undertaker_oldschool_2 ezgif-1-ded9df603f

It is absolutely possible to sustain injuries in pro wrestling or in any contact sport, even serious ones, such as broken bones or worse, but these are uncommon, and the norm is that wrestlers will continue to perform immediately after suffering such attacks. Acute ill effects must be no more than some pain.

Mind you, these are actual leaps and dives, not just gravitational collisions. And from what I can tell, the risk of injury is much higher for those performing diving attacks than for those receiving them.

While not studying American professional wrestling, which is at least more controlled in principle, this paper found the following about general injury risks

A total of 7 fractures and 8 dislocations were recorded during the study. The incidence of fractures and dislocations was 1.1 per 10 000 athlete exposures, with a fracture rate of 0.5 and a dislocation rate of 0.6

For comparison, this study on professional football (gridiron) players found

A total of 108 players sustained fractures during 638,247 hours of player exposure (88.9% training and 11.1% matches), representing 2.7% of all time-loss injuries. The incidence was 0.17 fractures per 1000 h of exposure (match and training incidence of 0.9 and 0.07 fractures / 1000 h, respectively), equivalent to an average of one fracture per team per season.

While these are general risks, it is quite routine in either sport to receive impacts (usually same "z-level) in the kilojoules. It is not clear why the risk of damage should be orders of magnitude greater on the vertical axis rather than the horizontal axis at the same distance, nor is that really observable.

What is the bottom line? A moderate-sized object falling onto the player from one Z-level should have a moderate chance to cause pain, a very small chance to cause token damage, and a very marginal chance to cause double-digit damage.

Suffering major injury in the 30-damage range from a falling wasp should be an occurrence on the order of 0.001% probability or something like that.

A player character who receives such impacts daily might fear systemic health effects in the future, but nothing that is simulated at the level of gameplay. Indeed, players can shrink or grow multiple times their original size using mutagen and purifiers, so the health implications of mild blunt trauma are nothing to think about from a design perspective.

Montimorency avatar Mar 29 '24 00:03 Montimorency

Merged PRs are the wrong place for this. It’s already merged and therefore most people who haven’t commented on it will never see any further comments.

Maleclypse avatar Mar 29 '24 01:03 Maleclypse

That's true, but those people already working on or reviewing the matter can see it. I'm not sure if it's worth bringing to more general attention orthogonally to the former category.

Montimorency avatar Mar 29 '24 01:03 Montimorency

That's true, but those people already working on or reviewing the matter can see it. I'm not sure if it's worth bringing to more general attention orthogonally to the former category.

let me restate: if you feel you have a legitimate matter to raise, open an issue. if there is an open issue or PR that is relevant, post there instead. do not post on merged PRs.

esotericist avatar Mar 29 '24 02:03 esotericist