Jump to content

Saving Question


Recommended Posts

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?

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...