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

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

Merged
merged 4 commits into from Mar 28, 2024

Conversation

RenechCDDA
Copy link
Contributor

@RenechCDDA RenechCDDA commented Mar 25, 2024

Summary

Balance "Damage from dropped items scales with kinetic energy"

Purpose of change

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:
none

@RenechCDDA
Copy link
Contributor Author

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

@github-actions github-actions bot added [C++] Changes (can be) made in C++. Previously named `Code` <Bugfix> This is a fix for a bug (or closes open issue) Game: Balance Balancing of (existing) in-game features. astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels Mar 25, 2024
@Brambor
Copy link
Contributor

Brambor commented Mar 25, 2024

What happens when sand/water falls on you? Note: sand as dust vs sand in a bag.
Relevant comment: #67785 (comment)

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

@kevingranade
Copy link
Member

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.

@mqrause
Copy link
Contributor

mqrause commented Mar 27, 2024

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.

@Brambor
Copy link
Contributor

Brambor commented Mar 27, 2024

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.

@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Mar 27, 2024
@mqrause
Copy link
Contributor

mqrause commented Mar 27, 2024

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.

@Maleclypse Maleclypse merged commit ac793dc into CleverRaven:master Mar 28, 2024
25 of 27 checks passed
@RenechCDDA RenechCDDA deleted the dropping_safes_is_unsafe branch March 28, 2024 19:57
@Montimorency

This comment was marked as off-topic.

@Maleclypse
Copy link
Member

Maleclypse commented Mar 29, 2024

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.

@Montimorency
Copy link
Contributor

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.

@esotericist
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Game: Balance Balancing of (existing) in-game features. json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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