Game Development Reference
In-Depth Information
Once the game room host starts the game and is in the playing state, any player in
the game room may add, remove, update, or send game states. The added game
states are cached on the server and clients. Once the game is finished, all the
added (non-initial) game states will be cleared from cache.
Game states in Hello World
Game states in the Hello World sample demonstrate only the use of normal game
states. The following screenshot is of the Hello World sample's game screen:
A new game state is added to the game by clicking on the Add button. When the
game state is successfully added, a visual representation of the game state is shown
as a circle on the screen. The circles may be moved around by dragging them. When
the circle is let go, an update is called on the corresponding game state. The update
is reflected on every client within the game room. To remove a game state, we may
first select one of the circles and then click on the Remove button. If the remove
was successful, the corresponding circle will be removed from the game and will
disappear from all the other clients in the game room as well.
Code walk-through
Let us now explore the actual code within the Hello World sample that deals with
adding, updating, and removing game states.
In order to visualize the game states in a game client, we draw circles to represent
the game state. For this purpose, we make use of a simple sprite-based class.
 
Search WWH ::




Custom Search