[Feature Request] Internal Body Heat Regulation
gatoborrachon opened this issue ยท 11 comments
Please describe your requested feature
We started to discuss this as you said in this comment in CurseForge in this issue, but i think that the best option would be to make an issue just for this (without the part of Heat and Climate or Cyberware).
+The request talks about a proper Temperature Regulation made by the body itself
1.- Base temperature
The body should tend to reach a comfortable temperature, and to achieve this, it could be at the expense of Hunger (Vanilla) and Hydration (Survival Inc.)
1.1.- Base Heat Generation
+Even if you wear nothing, when you are too cold, the body should try to warm you until a certain point (this point could be between the 2 harm temperatures)
+This could be done through your hunger: as your body warms you, it takes that energy from your reserves.
+And once your hunger is below a configurable number of drumsticks, it will stop to use it and consequently, you will start to freeze again (i thought on this last point after imagine that you will die of starvation instead of freeze every time you go to cold areas without clothes, but let me hear what you think)
1.2.- Heat Dissipation
+When you are too hot, the body should start to sweat to take advantage of an already Survival Inc. feature: Losing heat through Wetness.
+The level of wetness could increase as the external temperature increases, and it should take that water from hydration (maybe just doubling the hydration losing rate than when you are not too hot)
Extra suggestion
1.- Adding a way to know your exact temperature
I had in mind to use a thermometer that will display the body temperature in-chat when you right-click it.
Well, i made a small test in a world where, before the new heat regeneration, i died from freeze after like 20 seconds of exposure, but now with a full set of leather armor i can be over the minimun temperature before the freezing shader, and without it i can be just in the start of the freeze shader which i supposed it should not damage you right?
it was in the Extreme Hills biome,
but i found a small rendering bug
Yeah what you described matches my experience. When I commited it I was questioning whether it's really balanced. Because this way, by wearing full leather armor you can stay even in the coldest biomes during the coldest season (Snowy Taiga @ Winter:7). But whatever, if someone feels like this is not very balanced, they can tune the variables in the config or turn it off altogether, right?
if someone feels like this is not very balanced, they can tune the variables in the config or turn it off altogether, right?
well, yes, but it requires some tests more with the damage enabled to give a reliable verdict, but there's not need to hurry, we can do more tests when everything is implemented (and when we have enough free time), (or the description of this commit means that the last 3 steps from your comment are already implemented?)
Well the heat effects were left disabled just because of accident, the latest commit includes all the heat effects (download from jitpack).
And yes the commit you mentioned includes all the last 3 steps. Fully implemented. See for youself: Invocation: line 149, Method: line 246.
I think we can safely close this, since there is nothing more to be done I guess.
ok, just more tests are needed, but we can see the feedback from the players
let me see if i understood well
1.- The first approach consist in taking the "Internal Body Heat Generation" as a Radiant Source (like any Hot Block) but this would be affected by armors. (Unreal, not practical but is the easiest implementation)
2.- The second one is about (dinamically?) modify the Heat Exchange Rate but i don't totally understand this:
instead of scaling the value, it would translate the value as intended.
You have some good points here. Actually, I had something like this in mind when I tought about reworking the heat mechanics. However, there are still some loose ends here I need to figure out first.
You see, the temperature needs to have a definite value every tick. This value is currently being computed by running a number through several functions in 2 steps. In the first step, an radiant temperature is calculated (see HeatModifier.java:135). Then, a temperature difference between the body and the environment is calculated (HeadModifier.java:137) and based on that value, the rate of change is calculated (HeatModifier.java:138). This rate value is then run through another series of function (ones adjusting the actual exchange rate), and the resultant value is added to the current body heat.
Why am I saying all this? Because I need to create a formula like this to achieve the "Internal Body Heat Regeneration". But how should it be computed? I had an idea that the body itself could be a source of "radiant" heat (i.e. a function in the first chain), and the heat generation would scale quasi-logarithmically based on how far the actual body heat is (was the last tick) from the opimal one (with a maximum effect of course). This would be the easiest approach, but it wouldn't be very accurate, since it's effect would be affected by insulation such as armor in a negative way (e.g. the body would regenerate 0.1pt/tick and with a full set of leather armor, it would drop to let's say 0.025pt/tick, which is undesirable).
Another idea that came to my mind is that the body heat regeneration could be added as step 2 function (i.e. exchange rate computation). But instead of scaling the value, it would translate the value as intended. This would be probably the best approach I can think of at this moment.
By "translating the value", I means adding an abritrary value to the previous one. Because in the second step, all the functions just scale the value (i.e. multiply it by some number) but I tought about adding some other value to it, and that value would be dependant on the body heat from previous tick. I have to admit it's a bit whacky and sometimes confusing to think about, but that's the best I have come up with so far.
To explain further what I had in mind: Imagine that you're already on the last step of the computation. You have the value (exchange rate) which will be added to the body heat value. Now, the player's body has an optimal temperature it wants to keep as much as possible, but it has it's limits. So, you have the desired body temp and the actual to-be body temp (freshly computed but not applied yet). You have to somehow compute a value from these 2, which will be then added to the resultant body heat. And that modified body heat will be then stored inside the record, and acted upon.
So, to summarize this in steps:
- Compute radiant heat
- Compute heat delta (difference between environmental "radiant" heat and current body heat)
- Compute base exchange rate
- Adjust exchange rate (run through a series of functions)
- Add the exchange rate value to the actual heat
- Compute optimal heat delta (difference between optimal heat and to-be body heat [computed in step 5])
- Compute heat counteraction (aka "Internal body heat regeneration") -> quasi-logarithmic based on value from step 6
- Add heat counteraction to the body heat from step 5
The resultant value would be then stored in the record and acted upon. Currently, all steps up to step 5 are implemented. So what I originally meant was to implement steps 6-8 in addition to the existing ones.
the new steps sound nice to me, yeah, the generated temperature by the body could be like that
If you want to try it out, here's a link to a snapshot from that commit (kindly provided by JitPack, those guys are awesome).
NOTE: Temperature adverse effects (e.g. slowness / hypothermia) are disabled in that commit, since I forgot to enable them back. But it could do just fine for testing I guess...