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

Suggest increasing body heat from high exercise levels #47428

Closed
PaulBlay opened this issue Feb 11, 2021 · 24 comments
Closed

Suggest increasing body heat from high exercise levels #47428

PaulBlay opened this issue Feb 11, 2021 · 24 comments
Labels
Mechanics: Character / Player Character / Player mechanics stale Closed for lack of activity, but still valid. <Suggestion / Discussion> Talk it out before implementing

Comments

@PaulBlay
Copy link

Is your feature request related to a problem? Please describe.

Doing something vigorous like chopping down trees doesn't make me warmer when I'm chilly, and doesn't give me heat stroke when I'm warm.

Describe the solution you'd like

Some increase to body-heat from exercise levels of 'brisk', 'active' and 'extra'.

Describe alternatives you've considered

Leave as is.

Additional context

Obviously this is potentially 'good' for winter, but equally 'bad' for summer so it evens out overall.

@BrettDong BrettDong added <Suggestion / Discussion> Talk it out before implementing Mechanics: Character / Player Character / Player mechanics labels Feb 11, 2021
@anothersimulacrum
Copy link
Member

anothersimulacrum commented Feb 11, 2021

Assumption 3 : the player is always running, thus generating more heat.

@PaulBlay
Copy link
Author

PaulBlay commented Feb 11, 2021

@anothersimulacrum Forgive me for being obtuse, but are you just pointing at where stuff would be changed if stuff is changed?

@actual-nh
Copy link
Contributor

@anothersimulacrum Forgive me for being obtuse, but are you just pointed at where stuff would be changed if stuff is changed?

I don't think so. The line appears to be indicating that, in figuring out body heat, it is assumed the character is running (all the time); I'm not sure exactly what level of exercise (in BMI terms) the code is assuming.

@Fosheze
Copy link
Contributor

Fosheze commented Feb 11, 2021

This would be awesome but it should definitely wait until after #44880 is merged because Summer is barely survivable as it is.

Good thing it's the apocalypse and no-one is around to see my character streaking everywhere wearing nothing but a backpack and shame every summer.

@actual-nh
Copy link
Contributor

This would be awesome but it should definitely wait until after #44880 is merged because Summer is barely survivable as it is.

Good thing it's the apocalypse and no-one is around to see my character streaking everywhere wearing nothing but a backpack and shame every summer.

It may be what already is happening.

@anothersimulacrum
Copy link
Member

Where the changes would take place. That makes the (erroneous) assumption that the character is always running, and it should have activity levels tied in instead of making that assumption.

@Fosheze
Copy link
Contributor

Fosheze commented Feb 11, 2021

This would be awesome but it should definitely wait until after #44880 is merged because Summer is barely survivable as it is.
Good thing it's the apocalypse and no-one is around to see my character streaking everywhere wearing nothing but a backpack and shame every summer.

It may be what already is happening.

I'm not seeing anything in there that interacts with activity level. I think those were just the assumptions that were used before the activity level system was in place. Farther down there is a spot where it interacts with "metabolic_rate" however, confusingly, that doesn't appear to be connected to activity level anywhere. From what I can see it is just the character's base metabolic rate.

float Character::metabolic_rate_base() const
{
static const std::string hunger_rate_string( "PLAYER_HUNGER_RATE" );
float hunger_rate = get_option< float >( hunger_rate_string );
static const std::string metabolism_modifier( "metabolism_modifier" );
return hunger_rate * ( 1.0f + mutation_value( metabolism_modifier ) );
}
// TODO: Make this less chaotic to let NPC retroactive catch up work here
// TODO: Involve body heat (cold -> higher metabolism, unless cold-blooded)
// TODO: Involve stamina (maybe not here?)
float Character::metabolic_rate() const
{
// First value is effective hunger, second is nutrition multiplier
// Note: Values do not match hungry/v.hungry/famished/starving,
// because effective hunger is affected by speed (which drops when hungry)
static const std::vector<std::pair<float, float>> thresholds = {{
{ 300.0f, 1.0f },
{ 2000.0f, 0.8f },
{ 5000.0f, 0.6f },
{ 8000.0f, 0.5f }
}
};
// Penalize fast survivors
// TODO: Have cold temperature increase, not decrease, metabolism
const float effective_hunger = ( get_hunger() + get_starvation() ) * 100.0f / std::max( 50,
get_speed() );
const float modifier = multi_lerp( thresholds, effective_hunger );
return modifier * metabolic_rate_base();
}

Edit: I could also just be blind. I'm still looking.

@anothersimulacrum
Copy link
Member

They're assumptions from before running even existed.
746c5be69bd player.cpp (Shoes01 2013-05-07 18:15:56 -0700 696) Assumption 3 : the player is always running, thus generating more heat.

@actual-nh
Copy link
Contributor

Is this code left over from before base_bmr() in character.cpp?

@Fosheze
Copy link
Contributor

Fosheze commented Feb 11, 2021

They're assumptions from before running even existed.
746c5be69bd player.cpp (Shoes01 2013-05-07 18:15:56 -0700 696) Assumption 3 : the player is always running, thus generating more heat.

Ahh. "Vintage" code.

The whole update_bodytemp method looks like a nightmare. 500 lines of old code that touches what appears to be practically everything except for activity level. As much of a nightmare as it would be, a lot of it (disease, metabolic rate, mutations, sleep, fatigue, and maybe blood loss) looks like it should be moved over to BMR rather than being directly in that method. All of those different parts should be altering BMR rather than changing temperature directly.

@Fosheze
Copy link
Contributor

Fosheze commented Feb 11, 2021

Is this code left over from before base_bmr() in character.cpp?

It looks like it. I can't find anywhere where "metabolic_rate" interacts with activity level or BMR.

@actual-nh
Copy link
Contributor

I'm not seeing anything in there that interacts with activity level. I think those were just the assumptions that were used before the activity level system was in place.

That's what I was thinking but evidently not clearly communicating...

@actual-nh
Copy link
Contributor

Ahh. "Vintage" code.

Chuckle!

The whole update_bodytemp method looks like a nightmare. 500 lines of old code that touches what appears to be practically everything except for activity level. As much of a nightmare as it would be, a lot of it (disease, metabolic rate, mutations, sleep, fatigue, and maybe blood loss) looks like it should be moved over to BMR rather than being directly in that method. All of those different parts should be altering BMR rather than changing temperature directly.

I can think of a few things among those you named that should be interacting via altering heat loss (blood loss, fur mutations, etc), as in "warmth" values. (I seem to remember that fur mutations do work via "warmth", but I may be incorrect.) For that matter, the body does alter BMR (via thyroid and related hormones) in response to core body temperature. (Fun factoid: This is partially via thyroid hormone causing the mitochondria - where oxygen is used to "burn" food - to be less efficient and release more energy as heat instead of as energy for the cell in the form of ATP.)

@Fosheze
Copy link
Contributor

Fosheze commented Feb 11, 2021

I can think of a few things among those you named that should be interacting via altering heat loss (blood loss, fur mutations, etc), as in "warmth" values. (I seem to remember that fur mutations do work via "warmth", but I may be incorrect.)

That's why I had left a maybe after blood loss. There is the temperature loss from the physical loss of blood but I am not sure if being in a state of hypovolemic shock would effect BMR as well. I also found this section where it appears to be using body part HP rather than actual blood loss for temperature calculation. That would make sense if this hasn't been touched since 2007 because bleeding wasn't a thing.

// Loss of blood results in loss of body heat, 1% bodyheat lost per 2% hp lost
mod_part_temp_conv( bp, - blood_loss( bp ) * get_part_temp_conv( bp ) / 200 );

I'm also not sure where I saw the mutations in there. I just took another look and I don't see anything but bark (which actually makes sense where it is) and a couple of the metabolism traits. So it looks like I was wrong there.

@actual-nh
Copy link
Contributor

actual-nh commented Feb 11, 2021

That's why I had left a maybe after blood loss. There is the temperature loss from the physical loss of blood but I am not sure if being in a state of hypovolemic shock would effect BMR as well. I also found this section where it appears to be using body part HP rather than actual blood loss for temperature calculation. That would make sense if this hasn't been touched since 2007 because bleeding wasn't a thing.

Hmm. It should definitely result in vasoconstriction, especially outside of the core - as in people turning pale (and shaking given the epinephrine release). That could cause loss of heat in the extremities, and it is true that a lot of the body's heat is in water, some of which is lost with lost blood. I'd have to check for exactly what proportion is in blood as opposed to intercellular and intracellular fluid's water component.

@Venera3: Any further input regarding shock and body heat? I'm going off the top of my head in the above.

@Fosheze
Copy link
Contributor

Fosheze commented Feb 11, 2021

That's why I had left a maybe after blood loss. There is the temperature loss from the physical loss of blood but I am not sure if being in a state of hypovolemic shock would effect BMR as well. I also found this section where it appears to be using body part HP rather than actual blood loss for temperature calculation. That would make sense if this hasn't been touched since 2007 because bleeding wasn't a thing.

Hmm. It should definitely result in vasoconstriction, especially outside of the core - as in people turning pale (and shaking given the epinephrine release). That could cause loss of heat in the extremities, and it is true that a lot of the body's heat is in water, some of which is lost with lost blood. I'd have to check for exactly what proportion is in blood as opposed to intercellular and intracellular fluid's water component.

I also just discovered the section where it is calculating blood loss and it does appear that it is just based on body part HP rather than the character's actual blood volume.

int Character::blood_loss( const bodypart_id &bp ) const
{
int hp_cur_sum = get_part_hp_cur( bp );
int hp_max_sum = get_part_hp_max( bp );
if( bp == body_part_leg_l || bp == body_part_leg_r ) {
hp_cur_sum = get_part_hp_cur( body_part_leg_l ) + get_part_hp_cur( body_part_leg_r );
hp_max_sum = get_part_hp_max( body_part_leg_l ) + get_part_hp_max( body_part_leg_r );
} else if( bp == body_part_arm_l || bp == body_part_arm_r ) {
hp_cur_sum = get_part_hp_cur( body_part_arm_l ) + get_part_hp_cur( body_part_arm_r );
hp_max_sum = get_part_hp_max( body_part_arm_l ) + get_part_hp_max( body_part_arm_r );
}
hp_cur_sum = std::min( hp_max_sum, std::max( 0, hp_cur_sum ) );
hp_max_sum = std::max( hp_max_sum, 1 );
return 100 - ( 100 * hp_cur_sum ) / hp_max_sum;
}

@anothersimulacrum
Copy link
Member

Just to confirm what you're discovering, Character::update_bodytemp() is ancient, and full of skeletons and nonsense that really ought to be cleaned up.

@actual-nh
Copy link
Contributor

I also just discovered the section where it is calculating blood loss and it does appear that it is just based on body part HP rather than the character's actual blood volume.

It is giving a result back in percentage of estimated blood lost; bleeding really needs to be integrated... someone at the verge of death due to a crushing injury may well have lost some blood internally, but not 99% of it!

@Venera3
Copy link
Member

Venera3 commented Feb 12, 2021

As it is usually the case, you're pretty good at maintaining homeostasis up until you just can't, at which point the whole house of cards comes crashing down at once. Part of it is losing -essentially- water you spent a lot of energy heating up, but the main reason is your body centralising blood flow, prioritising brain and heart and forcing the rest to make do. Less blood flow, however, also means less metabolism and less heat production, so if you get to the point of starting to cool your temperatures are gonna sink like a rock and it will be a challenge to warm you up (proper trauma patients can sometimes arrive at below 30 °C, despite being wrapped in tinfoil).

With that in mind I suggest tying cooling out to the shock status, maxing out at ~ -30 °C at the last stage (direct cold damage is unlikely, and the negative effects of hypotermia aren't really simulated).

@RadHazard
Copy link
Contributor

I also just discovered the section where it is calculating blood loss and it does appear that it is just based on body part HP rather than the character's actual blood volume.

It is giving a result back in percentage of estimated blood lost; bleeding really needs to be integrated... someone at the verge of death due to a crushing injury may well have lost some blood internally, but not 99% of it!

So that's why I'm always freezing to death after getting punched across a room by a hulk! I always wondered why limb health was correlated with warmth

@kholat
Copy link
Contributor

kholat commented Mar 7, 2021

This should only be a thing after sweating is added with some kind of a better "wetness" system. Right now summers are already impossible hot and give you a constant speed penalty and pain.

@anothersimulacrum
Copy link
Member

Well, at the moment the game is constantly assuming you are at an ACTIVE_EXERCISE level of exertion (just one level before the top).

anothersimulacrum added a commit to anothersimulacrum/Cataclysm-DDA that referenced this issue Feb 22, 2022
Now that we have better blood simulation, we can rip this out.

It didn't make much sense in the past, and especially does not now.
Based on CleverRaven#47676 and CleverRaven#47428, it may make sense to tie some temperature
loss to shock, but there's no need to keep this (somewhat confusing)
mechanic.
kevingranade pushed a commit that referenced this issue Feb 25, 2022
Now that we have better blood simulation, we can rip this out.

It didn't make much sense in the past, and especially does not now.
Based on #47676 and #47428, it may make sense to tie some temperature
loss to shock, but there's no need to keep this (somewhat confusing)
mechanic.
@stale
Copy link

stale bot commented Apr 30, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not 'bump' or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.

@stale stale bot added the stale Closed for lack of activity, but still valid. label Apr 30, 2022
@Night-Pryanik
Copy link
Contributor

Closing as stale, since stalebot can't do this by itself.

@Night-Pryanik Night-Pryanik closed this as not planned Won't fix, can't repro, duplicate, stale Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mechanics: Character / Player Character / Player mechanics stale Closed for lack of activity, but still valid. <Suggestion / Discussion> Talk it out before implementing
Projects
None yet
Development

No branches or pull requests

9 participants