PDA

View Full Version : Deviation rates in food decay



latyper
2nd April 2016, 00:02
I've been trying to work out the actual decay rates of food in hard numbers. I started testing on my creative single player world but my results kept coming up different when I would repeat a test. This lead me to trying to work out deviation rates - how random are decay rates. So I filled my hot bar with raw beef and skipped forward 48000 ticks (2 days) using /time add 48000. After each test I put new beef in my hot bar and repeated that 10 times.

Here is the chart I came up:

2814

The y axis is the decay rate recorded. the x axis is the test batch number. The red line shows the average of each test. The total average decay for a piece of raw beef is 1.86 decay. The highest recorded decay rate was 4.3 decay. The lowest was .1 decay.

I was hoping that this would work out as a nice bell curve but when I organized the results by frequency within ranges I got this:
2815

In other words there is no pattern to the distribution of decay rates. Decay rates don't tend to be anything. Instead all I can say about there being a pattern is that decay rates on a piece of raw beef over 48,000 ticks can be anything between .1 and 4.3.

Rainnmannx
2nd April 2016, 00:45
Doesnt temperature and rain affect it also?
If you keep going 2 days ahead wont that change temp due to season change?

latyper
2nd April 2016, 20:00
Doesnt temperature and rain affect it also?
If you keep going 2 days ahead wont that change temp due to season change?

And that ladies and gentlemen, is why we do peer review.


Rainmaxx,
Yes. That would change everything. The samples in each batch are consistent, (same temperature, season, and rain). However. the tenth batch was recorded 18 days after the first batch. This means that the batches shouldn't really be compared to one another, just the samples within each batch. I don't think this changes the basic finding though that decay rates are all over the place and cannot be predicted.

Chogata
2nd April 2016, 20:42
There is a bug in decay and Kitty announced lately that she will try to fix is ASAP, but may be unable to do it before May...

latyper
2nd April 2016, 20:43
There is a bug in decay and Kitty announced lately that she will try to fix is ASAP, but may be unable to do it before May...

What bug? Can you link me?

InsaneJ
3rd April 2016, 00:07
It's been analyzed and tracked down in the TFC code by our very own LarsonPacific:
http://happydiggers.net/showthread.php?2095-Food-Decay-on-Crack

And reported on the TFC forums as well:
http://terrafirmacraft.com/f/topic/9117-food-decay-russian-roulette/

latyper
3rd April 2016, 03:18
In that case I''' hold off on trying to figure out decay rates until after this is fixed.

LarsonPacific
3rd April 2016, 09:15
In that case I''' hold off on trying to figure out decay rates until after this is fixed.

Random decay is coded in, and works like this: All food stacks start life with a decay value of -24. The negative value then ticks towards 0. Once it reaches 0, the very first tick of decay on the food item is random and based on a function of it's weight. This usually results in a value ranging from 0 to .5%. This initial tick is the most important one, since decay compounds. So a piece of food that takes an initial tick of .5 will be gone long before a piece of food that takes an initial tick of .1. In this way, you can have several "identical" stacks of food in a container or in inventory, all placed there at the exact same time... and all will have vastly different decay values after a period of time.

Temperature of course plays a role in decay rate, by way of being part of the calculation of the environmental decay factor, which is multiplied along with all with other decay factors, such as being cooked, being in a vessel, salted, dried, smoked, preserving etc, when determining the decay amount for each tick. Rain once had an effect on decay as well, but they removed that feature soon after introducing it...

As far as I've observed, everything is working exactly as it's was coded to, and apart from that one bug, as the devs intended it to be... :)

latyper
3rd April 2016, 11:06
Random decay is coded in, and works like this: All food stacks start life with a decay value of -24. The negative value then ticks towards 0. Once it reaches 0, the very first tick of decay on the food item is random and based on a function of it's weight. This usually results in a value ranging from 0 to .5%. This initial tick is the most important one, since decay compounds. So a piece of food that takes an initial tick of .5 will be gone long before a piece of food that takes an initial tick of .1. In this way, you can have several "identical" stacks of food in a container or in inventory, all placed there at the exact same time... and all will have vastly different decay values after a period of time.

Temperature of course plays a role in decay rate, by way of being part of the calculation of the environmental decay factor, which is multiplied along with all with other decay factors, such as being cooked, being in a vessel, salted, dried, smoked, preserving etc, when determining the decay amount for each tick. Rain once had an effect on decay as well, but they removed that feature soon after introducing it...

As far as I've observed, everything is working exactly as it's was coded to, and apart from that one bug, as the devs intended it to be... :)

Wow. Have you been hacking the code? How did you find out all this stuff about initial decays and everything?

Chogata
3rd April 2016, 15:44
I think he just downloaded the sources from GitHub ;)