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

New Characters Begin Starving #46995

Closed
eddj93 opened this issue Jan 24, 2021 · 35 comments · Fixed by #47482
Closed

New Characters Begin Starving #46995

eddj93 opened this issue Jan 24, 2021 · 35 comments · Fixed by #47482
Labels
<Bug> This needs to be fixed Character / World Generation Issues and enhancements concerning stages of creating a character or a world (S2 - Confirmed) Bug that's been confirmed to exist

Comments

@eddj93
Copy link

eddj93 commented Jan 24, 2021

Describe the bug

New player characters spawn as starving, dehydrated and skeletal when beginning a new game

Steps To Reproduce

  1. Start a new game
  2. Starve

Expected behavior

  1. Start a new game
  2. Don't starve
  3. Be Overweight as in previous builds

Screenshots

cdda

Versions and configuration

  • OS: Windows
    • OS Version: 10.0 2004
  • Game Version: 0.E-9181-g308bec1-dirty [64-bit]
  • Graphics Version: Tiles
  • Game Language: System language []
  • Mods loaded: [
    Dark Days Ahead [dda]
    ]
@anothersimulacrum anothersimulacrum added the (S1 - Need confirmation) Report waiting on confirmation of reproducibility label Jan 24, 2021
@anothersimulacrum
Copy link
Member

Cannot reproduce on 0.E-9181-g308bec1612

@BrettDong
Copy link
Member

Which starting scenario, profession and traits did you choose?

@wapcaplet
Copy link
Contributor

Which starting scenario, profession and traits did you choose?

It appears to be the "Overrun" scenario using the "Combat Medic" profession, with the "No NPC Needs" and "Bionic Professions" mods disabled. Starting traits are indicated in the OP screenshot.

I tried several times in 0.E-9181-g308bec1612 to reproduce the issue with the same parameters, but always began in "Overweight" rather than "Skeletal" status.

@Reknot
Copy link

Reknot commented Jan 24, 2021

Can confirm.
Occurs on build >11367
11366 works fine.
Using Operator Recon class from Fuji's Military Profession Pack
unknown

Using this mod setup

image

Doesn't matter how you restore\reset\juggle things. Always starts as starving.

@wapcaplet wapcaplet added (S2 - Confirmed) Bug that's been confirmed to exist <Bug> This needs to be fixed and removed (S1 - Need confirmation) Report waiting on confirmation of reproducibility labels Jan 24, 2021
@BrettDong BrettDong added the Character / World Generation Issues and enhancements concerning stages of creating a character or a world label Jan 24, 2021
@wapcaplet
Copy link
Contributor

wapcaplet commented Jan 24, 2021

Reported by user Kasper on dev Discord as well:

Each new game I start, I spawn skeletal and starving - which results in instant death. I've tried rollbacks and recreating the world, but it keeps happening.
I've tried several different scenarios and professions, and it even worked fine earlier today on the same patch, but suddenly it started happening

I still cannot reproduce it myself.

@actual-nh
Copy link
Contributor

actual-nh commented Jan 24, 2021

Does it happen in builds prior to 11400-11398?

@Reknot
Copy link

Reknot commented Jan 24, 2021

Does it happen in builds prior to 11398?

I tested it trough the CDDA Game Launcher, any build above and including 11397 it happens to any character-
I can provide world and template for character.

@BrettDong
Copy link
Member

What is the value of stored calories in debug menu -> player -> edit player -> you -> set needs?

@Reknot
Copy link

Reknot commented Jan 24, 2021

image
On borken @BrettDong

@Reknot
Copy link

Reknot commented Jan 24, 2021

Does it happen in builds prior to 11400-11398?

Template_And_WorldGenFiles_OHGODZIPPLZ.zip

[ Sorry for nested Zip ]

@actual-nh
Copy link
Contributor

Does it happen in builds prior to 11398?

I tested it trough the CDDA Game Launcher, any build above and including 11396 it happens to any character-

Huh. The first thing I thought of was a metabolism refinement @anothersimulacrum and I (or, if it is indeed the culprit, I rephrase that to myself and anothersimulacrum) did... but it didn't go in until 11398.

I can provide world and template for character.

What OS are you using? (And wapcaplet - what OS are you using?)

@BrettDong
Copy link
Member

Confirmed with world file and character templated provided by @Reknot on macOS on 0.E-9182 85a23ed

@Reknot
Copy link

Reknot commented Jan 24, 2021

What OS are you using? (And wapcaplet - what OS are you using?)

Win10

I jump back and fourth between 11396 and 11398 (11397 is "unavailable") to make the screenshot and test stuff you request. =)
Resetting world and starting new toon each time I go to 11398
.
image

@Proxiehunter
Copy link

Are you using preset characters? Someone on Reddit said once they deleted their presets and remade them the problem ceased.

@Reknot
Copy link

Reknot commented Jan 24, 2021

Are you using preset characters? Someone on Reddit said once they deleted their presets and remade them the problem ceased.

Well, I suppose Yes. Mine are made prior 11397.
Soo, I guess the new calorie system doesn't take that into account making any old Template broken?

@actual-nh
Copy link
Contributor

Actually, it does. It multiples the old kcal by 1000. Savegame_version went from 31 to 32. Perhaps something went wrong with the versioning?

@Proxiehunter
Copy link

Not sure of the why but I was having this problem a few minutes ago and I can confirm that deleting your presets and remaking them fixed the issue, just did it now. Kind of annoying to have to do that but at least there's an interim fix.

@actual-nh
Copy link
Contributor

What does it say at the start of the file - the number after '# Version"?

@BrettDong
Copy link
Member

I guess the new calorie system doesn't take that into account making any old Template broken?

You are right. Multiplying stored calories in your character template by 1000 solves the issue.

@actual-nh
Copy link
Contributor

src/savegame_json.cpp - line 565-566 should be multiplying anything with a version of 31 or before by a 1000. So what's going wrong with that?

@BrettDong
Copy link
Member

Migration fails because there is no version information in character templates.

@actual-nh
Copy link
Contributor

Umm... possibly version information should be put into them, and no version treated as 31?

@actual-nh
Copy link
Contributor

And why is it happening with 11396?

@wapcaplet
Copy link
Contributor

(And wapcaplet - what OS are you using?)

Linux (PopOS! / Ubuntu)

@PaulBlay
Copy link

Umm... possibly version information should be put into them, and no version treated as 31?

The only problem with that is that a select few preset character templates will be so fat they explode. Those that were created after the x1000 change but before the version number was added. That's a pretty unlikely scenario, though.

@Reknot
Copy link

Reknot commented Jan 24, 2021

And why is it happening with 11396?

Holy shit! My bad. I typed it >11396. But wanted to be more specific in text and FORGOT to change to 11397 when typing
"any build above and including 11396" <-- This is my mistake, should be
"any build above and including 11397"

Just wanted to clarify this, incase of confusion.

@actual-nh
Copy link
Contributor

actual-nh commented Jan 24, 2021

Umm... possibly version information should be put into them, and no version treated as 31?

The only problem with that is that a select few preset character templates will be so fat they explode. Those that were created after the x1000 change but before the version number was added. That's a pretty unlikely scenario, though.

If the stored calories are already greater than sqrt(1000)*55,000, then don't multiply them by 1000.

@actual-nh
Copy link
Contributor

actual-nh commented Jan 24, 2021

Regarding putting version information into character template files, and treating properly the absence of such: I am not up to the needed C++ coding, at least not without considerable trial and error (and thus time).

@anothersimulacrum
Copy link
Member

Templates appear to be saving an entire character, I am not sure they need to be doing that at all, there's all sort of data that is really not needed there, and it would avoid bugs like this.

This doesn't fix the current issue, but would prevent it from occurring in large part in the future.

@actual-nh
Copy link
Contributor

Templates appear to be saving an entire character, I am not sure they need to be doing that at all, there's all sort of data that is really not needed there, and it would avoid bugs like this.

There is information that can be reconstructed instead (given that they are otherwise a default starting character)?

@anothersimulacrum
Copy link
Member

The only data that needs to be saved is that which can be selected through character creation: scenario, profession, stats, skills, traits, gender, name, height, age, blood type, and starting location selection. Start with a default character, then apply all those, and we're back to the character we made.
It's a little more of a burden, because new things added to character creation must be added to it, but it prevents the need to do much of any migration.

@K7ATR
Copy link

K7ATR commented Feb 1, 2021

Are you using preset characters? Someone on Reddit said once they deleted their presets and remade them the problem ceased.

This fixes the issue for me.

@wapcaplet
Copy link
Contributor

I have added and self-assigned a new feature request to implement the solution @anothersimulacrum described above. That won't really fix this bug - nothing can truly fix it now, since we don't have game version in the template - but it will prevent similar issues in the future.

Since it took so long for the above discussion to even arrive at what the problem was, and is not even particularly interesting to read, I am closing this dark rabbit hole in lieu of #47462. Thanks everyone for participating!

@BrettDong
Copy link
Member

How about adding a band-aid hack for 0.F migration? Say automagically multiply by 1000 if the value read from JSON is below some threshold.

@actual-nh
Copy link
Contributor

actual-nh commented Feb 13, 2021

How about adding a band-aid hack for 0.F migration? Say automagically multiply by 1000 if the value read from JSON is below some threshold.

Suggested threshold: 55,000/sqrt(1,000) kcal.

wapcaplet added a commit to wapcaplet/Cataclysm-DDA that referenced this issue Feb 13, 2021
Before CleverRaven#46906, character templates were saved with stored_calories equal
to total kilocalories (55,000 being the "healthy" baseline).

Now, stored_calories is in units of small-c calories, being 55,000,000
for the healthy baseline. This led to a bug CleverRaven#46995 where new characters
created from older-version templates would spawn with too few calories,
by a factor of 1,000.

Detect this when templates are loaded, and multiply stored_calories if
its value appears to be way too small.
wapcaplet added a commit to wapcaplet/Cataclysm-DDA that referenced this issue Feb 13, 2021
Before CleverRaven#46906, character templates were saved with stored_calories equal
to total kilocalories (55,000 being the "healthy" baseline).

Now, stored_calories is in units of small-c calories, being 55,000,000
for the healthy baseline. This led to a bug CleverRaven#46995 where new characters
created from older-version templates would spawn with too few calories,
by a factor of 1,000.

Detect this when templates are loaded, and multiply stored_calories if
its value appears to be way too small.
wapcaplet added a commit to wapcaplet/Cataclysm-DDA that referenced this issue Feb 13, 2021
Before CleverRaven#46906, character templates were saved with stored_calories equal
to total kilocalories (55,000 being the "healthy" baseline).

Now, stored_calories is in units of small-c calories, being 55,000,000
for the healthy baseline. This led to a bug CleverRaven#46995 where new characters
created from older-version templates would spawn with too few calories,
by a factor of 1,000.

Detect this when templates are loaded, and multiply stored_calories if
its value appears to be way too small.
Ramza13 pushed a commit to Ramza13/Cataclysm-DDA that referenced this issue Apr 12, 2021
Before CleverRaven#46906, character templates were saved with stored_calories equal
to total kilocalories (55,000 being the "healthy" baseline).

Now, stored_calories is in units of small-c calories, being 55,000,000
for the healthy baseline. This led to a bug CleverRaven#46995 where new characters
created from older-version templates would spawn with too few calories,
by a factor of 1,000.

Detect this when templates are loaded, and multiply stored_calories if
its value appears to be way too small.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bug> This needs to be fixed Character / World Generation Issues and enhancements concerning stages of creating a character or a world (S2 - Confirmed) Bug that's been confirmed to exist
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants