Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Killed a giant wasp and it fell on me, shattering my skull instantly and killing me from full hp #67785

Closed
anoobindisguise opened this issue Aug 20, 2023 · 36 comments · Fixed by #72615
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Help Wanted Not particularly urgent or easy (see Good First Issue for this), but help is appreciated with this! Z-levels Levels below and above ground.

Comments

@anoobindisguise
Copy link
Contributor

anoobindisguise commented Aug 20, 2023

Describe the bug

Due to the way items cause falling damage from #65125 any given item does damage equal to (Mass in KG x Z-levels fallen x Its density). A giant wasp weighs 87.5kg and has a density of 1.1. I killed a wasp directly above my head and it fell on me, doing 99 damage.
This is a problem for every other flying enemy too but this is pretty silly in particular since it's a oneshot.

Attach save file

n/a

Steps to reproduce

  1. Debug spawn a giant wasp directly over your head.
  2. Debug kill it.
  3. Observe its corpse falling on you and killing you.

Expected behavior

Falling damage should be based solely on density and not on weight to prevent ridiculous situations like this (and preventing you from doing ridiculous things like oneshotting mutants and the MTF by dropping an engine block on them)
Also, things probably shouldn't do damage this way, if it's close enough for you to shank it with a sword it's not going to fall fast enough to hurt you.

Screenshots

image

Versions and configuration

  • OS: Windows
    • OS Version: 10.0.22621.1992 (22H2)
  • Game Version: 8c55459 [64-bit]
  • Graphics Version: Tiles
  • Game Language: System language []
  • Mods loaded: [
    Dark Days Ahead [dda],
    Disable NPC Needs [no_npc_food],
    Portal Storms Ignore NPCs [personal_portal_storms],
    Slowdown Fungal Growth [no_fungal_growth],
    Bionic Slots [cbm_slots],
    Stats Through Kills [stats_through_kills]
    ]

Additional context

THE WASPS DID IT AGAIN

@anoobindisguise anoobindisguise added the (S1 - Need confirmation) Report waiting on confirmation of reproducibility label Aug 20, 2023
@Kywi001
Copy link

Kywi001 commented Aug 20, 2023

In my opinion, the damage calc should depend on:

  • Damage depends on the weight of the item dropped.
  • Damage reduction depends on the size of the zombie/something you're dropping it from.
  • Accuracy depends on the volume of the item dropped.
  • Miss chance depends on how small the size of the zombie/something you're dropping it from.

@ZhilkinSerg
Copy link
Contributor

I would say it works as intended, except for the missing chance to miss (due to objects, monsters and characters not occupying the whole tile most of the time).

@ampersand55
Copy link
Contributor

ampersand55 commented Aug 20, 2023

Let's say a z-level is 2.5 meters. The wasp would be falling for √(2x2.5m/9.8m/s2) = 0.714s, and it's final velocity would be 9.8m/s2 * 0.714s = 7m/s.

It's kinetic energy would be 87.5kg*(7m/s)2 / 2 = 2177 J, which is close to the muzzle energy of a 7.62×39mm fired from an AK47, which does 44 damage in game.

Also:

  • The kinetic energy of the falling wasp would be spread out over a larger area and not a point penetration like a bullet.
  • Neither you or the wasp are rigid bodies, you would absorb the kinetic energy over a longer period as your legs would bend as you got hit.

TL;DR: 99 damage is too much. Somewhere between 20-44 damage would be more realistic.

@Nebnis
Copy link
Contributor

Nebnis commented Aug 20, 2023

You probably didn't take in account that falling straight into your head would snap your neck plus brain trauma. I know someone who broke their arms from falling off their couch. This is a lot of conjecture though :P

@anoobindisguise
Copy link
Contributor Author

anoobindisguise commented Aug 21, 2023

a z level is 2.5 meters

If the wasp is close enough to attack you it's what. 0.5 meters?
Also the giant 100kg mutant bugs are full of hydrogen sacks that should reduce their density.

@ZhilkinSerg
Copy link
Contributor

a z level is 2.5 meters

If the wasp is close enough to attack you it's what. 0.5 meters? Also the giant 100kg mutant bugs are full of hydrogen sacks that should reduce their density.

I agree with the length, but 100 kg of wasp is the same is 100 kg of non-wasp

@Nattfarinn
Copy link

TL;DR: 99 damage is too much. Somewhere between 20-44 damage would be more realistic.

The wasp would not be falling 2.5 meters but ~70cm (considering man height of 1.8m). So kinetic energy at impact would be mere ~500J. Also bullets do penetration damage and to compare them you would need to compare pressure and force.

Formulas aside, 87.5kg and 2.5m is pretty much a man falling from not very high ledge on another man. Not saying it definitely can't be lethal but in most cases it would be few bruises.

@ampersand55
Copy link
Contributor

According to the following study, there's a 50% chance to survive a fall from 48 ft./14.6 m, which is mechanically equivalent of something weighting as much as you falling with the hardness and rigidity as the ground falling on you.

https://link.springer.com/article/10.1007/s00068-017-0799-1

We can normalize 14.6 m to being 84 damage, the same head hp as a 8 strength character,

Looking at the damage value for bullets in GAME_BALANCE.md, damage is equal square root of kinetic energy (muzzle energy). If we say falling damage is also proportional to square root of kinetic energy, we get a proportionality constant of about ~0.75. I.e. damage = 0.75 * √(Ke).

Then we would have the following damage for a falling 87.5 kg rigid body with a z-level being 2.5 m:

Z-levels fall height (m) kinetic energy (J) damage
1 2.5 2144 34.8
2 5.0 4288 49.2
3 7.5 6431 60.2
4 10.0 8575 69.5
5 12.5 10719 77.7
6 15.0 12863 85.1
7 17.5 15006 92.0
8 20.0 17150 98.3
9 22.5 19294 104.3
10 25.0 21438 109.9

Calculated with a z-level being 14 ft (~4.3 m), the average height of a floor in in the US, the damage table would look like this:

Z-levels fall height (m) kinetic energy (J) damage
1 4.3 3659 45.4
2 8.5 7318 64.2
3 12.8 10977 78.7
4 17.1 14636 90.8
5 21.3 18296 101.5
6 25.6 21955 111.2
7 29.9 25614 120.1
8 34.1 29273 128.4
9 38.4 32932 136.2
10 42.7 36591 143.6

@Brambor
Copy link
Contributor

Brambor commented Aug 22, 2023

Realistic

The wasp would not be falling 2.5 meters but ~70cm (considering man height of 1.8m).

I recommend adding this to the calculation: substracting the target height from the distance of the falling object.
Note: Don't screw up if creatures spanning multiple tiles are introduced.

Then small insects would get more crushed than hulks. Especially in the OP's case:

I killed a wasp directly above my head and it fell on me

I believe that the OP's case would be the most common. So it definitely should be considered as the most important.

Sensible

Alternatively. If you kill with a mele weapon something over your head, it is in reach regardless if you are 2m50cm or 20cm tall. So just substracting a whole tile might be the most bug-prone way. Making the feature not totally broken but still viable strategy. Just get a floor higher to throw the piano on the shocker's head to achieve the same result. But don't kill hulk by placing something on their head.

I read somewhere:

If we want to do CDDA hyper realistic, you can roll a dice every time you go down the stairs to see if you broke your neck. But that's not fun.

@ZhilkinSerg
Copy link
Contributor

I read somewhere:

If we want to do CDDA hyper realistic, you can roll a dice every time you go down the stairs to see if you broke your neck. But that's not fun.

That's just some dumb shit which has nothing to do with CDDA development.

@anoobindisguise
Copy link
Contributor Author

That's just some dumb shit which has nothing to do with CDDA development.

idk it's relevant here isn't it? semi buoyant wasps falling 50 cm after dying should just not kill you.

@ZhilkinSerg
Copy link
Contributor

That's just some dumb shit which has nothing to do with CDDA development.

idk it's relevant here isn't it? semi buoyant wasps falling 50 cm after dying should just not kill you.

No, it is not relevant. 90 kg (wasp or not) falling onto your head can easily break your neck and kill you.

@fairyarmadillo
Copy link
Contributor

The wasp is not a bowling ball. It is a flexible articulated body with a high surface area. Even if it lands squarely on top of you, it is not going to transfer all of its energy into your head.

If a 100kg bowling ball landed on your head you would definitely be in trouble.

Most wasps also should not be 100kg. That is way heavier than makes sense for a roughly man-sized insect that is supposed to be flying partially aided by hydrogen sacs.

@ZhilkinSerg
Copy link
Contributor

The wasp is not a bowling ball. It is a flexible articulated body with a high surface area. Even if it lands squarely on top of you, it is not going to transfer all of its energy into your head.

The dynamic kinetic energy of a moving object is defined by its mass and velocity. Its surface area would affect drag force, but not that much, so we can ignore it. When an object is dropped onto something it would lose its kinetic energy to do some work until fully stopped. If stopped by the head it would do that work deforming the head (and possibly itself).

If a 100kg bowling ball landed on your head you would definitely be in trouble.

100 kg is 100 kg whether it is a wasp or a bowling ball or anything else, so you are in trouble either way.

Most wasps also should not be 100kg. That is way heavier than makes sense for a roughly man-sized insect that is supposed to be flying partially aided by hydrogen sacs.

All monsters of specific monster type have exactly the same weight in DDA - 81500 g. It might be a wrong value (and that is a separate issue), but it does not matter for calculation - formulas would be the same no matter the values used.

@I-am-Erk
Copy link
Member

Quotes from thread on discord to more appropriate place:

so I think the correct thing to do might be to add a perception test as well as the existing dodge roll. dodging a falling object is different from dodging an attack, the first major question is "do you see it coming". If you do, we should significantly buff your dodge. You should auto-pass this test if the falling object is something you killed or launched yourself.

also I think:

// values calibrated so that %hit chance starts from 60% going up and down according to the two modifiers

is incorrect, since that's 60% if the drop is totally random. If you drop an item randomly into a ~1-2m square region, there's not a 60% chance you'll hit a person-sized target. We should drop it to at most 25%, and probably more like 10%. We could consider making it partially influenced by the item's volume.

The chance of it hitting your head is already modified by your dodge. The more you successfully dodge the more likely it is to hit your arms, so if we drop the base hit rate and add a perception test, it should be very hard to hit yourself with a falling wasp unless you are otherwise unable to defend yourself.

@Brambor
Copy link
Contributor

Brambor commented Aug 24, 2023

@I-am-Erk beat me to it, but my approach is a bit different...

When a sufficiently heavy thing lands on you, you could fall down. Is that simulated?
Though I see that wasp would break your neck if it fell on you without you noticing, If you fought it to death, it shouldn't, you would take action!

Your neck is bent as you are looking up at the thing you just fought. If you don't manage to dodge, no, rather either the simulation picks your action, or you should be able to pick one.

It is based on dodging skill, and strength. If you didn't yet notice, then on your trap skill to check if you do notice.

Defend
Arms over your head, head down, shoulders up then it falls onto you, so arms take damage (hands, forearms, bit of shoulder).

Better with strenght.
image

Leaping
You try to leap away! Didn't lept enough? It falls on your legs! Lept less? It falls on your torso and legs! If you lept very little, it falls on your head, torso, and legs. Even less? It falls on your arms, too!

Better with dodging skill and dexterity. The more time you have, the easier it is / the further you get.
image

Catch / push away
You will extend your arms to the wasp, trying to catch the thing. Or lay your head back and push the wasp away, if it does work, the force is transferred through your arms to your torso and legs, overwhelming arms and legs, they bend (getting no dmg from that).
If it doesn't work (you are too weak / the thing slipped / it went in between your arms) Your parts are hit in order with decreasing probability: head (turned away) torso, arms, legs.
image

@Brambor
Copy link
Contributor

Brambor commented Aug 24, 2023

I would like it if the player could choose. It would say what increases the chances, Like surgery or something I don't remember.

@I-am-Erk
Copy link
Member

I would like it if the player could choose. It would say what increases the chances, Like surgery or something I don't remember.

Your diagrams are wonderful.

Generally we try to avoid player input on these things for a couple reasons; first, it represents the kind of split moment decision that feels like the opposite of pausing the action to pull up a dialogue, and second, because we still have to code in all the behaviour trees for what to do anyway for NPCs, so it means doing all that and also doing an optional dialogue that interrupts the action.

Your general summary is correct but I think honestly that most of that can be modelled by "if you see it coming and try to get out of the way, chances are it either misses you or hits your arms rather than your squishy parts".

It would be nice if your helmet and shoulder armour had higher coverage against falling attacks, idk how tough that is

We should also highly increase the chance of getting knocked down by these attacks. That's naturally modified by strength.

@Brambor
Copy link
Contributor

Brambor commented Aug 24, 2023

I was going for a DnD feeling, that's why I wanted the choice. But simple

Something is falling on you!

  1. Leap away!
  2. Cover!

Would do. I would prefer if you could choose a direction of the leap.

I would like the flavour text,

@ampersand55
Copy link
Contributor

Random thought:

We have some info from the monsters that we could use to approximate rigidity, such as armor. A skeletal zombie, giant wasp or Exodii with a high stab armor to bash armor ratio is going to be more rigid than a slug, slime or fat zombie with low stab armor to bash armor ratio. Also bodytype, material, phase and weakpoint families provide some info.

@fairyarmadillo
Copy link
Contributor

fairyarmadillo commented Aug 25, 2023

100 kg is 100 kg whether it is a wasp or a bowling ball or anything else, so you are in trouble either way.

This is patently incorrect. The wasp is a large, partly soft, and most importantly articulated body with a very large surface area. When it impacts with the top of your head, it does not transfer all of its energy into your body because the rest of the wasp is still falling down around you. Your head is a stop on the way down, not the end of the fall. A bowling ball is much more dangerous because it is denser. It comes at least momentarily to a full stop on top of your head and delivers much more force into your body.

One Z-level is a single floor. It's maybe 2.5 meters tops. 100kg is the size of an adult man. Adult men fly into each other at moderate speeds all the time - police, football players, etc. This occasionally results in injury, but to say that your uncle jumping out a second story window and landing on top of you should instantly and invariably squash your head like a melon is ridiculous.

As mentioned above, a human body is also not an immobile post buried in the ground. A lot of what energy the body does receive, even on a direct hit, is absorbed when the body moves in response to the impact. Knees bend, the person tips over, they cover their head or duck so that part of the impact hits their arms or back, etc.

Lastly the calculations are obviously broken because you can kill bosses by dropping water or sand on them. Mass and velocity might be the only thing you need to think about when you're describing small projectiles like bullets (and even then ballistic performance is actually a lot more complicated than that), but things obviously get a lot more complicated when you're dealing with anything bigger.

@ZhilkinSerg
Copy link
Contributor

100 kg is 100 kg whether it is a wasp or a bowling ball or anything else, so you are in trouble either way.

This is patently incorrect. The wasp is a large, partly soft, and most importantly articulated body with a very large surface area. When it impacts with the top of your head, it does not transfer all of its energy into your body because the rest of the wasp is still falling down around you. Your head is a stop on the way down, not the end of the fall. A bowling ball is much more dangerous because it is denser. It comes at least momentarily to a full stop on top of your head and delivers much more force into your body.

One Z-level is a single floor. It's maybe 2.5 meters tops. 100kg is the size of an adult man. Adult men fly into each other at moderate speeds all the time - police, football players, etc. This occasionally results in injury, but to say that your uncle jumping out a second story window and landing on top of you should instantly and invariably squash your head like a melon is ridiculous.

As mentioned above, a human body is also not an immobile post buried in the ground. A lot of what energy the body does receive, even on a direct hit, is absorbed when the body moves in response to the impact. Knees bend, the person tips over, they cover their head or duck so that part of the impact hits their arms or back, etc.

Lastly the calculations are obviously broken because you can kill bosses by dropping water or sand on them. Mass and velocity might be the only thing you need to think about when you're describing small projectiles like bullets (and even then ballistic performance is actually a lot more complicated than that), but things obviously get a lot more complicated when you're dealing with anything bigger.

100 kg is 100 kg

@I-am-Erk
Copy link
Member

As I said in discord, damage calcs are very much secondary. First see what a far less accurate hit roll does since it will then be smacking secondary body parts. Then let's review damage based on that.

@Nattfarinn

This comment was marked as abuse.

@ZhilkinSerg

This comment was marked as off-topic.

@Brambor
Copy link
Contributor

Brambor commented Aug 26, 2023

I am affraid this will have to be settled with a physics experiment.

@NetSysFire
Copy link
Member

One thing that has not been explicitely brought up yet is that most monster masses and their densities are likely vastly wrong. There is no method to determine a somewhat correct value for most of our (mutated) critters yet. Wasps are just one example. That could benefit from a seperate issue if someone wants to look into that.

And folks, please cease the hostilities. Especially when you happen to have a badge due to being in the CleverRaven organization.

@Kamayana
Copy link
Contributor

Kamayana commented Aug 26, 2023

I've been working on how the weight carried cache is handled, and I noticed something that's relevant here, in item::on_drop:

bool item::on_drop( const tripoint &pos, map &m )
{
    // dropping liquids, even currently frozen ones, on the ground makes them
    // dirty
    if( made_of_from_type( phase_id::LIQUID ) && !m.has_flag( ter_furn_flag::TFLAG_LIQUIDCONT, pos ) &&
        !has_own_flag( flag_DIRTY ) ) {
        set_flag( flag_DIRTY );
    }

    avatar &player_character = get_avatar();

    // set variable storing information of character dropping item
    dropped_char_stats.throwing = player_character.get_skill_level( skill_throw );

    player_character.flag_encumbrance();
    player_character.invalidate_weight_carried_cache();
    return type->drop_action && type->drop_action.call( &player_character, *this, pos );
}

This function is called from add_item_or_charges, which is used every time an item is added to the map from anywhere and for any reason, including things like items being loaded into the reality bubble and, relevant here, corpse creation. This code naively makes the assumption that it's always the player dropping the item and uses the player's throwing skill to amplify the corpse drop's hit percentage, which means the hornet corpse will more likely hit the player the better the player's throwing skill, which is very silly, to say the least.

This code is also responsible for the player's weight carried cache getting invalidated every time any item is loaded to the map, so I'll probably fix it up as part of my PR.

This is a separate topic to the damage discussion going on here, note, I just thought it was funny and technically related.

@Kamayana
Copy link
Contributor

One thing that has not been explicitely brought up yet is that most monster masses and their densities are likely vastly wrong. There is no method to determine a somewhat correct value for most of our (mutated) critters yet. Wasps are just one example. That could benefit from a seperate issue if someone wants to look into that.

And folks, please cease the hostilities. Especially when you happen to have a badge due to being in the CleverRaven organization.

For what it's worth, this is my stance. I think ZhilkinSerg is correct that a 100kg bug falling on you should probably be very damaging, even taking elasticity/dodging/air resistance into account, but... the mutant wasp being 100kg and yet still able to fly around seems like the real unbelievable thing, here. The largest flying bird in the world is only 15kg. If we want mutant bugs to stay heavy, maybe we could say they have, like, hydrogen/helium sacs that keep them light despite their size?

@Nattfarinn
Copy link

100kg bug falling on you should probably be very damaging, even taking elasticity/dodging/air resistance into account

This does not have to be an abstract problem. Like I've said before, the problem we are discussing can be easily replicable real life and is hardly fatal. 85kg is weight of an average adult man. Human body is not made of glass, most likely you will end up with some bruises if someone will fall on you. Not saying it can't be fatal, but it is lot lethal by definition or physics. We have joints that will absorb the fall, we have instinct and we do lean backward to not be hit at 90 angle. I would say that if we talk about imaginary realism, 99% of time you would fall on your back. This is not bullet headshot or 100kg bowling ball scenario by any means.

@I-am-Erk
Copy link
Member

I-am-Erk commented Aug 26, 2023

This is going around in circles. The first step to the solution has been covered a few times: reduce the way overcharged hit rate, ideally add more weight to perception and make it almost impossible to hit yourself with a falling object. This should inherently reduce a lot of damage concerns because the design already models a lot of the basics (cover your head with your arms, get out of the way). Once that's implemented, and basic bugs like liquids not being excluded are also fixed, we should assess if there are other concerns and address them as they exist at that time, because the core balance will have changed and most of this long circular discussion will be irrelevant.

Given that the ongoing circular discussion is drowning out how to fix the bug, I'm gonna lock this to contributors if we can't get off it, k?

@fairyarmadillo
Copy link
Contributor

fairyarmadillo commented Aug 27, 2023

This is going around in circles. The first step to the solution has been covered a few times: reduce the way overcharged hit rate, ideally add more weight to perception and make it almost impossible to hit yourself with a falling object. This should inherently reduce a lot of damage concerns because the design already models a lot of the basics (cover your head with your arms, get out of the way). Once that's implemented, and basic bugs like liquids not being excluded are also fixed, we should assess if there are other concerns and address them as they exist at that time, because the core balance will have changed and most of this long circular discussion will be irrelevant.

Given that the ongoing circular discussion is drowning out how to fix the bug, I'm gonna lock this to contributors if we can't get off it, k?

I have to disagree - falling will need to correctly account for wind resistance, strike surface area, and hardness of the falling object before it can be called a decent simulation. It's a fine first step, but dodge alone will not be sufficient, and I feel like you're trying to set up the expectation that it will solve the argument.

@I-am-Erk
Copy link
Member

No, I'm trying to set up the assumption that the overall play balance is going to be dramatically different when it's far harder to nail people in the vitals and when we can assume almost every falling item that hits is hitting with intent. Much of what you're describing is the (long desired) revamp of all thrown items, and well out of scope of the problem at hand - which is people killing themselves by shooting an enemy on the z level above.

@github-actions
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not bump or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.

@github-actions github-actions bot added the stale Closed for lack of activity, but still valid. label Sep 26, 2023
@NetSysFire NetSysFire added Z-levels Levels below and above ground. [C++] Changes (can be) made in C++. Previously named `Code` Help Wanted Not particularly urgent or easy (see Good First Issue for this), but help is appreciated with this! and removed (S1 - Need confirmation) Report waiting on confirmation of reproducibility stale Closed for lack of activity, but still valid. labels Sep 26, 2023
@RenechCDDA
Copy link
Member

Here's a huge issue, in addition to Kamayana's excellent point. The drop damage always assumes it falls the full distance, regardless of how far it possibly could drop.

float damage = 5 * to_kilogram( wt_dropped ) * height_fallen * item_density;

I have prepared a beautiful artwork diagram explaining the problem, with the illustrated case being said giant wasp falling on your head.
image

I believe the first z-level (for arbitrary dropping of items) and final z-level (only when impacting a creature) should be greatly reduced in effect. Right now it's assuming that dropped item had an entire z-level to fall, even though that clearly can't be the case with an enormous flying wasp which occupies a large area of the tile (and is engaged in melee with you, etc).

As an example, here's the formula and some results with hypothetical values.
float damage = 5 * to_kilogram( wt_dropped ) * height_fallen * item_density;
Current damage as suffered by the reporting player:
5 * 87.5 * 1 * 1.1
= 481.25 damage (Note that @anoobindisguise reported "99 damage" but I assume that is how much head HP they had, not the total damage inflicted.)
Proposed damage suffered:
5 * 87.5 * 0.1 * 1.1
= 48.125 damage Still absurdly high, but not instantly lethal to normal characters even with a headshot.
Current damage if wasp fell from 10 z-levels up:
5 * 87.5 * 10 * 1.1
= 4,812.5 damage (pancaked)
Proposed damage if wasp fell from 10 z-levels up:
5 * 87.5 * 9.1 * 1.1
= 4,379.375 damage (still pancaked)

@KaleProgram

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Help Wanted Not particularly urgent or easy (see Good First Issue for this), but help is appreciated with this! Z-levels Levels below and above ground.
Projects
Status: Completed
Development

Successfully merging a pull request may close this issue.