Content: Slate Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate Marble
Background: Slate Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate Marble
Pattern: Blank Waves Notes Sharp Wood Rockface Leather Honey Vertical Triangles
Welcome to TerraFirmaCraft Forums

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

  • Announcements

    • Dries007

      ATTENTION Forum Database Breach   03/04/2019

      There has been a breach of our database. Please make sure you change your password (use a password manager, like Lastpass).
      If you used this password anywhere else, change that too! The passwords themselves are stored hashed, but may old accounts still had old, insecure (by today's standards) hashes from back when they where created. This means they can be "cracked" more easily. Other leaked information includes: email, IP, account name.
      I'm trying my best to find out more and keep everyone up to date. Discord (http://invite.gg/TerraFirmaCraft) is the best option for up to date news and questions. I'm sorry for this, but the damage has been done. All I can do is try to make sure it doesn't happen again.
    • Claycorp

      This forum is now READ ONLY!   01/20/2020

      As of this post and forever into the future this forum has been put into READ ONLY MODE. There will be no new posts! A replacement is coming SoonTM . If you wish to stay up-to-date on whats going on or post your content. Please use the Discord or Sub-Reddit until the new forums are running.

      Any questions or comments can be directed to Claycorp on either platform.
dodgersfan2134

Decay not working when changing FoodDecayMultiplier in new config. (78.12)

10 posts in this topic

I was playing with 78.12's config settings for the decay. When I change the multiplier, and add time with counsel commands, the toolip doesn't go above 0% and starts blinking. Anyone else experiencing this?  :blink:

0

Share this post


Link to post
Share on other sites

What exactly did you change the multiplier to?

0

Share this post


Link to post
Share on other sites

Yes. The new math is slightly broken. You need to put more than 1 into rate. 

0

Share this post


Link to post
Share on other sites

Yes. The new math is slightly broken. You need to put more than 1 into rate. 

 

You're right. Seems like there could be issues if any of the other multipliers are less than 1 as well. I'm guessing the code should really look like this instead:

float baseDecayToAdd = (decay * Global.FOOD_DECAY_RATE) - decay;float adjustedDecayToAdd = baseDecayToAdd * thisDecayRate * environmentalDecay * protMult * TFCOptions.decayMultiplier;decay += adjustedDecayToAdd;

Global.FOOD_DECAY_RATE will always need to be 1.0 or greater, but other than that the other multipliers can be between 0 and 1 and always result in decay being added. Need to make sure they're not negative also.

0

Share this post


Link to post
Share on other sites

math is confusing....

 

 

 

First, I look at the formula that Bioxx postet in "Setting up our own decay rate" (omitting the /24):

 

  decay_new = decay_old + decay_old * Global.FOOD_DECAY_RATE * thisDecayRate * environmentalDecay * protMult * TFCOptions.decayMultiplier

 

lets simplify it a bit, with mult = thisDecayRate * environmentalDecay * protMult * TFCOptions.decayMultiplier:

 

  decay_new = decay_old * (1 + Global.FOOD_DECAY_RATE * mult)

 

after 24 decay-ticks this would result in

 

decay_new24 = decay_old * (1 + Global.FOOD_DECAY_RATE * mult)^24.

 

Now I use the Information that decay_new24 = decay_old * 1.5 if mult = 1 and solve the equation (1 + Global.FOOD_DECAY_RATE)^24 = 1.5, this results in Global.FOOD_DECAY_RATE = 0.01703789660558695 (that is exactly 1 less than the value set in the config that solves the equation Global.FOOD_DECAY_RATE^24 = 1.5).

 

 

 

Second, I look at what VegasGoat posted in that same thread (and what might be implemented at the moment?)

 

  decay_new = decay_old * Global.FOOD_DECAY_RATE * thisDecayRate * environmentalDecay * protMult * TFCOptions.decayMultiplier

 

simplified:

 

decay_new = decay_old * Global.FOOD_DECAY_RATE * mult

 

after 24 decay-ticks:

 

decay_new24 = decay_old * Global.FOOD_DECAY_RATE^24 * mult^24

 

with Global.FOOD_DECAY_RATE = 1.01703789660558695 and mult = 1 this formula fulfills the condition decay_new24 = 1,5* decay_old, but else it is totally different. Especially if Global.FOOD_DECAY_RATE * mult < 1 the new decay would be less than the old decay (but it should be that the new decay is always greater or equal to the old decay)! Bioxx stated that for temperatures below 15°C decay is slowed, assuming the environmentalDecay-multiplier is calculated to match his formula that would mean environmentalDecay < 1, depending on the values of the other multipliers that could sometimes result in Global.FOOD_DECAY_RATE * mult < 1.

 

 

 

Third, I look at what VegasGoat posted above, writing it as a formula:

 

decay_new = decay_old + (decay_old * Global.FOOD_DECAY_RATE - decay_old) * mult = decay_old * (1 + (Global.FOOD_DECAY_RATE - 1) * mult)

 

that is almost the same formula than the one from Bioxx, just with Global.FOOD_DECAY_RATE - 1 instead of Global.FOOD_DECAY_RATE.

0

Share this post


Link to post
Share on other sites

I'm not really a math guy, I'm just a programmer, so anything I say can be wrong. Usually the math guys just give me a formula to implement. But I think the difference is what happens when "mult" is less than 1. In the currently implemented formula you end up with less decay than when you started, which shouldn't happen. I don't know if my proposed solution will work or not but I think it might.

0

Share this post


Link to post
Share on other sites

Re-download 78.12. Bioxx did a ghost fix for this.

0

Share this post


Link to post
Share on other sites

This issue has been fixed in a ghost fix. Re-download 78.12 if you haven't already. NEVER EVER set FOOD_DECAY_RATE <= 1. Anyone who was, was being stupid.

0

Share this post


Link to post
Share on other sites

Just adding the current math is:

newDecay = decay * (1 + (FoodDecayRate - 1) * environment_rate * food_rate * FoodDecayMultiplier)

 

If all other than FoodDecayRate are 1, the formula becomes :

newDecay = decay * FoodDecayRate

 

Which is nice, because it allows that nice default decay rate calculation while keeping the same food rates.

0

Share this post


Link to post
Share on other sites