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] Rebalance stamina recovery. #24052

Closed
wants to merge 60 commits into from

Conversation

@Vasyan2006
Copy link
Contributor

commented Jun 19, 2018

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_modifier and fatigue_regen_modifier (more/less sleep) will also change penalty and stamina pool recovery rates.

Add settings in game_balance.json to change rates of applied effects or disable them completely.

Comestible items will have new attribute stamina_pool_recovery with obvious effect. It is added to coffee, energy drinks and meth because they already restore fatigue.

Effect winded will 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 in
https://en.wikipedia.org/wiki/Basal_metabolic_rate

Same effects will be applied to NPCs, but they will get only 25% of penalties.

Add stamina_used variable 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:

  • Using stamina will not decrease stamina pool or increase needs,
  • Effect "winded" (it is coded and will still apply if stamina is below 10%) will not apply any penalty.
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.

Copy link
@Night-Pryanik

Night-Pryanik Jun 19, 2018

Member

Typo: should be "AddFatigue".
Also, no fatigue increase for npc?

This comment has been minimized.

Copy link
@Vasyan2006

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.

Copy link
@Night-Pryanik

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).

@nexusmrsep

This comment has been minimized.

Copy link
Contributor

commented Jun 19, 2018

Using stamina for any action will reduce stamina pool up to 25%.

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.
For example:

  • 10% penalty : exhausted : You are exhausted by physical work you've done. Your avalaible stamina is somewhat limited.
  • 20% penalty : exerted : You are exerted by physical work you've done. Your avalaible stamina is strongly limited.
  • 25% penalty : spent : You are spent by physical work you've done. Your avalaible stamina is extremaly limited.

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?

@Vasyan2006

This comment has been minimized.

Copy link
Contributor Author

commented Jun 19, 2018

Edit equations so stamina penalty can be disabled via jsons. Reduce penalties for npc.

@Rivet-the-Zombie

This comment has been minimized.

Copy link
Member

commented Jun 19, 2018

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".

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.

@Vasyan2006

This comment has been minimized.

Copy link
Contributor Author

commented Jun 19, 2018

@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.
Using stimulators to recover slow stamina is good, but I have no idea how to implement it in terms of game mechanics.
It is possible to recover some stamina it character doing nothing or reading a book (i.e. zero stamina loss per turn), but it will interfere with building or butchering or any other long physical activity.

@nexusmrsep

This comment has been minimized.

Copy link
Contributor

commented Jun 19, 2018

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.

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.

Using stimulators to recover slow stamina is good, but I have no idea how to implement it in terms of game mechanics.

Stimulants like atomic_coffee have use functions in iuse.cpp, see function iuse::atomic_caff for reference.
Adding additional stamina_penalty modification in few places, would not be hard i guess.

@NickGrease

This comment has been minimized.

Copy link
Contributor

commented Jun 19, 2018

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 Wait 5/30 100 times more then I used to. It already feels like I can do less and less each day in game. This seems like more you must idle to enjoy this game or you must do nothing just to continue playing

@Vasyan2006

This comment has been minimized.

Copy link
Contributor Author

commented Jun 19, 2018

@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.
Anyway this feature can be tuned and disabled in settings.

@NickGrease

This comment has been minimized.

Copy link
Contributor

commented Jun 19, 2018

@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 Well Rested from getting a good sleep. Maybe with high/full stamina some tasks can be done faster/use less stamina?

@Xhuis

This comment has been minimized.

Copy link
Contributor

commented Jun 19, 2018

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?

@DracoGriffin

This comment has been minimized.

Copy link
Member

commented Jun 19, 2018

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

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% [Achy: Your muscles are beginning to ache from the constant exertion. Your stamina is temporarily limited by 10% until you rest.], 25% [Stiff: Your muscles are starting to become stiff and difficult to move. Your stamina is temporarily limited by 25% until you rest.] and finally 50% [Sore: Your muscles are extremely sore and exertion requires much more effort now. Your stamina is temporarily limited by 50% until you rest]. Maybe even 75%, but I think by then most survivors will have slept, and I don't think players will choose to continue once they realize the issue.

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.

@NickGrease

This comment has been minimized.

Copy link
Contributor

commented Jun 19, 2018

@Xhuis Wrote:

Agreed that this is a good thing. People come to Cata for different things - some praise its realism, and some praise the crazy stuff and gameplay. Allowing both parties to enjoy the game more fully is, in my eyes, a good thing no matter how you view it.

How did you go from that, to:

what does this add to gameplay other than realism

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 winded and such will show up there), and the realistic type player might agree that absurd amounts of physical activity with no/minimal downside, could use a tweak/fix. As described, this doesn't seem to bad, but I'll reserve judgement for a bit and see how it plays out.

@nexusmrsep

This comment has been minimized.

Copy link
Contributor

commented Jun 19, 2018

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.

@kevingranade

This comment has been minimized.

Copy link
Member

commented Jun 19, 2018

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.

@Xhuis

This comment has been minimized.

Copy link
Contributor

commented Jun 19, 2018

@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.

@NickGrease

This comment has been minimized.

Copy link
Contributor

commented Jun 19, 2018

@Xhuis You are correct, it's not optional atm.

@kevingranade wrote:

sliding scale based on character strength, very strong characters would definitely be able to keep going longer than weak ones

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..

@DracoGriffin

This comment has been minimized.

Copy link
Member

commented Jun 20, 2018

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..

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).

@nexusmrsep

This comment has been minimized.

Copy link
Contributor

commented Jun 20, 2018

@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.

@Vasyan2006

This comment has been minimized.

Copy link
Contributor Author

commented Jun 20, 2018

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.

@NickGrease

This comment has been minimized.

Copy link
Contributor

commented Jun 20, 2018

@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].
If the rules have changed around here, I'll be happy to edit my comments to longer include ideas.

@DracoGriffin

This comment has been minimized.

Copy link
Member

commented Jun 21, 2018

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].
If the rules have changed around here, I'll be happy to edit my comments to longer include ideas.

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.

@Vasyan2006

This comment has been minimized.

Copy link
Contributor Author

commented Jun 21, 2018

I dont have any particularly reason for stamina penalty so lets call it common muscle fatigue.
Using stamina consumption as a measure of exhaustion looks most simple and affective for me, because characters with different stats must spend different amount of stamina on the same actions. Unfortunately it is not realised and stamina cost of most activities is constant for now, but its rebelance should be done as a separate PR.

@Vasyan2006

This comment has been minimized.

Copy link
Contributor Author

commented Jun 23, 2018

  • Add sugested effect to inform player about penalty,
  • Needs increasings scale with traits,
  • Add "stamina_penalty" parameter to comestible items, only coffee and energy drinks have it for now.

Rebasing was required.

@Vasyan2006 Vasyan2006 force-pushed the Vasyan2006:stamina branch Jun 23, 2018

@DracoGriffin

This comment has been minimized.

Copy link
Member

commented Jun 23, 2018

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.

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:

Furthermore, low-intensity exercise with LC compound increases muscle mass, satellite cell activity, and anabolic signals. These results suggest that administration of LC compound could effectively increase muscle mass concomitant with elevated myonuclei, even with low-intensity exercise, by means of activated satellite cells and anabolic signals in skeletal muscle.

The third source is the most interesting:

In comparison to the placebo trial, the caffeine trial resulted in 1.1% (90% CI 0.4-1.6) and 1.0% (0.2-2%) faster times for the well-trained and recreational runners. Reliability testing of the recreational runners indicated a test-retest error of measurement of 1.4%. We conclude that caffeine ingestion is likely to produce small but significant gains in 5-km running performance for both well-trained and recreational runners.

@NickGrease

This comment has been minimized.

Copy link
Contributor

commented Jun 24, 2018

@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).

@Vasyan2006

This comment has been minimized.

Copy link
Contributor Author

commented Jun 24, 2018

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.
Or instead of changing items properties we can change iuse functions caff, stimpack and meth because they provide signifficant fatigue boost and must increase stamina pool. Not sure which way is better, but changing item properties looks more flexible.

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

@Vasyan2006

This comment has been minimized.

Copy link
Contributor Author

commented Apr 9, 2019

starve_test_hunger3 failed because base hunger rate was decreased from 1 to 0.65.

@Mcrone617

This comment has been minimized.

Copy link

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!

@Vasyan2006

This comment has been minimized.

Copy link
Contributor Author

commented Apr 13, 2019

Version 0.0.1 demo prealpha was releases!
Compiled for windows with SDL tiles. All required dll are included so it should be playable without additional magic.
https://github.com/Vasyan2006/Cataclysm-DDA/releases/download/0.0.1/stamina.zip
https://github.com/Vasyan2006/Cataclysm-DDA/releases/tag/0.0.1

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.

@Mcrone617

This comment has been minimized.

Copy link

commented Apr 13, 2019

Version 0.0.1 demo prealpha was releases!
Compiled for windows with SDL tiles. All required dll are included so it should be playable without additional magic.
https://github.com/Vasyan2006/Cataclysm-DDA/releases/download/0.0.1/stamina.zip
https://github.com/Vasyan2006/Cataclysm-DDA/releases/tag/0.0.1

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.

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.
Just to clarify, the way your rebalance works is that people now have slowly reducing "stamina" over the day, and the only way to regain it is by waiting/sleeping? Or is it only sleeping that works. Also it has the effect of increasing hunger/thirst/stamina bar if your stamina level is too low right? Anything else major that I missed?

@Vasyan2006

This comment has been minimized.

Copy link
Contributor Author

commented Apr 13, 2019

Just to clarify, the way your rebalance works is that people now have slowly reducing "stamina" over the day,

Yup.

the only way to regain it is by waiting/sleeping

Or drinking coffee.
Item which currently restore fatigue will have stamina_pool_recovery property and will reduce penalty.
Because drinking atomic coffee every day instead of sleeping is 100% healthy and natural.
In addition, fatigue-related mutations will change stamina penalty and recovery rates, so night elfs-a will get less penalty and will recover faster during sleep.
Technically slow stamina will restore if character has Character::rest_quality() above zero, but for now it is set to 1 for sleeping and to 0 for all other situations.

Also it has the effect of increasing hunger/thirst/stamina bar if your stamina level is too low right?

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.
Default hunger rate was reduced by 35% and set to basal metabolic rate.

If stamina is below 10% character will get winded effect, which will decrease strength, speed and increase pain. This effect is in the game for long time, but it was quite difficult to get it. I am not sure if this effect should increase needs in addition to the main increment from using stamina.

Anything else major that I missed?

Stamina recovery rate will be reduced twice after a day without sleep or stimulants (250 fatigue or tired) and it will be only 10% after two or more days without sleep (over 500 fatigue or deadly tired). It depends only on fatigue value, so coffee can help.

Add info effect visible in @ screen to notify player if stamina pool was reduced by 10%, 25% or over 50%.
Stamina bar on the side panel will not restore completely if 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.

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.
Add new mod "No Stamina Penalty" to set these values to 0 and disable their effects.

@paulenka-aleh

This comment has been minimized.

Copy link

commented Apr 13, 2019

Because drinking atomic coffee every day instead of sleeping is 100% healthy and natural.

I used to play with sleep deprivation mode where it's not that healthy. Your changes sound great too. Would they work together well?

@Vasyan2006

This comment has been minimized.

Copy link
Contributor Author

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?

New changes should work with any mod, but having both effects can be unbalanced.

@Vasyan2006

This comment has been minimized.

Copy link
Contributor Author

commented Apr 13, 2019

To clarify: increase hunger means decrease stored nutritions from stomach PR, not actual hunger meter.

@Mcrone617

This comment has been minimized.

Copy link

commented Apr 14, 2019

https://www.reddit.com/r/cataclysmdda/comments/bcyp5y/new_pr_testing_needed_for_the_upcoming_stamina/
here's a link to the reddit thread, expect some responses there, and some here, so I would keep an eye on the thread over the next week. Let me know if you want me to change anything in the post also, I tried to do your work justice, but it is complicated, so I could have said something misleading. Here's to hoping you get some good feedback on this stuff!

@Vasyan2006

This comment has been minimized.

Copy link
Contributor Author

commented Apr 14, 2019

Vasyan2006 added some commits Apr 21, 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.

Copy link
@KorGgenT

KorGgenT May 1, 2019

Contributor

note that because of the way all of these are coded, they can only actually be multiples of 30.

@Vasyan2006

This comment has been minimized.

Copy link
Contributor Author

commented May 1, 2019

Jenkins rebuild

@Vasyan2006

This comment has been minimized.

Copy link
Contributor Author

commented May 1, 2019

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.

@KorGgenT

This comment has been minimized.

Copy link
Contributor

commented May 1, 2019

i can try to investigate later today.

@KorGgenT

This comment has been minimized.

Copy link
Contributor

commented May 3, 2019

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.)

@Vasyan2006

This comment has been minimized.

Copy link
Contributor Author

commented May 3, 2019

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.
And because this game settings were created in ancient times when calories was not invented and food was measured in nutrition units.

@KorGgenT

This comment has been minimized.

Copy link
Contributor

commented May 3, 2019

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
(i've got some free time coming up next week, so i don't doubt i'll be able to finish it quickly)

@Vasyan2006

This comment has been minimized.

Copy link
Contributor Author

commented May 4, 2019

to have to do less in the PR

Excellent idea, thanks!
It is very kind of you to offer your help in removing on of the main feature in already finished PR, only because you have a pretty detailed plan.
No doubt your new Combat activity will be very simple to code and balance, because all combats are literally the same for any characters.
Wouldn't you mind to help me a bit more and close this PR? So I will do less and focus on more important things.

so i don't doubt i'll be able to finish it quickly

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

upd
@Vasyan2006

This comment has been minimized.

Copy link
Contributor Author

commented May 5, 2019

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.
This will make new stamina system unfinished, but if players want to reduce basic needs - they can be mod them as prefer.

1 stamina point will cost 0.07 Calorie instead of 0.008 nutrition. To get rid of old food measurement system.

@Vasyan2006

This comment has been minimized.

Copy link
Contributor Author

commented May 19, 2019

Dont want to criticize, but recently merged activity PR has some fundamentals flaws:

  • Only the highest activity in the last 30 minutes will be taken into account.
    This makes poking a lemming with a stick equal to nonstop fighting for half an hour.

  • Mutations, encumbrance and other factors will not modify calorie consumption, so tree and bird mutants will burn the same amount of calories during running. It if technically possible to include them, but this will require to copy code parts from all actions to corresponding activities.
    But instead calorie consumption is modified by character age, because age is much more important than mutations. This example perfectly show development priorities: Lets use BMR equation instead, it sounds very scientific! Yay!
    Despite the fact that the BMR equation is empirical, it is merely statistic over different human bodies and does not explain why some peoples need more calories and other need less.

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.
As the result foot encumbrance and mutations will modify calorie burning from walking and running without any effort from my side, because they already modify move cost and stamina cost.
Same for swimming, melee attacking, throwing, bicycle riding and probably some other actions I dont know about.
In the same way skills and equipment are included. Character with high skills and good weapon can kill enemies faster, will use less stamina and will lost less calories at the end.
Even torsion CBM will consume calories because it already consumes stamina.

This mechanic returns much more accurate results with less interventions to the code.
But it does not involve character age so it was ignored and replaced with something far inferior.

I am already tired of updating this PR for almost a year and have no intentions to continue.
Closed. Enjoy your activities.

@Vasyan2006 Vasyan2006 closed this May 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.