Astronomical Calorie Burn (FIXED IN .04)


ArrayKnight

Recommended Posts

For those that may be curious, here is the code that updates the calorie burn rate:

public void UpdateCalorieBurnRate()

{

float burnRate = 0f;

if (PlayerIsRunning()) {

burnRate = m_HungerComponent.m_CalorieBurnPerHourRunning;

} else if (PlayerIsWalking()) {

burnRate = m_HungerComponent.m_CalorieBurnPerHourWalking;

} else if (PlayerIsSleeping()) {

burnRate = m_HungerComponent.m_CalorieBurnPerHourSleeping;

} else if (PlayerIsForagingWood()) {

burnRate = m_HungerComponent.m_CalorieBurnPerHourForagingWood;

} else {

burnRate = m_HungerComponent.m_CalorieBurnPerHourStanding;

}

// add to calorie burn based on inventory weight

if (!PlayerIsSleeping()) {

burnRate += GameManager.GetEncumberComponent().GetHourlyCalorieBurnFromWeight();

}

// increase calorie burn rate due to player being cold

burnRate += m_FreezingComponent.m_CurrentFreezing * m_FreezingComponent.m_CalorieBurnMultiplier;

For inventory weight, we increase the burn rate by 5 for each KG of gear. For being cold, the maximum calorie burn addition is 150 (1.5 * freezing_level), since freezing is tracked as a number from 0 to 100.

From the above screen you are warm, so the only way to get to 951 burn would be for the game to think you were still running, and then applying the gear penalty. The burn per hour while running is 800 (on flat ground), but it's only 100 while standing.

So this gives me some good clues to work from.

Link to comment
Share on other sites

It looks like the post removed the tabs used for formatting the code... sorry about that. My code is not that hard to read!

Edit: Bug fixed for version v0.4. The problem was that you could invoke the survival panel while running, and the code that normally checks for the key-up event for running doesn't get called when the survival panel is active. So that key-up event got lost, and you were perpetually in a run state as far as the simulation was concerned (even when not moving).

It would reset itself if you ran again (outside of the survival panel), so hopefully this didn't impact your playthrough too much.

Link to comment
Share on other sites

For those that may be curious, here is the code that updates the calorie burn rate:

public void UpdateCalorieBurnRate()

{

float burnRate = 0f;

if (PlayerIsRunning()) {

burnRate = m_HungerComponent.m_CalorieBurnPerHourRunning;

} else if (PlayerIsWalking()) {

burnRate = m_HungerComponent.m_CalorieBurnPerHourWalking;

} else if (PlayerIsSleeping()) {

burnRate = m_HungerComponent.m_CalorieBurnPerHourSleeping;

} else if (PlayerIsForagingWood()) {

burnRate = m_HungerComponent.m_CalorieBurnPerHourForagingWood;

} else {

burnRate = m_HungerComponent.m_CalorieBurnPerHourStanding;

}

// add to calorie burn based on inventory weight

if (!PlayerIsSleeping()) {

burnRate += GameManager.GetEncumberComponent().GetHourlyCalorieBurnFromWeight();

}

// increase calorie burn rate due to player being cold

burnRate += m_FreezingComponent.m_CurrentFreezing * m_FreezingComponent.m_CalorieBurnMultiplier;

For inventory weight, we increase the burn rate by 5 for each KG of gear. For being cold, the maximum calorie burn addition is 150 (1.5 * freezing_level), since freezing is tracked as a number from 0 to 100.

From the above screen you are warm, so the only way to get to 951 burn would be for the game to think you were still running, and then applying the gear penalty. The burn per hour while running is 800 (on flat ground), but it's only 100 while standing.

So this gives me some good clues to work from.

Love it Alan. Thanks for giving us some insight to the code you are writing. . . . . This stuff is very interesting, and love seeing how you work out this and that. . . Would love to see more :D

Link to comment
Share on other sites

Love it Alan. Thanks for giving us some insight to the code you are writing. . . . . This stuff is very interesting, and love seeing how you work out this and that. . . Would love to see more :D

Same here. This look behind the curtain is much appreciated, Alan.

Reading someones code is a lot of fun. (As a web developer I can read your code without any problems.)

Link to comment
Share on other sites

Love it Alan. Thanks for giving us some insight to the code you are writing. . . . . This stuff is very interesting, and love seeing how you work out this and that. . . Would love to see more :D

Same here. This look behind the curtain is much appreciated, Alan.

Reading someones code is a lot of fun. (As a web developer I can read your code without any problems.)

This makes me wish I was on the dev team.

Link to comment
Share on other sites

Reading someones code is a lot of fun. (As a web developer I can read your code without any problems.)

Same here. Especially if it is nice and cleanly written. There is nothing worse when someone wants you to fix up their Website and the code is that unreadable you got no idea where to start, except from the scratch :(

This is even better than looking at the in-house chat conversations :mrgreen: :mrgreen:

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Guest
This topic is now closed to further replies.