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

Muscle strain: pass 1 #72733

Closed
wants to merge 28 commits into from
Closed

Conversation

I-am-Erk
Copy link
Member

@I-am-Erk I-am-Erk commented Mar 30, 2024

Summary

Features "Adds 'strain', modelling muscle use separate from aerobic stamina"

Purpose of change

See #59862 for the basic theory. I'm doing this slightly differently than in that proposal.

Basically, currently despite having all kinds of different pools of stats that run out as you use them, "stamina" covers a wide range of things that shouldn't be the same. Put simply, you shouldn't be unable to run after drawing your bow. As long as 'stamina' is a single vague thing, we can't easily balance eg. the ability to swing your sword without getting winded, and we can't easily add a tool for gaining strength as you use your muscles.

Describe the solution

This is a first pass and will be a bit prototypic. It adds a new pool, "strain", which uses roughly the same units as stamina. On the UI end, I would like to represent strain as increasing as the pool is used up, but on the back end I am keeping them the same so that it's easier to shift stamina costs straight over without rebalancing them sometimes. I suspect this will be a little confusing for contributors but I hope not too bad. On the back end you have start at max strain and drop to zero, in other words, calls to update_strain() using negative numbers will lead you closer to muscle failure. The UI is the only place it goes the other way, partly because of the word choice 'strain' and partly because it helps distinguish the two bars.

Strain uses the same 'units' as stamina, whatever those are: to port sometihng over to strain, you can use whatever previous methods we used for stamina calcs. Anything that uses burn_energy_arms now builds up strain primarily, although it still burns stamina at 25% the previous rate. This is a ballpark, eyeballed measure to get things in place to work on. In my playtests I suspect I've set it too low and we should bump it up to like 50% or something but I am not sure. It might also be something we need more refinement on, like maybe stamina should drop faster for low strain weapons and slower for high strain ones.

Strain has a smaller pool than stamina: it reaches its cap much faster. It also recovers faster. When you cap strain out, you're supposed to stop being able to smash and attack, and have to stop aiming your bow; however, I haven't yet been able to get that working. In my playtests, I can make about 8-10 attacks with a heavy sledge, and a lot more with my fists (I lost count) before running out of strain.

As your strain builds up, you also build up what I've called "Burn". This effectively reduces your maximum strain. In the current UI it's hidden, you just run out of strain faster the more you operate at high strain. Burn recovers much slower.

This pass will not add the big fun parts of strain, like the ability to transition Burn into Gainz that increase your strength. We'll get there.

And now a special category for everyone who notices that this totally messes with the game:

This totally messes with the game!

This is a huge paradigm shift to stamina and melee combat balance. I know. It's far, far too broad reaching for me to have even vaguely assembled playtest data, that's what happens next. I don't expect this to work well from the start, it's going to need your feedback.

Things that need fixing sooner rather than later:

  • the balance is probably not correct. There's very little data to use to get an idea of what's going to be right, so I've gone by feel here. I'll be shocked if I got it right.
  • The UI should show Burn. I'd like burn to appear on the end of the strain bar like this: ||\......██ to indicate the latter part of the strain bar can no longer be accessed. EDIT: Renech helped me glue together a very messy solution to this problem, but it definitely needs refinement in a dedicated PR.
  • we need better concepts for what happens as strain rises. Currently it stops you from attacking and bashing things. This should be made more interesting. I'd like to give players a small buff to attack speed when "fresh" and dropping as strain approaches 50%. I'd also like to stop people from drawing a bow and doing other things that need strain when the strain is at its very edge.
    • My thought here is that we should use the flinch/hesitate mechanic I've suggested for pain, so as your strain rises, rather than your attacks getting slower, you have a chance to "hesitate" (better word needed) for 20-50 ticks, aborting the attack temporarily. This will require adding this mechanic. I'd like it if this mechanic completely replaced the current "complete fail due to strain" mechanic, so that when your strain is totally maxed out, you just get a lot of flinches and rapidly rising burn.
So why are we changing things? Stamina worked okay.

It works okay, but not great. Besides the stuff listed, this change is something we've wanted for a long time. Here's some of the stuff it sets the stage for.

  • Strength gains over time
  • the ability to draw bows above your max draw strength at the cost of extra strain burn
  • running and athletics are no longer as penalizing to combat and vice versa (that's kind of already in)
  • cybernetic limbs that never tire
  • melee combat has a form of attrition as you fight so many zombies your arms gradually turn to jelly, but on the bright side, you just had a great upper body workout.

So, please bear with us as we try to add one of the most long-requested features in the game. After all, no pain, no gainz.

Describe alternatives you've considered

I really don't want to add yet another stat that we track, but I can't see any other very good way to balance this without sacrificing a lot of stuff we want.

Testing

Thanks to Renech for helping me do the UI stuff when my brain was too full.

image

When you get up to high levels of strain, for now it just stops you from doing things. This is meant to simulate "the wall" like in a workout, where you've just done so many pullups that your arms don't work any more (for me this happens after like, uh, like thirty pullups, I swear). For attacks, this is based on the stamina/strain cost of the weapon, for smashing this just kicks in if you've got less than 25% strain left. I'd like a finer tuned option for smashing but that can wait for later. Note that you can always make at least one attack even if it would cost more strain than you've got.

image

image

I've tested it a bunch, it's mostly working pretty well, but as I outlined above, the balance is not really bang on. I've tested it a fair bit but it's hard to recreate a realistic testing scenario after staring at the same thing for so long. Also, the balance is likely to change a fair bit as we refine the implementaiton

Additional context

Since it is quite confusing at first, here is the complete list of easily-confused terms for different types of fatigue:

  1. Stamina: Your aerobic capacity: runs out when you run around fast and do other things that would leave you 'winded' irl.
  2. Strain: Your muscle capacity, increases as you do hard resistance exercise like drawing a bow, lifting weights, or swinging a big thing.
  3. Weariness: In general how beat you are as you work hard through the day. Influenced by and has effects on both strain and stamina.
  4. Sleepiness: Formerly fatigue. How close is it to bedtime.
  5. Cardio: How much you've built up your stamina over the course of running around in the apocalypse
  6. Gainz: not yet implemented, but basically the same as cardio for your muscles.
  7. Focus and morale are also types of pool like this and so is hunger. Man we have a lot. I'm sure I'm forgetting some too.

At the moment this is just "stamina but worse" and does not do anything. Bear with me.
Throwing things, drawing bows, and breaking sticks.
@github-actions github-actions bot added [JSON] Changes (can be) made in JSON [C++] Changes (can be) made in C++. Previously named `Code` Mechanics: Enchantments / Spells Enchantments and spells <Enhancement / Feature> New features, or enhancements on existing json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Mar 30, 2024
@PatrikLundell
Copy link
Contributor

  1. Climbing should probably cause strain as well, especially when carrying a lot of gear. Might not be a first pass candidate, though.
  2. Thirst is another one of those...

this is a coarse split that assumes all arms usage is the same, but honestly it might work fine.
@ADekema
Copy link

ADekema commented Mar 31, 2024

Just off the top off my head things that should increase strain. Just spitballing increase there is something that you didn´t think off yet:

  1. Being overencumbered (both wearing heavy loads and carrying heavy things).
  2. Melee attacks.
  3. Bashing things (you would be hitting with all your strength as which isn´t the cease with most mellee attacks).
  4. Crafting and construction activities should not just drain stamina but also strain depending on activity level. Probably not more than the passive regeneration of the character unless you have heavy fatigue/weariness or muscle burns.
  5. Digging manually.
  6. Mining manually.
  7. Trying to break free of a grab.
  8. Cutting down trees/cutting wood.
  9. Running. Should be relatively minor and you should run out of stamina long before strain in this cease.
  10. Jumping.
  11. Butchering. Normal butcheries wouldn´t be so bad. Dismemberment would be very draining on strain however.
  12. Breaking sticks.
  13. Swimming. This is a interesting one. Swimming slowly should drain your stamina quicker than your strain. Swimming quickly and forcefully however should drain your strain much quicker than your stamina. Swimming slowly should allow you to recover some strain up to a point.
  14. Specific types of training such as training with weights or strength forcused body exersices should be draining specifically strain.
  15. Dragging things.
  16. Smashing corpses.
  17. Moving objects. Heavily dependent on weight of the object (moving a dozen pillows one at a time shouldn´t cause any, Moving one 50 kilo vehicle frame should cause a lot).
  18. Dragging things. Special consideration should be given to vehicles. Things with wheels should have a massive reduction in the amount of strain they cause.
  19. Farming activities such as plowing, planting, digging and harvesting can be very strenious.

Implementing a strain drain for most activities wouldn´t add much at this stage but it would do much of the work for the next GAINZ part. Meaning you would only have to implement muscle gains and characters would start to automatically become buff from everything that should make them buff.

@I-am-Erk
Copy link
Member Author

I-am-Erk commented Apr 2, 2024

The linked issue post is a good place to talk about things that should affect strain. In this PR I'm just trying to implement a prototypic version and it doesn't need to, nor should it, touch on every possible use case.

Still needs work but it's a start
@github-actions github-actions bot added the Info / User Interface Game - player communication, menus, etc. label Apr 5, 2024
@github-actions github-actions bot added the Melee Melee weapons, tactics, techniques, reach attack label Apr 6, 2024
@github-actions github-actions bot removed the astyled astyled PR, label is assigned by github actions label Apr 6, 2024
I-am-Erk added 2 commits April 6, 2024 11:25
It works now. Still a bit clunky.

weariness also impacts strain recovery at high levels.

This comment was marked as spam.

@github-actions github-actions bot removed the BasicBuildPassed This PR builds correctly, label assigned by github actions label Apr 6, 2024
I-am-Erk added 2 commits April 6, 2024 23:10
tune strain to target ~8-10 sledge swings
Add burn
this was a lot of work to accomplish
@I-am-Erk
Copy link
Member Author

I-am-Erk commented Apr 7, 2024

This isn't really ready to merge, but it's ready for some more scrutiny now.

@I-am-Erk I-am-Erk marked this pull request as ready for review April 7, 2024 06:35
@github-actions github-actions bot requested a review from dseguin April 7, 2024 07:05
@github-actions github-actions bot added the Code: Tests Measurement, self-control, statistics, balancing. label Apr 13, 2024
@github-actions github-actions bot removed the json-styled JSON lint passed, label assigned by github actions label Apr 13, 2024
@github-actions github-actions bot added the json-styled JSON lint passed, label assigned by github actions label Apr 13, 2024
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actions github-actions bot added astyled astyled PR, label is assigned by github actions and removed astyled astyled PR, label is assigned by github actions labels Apr 14, 2024
@github-actions github-actions bot added the Monsters Monsters both friendly and unfriendly. label Apr 14, 2024
@I-am-Erk I-am-Erk marked this pull request as draft April 16, 2024 19:07
@I-am-Erk
Copy link
Member Author

Trying to add this in a simple form is just opening too many cans of worms, I am going to need to do a bit more infrastructure. not really surprising given the magnitude of the change.

  1. I think "Flinch", a mechanic for making speed penalties less deadly and annoying #73050 is necessary just to make these tests stop complaining so much. This adds a "flinch" mechanic, which strain will impact as well. Rather than being unable to attack at high strain, you'll 'flinch' more often as your strain bar reaches max. Even maxed out on strain you'll still be able to attack, but at reduced speed due to all the flinching.
  2. since ↑ would make strain do relatively little, we also need strength to drop off precipitously as you approach your strain limit. I would suggest that when you reach 80% of your strain meter, your strength starts linearly dropping until at 100% strain you have only 1/4 of your baseline strength left. Thanks to Pain is less painful #72955 we can do this without obnoxiously tanking carry weight and from there movement speed and such. This has a (probably) desired side effect that you might become too weak to continue drawing your bow; in a follow up PR though I'd really like to give you the chance to loose your arrow before the aim action is canceled. (in general, we're probably going to be looking more at how bows and aim work now)

I can do 2 pretty easily, but 1 will require a separate PR by me or someone smart.

@PatrikLundell
Copy link
Contributor

Becoming unable to attack (with a bow) due to strength loss was a major pain in the past, because the STR requirements were incredibly high, including a bow recipe for a bow that wasn't possible to be used by humans using either of the normal character generation methods (not the "grab whatever you feel like" one).
That has currently been alleviated by a reduction of the required STR, as well as the ability to adjust the bow tension to allow for a lower STR character to still use the good bows (to a lesser effect, of course).
Rapidly tanking STR brings all that back, which is not good. You'd then again have to have an "overpowered" character to make sure you're not rendered weaponless by a single unfortunate hit that hurts a lot.
Being able to flee would probably make the end situation marginally better than it was before, depending on how quickly STR loss would disarm you.

@I-am-Erk
Copy link
Member Author

I-am-Erk commented Apr 16, 2024

Remember, rapidly tanking STR in this case can only kick in at the end of strain. For a bow, that means you've been holding it drawn for some time, and your muscles have given out. It's not something that kicks in due to externalities... being hit by a zombie doesn't change your strain, for example.

In the longer term, strain should have different impacts on aim for the most part, and this should be mostly unimportant; on a first pass, having your aim action cancel because you tried to aim for a long time and your muscles gave out is not that big a problem, even if it's not where I want it to end.

Remember too, strain recovers in a few seconds. If your str drops, you have to shake your arms out for a moment and then you can try again.

@anoobindisguise
Copy link
Contributor

what else needs to be done for this to be mergeable?

@NetSysFire
Copy link
Member

  1. It has conflicts.
  2. Clang-tidy probably?

@I-am-Erk
Copy link
Member Author

I-am-Erk commented Apr 23, 2024

@anoobindisguise, per the comment:

Trying to add this in a simple form is just opening too many cans of worms, I am going to need to do a bit more infrastructure. not really surprising given the magnitude of the change.

1. I think ["Flinch", a mechanic for making speed penalties less deadly and annoying #73050](https://github.com/CleverRaven/Cataclysm-DDA/issues/73050) is necessary just to make these tests stop complaining so much. This adds a "flinch" mechanic, which strain will impact as well. Rather than being unable to attack at high strain, you'll 'flinch' more often as your strain bar reaches max. Even maxed out on strain you'll still be able to attack, but at reduced speed due to all the flinching.

2. since ↑ would make strain do relatively little, we also need strength to drop off precipitously as you approach your strain limit. I would suggest that when you reach 80% of your strain meter, your strength starts linearly dropping until at 100% strain you have only 1/4 of your baseline strength left. Thanks to [Pain is less painful #72955](https://github.com/CleverRaven/Cataclysm-DDA/pull/72955) we can do this without obnoxiously tanking carry weight and from there movement speed and such. This has a (probably) desired side effect that you might become too weak to continue drawing your bow; in a follow up PR though I'd really like to give you the chance to loose your arrow before the aim action is canceled. (in general, we're probably going to be looking more at how bows and aim work now)

I can do 2 pretty easily, but 1 will require a separate PR by me or someone smart.

However I ran out of easy computer time to do c++, so it's hanging on that for the time being.

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 May 23, 2024
@github-actions github-actions bot closed this Jun 23, 2024
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 [C++] Changes (can be) made in C++. Previously named `Code` Code: Tests Measurement, self-control, statistics, balancing. <Documentation> Design documents, internal info, guides and help. <Enhancement / Feature> New features, or enhancements on existing EOC: Effects On Condition Anything concerning Effects On Condition Info / User Interface Game - player communication, menus, etc. [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions [Markdown] Markdown issues and PRs Mechanics: Enchantments / Spells Enchantments and spells Melee Melee weapons, tactics, techniques, reach attack Monsters Monsters both friendly and unfriendly. NPC / Factions NPCs, AI, Speech, Factions, Ownership stale Closed for lack of activity, but still valid.
Projects
Status: Abandoned PRs with no one to pick them up
Development

Successfully merging this pull request may close these issues.

7 participants