cameroncondry / cbc-kitten-scientists

Add-on for the wonderful incremental browser game: http://kittensgame.com/web/
MIT License
113 stars 94 forks source link

Some Crafting/Trade Improvements and A Bulk Build Bugfix #256

Closed Wymrite closed 5 years ago

Wymrite commented 5 years ago

This pull request is a collection of a handful of minor modifications to the crafting system to make limited crafting a bit more versatile.

Firstly, in the current version of KS, the limited toggle has no effect for resources made with only raw resources (such as slabs or plates). The reason for this is that the trigger and consumption rate took priority over limited crafting, so it would always wait until the trigger is reached before consuming the consumption rate in raw resources thus causing the limited toggle to have no effect. I've changed it so that limited crafting now takes priority over these, so that regardless of the storage cap, KS will for example turn 500 minerals into 250 minerals and 1 slab. Once the trigger value is reached or if limited is disabled for these resources, KS will behave as before.

This also had the effect of helping keep resources like alloy which have both uncapped and capped ingredients stay more proportional when limited is enabled.

Some special functionality was added for plates and steel as well, since they fall into the unique position of using the same uncapped resource, thus commonly causing the auto-production of one to block out the other. I've added a check for limited to keep these two proportional to each other while still crafting plates when iron would otherwise be wasted.

These changes together shift the goal of limited crafting from proportionally distributing raw materials down the crafting chain (eg, having beams and scaffolds such that both are worth the same amount of wood) to proportionally distributing raw materials across all limited crafted resources. KS default settings have been modified to reflect the new state of limited crafting.

Lastly, there is a small change to how consumption rate is handled so that multiple iterations of the crafting loop are no longer necessary when there are more raw materials than the storage limit (which can happen after resetting with chronospheres).

Also a bugfix for an issue where bulk crafting would slowly advance time while the game is paused.

Edit: Made some additional modifications to crafting and trade which optimize the crafting/trading loops so that they reach equilibrium after the first pass. Before, if you paused the game while autocrafting/trading, it would spam the log by repeatedly crafting/trading smaller and smaller values until it reached an equilibrium point, taking several minutes to accomplish this. Now both of these will reach equilibrium after one cycle. I've seen a noticeable improvement in performance for trading with this too.

cameroncondry commented 5 years ago

Looks like a great bunch of updates. Thank you for your continued support!