Command Log

For my next video game design, I’m going to use a design pattern called a command log. It will be an asynchronous multi-player game, similar to the mechanism used for multi-player in Words WIth Friends. The basic idea is that every action a user takes in the game is stored to the command log. As long as they are logged in they will only get fresh command log entries.

{“action” : “do_x”, “player” : 1 }

However, if the are detached for a while, or restart their app they’ll need to be able to get a complete game state. I could send them just the state the game is in, but if I do that, then they’ll have no idea about the actions other players have taken since they last logged in. It would be nice to animate them through the changes that have transpired since they last played. So I’ll send them a complete command log of everything that has happened thus-far. That will ensure that the client is in the right state, and that the client has the info it needs to animate changes since last login.

{“action” : “do_x”, “player” : 1 },
{“action” : “do_y”, “player” : 2 },
{“action” : “do_z”, “player” : 1 }

  1. omgtcid reblogged this from plainblackguy
  2. plainblackguy posted this