Brotato

Brotato

Not enough ratings
Zat's Compact Fruits [Anti Lag, Endgame]
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
3.402 KB
15 Dec, 2024 @ 2:58pm
16 Dec, 2024 @ 9:08am
4 Change Notes ( view )

Subscribe to download
Zat's Compact Fruits [Anti Lag, Endgame]

Description
This mod aims to reduce lag in the endgame when lots of fruits are spawned in.

With this mod enabled, only a maximum of 50 fruits is spawned; any surplus is added to an internal counter and distributed evenly when you pick up one of the 50 fruits.

Quick example:
Counter = 800, picking up a fruit triggers 16 pickups, reducing counter to 784
Counter = 600, picking up a fruit triggers 12 pickups, reducing counter to 588
Counter = 200, picking up a fruit triggers 4 pickups, reducing counter to 196
Counter = 100, picking up a fruit triggers 2 pickups, reducing counter to 98

When "optimize end of round" is enabled this mod also reduces some of the endgame lag: instead of attracting fruits to players, they are teleported to players instead.

This mod is inspired by Mo's Fruit Compressor which takes a different approach to solving the same problem :)
11 Comments
test 14 Sep @ 12:21pm 
@Sunny its incompatible with [Utility] Brotils which is required by most other mods
Sunny 14 Sep @ 12:20pm 
broken for me, using a lot of mods tho so prolly a conflict.
tested to be sure this one is the problem tho
Justin Case 30 Mar @ 6:10pm 
does the overflow work with farmer's ability (if the counter is above 50 and I'm at full hp will I still get the harvesting?)
test 31 Dec, 2024 @ 11:54am 
I found what causes it, it crashes with https://steamproxy.com/sharedfiles/filedetails/?id=2931388196
test 31 Dec, 2024 @ 11:42am 
the comment below was true. the game didnt start after i installed this mod
wilderneschicken 26 Dec, 2024 @ 8:41am 
cant start game when mod is added
Zat | Mo.  [author] 20 Dec, 2024 @ 6:45am 
@Mo Thanks for your feedback! You raised some very good points there, I'll definitely look into addressing them in a future update :)
Mo 19 Dec, 2024 @ 11:14pm 
Comment 2/2
- similarly, you're not touching the gardens' cooldown. Besides the spawn triggering up to 60 times a second per garden - if you check my nerd notes under my mod, you'll see that vanilla garden cooldown is bound to the animation. Compared to mine, your mod should give results that are very close (give or take rounding error) to what you'd expect from vanilla, minus lag. And that's great, certainly different approach to mine - where I decided to unlock the garden's full potential by enabling speed scaling bypassing the animation holdback. It's more of a note to subscribers choose a mod that fits their needs best (stay pure-ish or silly mode go brrrr)
- you overlooked Druid's poisoned fruit (id "consumable_poisoned_fruit), just like I did. At quick glance in your code, their spawn is affected by the cap, while picking them up doesn't trigger your consumption

All in all, great mod, love the simplicity, keep up the work :)
Mo 19 Dec, 2024 @ 11:14pm 
Comment 1/2
Good work Zat! But couple things to consider:
- running parent on_consumable_picked_up() in a loop over the stacked amount will have linear execution time growth; for all practical purposes it's still waaaaay better than vanilla, amazing and I love it, but when numbers get silly (say millions, billions) the lag will start to come back. I do not believe it matters really, but I would just be cautious with this approach in a different, more complex scenario
Zat | Mo.  [author] 16 Dec, 2024 @ 7:48am 
@test I'd use either or since both modify the amount of fruits you're rewarded upon pickup. If I understood his mod's description correctly, mine should provide the better lag reduction as just fewer fruits are spawned alltogether.