ROSE icon indicating copy to clipboard operation
ROSE copied to clipboard

Persist games

Open nirs opened this issue 7 years ago • 1 comments

Currently when a game is played, the server generate a new game state on each cycle, and send the new state to all clients. Clients process the new state and send updates to the server. When the game is completed, the game history is lost.

If we would keep the game state, we could enable these use cases:

  • Debugging a driver module, by playing back the game, possibly by moving forward or backward frame by frame.
  • Keeping scoreboard with the best drivers ever played, and watching the games later
  • Creating a competition management system, selecting players for games, selecting the winners for the next step, and so on.
  • Having a playback UI, we can create a web demo, see #177

The simplest way to persist the game state is to keep a list of states on the server, and persist the list as json text when the game is completed. To playback a game, the web interface can load the game state list from the server, and playback the game.

We probably need additional metadata, we will work on it later.

Possible implementation:

  1. Add sqlite database to the server
  2. Add rose/server/db.py to access the database
  3. Keep game history list in rose/server/game.py. Once a game is started, append the game state once per game tick.
  4. When a game completes, create json text from the history list, and store in the database.

nirs avatar Oct 27 '17 21:10 nirs

@rollandf can you review this proposal?

nirs avatar Oct 27 '17 21:10 nirs