cameroncondry / cbc-kitten-scientists

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

Bulk Building, an Overhaul of Automated Building #252

Closed Wymrite closed 5 years ago

Wymrite commented 5 years ago

I completely overhauled the automated building for the bonfire tab to be able to build more than a single building at a time. Now it instead it creates a temporary copy of the resource pool, and iterates through the array of possible buildings, subtracting the resource cost from the fake resource pool if possible to build an additional building of this type with the remaining resources and increasing the "to be built" number of this building by one, and removing the building from the array if no longer possible. This means that no building will be underrepresented by the system. All the usual conditions need to be met for a building to actually fall into the possible buildings array, enabled and trigger and actually being unlocked and etc.

The actual build manager has been modified somewhat too, it no longer clicks the button, instead calling a slightly modified version of the game's internal building function, changed to use KS's log system and also actually fixes a Kitten's Game bug where prices aren't correctly updated when building in bulk so shift-clicking to build-all will actually get you one extra building than you would be able to build by clicking individually. This has been fixed in the version used here by updating the price an extra time.

This new setup has seemingly no performance impact when KS is idling or only building small numbers of buildings, but is significantly quicker when buying in bulk, such as after a reset while paragon farming. Currently KS takes me like a half hour to an hour to build all possible buildings lagging the whole time, but with this it takes about 5 seconds to accomplish the same result. Because of this, I think a modification of this setup would work well for a trade revamp in the future, and I'll also eventually port it to all the other tab auto-builders.

cameroncondry commented 5 years ago

Very impressive, thank you for the update! I am going to do some quick testing but will trust that you tested the changes more thoroughly, then will merge into master.

cameroncondry commented 5 years ago

I love it, thanks again!