Technical Details and Config Setup - Kevun1/Spice-of-Life-Potato-Edition GitHub Wiki
Notation: names that are formatted **like this** refer to config values.
Food Queue
This mod tracks the past **queueSize** foods that a player has eaten in a queue. Whenever a new food is eaten, a food is added to the queue. If the queue is overfilled, then the oldest food tracked is removed.
Diversity Contribution
Only the most recent of each type of food can count towards food diversity. That means only unique foods in the food queue can contribute to diversity. This is not configurable.
For example, if I ate steak 1, potato, apple 1, steak 2, apple 2, in that order, the only foods that contribute to diversity are potato, steak 2, and apple 2.
For each of the unique foods in the food queue, they each contribute to the total food diversity score according to the formula diversity contribution = base diversity * time penalty.
The base diversity is equal to the complexity defined in **complexityUnparsed** if defined, or equal to **defaultContribution** if not.
The time penalty is a multiplier between 0 and 1 that penalizes the diversity contribution based on how far in the past you last consumed that type of food.
Thus, the optimal strategy for increasing diversity is always to cycle between foods in a set order, like A -> B -> C -> D. The more foods you have in your cycle, the higher your diversity will be.
By default, this is just a linear function that starts at 1 for the most recent eaten food and goes to 0 for the last food in the queue. It looks like the following graph, where the x-axis represents the position in the queue, where 0 is the most recently eaten food.
Again, this means that food diversity has diminishing returns. For example, say the queue size was 10. Say you eat three unique foods in a row, A, B, and C. A will add 1.0 to your diversity score, but B will only add a net of 0.9. This is because adding B will move A down in the food queue 1 slot, so the time penalty applied on A is 0.9. Thus, A's diversity contribution decreased 0.1 points from 1.0 to 0.9. Thus, the net increase from eating B is only 1.0 - 0.1 = 0.9, for a total diversity score of 1.9. Next, when you eat C, it will move both A and B down the queue. A will contribute 0.8, B will contribute 0.9, and C will contribute 1.0, for a total score of 2.7. This means that the marginal change in diversity from C is only 0.7. Keep this in mind when defining custom benefit thresholds! High thresholds will be harder to reach because of diminishing returns!!
However, the config file offers config options for **minContribution**, **startDecay**, and **endDecay**, which make the penalty function look like this:
Basically, foods won't have a time penalty until they are at least **startDecay** positions in the queue. Then, foods after **endDecay** in the queue won't have an increasing time penalty. Between **startDecay** and **endDecay**, the penalty is linear. Finally, as the name suggests, the time penalty is at minimum **minContribution** (note that **minContribution** is a value between 0 and 1). As you can see, the default settings for **startDecay** = 0, **endDecay** = 32, **minContribution** = 0, and **queueSize** = 32 result in the strictly linear function above.
Finally, there is the **shouldForbiddenCount** option. This makes it so that blacklisted foods (which do not add to food diversity) still take up a spot in the food queue. If this is set to false, once a player gets a higher enough diversity, they can just eat only blacklisted foods, and their diversity will never decrease. Thus, I'd suggest setting this to true, unless if you specifically want an option to "lock in" your diversity and not worry about food diversity anymore.
So you might ask, why does any of this matter? Why would I configure this at all? Well, normally you wouldn't need to tweak any of the values, but I've found that the exact diversity calculation method can have a pretty large impact on gameplay experience. And with everyone playing with a different mod list, which may add a different amount of foods, I thought I'd make this all configurable.
So what configs do I choose?
All that info is great and all, but how do you decide on what values you want?
Basically, changing the time penalty function allows you to control for the effect of diminishing returns. The steeper your penalty function is, the greater the effect of diminishing returns. The greater the diminishing returns, you need to eat relatively more types of foods to get to higher diversity levels. If you are a modpack maker, you can go and tweak everything to your heart's content. But if you just want some quick settings I recommend, here's some premade configuration suggestions (not necessarily mutually exclusive):
- Set
**queueSize** = Xand**endDecay** = X, whereXis the total number of foods in your modpack.
- This makes it so that the maximum diversity is achieved only when you rotate between every single food in your modpack. That means there is no ceiling for the amount of foods you are incentivized to automate, which is the spirit of this mod.
- Set
**minContribution** = 1.0.
- This basically eliminates diminishing returns by getting rid of the time penalty. Enable this if you want every single unique food you eat to boost your diversity by the same amount always. This makes creating custom benefit thresholds very easy. However, one side effect is that it can take a long time for diversity to decrease once you stop diversifying and start eating the same foods again.
Negative Effects
It is possible to add penalties for low food diversity by adding negative attribute modifiers or negative potion effects at low diversity thresholds.
Note that players start with 0 food diversity, so if you add a negative potion effect at a threshold of 0, players will get that effect instantly upon creating a new world. To stop effects from kicking in immediately, modify the **minFoodsToActivate** config option, which will make it so that the player needs to eat **minFoodsToActivate** times before any benefit activates, regardless of diversity.