Fruit Compressor
Compresses fruit in order to reduce lag in the late game. The way it works:
– should the fruit spawn too fast for the game to handle, slow down their spawn rate
– in exchange, any On Consume effect is respectively magnified (heal by fruit, Farmer’s harvesting, Spicy Sauce damage, Chubby’s explosions)
– arbitrary cap at a single fruit every 2 seconds
So if a garden was to produce 4 fruit a second normally, with this mod gardens will produce a fruit worth 8 fruits every 2 seconds. This allows gardens to truly produce what they are supposed to, without causing lag. Vanilla gardens have a soft cap explained below.
Nerd talk below:
There is actually a limit how fast gardens can spawn fruit. The speed, or rather cooldown in between spawns is bound by how many times a second the game does processing. To give the numbers:
• each second the game may process the game loop up to 60 times (or the game runs at 60 ticks per second)
• gardens’ default cooldown is defined as 900 ticks, being 60 ticks times 15 seconds
• the cooldown is also influenced by the gardens’ animation speed, in a similar way melee weapons can’t hit as fast as ranged do shoot
• theoretically the limit is 60 fruit per second per garden, or the cooldown of 1, but from tests, at attack speed of 9999999999999% the cooldown until next fruit was still somewhere between 1.7 and 2.5 (due to – you guessed it – the animation speed). Quite crazy, given that this much attack speed should spawn over 11 billion fruits a second
• in that test harvesting jumped from 23 to 453, giving 430 fruit consumed from a single garden over a 60 second round
• due to the vague influence of the animation speed, that gives us 7.16 fruit a second
• or a fruit spawned every 8.37 ticks, and that is essentially the soft cap on how many fruit you can get