Game Development Reference
In-Depth Information
The previous figure shows a successful game state request that is broadcast to all
the players in the room, including the sender. In the following illustration where a
validation error occurred, the server will send back the error to the sender and the
rest of the game clients will not receive the notifications regarding the failed request.
Not all games are implemented as shown above. For a fast twitchy game, we simply
send the game state to the server hoping that it will pass validation and immediately
update the client screen. When the server does send back an error, the sending client
will then make a correction.
As we will see in Chapter 9, during the implementation of a racing game, the client
will send the game state action and update its own spaceship position without
waiting for the server's confirmation.
Game state schema
The following is the snippet of schema file for the Hello World sample. It is a very
simple game state containing three properties:
<class name="HelloGameState" parent="GameState" classId="601" >
<public>
<property index="0" name="x" count="1" type="int"/>
<property index="1" name="y" count="1" type="int"/>
<property index="2" name="color" count="1" type="int"/>
</public>
</class>
The name of the game state class is HelloGameState , which means a
HelloGameStateClient class will be available for us after the modeling phase.
 
Search WWH ::




Custom Search