Health (not hp, the hidden stat) balancing

The hidden health stat is supposed to represent immune system function, toxicity of diet, ability of the body to deal with hardships and so on.
It is the difference between eating salads from fresh vegetables, and eating deep fried lard, chasing it with coke and popping a multivitamin to meet the daily requirements.

The problem is, it is mostly random, barely affected by diet. A lucky meth addict can feasibly end up healthier than an unlucky health nut who somehow manages to find fresh fruit all year long.
A stack of apples a day won’t keep the doctor away, unless you’re really good at throwing them.
Related issue: https://github.com/CleverRaven/Cataclysm-DDA/issues/21155 - tl;dr the randomness is so strong that it looked like there is a bug that caused health from food to have an effect opposite to the intended one.
Trying to work around this requires gorging on the fruit past satiety, accelerated metabolism or some sort of bulimia.

To fix this, we’d need some sample diets and expected health ranges for them.
Simple ones would work best. For example, diet of potato chips and energy drinks (nothing else) resulting in health in range of [-20, -50] after 14 days, and diet of cranberries and mineral water giving range of [50, 100] after a month.
Alternatively, someone to crunch the math and provide a bunch of plots for how could it look.

Health is in range [-200, 200], but values below -150 and above 150 should probably be reserved to hardcore abuse (advanced alcoholism, faulty bionic) and strict health fanaticism respectively.

[s]I agree that the game doesn’t handle nutrition correctly. Nutrition is a tricky, fickle thing, even in the real world. Our diets affect almost everything we do, how we feel, how we think, and how our bodies function even down to the cellular level. Eating unhealthily has a dramatic effect on the body, and someone who eats healthily for their entire life and then gorges on something unhealthy will tell you that it made them feel terrible. Every decade it seems that scientists come out and tell us that, no, what we thought was healthy all along actually isn’t. Turns out that almost everything we eat that’s processed is slowly killing us or contributing to a lack of health. No, all that sugar and fat and those carbohydrates is actually not good for you.

In the game, the importance of nutrition is terribly underrepresented. Your health almost entirely circulates around whether or not you have multivitamins. You can eat nothing except candy and junk food in this game, and as long as you eat a multivitamin every once in a while, you’ll be just fine. This kind of perpetuates the real life myth over multivitamins and other supplements being a cure-all. But multivitamins can NEVER replace a diet (I say this as I take a multivitamin IRL).

I think that another issue is how effective multivitamins are. In the game, there is no distinction between getting your vitamins from food and getting them from a multivitamin except for which vitamins. The truth is that the body does not absorb pills the same way as food. There is something called bio-availability, which is a percentage of the nutrient absorbed by the body. Nutritionists have a saying: it’s not what you eat, it’s what you absorb. If you were to inject someone with a nutrient, that would technically be 100% bio-availability; but mostly we get this from food. And it’s always better to get your vitamins from food because food comes with additional chemicals that increase bio-availability. If you were to drink milk to absorb calcium, you would benefit from the lactose found in milk which increases calcium and magnesium absorption. Meat, fish, and poultry also contain chemicals that increase your absorption of iron. The fat-soluble vitamins A, D, E, and K are better eaten along with fat to increase absorption.

Another problem with nutrition in this game is that none of the actual benefits of eating healthy are really represented. Higher HP regen and resistance to disease is nice, but why is my character’s stamina not increased? Or their stats? My character’s flavor text upon waking with high health is that they feel alert and extra rested. Why, then, is my perception not increased? Being healthy should give you a boost to every attribute you have. There should be an extra incentive to want to actually eat healthy and take care of your body.

I wonder why even to include a nutrition/health system if it’s not even realistic or fun. It’s just multivitamin chugging/gamma globulin injecting simulator to get some extra health. No wonder people turn nutrition off.[/s]

EDIT: After re-reading this thread a month later, I’ve come to the conclusion that this post really was just a rant and doesn’t contribute anything. Sorry about that.

This is less about nutrition as a whole and more about just toxicity alone.
Making proper nutrition system would be a huge undertaking, the health stat alone could easily be just a bunch of number tweaks that could be done in one sitting.
Those values could later be slowly converted into a proper nutrition system, but that’s for later, when we have a proper design of it and not just brainstorming.

And there’s the single biggest problem with this concept, laid out in beautiful simplicity: anything they implement is guaranteed to be believed to be wrong by the majority of people.

And here’s a great example of that. Sugar IS a carbohydrate, and you can live ENTIRELY without them all (the simply the carbohydrate, the worse it is likely to be for you, though even that is a bit of an oversimplification). Fat, on the other hand, is required to live, and even the most damning studies on fat have found nothing more than fringe effects from certain KINDS of fat, and even those findings are not incredibly strong, statistically speaking. Fat has been dishonestly slandered for nearly two generations now, with essentially no evidence (and certainly none when it started - the famous “food pyramid” was a political creation, not a scientific one).

The current system could use some tweaks to the strength of certain things (and few other effects at either end, as you mentioned, aren’t a bad idea at all), but anything more serious is exceedingly likely to be considered a failure by the game population at large.

[quote=“Coolthulhu, post:3, topic:13824”]This is less about nutrition as a whole and more about just toxicity alone.
Making proper nutrition system would be a huge undertaking, the health stat alone could easily be just a bunch of number tweaks that could be done in one sitting.
Those values could later be slowly converted into a proper nutrition system, but that’s for later, when we have a proper design of it and not just brainstorming.[/quote]

Oh I understand you can’t make a super-realistic nutritional system. If you could, you’d be a proper biologist. I’m just saying that it’s actually very complex and either needs to be represented truthfully or simplified. The way it is now is kind of a joke. It needs to have real effects on your character, even bonuses. Fun is more important than realism.

I am sorry, but this is nonsense.

You need carboydrates. Your brain needs glucose, and if you don’t get it from your diet, it will have to be supplied by your liver by producing Ketone bodies (To transport it through the blood). Low-carbodhydrate diets cause Ketosis, lowering your blood PH (Ketone bodies are acidic) and leading to a whole host of problems.

Yep.

I am sorry, but this is nonsense.

You need carboydrates. Your brain needs glucose, and if you don’t get it from your diet, it will have to be supplied by your liver by producing Ketone bodies (To transport it through the blood). Low-carbodhydrate diets cause Ketosis, lowering your blood PH (Ketone bodies are acidic) and leading to a whole host of problems.[/quote]

Your body can quite easily MAKE glucose when it needs it, provided you have enough calories (that’s what happens when you live on your fat stores, for one example). There are people who have been eating extremely low-carb diets for decades at this point, and they are, as a group, quite a bit healthier than the general population. (Yes, of course, there are exceptions to this… there are exceptions to almost every rule short of “being dropped into the sun results in death” and other such extremes.)

The idea that you must EAT carbs because you need glucose in your system is right up there with “eating fat makes you fat” - no, eating carbs (especially simple carbs, like sugar) is the best way to get fat. We’ve been conducting a society-wide experiment into that for about 35 years, and the results are painfully obvious.

Of course, this simple exchange makes my larger point, above, that any attempt to model “true” health is going to be actively disagreed with by a large percentage of the playing population, as the “rules” change every year (well, according to the latest papers and such, anyway - the actual, real-life rules don’t change on a human-lifetime scale, we just don’t actually know what those rules are, exactly, hence all the disagreement).

We don’t need a giant system that monitors cholesterol levels (HDL vs. LDL) or even one that makes a distinction between calories from glucose and ones from fat.
For now, we need a simple but working system that only really cares about the most common consensus - it can be based on medical stereotypes and misconceptions, as long as it WORKS, as in “has noticeable in-game effects that are useful to the player who plays by it and/or hurt those who don’t” and is relatively intuitive - even if incorrect - to people raised in western cultures.

Foundations first, then more complex ideas. Look at current vitamin system as an example of what happens if you forget the proper order of things.

You need carboydrates. Your brain needs glucose, and if you don’t get it from your diet, it will have to be supplied by your liver by producing Ketone bodies (To transport it through the blood). Low-carbodhydrate diets cause Ketosis, lowering your blood PH (Ketone bodies are acidic) and leading to a whole host of problems.[/quote]
You’ve made deoxy’s point brilliantly, parts of your statement are correct, but overall you’re just wrong. Ketosis is just fine, the nervousness people have about it is due to conflating it with diabetic ketosis, which is only vaguely related.

[quote=“Coolthulhu, post:8, topic:13824”]We don’t need a giant system that monitors cholesterol levels (HDL vs. LDL) or even one that makes a distinction between calories from glucose and ones from fat.
For now, we need a simple but working system that only really cares about the most common consensus - it can be based on medical stereotypes and misconceptions, as long as it WORKS, as in “has noticeable in-game effects that are useful to the player who plays by it and/or hurt those who don’t” and is relatively intuitive - even if incorrect - to people raised in western cultures.

Foundations first, then more complex ideas. Look at current vitamin system as an example of what happens if you forget the proper order of things.[/quote]

Okay, so let’s talk foundations. Assuming we don’t just want to count calories and call it a day, here’s my own list of foundations I feel will improve the way nutrition works without getting too complex:

Foundation number 1: is it meaningful, and is it fun? Does it make sense? Every feature of nutrition needs to be something obvious and necessary.

Foundation number 2: Carbohydrates, fat, and protein. These 3 macronutrients should be the cornerstone of the nutrition system. All three are a form of energy, with fat being the most energy dense. Carbohydrates are generally your #1 source of energy as it is the most abundant macronutrient in most foods. Protein is necessary to replace lost body tissue and generate new cells. You need all of these macronutrients, though carbohydrates aren’t strictly necessary for survival. All food items in the game must provide 1 or more of these things to satisfy the character’s dietary needs.

Foundation number 3: Health should be affected by nutrition in a large way. Good diets raise health to high or moderately high levels over time and vice versa (diminishing returns?). Yet, the player should not be required to be a gourmet chef in order to become healthy. The food items necessary to become at least somewhat healthy should be generally available in most supermarkets, though the player must be required to give a bit of thought as to what exactly is healthy.

Foundation number 4: Character performance should be affected by nutrition in a meaningful way that makes sense. Junk food fills you up and provides a quick burst of energy in the form of carbohydrates, but hurts you in the long run. Spending a few days eating nothing but junk food will cause energy levels to deplete faster—stamina goes down more quickly, you become tired more easily. Protein and fat is necessary to stay in good performance—junk food does not provide protein, for sure. This should be reflected in the game—satiety vs nutrition. And if you eat well, you should see a meaningful boost in your character’s performance to a degree that it is generally a good idea to bother with staying healthy at all; it should be worth your time to be healthy.

Foundation number 5: Vitamins and minerals in reality are usually a non-issue for people who eat a variety of foods. Multivitamins should not be a surefire way to get super healthy. They are a way to make up for a lack in vitamins in the diet, and that is it. This is all assuming they even stay in the game.

Foundation number 6: Nutrition should be affected by some factors externalized from food. Certain mutations, bionics, and perhaps perks should exist that affect nutrition. Perhaps certain advanced technologies could exist that make balancing the diet a bit easier.

[quote=“Neonwarrior, post:10, topic:13824”][quote=“Coolthulhu, post:8, topic:13824”]We don’t need a giant system that monitors cholesterol levels (HDL vs. LDL) or even one that makes a distinction between calories from glucose and ones from fat.
For now, we need a simple but working system that only really cares about the most common consensus - it can be based on medical stereotypes and misconceptions, as long as it WORKS, as in “has noticeable in-game effects that are useful to the player who plays by it and/or hurt those who don’t” and is relatively intuitive - even if incorrect - to people raised in western cultures.

Foundations first, then more complex ideas. Look at current vitamin system as an example of what happens if you forget the proper order of things.[/quote]

Okay, so let’s talk foundations. Assuming we don’t just want to count calories and call it a day, here’s my own list of foundations I feel will improve the way nutrition works without getting too complex:[/quote]

Those are a pretty good start, I think. I would point out that, since “carbohydrates aren’t strictly necessary for survival” and “Carbohydrates are generally your #1 source of energy as it is the most abundant macronutrient in most foods.”, we don’t bother to track carbs - any source of food that doesn’t provide protein or far is assumed to be carbs, and we don’t really care about that. Heck, even high sugar intake is likely to be balanced out by how much physical activity most survivors engage in…

So, as far as balancing goes, I’d suggest tracking protein and fat intake, as suggested - insufficient quantities of each can generically affect “health” (trying to tie down individual effects would get messy and potentially result in large amounts of disagreement).

Other than that suggestion, though, I think those 6 points are a great foundation.

[quote=“Coolthulhu, post:1, topic:13824”]To fix this, we’d need some sample diets and expected health ranges for them.
Simple ones would work best. For example, diet of potato chips and energy drinks (nothing else) resulting in health in range of [-20, -50] after 14 days, and diet of cranberries and mineral water giving range of [50, 100] after a month.
Alternatively, someone to crunch the math and provide a bunch of plots for how could it look.[/quote]

I don’t understand what you mean by sample diets or crunching the math.

Anyway a bit off-topic but I wanted to make something to help me understand and balance the health and nutrition thing.
But I’m going to review some things to make sure I understand how the health system currently works:

Thirst and hunger go up by 1 every 5 minutes (50 turns).
1 day has 14400 turns.
Thirsty and hunger level per day is 288 points each, or 12 points per hour. And we die at 6000 hunger.
Health goes from -200 to 200.
Health tries to go to 0 from whatever value it is in.

Consumables affects the health modifier which triggers a health update, and it seems that the function to update the health is called from update_body that is inside the game.cpp, so I guess it is updated every turn too.

I made a small app to simulate it. By copypasting the update_health and modified it to make it work in console and to simulate the pass of time, I included the RNG method the game uses.

And these are its values:


Enter the desired daily nutrition for a 2 weeks estimation:
50
Running simulation…
Simulation complete, this are the results:
Randomly: [-57]
Min/max: [-39,116]
Enter the desired daily nutrition for a 2 weeks estimation:
-50
Running simulation…
Simulation complete, this are the results:
Randomly: [51]
Min/max: [48,151]
Enter the desired daily nutrition for a 2 weeks estimation:
5
Running simulation…
Simulation complete, this are the results:
Randomly: [-3]
Min/max: [-5,115]
Enter the desired daily nutrition for a 2 weeks estimation:
-5
Running simulation…
Simulation complete, this are the results:
Randomly: [-4]
Min/max: [11,107]
Enter the desired daily nutrition for a 2 weeks estimation:

I think I royally fucked up somewhere but I don’t know where.

Anyway back to on-topic stuff.

You need to eat 288 points of nutrition to have 0 hunger per day. If the “normal” top of healthy is 150, you “should” need to eat food that is 0.5ish healthy by every nutrition point.
So you could make every non-junk food consumable give 0.5 health by every point of nutrition. That could a way of balancing it, what do you guys think?

Of course this is without taking into account thirsty points and quench, because is easier to make it work with the idea that the player only drinks healthy clean water. And uses food as the main source of health(I would say “nutrients” but in this game it is used in another context, I would rather use calories to be honest).

[quote=“Alec White, post:12, topic:13824”]You need to eat 288 points of nutrition to have 0 hunger. If the “normal” top of healthy is 150, you “should” need to food that is 0.5ish healthy by every nutrition point.
So you could make every non-junk food consumable give 0.5 health by every point of nutrition. That could an idea of balancing it, what do you guys think?[/quote]

This is the kind of idea I wanted here.
I wouldn’t tie it directly to nutrition, but the math regarding scale looks good.
At the moment the health values are generally significantly lower than nutrition values - ~25 times lower, not 2 times lower. Changing them to have roughly the same scale as nutrition (or treating them as a multiplier) could fix the problem.

Alternatively, other parts of health calculations could be tweaked. The wide dispersion on rng, number of health checks per day (just one every sixth hour is not granular at all), multiplier on health mod after a check and so on. All of those parameters are simple by themselves, but have rather significant effects in the end.

Mind explaining what was the rationale behind the current way the health points per food and health calculations were made? Just curious about it.

Well I just hope you don’t need an overhaul.
But I think the whole point of this is to make it look like the character is actually eating food instead of nutrition points.
First of all, you don’t eat 30 bowls of noodles in one go even if you haven’t eat anything for days.

Edit*

And I think currently the game is doing fine with simple nutrition mod.
Gameplay-wise, you need to stay away with junk food, eat fruits, cook instead of eating raw, etc. It is without simple nutrition that the gameplay is truly broken. Most of the vegi based food are just the same, and why am I low on calcium even if I ate meat? It is just so hard without pills.

I wasn’t a part of the team when it was made, but I think I can reverse-engineer it from comments and general idea.
The system was changed from older “pure health” one I haven’t seen in action, to the more current “healthy_mod to health” in Basic health rewrite 1 by i2amroy · Pull Request #8390 · CleverRaven/Cataclysm-DDA · GitHub
The change doesn’t really look bad when I look at the old code, it’s just that it is incredibly static and random, compared to ancient code’s constant and heavy drift in the direction dictated by player’s diet.
Looks like the idea was to semi-randomly adjust health so that it slowly settles near the value dictated by diet. The author notes that the temporary healthy_mod is supposed to quickly decay over the course of the day.

I don’t think there was much more thought that went into it, considering that mathematically, it doesn’t really work. I don’t see any real formulas in the PR, meaning the number crunching was not done or was only done empirically (“throw it at a wall and see what happens”), in very specific environment.
The fact that it doesn’t really work was masked by lack of proper display (back then there were no health messages on wake up) and vagueness of effects (sleep healing speed change isn’t really noticeable until it slows down very heavily, other effects are very random).
Also existence of vitamins, which back then worked like gamma globulin does work now, except were far more common and thus allowed maxing out health if used properly. Once those got removed in vitamin update, the problems surfaced: the fact that the system simply doesn’t allow getting far from 0 health without bionics, despite health ranging from -200 to 200.

I don’t really see anything wrong with the idea, just the numbers behind it. Both the rng(-100, 100) and the scale of food health vs full range of health.

The “healthy” value still has its full effects with simple nutrition mod. The only thing the mod turns off is the “vitamins”, which also include microelements.

Well, then I still don’t understand why it is so complicated.

I would make it update the health every hour, and every time you do something healthy/unhealthy and make the health go to the average by loosing/gaining one point on top of everything else.

But then I’m not good at math or balancing and I like simple things due not being able to make more complex ones.

That’s basically what the old system did - you had a “health” stat, and a “health mod” stat. Things that affected health almost all affected the “health mod” stat, VERY few things affected health directly (gamma globulin and leukocyte breeder are the only two I know of). Every so often (so many hours? I don’t remember exactly), there was a check, and the chance of changing your health was based on how far your “health mod” was from zero (with a slight bias towards zero health - that is, high health would drop over time without more healthy stuff going on, and low health would raise over time without bad stuff going on).

So, do healthy things regularly, and eventually, you have higher health. Do unhealthy things regularly, and eventually, you have lower health.

The main problem was that it was too easy to game - take vitamins every 12 hours, and almost nothing else mattered, and vitamins were common. Instead of a massive overhaul, adjust the effect of vitamins, done.

A secondary problem was that food variety didn’t matter - find ant hill, live on ant meat (smoked/dehydrated/jerky), done. Hence the (IMO poor) attempt at a specific nutrients (calcium, etc).

But I’m not on the team, so really, I don’t have much right to complain.

an idea, use the classic food pyramid, grain meat dairy vegetable fruit, as the nutrients. meaning things like Deluxe sandwich which has 4 of those is a really good food, which it is.

That is also the current system. The only thing that did change was removal of health-boosting vitamin pills, leukocyte rework, radiation affecting health, and some of the effects of health (just their strength, not new mechanics).
This system did not go away when vitamins were added and is not disabled with simple nutrition.

It’s what I want to balance here, not the vitamins.