I delved much deeper into the TFC source code to figure out exactly what happened this last update.
What they did, was change how the decay value is stored. Simply put, it went from two decimal places, to four. Seems like a minor change, however, this has a _massive_ effect on lifespan of foods in certain areas.
Consider a stack of fruit near the equator. Say its initial tick off zero is 0.2, or 0.20. Decay calculations are very precise, using float values for most calculations, with many, many decimal places; most early decay calculations in most climates return fractions of a percent decay. At 35C (pretty warm imho), this stack of raw fruit, which has a 2.0 decay multiplier sitting at a current decay of 0.20, will get it's decay tick calculated at 0.2097037845, or when truncated to two decimal places... is... 0.20.
So, there was the problem.
The decay tick would simply update the decay timer and rewrite the same decay value of 0.20 back to the stack of food. Wash, rinse, repeat. Like being in a freezer most of the time, but not. Until the player happens to be standing somewhere where the calculated decay gets over that hump, like in front of a firepit, or during a hot part of the day, the decay would never tick... and even when it did, still would probably not tick regularly due to changing temperatures, temperature caching etc, thus drastically or indefinitely increasing shelf life of the food. When you take into account all the fractional decay percentages being regularly tossed out effectively nullifying the majority of all early decay ticks, the bug was making almost all food everywhere last an artificially long time.
Their truncation function simply took the very precise decay float value, multiplied it by 100, stored it as an int value (fancy name for a whole number), then returned it divided by 100 again as a float and stored it, thus effectively truncating the decay to 2 digits. All they did in the update was change the multiplier from 100 to 10,000, so now it truncates to 4 decimal places. Ironically, this in-house truncation function they wrote, is named "roundNumber" XD
Now, taking into account that each tick is now actually logging decay far more accurately and not throwing away those all important early fractional decay ticks, and the fact the average temp is 45C near the equator, and the fact that a person who logs off while others rack up several hours total play time will receive hundreds of decay ticks in quick succession using a decay "protection" of only 50% a regular tick or more when they log in, it's not difficult to see why people's food is evaporating between logins near the equator on hardcore. It's just designed to be that way.
So anyways, that's why decay is doing what it's doing. It's possible there may be a cauldron issue, but nothing I've seen myself personally really indicates the issue is any deeper than this. My initial tests were flawed because I was testing at the equator with fruit, at a temperature where every tick would have logged decay, so testing decay times showed little difference between current and previous versions. Using a mathematical model accounting for the decay truncation, everything became clear pretty quick.
Decay protection on the other hand, now makes less sense in my head. According to the source code, if you've been offline more than 24 in-game hours, and less than 576, your food in inventory will take that many decay ticks (yes, it will process every last one of them individually) at logon, with a decay protection multiplier of 1 - (remainingTicks/576) which is multiplied in with the other decay multipliers. Logging in after 576 hours, however, you will simply take 24 ticks of regular decay. Go figure? The numbers aren't jiving in my brain, but I will have to do some further mathematical analysis to determine if anything is indeed awry...
On a personal note, for others who haven't seen me online much lately, since food preservation isn't really my thing outside of pure mathematical curiosity, and I don't want to pack my smithing shop back north, I'll probably just pack my gear in the ark, await the flood, and focus efforts elsewhere for the next while... maybe towards getting the new maps ready![]()

Reply With Quote



