Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.
Sign up[CR] Rebalance stamina recovery. #24052
Conversation
Night-Pryanik
added
Game: Balance
[C++]
[JSON]
labels
Jun 19, 2018
Night-Pryanik
reviewed
Jun 19, 2018
| mod_stat( "thirst", AddThrist ); | ||
|
|
||
| int StaminaIncreaseFatigue = get_option< int >( "PLAYER_RECOVER_STAMINA_INCREASE_FATIGUE" ); | ||
| float AddFatigie = roll_remainder( stamina_recovery * turns / 1000.0f * StaminaIncreaseFatigue ); |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Vasyan2006
Jun 19, 2018
Author
Contributor
Should npc have 1/4 rate of stamina decreasing, like for hunger and thrist? They must have buff, but not sure how to implement it better.
| } | ||
| if( u.move_mode == "run" && u.has_effect( effect_winded ) ) { | ||
| u.toggle_move_mode(); | ||
| add_msg(m_bad, _("You're too tired to run.")); |
This comment has been minimized.
This comment has been minimized.
Night-Pryanik
Jun 19, 2018
Member
I'd rephrase that. "Tired" means character has high fatigue, but this case is about low stamina (he may not be tired at all).
This comment has been minimized.
This comment has been minimized.
This itself might be a game_balance.json EXTERNAL_OPTION for easy access. Also, this exhaustion mechanic needs a strong feedback for a player, possibly by add_effect()/remove_effect() compilation, so player would know of his/her exhaustion level.
Rationale: after long hours of skull breaking with your hammer you simply know that after another short break your body will give up after a skull or two, even if you regain that little energy for those few swings. Also: you regain your "deep" stamina not only by sleeping, but by resting too, so maybe allow it's regen when player is idle for extended ammount of time, for example using 'wait' option to wait 2h might be equal to a long rest giving you that much needed "second wind". Another thing to think about: should caffeine and certain drugs affect this pool? |
This comment has been minimized.
This comment has been minimized.
|
Edit equations so stamina penalty can be disabled via jsons. Reduce penalties for npc. |
This comment has been minimized.
This comment has been minimized.
This is a good point. We should also keep in mind that some late-game characters do not sleep at all, whether due to mutations or chemical means. |
This comment has been minimized.
This comment has been minimized.
|
@nexusmrsep exhaustion level can be visible in the UI by the length of stamina bar. It will not increase after ||\ if stamina pool is only 500 for example. But better indication is required. |
This comment has been minimized.
This comment has been minimized.
Somehow i didn't thought of that, thinking instead that stamina bar would represent new value (ex. 500) as a new 100%. Still I encourage you to implement the add_effect idea, so player would know why did stamina stopped rising above certain level.
Stimulants like atomic_coffee have use functions in iuse.cpp, see function iuse::atomic_caff for reference. |
This comment has been minimized.
This comment has been minimized.
|
I smash one body and lose 25% of my stamina that I can't get back unless I sleep or wait 2 hours? Please tell me that's not what this is. Compared to a year ago, I'm already using |
This comment has been minimized.
This comment has been minimized.
|
@NickGrease 25% of your stamina will return after few minutes. But stamina pool will decrease from 1000 to 999. After another body it will decrease to 998 etc. Only after smashing few hundreds bodies you will see significant decreasing. This will prevent players from doing unrealistic amount of physical activities per day. |
This comment has been minimized.
This comment has been minimized.
|
@Vasyan2006 Whew, you scared me there. This sounds pretty good than! You've listed some debuffs you'll get at lower stamina, will there be any buffs? This seems like a good place to tie in |
This comment has been minimized.
This comment has been minimized.
|
If it's alright for me to be blunt, what does this add to gameplay other than realism? For the average player, this will result in their stamina not regenerating to maximum for a reason that isn't immediately obvious or relayed in any way, which might lead a lot of people to think it's bugged. In practice, all this will do is force people to fight smaller groups before leaving, and makes the earlygame needlessly difficult due to how quickly a character in that time will become exhausted, with having to fight, search, and flee very often until they find a car or stabilize with better weapons. This seems like it punishes players for playing the game, by vastly increasing their needs while they do things that a normal survivor has to do anyway. How, for the average player who plays the game casually and doesn't involve themselves in development or anything, does this improve the game? |
This comment has been minimized.
This comment has been minimized.
|
I can understand the logic behind becoming increasingly tired / fatigued from continuous hard manual labor (no matter how much you stop to "catch your breath", your muscles will still be sore). And I can see this as somewhat of a push towards making late-game survivors having to rest more often (rather than go days without it, as Rivet accurately pointed out). Two things I don't see that I believe should be relevant: strength of the survivor and overall health. A high Strength survivor should not succumb to the same effects as one with 4 Strength (as the current code suggests "world-class athlete" with 14 Strength would be just as affected as a survivor with "average" 8 Strength). A sliding scale may be prudent to maintain some normalcy (so it may take longer for the high Strength survivor to reach say, 50% of max stamina than one with average Strength, but when they both reach 50%, the following effects [under <50%] become the same progression). Example graph: Secondly, health stat could be utilized to greatly improve stamina regeneration during sleep (this is completely silly but with 100 health, survivor should completely regain stamina in an uninterrupted sleep session, whereas a survivior with -100 health would barely regain any stamina) -- simulating you may have big muscles but if your diet and nutrition is poor, so too will your body's performance. I also agree with nexus on having some capstones present themselves as effects in the @ menu -- since players (especially new ones) will be very confused with their stamina isn't regenerating past a certain point -- giving them the resource and ability to understand this themselves without requiring code-diving or constantly asking for help -- I'd suggest setting them at 10% [ edit: I forgot to mention, could you give a sample scenario so we can get a better idea of how the stamina loss will progress? So every tile a survivor runs, that's a "permanent" loss of stamina until rest (basically can only run 500 tiles before needing to rest seems incredibly harsh)? Or example, smashing one zombie corpse costs 5 stamina, but you can recover up to 25% like normal, so the player stamina would have jumped down to 995, but can recover up to 999 (-1 from "permanent" stamina loss until rest)? I think the biggest issue will be the dramatic effect that running will have on stamina loss and would need a much more clear indication how that is supposed to work and why. Keep in mind the distance humans can walk in a day on average (2.5 to 3 miles) and all the various ("walking" ones mainly) marathons that are completed within a day and cover 22-30 miles. |
This comment has been minimized.
This comment has been minimized.
|
@Xhuis Wrote:
How did you go from that, to:
This is also optional. The 'new' player likely won't be smashing 100's of corpses, the average player is aware of the character screen and knows to check it if things don't seem right (I assume effects like |
This comment has been minimized.
This comment has been minimized.
|
Maximum realism, and complexity is the main virtue of this game, and the main reason why many people play and enjoy it. This and the neverending quest for enhanced realism is not standing in any way against casual play. Players are given multitude of options to customize gameplay. Simply ask for an option to use simplified (current) stamina system instead of this more realistic and sophisticated one. Then it would be fine for casual games. Good scalability and elasticity of the options can also be a virtue. Your style of gameplay is no better then mine. Mutual respect and understanding in such cases is far better then 0/1 judgment. If you accept the principles guiding the developement you can without unneccesary emotions ask for making exceptions in forms of options or mods. No game will ever satisfy everyones image of it, but we can and hopefully will find a way to fullfill as much expectations as it is possible, while achieving development goals. That is my humble opinion. Also nothing stands against implementing better feedback for reasons behind stamina not regenerating fully. See my previous comments above. |
This comment has been minimized.
This comment has been minimized.
|
Need a clearer rationale for this effect. @DracoGriffin is assuming its muscle fatigue, which seems reasonable, but it's not clear from anything else that that is the intent. Assuming that's correct, I agree it needs to be a sliding scale based on character strength, very strong characters would definitely be able to keep going longer than weak ones. Also, I hope to find some indications of real world endurance numbers and recovery speeds instead of making them arbitrary. |
This comment has been minimized.
This comment has been minimized.
|
@NickGrease This, as it stands, isn't optional; it's a change to the game with no setting at the moment. As such, I think it's alright for me to hold an opinion against it. @nexusmrsep I do agree that having an option for this, or a setting, would be preferable to what it is now. My concern is that, if such changes become so common with settings implemented to change them, that it might become overwhelming to people just dipping into the game and setting a massive amount of settings available to them. Now, I do know it somewhat already is, but I'm just a little worried that it might make it worse, is all. That's not to say the change should be outright rejected - just that (in my eyes) it should be weighed in terms of how much it adds or detracts from the game in comparison to without it before it's accepted or denied. |
This comment has been minimized.
This comment has been minimized.
|
@Xhuis You are correct, it's not optional atm. @kevingranade wrote:
Depending on your view of weak and strong, strong (think bodybuilder) usually means less endurance, and weak(er) (think long distance runners) usually have much higher endurance. Could be an interesting trade-off in game.. |
This comment has been minimized.
This comment has been minimized.
The only way I see this working within the constraints of the system now is some very complex relationships between Strength and Dexterity; which is quite beyond this PR. Instead, I'd suggest you really plan this out and make a new issue about it with more of a broad spectrum on how it would perform and inter-relate and hope someone else would eventually code it in -- that is, if you weren't capable of implementing it yourself. If you are, then make a new PR and detail that work, along with the proof of concept code (even if it's somewhat basic, as long as the goal is achievable and then people could pick up on it and build on afterwards). |
This comment has been minimized.
This comment has been minimized.
|
@Vasyan2006 can you also do some tests in a predefined environment and describe for most common exhausting tasks how many repetitions of such task would limit your stamina to a certain level. For ex. How many zombie bodies would i actualy need to pulp or butcher to reduce my stamina by maximum penalty applied by your variables droping its maximum to 75%? This would give everybody the idea of scope of this PR's actual effect on the gameplay. How many "laps" can i run in seqence (run till exhausted, rest, repeat) till i hit the limit? Etc. |
This comment has been minimized.
This comment has been minimized.
|
Description was updated, hope it is more understandable now. The question about Strength is based on a lack of the Constitution (or Endurance) stat. It is mostly represented by Strength but not entirely (bodybuilder vs marathon runner). Strength is indirectly included in the slow stamina decreasing, because character with more strength spend less stamina on most actions and spending less stamina means less penalties. |
This comment has been minimized.
This comment has been minimized.
|
@DracoGriffin To be fair, I didn't bring up Strength, Dexterity, Endurance or the relationship between them; so I'm not sure it would fall on me to PR a reply to a reply. I pointed out that rarely will you find things requiring high endurance dominated by bodybuilders, and offered an off the cuff idea, that if implemented that way, it might be interesting to tie high strength to lower endurance. Still, this is a [CR], and although sometimes it's difficult to draw the line between [CR] and [IR] (Ideas Requested), I don't think the latter should be discouraged just because it isn't attached to a full fledged, in-depth, [PR]. |
This comment has been minimized.
This comment has been minimized.
I think you misread my tone. It was meant more of "Hey, that is a good point and a good idea". However, that would involve looking more at the stats and understanding the relationships before we start modifying things -- basically, when should high Dexterity be more important in determining stamina loss/consumption doing X task or Y attack, and when would Strength be more of factor when doing action B or doing C, and when should they both be used -- equally, unequally, etc. For instance, you can say Dexterity should be more important in reducing stamina loss when running, but Strength should also factor in at a more minor contribution (say, 75% Dex, 25% Str) and so on. Another example could be smashing corpses: maybe Dexterity is useful in the technique of the swing or such, but not nearly as useful as Strength (this is more based on ergonomics - such that picking up a "25 lb. box requires about 700 lb of force to pick up" pg 3 or how bending at the back instead of knees increases force to pick up 10 lb box from 10 to 100 [up to slide 6].) None of what I said previously was to dissuade or stifle your suggestion -- I'm just clarifying it's best suited as an overview and potential information for progressive PRs that may build upon this one if it is accepted once Vasyan2006 details some of kevin's concerns. |
This comment has been minimized.
This comment has been minimized.
|
I dont have any particularly reason for stamina penalty so lets call it common muscle fatigue. |
This comment has been minimized.
This comment has been minimized.
Rebasing was required. |
Vasyan2006
force-pushed the
Vasyan2006:stamina
branch
Jun 23, 2018
This comment has been minimized.
This comment has been minimized.
Doing some good work Vasyan, however just want to point these out for you. That's three points kevin would like addressed, I'm assuming you're following the muscle fatigue for the first point. Looks like you've tackled the second point. Third, you should offer some research/data on how far humans can walk/run to support or change your values (if you find that you set your values too low/high, they should be readjusted). And as an aside, what's the rationale behind adding penalties to certain comestibles? If a survivor is still getting their correct caloric intake, appropriate vitamins and such, why should using those items penalize the player? And if you're suggesting that caffeine would weaken a player in some form -- studies report that caffeine can actually improve performance and muscle growth. So those items you marked with penalties would have the opposite effect. Sources: One Two Three Second source:
The third source is the most interesting:
|
This comment has been minimized.
This comment has been minimized.
|
@DracoGriffin I think it's a wording issue, in this case a negative value is a positive outcome - as in the stamina penalty for a given task is 100, drinking coffee brings the penalty down to 75 (-25). |
This comment has been minimized.
This comment has been minimized.
|
Items like coffee suppose to reduce fatigue and increase stamina, so penalty change is negative as mentioned by @NickGrease. This is for characters who dont sleep due to drugs and cannot recover stamina in the common way. For RL evaluations we can use army march standards (for above average character with 10+ strength and dexterity) for example https://armypubs.army.mil/epubs/DR_pubs/DR_a/pdf/web/ARN3051_ATP%203-21x18%20FINAL%20WEB.pdf (pages 3-7 and 3-8). But it is not clear how long is 1 mile after the cataclysm, so we cannot use it directly. |
Vasyan2006
added some commits
Apr 9, 2019
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
Mcrone617
commented
Apr 13, 2019
|
Hey @Vasyan2006 I'm working with @DracoGriffin and we're trying to use the Reddit participation to help out with PR testing. Your PR will definitely get merged a lot quicker if even 5-10 people test it out and give some feedback, so would you be interested in making a release based around the latest experimental? If you do this, and make a downloadable link via your release tab on Github, we can pretty easily advertise it on Reddit, and hopefully get the community to find if the stamina rebalance is good to go; or if it needs work still, what to work on. Let me know if you're interested or have questions on how to make a release, I'll be sure to help out any way I can. Ideally let me know in the next day or so, and we can advertise your PR in the weekly changelog. Hope to hear from you! |
This comment has been minimized.
This comment has been minimized.
|
Version 0.0.1 demo prealpha was releases! As an issue, with latest stomach PR it is difficult to see without logging are hunger and thirst increases were added by stamina usage or by stomach mechanics itself. |
This comment has been minimized.
This comment has been minimized.
Mcrone617
commented
Apr 13, 2019
Thanks for the quick response, it is unfortunate that some people will be slightly confused with the hunger changes, but I feel that people will still be able to test the important bits of this PR, specifically the fact that the stamina bar drops down over the day. |
This comment has been minimized.
This comment has been minimized.
Yup.
Or drinking coffee.
Character will get hunger/thirst/fatigue increase proportionally to stamina he used to any actions. It is calculated separately from stamina pool penalty and does not depends on actual fast stamina value. If stamina is below 10% character will get
Stamina recovery rate will be reduced twice after a day without sleep or stimulants (250 fatigue or Add info effect visible in @ screen to notify player if stamina pool was reduced by 10%, 25% or over 50%. Riding a bicycle will not increase needs, as it will be applied from stamina drain. NPCs will get 25% of penalties. Their needs will not increase with "Disable NPC Needs" mod. Rates for getting max stamina penalty and hunger/thirst/fatigue increases are in game_settings.json and can be modded. |
This comment has been minimized.
This comment has been minimized.
paulenka-aleh
commented
Apr 13, 2019
I used to play with sleep deprivation mode where it's not that healthy. Your changes sound great too. Would they work together well? |
This comment has been minimized.
This comment has been minimized.
New changes should work with any mod, but having both effects can be unbalanced. |
This comment has been minimized.
This comment has been minimized.
|
To clarify: increase hunger means decrease stored nutritions from stomach PR, not actual hunger meter. |
This comment has been minimized.
This comment has been minimized.
Mcrone617
commented
Apr 14, 2019
|
https://www.reddit.com/r/cataclysmdda/comments/bcyp5y/new_pr_testing_needed_for_the_upcoming_stamina/ |
This comment has been minimized.
This comment has been minimized.
|
Nice, will keep track of it. |
Vasyan2006
added some commits
Apr 21, 2019
KorGgenT
reviewed
May 1, 2019
| @@ -220,8 +220,8 @@ TEST_CASE( "hunger" ) | |||
| print_stomach_contents( dummy, print_tests ); | |||
| printf( "eat 2 cooked meat\n" ); | |||
| } | |||
| CHECK( hunger_time <= 270 ); | |||
| CHECK( hunger_time >= 240 ); | |||
| CHECK( hunger_time <= 320 ); | |||
This comment has been minimized.
This comment has been minimized.
KorGgenT
May 1, 2019
Contributor
note that because of the way all of these are coded, they can only actually be multiples of 30.
This comment has been minimized.
This comment has been minimized.
|
Jenkins rebuild |
This comment has been minimized.
This comment has been minimized.
|
Any reason why Travis has different results for hunger tests? The difference is about 50%. The only reason I see is because roll_remainder() returns different hunger values every 5 minutes for noninteger hunger rate, and this difference can be important on short time scales. |
This comment has been minimized.
This comment has been minimized.
|
i can try to investigate later today. |
This comment has been minimized.
This comment has been minimized.
|
so why exactly did you have to change the hunger rates and stuff in game_balance.json? this makes the hunger logic totally wacky. (i haven't forgotten about running the tests btw, but i didn't need to run them to see this problem first.) |
This comment has been minimized.
This comment has been minimized.
|
Because present value of hunger (2500 Cal/day) includes some sort of activity which will be calculated from stamina consumption, so hunger was reduced to BMR. |
This comment has been minimized.
This comment has been minimized.
|
i would not mind taking over the reigns of actual calorie burn due to activities. this will allow you to have to do less in the PR and focus on the stamina part, especially because I have a pretty detailed plan in #29528 |
This comment has been minimized.
This comment has been minimized.
Excellent idea, thanks!
Dont worry about it. Your PR definitely will be finished and merged before this one and it will be my fault not to resolve all new merge conflict and not to update unit tests. |
Vasyan2006
added some commits
May 5, 2019
This comment has been minimized.
This comment has been minimized.
|
Base rates for hunger, thirst and fatigue will not be changed to make Travis happy. If it is planned to calculate BMR for every character separately then it should be discussed in separate PR. 1 stamina point will cost 0.07 Calorie instead of 0.008 nutrition. To get rid of old food measurement system. |
This comment has been minimized.
This comment has been minimized.
|
Dont want to criticize, but recently merged activity PR has some fundamentals flaws:
In this PR I made an assumption that calorie burning from any action is proportional to its stamina cost and all actions are already balanced in their own parts of the code. This mechanic returns much more accurate results with less interventions to the code. I am already tired of updating this PR for almost a year and have no intentions to continue. |

Vasyan2006 commentedJun 19, 2018
•
edited
Summary
SUMMARY: Balance "Rebalance stamina recovery"Purpose of change
Add some simulation of common muscle fatigue and prevent characters from doing unrealistic amount of physical activity per day.
Describe the solution
Using stamina on any action will slowly decrease available stamina pool, so it will be more difficult for a character to stay in combat for long time.
Stamina pool will regenerate during sleep or by using stimulants.
Mutations which change
fatigue_modifierandfatigue_regen_modifier(more/less sleep) will also change penalty and stamina pool recovery rates.Add settings in
game_balance.jsonto change rates of applied effects or disable them completely.Comestible items will have new attribute
stamina_pool_recoverywith obvious effect. It is added to coffee, energy drinks and meth because they already restore fatigue.Effect
windedwill be applied if characters stamina is below 10%. It will decrease strength and speed, so stamina management will be important for melee combat.Stamina recovery rate will be reduced twice after a day without sleep or stimulants (based on actual fatigue value) and it will be only 10% of initial after two days without sleep.
Stamina recovery will increase hunger, thirst and fatigue rates.
Default hunger rate was set to basal metabolic rate for average Joe survivor calculated base on equation inhttps://en.wikipedia.org/wiki/Basal_metabolic_rate
Same effects will be applied to NPCs, but they will get only 25% of penalties.
Add
stamina_usedvariable too store number of used stamina points between checks every 5 minutes. It can be used later as a measure of overall physical activity.Add info effect to notify player if stamina pool was reduced by 10%, 25% or over 50%.
Stamina bar on the side panel will not restore completely is characters max stamina was decreased. For example it will not recover above
||\..if stamina pool was reduced by 50%.Riding a bicycle will not increase needs, as it will be applied from stamina drain.
Add "no stamina penalty" mod. It is in rebalance category and will disable following changes from this PR: