Skip to content

Implement LocalStorage #36

@ovidiubute

Description

@ovidiubute
  • Game progress should be saved to LocalStorage
  • This will allow users to continue the game even if they close their browser/tab
  • What needs to be saved?
    • Some sort of user id, we don't want a full login system yet so we'll have to generate a UUID for him and save it
    • It's 2017, we don't care about browsers not supporting LocalStorage, so no cookie workarounds 😄
    • The game needs to be paused when leaving the app and the state must be persisted
      • This is required because otherwise you will reload the game and the timer will start immediately and it will be confusing
    • Every move a user makes needs to be saved
      • This will be easier in the long term than just saving a snapshot of the game, we can implement replays for example or even (wait for it) have some sort of async multiplayer mode
      • This needs to be light so a format like [ [0,'r'], [1, 'l'], [3, 'u'], [2, 'd'] ] should be used (tile index 0 to 14 and direction 'r' = 'right', etc...
  • On new game we can clear the history until we have a backend to save them (way long term)
  • We'll need full 100% unit-test coverage for this functionality because it will be very easy to break stuff and it's very hard to debug local storage issues
  • Also need to take care of users having inconsistent data in local storage due to application bugs
  • There are literally dozens of LocalStorage libs out there, need to research on which one is the lightest and suits our needs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions