TruncateGame/Truncate

Improve handling of network drops in daily puzzles

Closed this issue · 0 comments

bglw commented

Sequence of operations:

  • Playing daily puzzle, sending moves to server
  • Each move receives the current "daily stats" from the server
  • Connection dies (network change, etc)
  • Sending moves to server silently fails
  • Win the game, which opens up the splash screen with the most recent "daily stats" (from a few turns ago)
  • Does not show the win
  • Click replay, new attempt is tracked as of whenever connection comes back

High level fixes:

  • Stop requesting / storing the daily stats ahead of time
  • At the end of the game require that all moves are synced to the server (wait for successful response)
    • Show some kind of loading screen / spinner until this comes back
  • Only request daily stats when pulling up splash screen
    • Likewise, show some loading spinner while waiting for the latest stats
    • Make the loading text fit better
  • Add nonces to all outgoing messages
    • Send acknowledgements from the server
    • Store messages in a new queue for "unacknowledged"
    • Remove from this queue on ack
    • On a new ws connection setup, re-send all unacknowledged messages