CuAnnan Posted July 15, 2017 Share Posted July 15, 2017 I have started an idle game. I'm at the stage now where I need to consider saving, which is going to be done by encoding a JSON string in binary safe format and sticking that into localStorage. Loading will be done by reversing that and feeding the JSON string into a fromJSON method. I'd like to be saving every 10s or so. My question is how to automate this. I could just set a timeout function, but that seems like it'd be competing with the requestAnimationFunction. Do I just put a tick counter in the animation function and when the modulo of that and the tick count is 0 save? Is there a best practice for this? Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.