Game Development Reference
In-Depth Information
Figure 21.3
TeapotWarsmain menu.
machine. Telling the clients to load a single level file is much better than spamming a
bunch of
events across the network.
Once the level has been loaded, the game needs to wait for all the expected clients to
connect. After that, all the teapots are created by the server and distributed to each
client. Then the game waits for all players to spawn into their level and gain control
of their teapots. Then the game starts running, and it
new actor
s every teapot for itself!
Each of these stages is separated into different states for processing by the game logic.
The states are represented by the BaseGameState enum :
'
enum BaseGameState
{
BGS_Invalid,
BGS_Initializing,
BGS_MainMenu,
BGS_WaitingForPlayers,
BGS_LoadingGameEnvironment,
BGS_WaitingForPlayersToLoadEnvironment,
BGS_SpawningPlayersActors,
BGS_Running
};
Each of these values corresponds to a different state the game can be in. All of these
states are managed by the game logic classes. Most of the processing happens in
Search WWH ::




Custom Search