mbkarle / mind-the-fog

Roguelike JavaScript game--mind the fog!
2 stars 1 forks source link

Cookies for temporary save #140

Open akarle opened 6 years ago

akarle commented 6 years ago

Store USER_INFO as a cookie!

We worked this out in our console and it seems pretty simple!

More here

akarle commented 6 years ago

Note to self--using document.cookie only works on the server (probably because firefox/chrome don't recognize file:// domains as websites)

akarle commented 6 years ago

a2bfc8b is a fully featured pilot for for the most part! Only consideration left is how long is the interval:

  1. Wait a long time to not interfere with other events (10secs-30secs interval), add a "save now" button
  2. Try to detect tab closing with window.unload event (need to do more research)
  3. Really short interval so as to not lose anything! (no need for save button)
akarle commented 6 years ago

I suppose the other thing to consider is how to actually save / load the game. Loading/Saving USER_INFO is great, but clearly not everything...

@mbkarle I suppose a true roguelike spirit would be to end the round but to save the GreatHall stats that carry over when the user quits (NPC's unlocked, etc)