-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Large "stacks" of food never freeze in freezer #60865
Comments
Can confirm stuff going immediately rotten after moving from a freezer. Also happened with (sealed) salted meat slices - first eaten slice would be ok, the second in the pack would insta rot. |
/confirmed It's not connected to stack size, but rather on some "random" factor. I've got frozen, unfrozen, and hot(!) food in a fridge weeks after it being placed there. The bug where things rot immediately after being removed from a fridge is (probably) a separate one, as it (can?) happens to food regardless of whether it's cold or not. The work around for that is to craft your meal (or eat it cold) directly from the fridge (i.e. not remove the food first). Based on having food rot while crafting (when relighting the fire that went out when cooking meat that was going old in the open), I suspect the crafting has to be uninterrupted. |
It looks like a very promising investigation lead, @Terrorforge! A long time (weeks, or possibly months, could even be a season, and I don't think I've got any stack with a count of 1000). Things were thrown into the freezer as soon as they'd been crafted (or, in the case of companion crafting, the crafter had been recalled and delivered the product). Thus, if leaving the reality bubble screws the timers up it would explain the randomness, and if cooling down time is connected to the stack size it would explain why it seems to be so inconsistent when coupled with reality bubble exits. Checking the contents of the freezer: Edit: Added debug data last temp, temp, and spec ener after the counts
|
So, if I understand correctly:
Could this simply be fixed by freezing a stack of items as fast as a single item? In other words, the code would take item mass instead of stack mass when the freezing operation is calculated? |
It is a real world thing that a large volume of things thrown into a freezer at once causes the temperature inside to rise, and thus take longer to freeze things (and potentially thawing others partially), while larger items take longer to freeze than a set of smaller ones. However, that can be a bit complicated to implement properly, so in the absence of such logic the work around suggested by @borsek could be implemented (assuming our assumptions of how the code works is correct). However, the big issue is really the reality bubble interaction, which shouldn't leave items in limbo, but rather freezing them down properly. |
I definitely agree that my suggestion is a simplification, but I'm sure accurate temperature interaction would kill CPUs - dwarf fortress has a fairly complex system, but it kills performance absolutely and completely. On that note, stuff like ethanol and antiseptic shouldn't freeze at -10 (assuming antiseptic is ethanol and not iodine-based, even then it should withstand several degrees C negative), so there's realism missing there too. Do we even have freezing points set or planned for stuff? |
When items are out of reality bubble they do not get processed. The temperature calculations are pretty much as realistic as they can be with the info avalable for use. The temperature is just calculated relatively slowly (once every 10 minutes per item) so it isn't big performance impact. (fun fact: The process of finding items for temperature processing is much bigger performance impact than temperature calculations themself). Items get their freezing points from their material. Items can also override their own freezing point in json (see alcohol drinks). Problems with freezers/fridges have existed for long time but nobody has been able to find reliable reproduction steps. If you enable debug mode you can see exact temperature of the item (in kelvins). It would be useful to know what it is on the items that experience the bug. |
I don't know how to display item temperatures. However, my impression is that temperatures just have ceased to be processed, rather than them being set incorrectly. |
Debug mode key is not bound do anything. Press Press that bound key. Turn debug mode on (there are other options that can be ignored). Look at the item. For the temperature bug the interesting values are:
|
Thanks for the instructions, @Hirmuolio. I've updated my previous post listing contents with last temp, temp, and spec ener for the first few and last few items. I can do the rest if required, but it's tedious and I'm lazy.
Edit: Added fresh, not cold scrap of meat to the mentioned post for a value that should be a bit above freezing, and it is. |
I somehow managed to trigger some bug maybe. And the findings make things even more confusing. The steps I roughly took to trigger the bug. Not sure which ones are necessary (maybe the save+load was all that was needed but I'm not going to test that right now):
None of the foods in the freezer were getting processed. For some reason the active item cache was completely empty. Creating new items would add the new items into the cache. And taking food out would make them process. But the food that were in the freezer did not get processed at all. This bug also persisted through save and load cycle. But now the part where things get weird. This bug happens only on certain versions of the game! If I load the save on build I build with Visual Studio 2022 the bug happens. Here is the save:
|
I got as far as verifying that the freezer contents are being loaded into |
I did some more debugging. It seems like the items are correctly loaded into the active item cache. But for some reason fetching the items from the cache causes the cache to be emptied. Here test code: master...Hirmuolio:Cataclysm-DDA:fixtemp (Early return to skip some irrelevant stuff so it doesn't trigger breakpoints.) |
Not sure if helpful, but just wanted to chime in and say that this has been a big issue in my games, although the solution doesn't seem to be too evident from reading previous comments. |
Lots of similar investigation happening in #58824. I think these issues both have the same root cause. @akrieger I confirmed the same thing as you, and then confirmed that the I pushed up something that seems to fix it in #60952 just not sure if it's the right fix. Edit: Okay, parts of this issue have the same root cause. Like the |
About the large stacks. In the temperature calculations the heat loss/gain is based on surface area which in turn is based on volume. When you stack items their mass is simply added together. So two 0.3 kg meat chunks has mass of 0.6 kg. But surface area behaves differently. The relation is not linear. It involves raising the volume to power of 2/3 (simply assumes all items to be cube shaped). So two chunks of meat has 2x the mass but only 1.5x surface area. So it cools down much slower. For N number of items in stack the mass is N times but the surface area is N^(2/3) times. 1000 chunks of meat has 1000x mass but only 100x surface area. Also the freezer is not very cold. It is only at -5 celcius. It was written for vehicle minifreezer. Maybe proper appliance freezers should me made colder? Most foods are pretty similar to water in their stats. So you can ask yourself "how long does it take for 300 L of water (1000x chunks of meat) to freeze at -5 celcius temperature". |
So, huh, why is it so warm in freezers? IRL, they are generally between -18 and -23 c (0 -> -10 F), so, yeah, it's no wonder things go bad in them. |
Afaik, this behavior is more or less accurate to reality. Heat exchange is largely a function of surface area (and thermal conductance), and the square-cube law means the volume (and thus mass) increases faster than surface area as an object gets larger. But it gets weird because it's treating all the meat chunks in a stack as one item, and items are handled individually. So if for example you have two stacks of 100 and two freezers, you can freeze them faster by splitting the stacks so each freezer has two stacks of 50 instead of one stack of 100. Which gets weirder still when you consider that a chunk of meat is an arbitrary unit. It's about a porkchop's worth, but the game doesn't really distinguish between 8 porkchops and one pork roast. |
The problem comes from a stack considered to be a single item from the game's perspective when it comes to cooling, and it stacks items without you being able to stop it (well, you can game it by placing e.g. stacks of 10 in at intervals to get them to get different temperature and rot timers, and thus not stack). In real life you wouldn't place your chunks as a compact mass, but rather spread it out as much as possible to expose as much of the surface area to the cold as possible. However splitting a 100 stack in two and putting each in a different freezer is going to cause freezing to be faster in real life because each freezer has a limited freezing capacity. I also suspect a health inspector in any somewhat civilized country would reject the game freezer temperatures as being dangerously high. |
So, could we, as a workaround, change freezing s.t. it looks at item stack counts when trying to figure out freezing time? (Only for non-fluids, of course. Probably just default to keeping items with charges the same, overall.) |
That would be possible. It would make freezing happen faster but it would also make melting happen faster. So it would cancel out usually. It doesn't usually matter if item freezes fast or slow. As soon as it is in the freezer the rotting stops (rot is mostly based on environment temperature). |
Glad you all arrived at the simple resolution I presented 8 days ago. |
Describe the bug
Having 1000 chunks meat stacked in a freezer will cause these chunks to never move beyond cold status.
Steps to reproduce
Expected behavior
Freezer making meat frozen.
Screenshots
No response
Versions and configuration
Dark Days Ahead [dda],
Disable NPC Needs [no_npc_food],
No Fungal Growth [no_fungal_growth],
Bionic Slots [cbm_slots],
Bionic Professions [package_bionic_professions]
]
Additional context
Potentially another bug at play, as accidentally moving contents of my freezer onto a nearby tile caused many "cold" items that were fine for weeks to immediately become rotten as if all the time they were in the freezer passed at the same time.
The text was updated successfully, but these errors were encountered: