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 upHunger and starvation improvements #24210
Conversation
bolaft
added some commits
Jul 5, 2018
This comment has been minimized.
This comment has been minimized.
|
Very interesting! |
This comment has been minimized.
This comment has been minimized.
|
Great addition, extremely clear reasoning and details. Very good work. edit: I think changing "inanition" would be a good idea, but honestly, I can't think of anything better. It is quite appropriate. However, I feel outside of translations, it's going to be a bit difficult for ESL people having a difficult time understand what it means (that is, it's not readily accessible, although honestly, I bet there will be English speakers that won't know the term either). Which can be fine, it's a good way to learn vocabulary and there are other things, but meh. This is really the only nitpick I have for this PR. Eagerly looking forward to it. |
This comment has been minimized.
This comment has been minimized.
|
Thanks for the feedback! Yeah I'm not too happy with "inanition" either actually. I didn't think of ESL people though, even though I am one myself. Initially I intended to use two differents modifiers, a "Hunger" speed modifier and a "Malnourished" modifier. However the I could tweak it so there are two separate speed modifiers, but I think I would have a hard time getting exactly the same modifier values as before. Or, I could just change "inanition" to something else, but I'm not sure what. "lack of food" maybe? |
This comment has been minimized.
This comment has been minimized.
|
Could this be integrated with nutrition instead? They are already added/removed from food/lack-of-food, and decoupled from hunger itself. It would make sense that a "calorie" nutrient be added and used for this, instead of a new (hidden) statistic. It would also make sense from a data perspective - food would have, in addition to nutrients, a caloric value. So long as this is kept reasonable to real values, this would make it intuitive for folks adding new foods. I wonder if you might even scale the depletion based on player activity, as well. |
This comment has been minimized.
This comment has been minimized.
|
@draeath Maybe I'm not understanding your suggestion right, but I don't really see how using the nutrition system for this would address the starvation issues? If "calories" became a nutrient similar to "Vitamin C" for example, it would not really solve the issue of the "bottomless pit stomach", nutrition needs are linear currently. So if a character misses a week's worth of calories, they would need to eat a week's worth of calories to go back to normal. Moreover, I don't think the nutrition system allows for gradual recovery: if a character has scurvy, taking three multivitamins fixes it instantly, and the same would go for calories: taking a week's worth of food at once would be required to fix it. And if the hunger is capped, then it would be impossible to keep up with caloric nutritional need, which would keep going down while the character is unable to eat any more. Moreover, I think I remember reading on a comment thread that nutrition values are already based on calories, so adding a new "calorie nutrient" would be redundant. Furthermore, adding a new nutrient type that would need a value for every single foodstuff sounds like a lot of JSON editing work to me, and would mean that every mod adding food items would need to be updated, doesn't it? Again I'm not sure I understood your suggestion correctly, please correct me if I'm wrong. |
This comment has been minimized.
This comment has been minimized.
|
Nice addition, but I have some comments. UPD: their is function
|
This comment has been minimized.
This comment has been minimized.
|
Fantastic! Quick idea: Malnourished effect (and other effect levels if you plan them) should also have some descriptive text as a feedback for the player who might think "Satiated" for hunger and "Malnourished" for starvation as a potential bug. Something along the lines of: "You haven't eaten for so long, that your body is weak, and you are a shadow of your former self. Only time and regular meals will help you recover." |
This comment has been minimized.
This comment has been minimized.
|
Neat, slightly different angle on it than I had anticipated, but a good one. tl;dr
|
This comment has been minimized.
This comment has been minimized.
|
I am not a expert, but is possible intake of calories really capped by amount of calories in reality or is it more a question of volume of food i can fit into my digestive system? Would making the choice between high energy density and low energy density food in a starving situation matter? |
This comment has been minimized.
This comment has been minimized.
|
Ok, many good suggestions/comments in this thread. So to sum up:
I added a commit to the PR based on @nexusmrsep's suggestions:
A couple questions:
Some of the other suggestions might make for an interesting separate PR:
|
This comment has been minimized.
This comment has been minimized.
|
Clarification is probably warranted in here regarding the difference between food nutritional value (ie., vitamins) and food nutrition which isn't the best name for "calories".
Volume of food is a super slippery slope and extremely variable in human beings already, notwithstanding mutations and CBMs and everything else. In terms of starvation recovery (like, actual starvation), is that you can harm yourself from overindulging (refeeding syndrome), even though "overindulgence" amount may look like a normal size meal for other people. So for example, my first link shows the average human stomach can stretch to 4 liters, yet how much could a starved person's stomach contain? Also, then you gotta consider extreme cases like this one. So how will this all affect survivors with traits/mutations that affect metabolism and such -- do bovine post-thresholds still only eat this volume or something else? You bring up a good point. The nutritional and caloric density value of a food is also important -- some foods would be much more suitable for starvation recovery and such. Anywho, there's my shotgun blast of information. And lastly, an interesting food calculator that spits out more information you could ever want. (which just calls from USDA Food Composition Databases but converts some of the information into a more ... digestible format.) For funsies, here's what one liter (1 L) of sliced bananas offers:
|
This comment has been minimized.
This comment has been minimized.
Honestly, keep it because it is extremely accurate ( |
This comment has been minimized.
This comment has been minimized.
Keep those too, Malnourished/Severely Malnourished also make sense in this context. We already have hypervitaminosis and the appropriate hypovits here. |
This comment has been minimized.
This comment has been minimized.
|
I removed this comment previously but since you answered it I put it back so the conversation makes sense:
Yes maybe it would be better to do away with it, but the reason why I used "malnourished" rather than "starving" or "starvation" is because I felt the latter implies the character is currently starving, rather than possibly suffering from the effects of a previous period of starvation. But I can change it. |
This comment has been minimized.
This comment has been minimized.
|
But the line is :
Putting a (I have no trouble compiling on my system). |
This comment has been minimized.
This comment has been minimized.
so that 12 nutrition can fluctuate for the player in terms of under/overeating if they choose. And lastly, there are quite a few variables so I don't know them all but one that might be an issue is metabolism_modifier.
|
ZhilkinSerg
reviewed
Jul 6, 2018
| @@ -315,9 +315,9 @@ void player::disp_status( const catacurses::window &w, const catacurses::window | |||
| } | |||
|
|
|||
| wmove( w, sideStyle ? 1 : 2, 0 ); | |||
| if( get_hunger() > 2800 ) { | |||
| if( get_hunger() >= 400 and get_starvation() > 2400 ) { | |||
This comment has been minimized.
This comment has been minimized.
ZhilkinSerg
reviewed
Jul 6, 2018
| wprintz( w, c_red, _( "Starving!" ) ); | ||
| } else if( get_hunger() > 1400 ) { | ||
| } else if( get_hunger() >= 400 and get_starvation() > 1000 ) { |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
ZhilkinSerg
Jul 6, 2018
Contributor
This should be one of the reasons why VS build is failing in AppVeyor - VC++ doesn't respect standards.
bolaft
added some commits
Jul 6, 2018
bolaft
added some commits
Jul 7, 2018
This comment has been minimized.
This comment has been minimized.
|
Well if we limit this PR to basic functionality (which I think is a good idea), then it's pretty much done, I don't see what else needs to change. I tested it for a several hours on my current playthrough without issues. I also did several tests on the debug mod. The only odd thing I noticed was that gradual changes were slightly off (I tested it by giving a survivor a lot of fatigue and making him sleep for over three days): Without PR:
With PR:
I looked into it and I'm not sure what is causing these differences, especially concerning thirst since I didn't touched thirst at all. Debug messages show the same metabolic rate and the same thirst rate. I'll try to figure it out by displaying more variables as soon if I have time today. Edit: not a bug, it's normal behaviour. Also, |
nexusmrsep
reviewed
Jul 7, 2018
| p->mod_thirst( m_category.mutagen_thirst ); | ||
| p->mod_fatigue( m_category.mutagen_fatigue ); | ||
|
|
||
| if ( m_category.mutagen_hunger + p->get_hunger() > 300 ) { |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Astyle regression means code style is not in standard for this repository. See Download your branch locally so you have it on you harddrive. From a command line run AStyle binnary [edit: actualy you might want to download AStyle first... silly me] |
This comment has been minimized.
This comment has been minimized.
|
Ok I will do that soon, thanks for the explanation. I'm a bit busy this weekend but worst case scenario I'll push a commit monday. |
This comment has been minimized.
This comment has been minimized.
|
Fixed code style, all checks pass. |
This comment has been minimized.
This comment has been minimized.
|
Starvation texts need to be translateable. |
This comment has been minimized.
This comment has been minimized.
|
In the |
This comment has been minimized.
This comment has been minimized.
|
Yeah, currently on a patato phone so I cant comment on specific line right now. |
This comment has been minimized.
This comment has been minimized.
|
New commit: made starvation descriptions translatable. |
bolaft
changed the title
[CR] Hunger and starvation improvements
Hunger and starvation improvements
Jul 9, 2018
This comment has been minimized.
This comment has been minimized.
|
I did more testing, the small discrepancies I found earlier are not an issue, there is an element of randomness to hunger/thirst increase. Two tests on the version of the game without this PR also give slightly different numbers (~5% difference). So as far as I can tell everything behaves as expected, I didn't find any bugs. I think this PR is ready. |
ZhilkinSerg
added
the
(P2 - High)
label
Jul 29, 2018
kevingranade
approved these changes
Aug 3, 2018
ZhilkinSerg
added some commits
Aug 5, 2018
ZhilkinSerg
merged commit 8e02486
into
CleverRaven:master
Aug 5, 2018
This comment has been minimized.
This comment has been minimized.
You make your own fork, you get compiler, you disable all that you don't like, you compile the game. |
bolaft commentedJul 5, 2018
•
edited
This PR addresses a few long-standing issues with hunger (see #11550, #11514):
In order to solve this, this PR separates the starvation logic from the hunger stat and links it to a newly introduced hidden stat, starvation. The process is simple: hunger is now capped at 400 (just above 'famished'). When hunger is at its maximum, starvation slowly increases. When hunger is NOT maxed out, starvation slowly decreases. Stat penalties and death are now tied to starvation, not just hunger. In terms of realism one could think of the starvation stat as an abstraction of body fat and how much nutrients are in the PC's system, while hunger is merely an indicator of the fullness of the stomach.
Gameplay effects
These relatively small changes have a few interesting gameplay effects:
Display
The player can see its character's starvation penalties in the character's page. They are displayed under the "Malnourished" effect. On the sidebar, the "hungry", "very hungry" and "famished" messages appear the same as before, depending on hunger. However, the "near starving" and "starving!" messages only appear if hunger is capped AND starvation is high enough. Therefore, a character with a full belly won't see those messages appear, even if its starvation is high. This reflects the fact that the character is not hungry, even though he or she still suffers from malnutrition penalties, and the player can't do anything about it at the moment anyway. As for the 'Hunger' speed modifier display, in order to avoid confusing players whose PC is not hungry (but still suffers from starvation), the label is changed to 'inanition'.
Balance
This PR does not affect established numbers. Characters will die from starvation exactly as fast as before (unless they ration food), and the speed, strength, dexterity etc. penalties from lack of food remain the same.
These changes should not affect balance much. They make the game a little bit easier by making it possible to ration food to alleviate starvation penalties, but they also make the game a little bit harder since it now takes some time to get rid of those penalties.
Justification for the choice of 400 as a hunger cap
The only number I introduced in this PR is the 400 cap for nutrition. Here's why:
Note
This is the first time I look into CDDA's code, and I don't usually use C++, so all comments and suggestions about the code are welcome. I tested the changes in game, they seem to work fine and everything behaves as expected, but I'd appreciate it if a CDDA veteran double checked to make sure I didn't break anything.
Updates
See comments.