OmeletHopper/Cookie-Clicker

Save auto-clickers only when we need to.

Closed this issue · 4 comments

We currently save everything every 2 seconds, which is good but I'm about to commit 5 new auto clickers and we are getting pretty big lag spikes from it. We should instead save them whenever a new one is bought, and only the one that was bought.

I think the save time should be when something gets bought or if they don't buy something for 2 (or 3) mins it will auto-save... that should reduce lag and be efficient...

As of the last few commits I've made, we now only save when an upgrade is purchased or when the app quits. However, instead of storing just the upgrade that was purchased, we store all of them. This needs to be fixed, I just think there is a better way then to rewrite a similar call over and over.

I'm thinking we set up some kind of struct array and have cursor be 0, grandma 1, etc, and make storeData() take an integer to point to the right spot in that array. I think this is a better way to do this, @Goldninja100gn let me know if you know a better way.

I can't really think of any better way

I have changed this behavior with 3a9ab55. I completely redid all of our saving code. It's much better and smaller now.