shewu / h4ck4th0n

Holy Balls: The Game
8 stars 2 forks source link

matching saving and playback #36

Open tjhance opened 12 years ago

tjhance commented 12 years ago

The server should log everything it does; all the packets it processes, all the values of "dt" that it uses, the srand seed. Then we can give the server an option to replay an old game rather than play a new one, so incoming connections will get to observe, but not play.

This could be really helpful for debugging and bug reproducing.

tjhance commented 12 years ago

By the way, making the playback will involve a bit reworking of the Game/Server.cpp relationship. At the moment, Game thinks of each play as having an associationed SocketConnection*, but for the playback, the Game will need to view each player in a more abstract way.

tjhance commented 12 years ago

Okay, I went ahead and did this. It's basically a huge hack right now. It just saves all the actions it does to logs/log, and then PlaybackServer (which you can make with `make playback') will read that file and you can connect with your favorite client to watch (but not do anything). It's not very robust, especially not to changes in the code, and it relies on the fact that the server makes no calls to rand() outside of Game.

I think it would be nice to someday have a fleshed out replay watching system. For now, I think this will be useful for debugging.