Game Development Reference
In-Depth Information
The server may hold connections to several players at the same time, so we need
something called a session object to keep track of the data transfer from different
clients so that we don't mix up the data from other players.
A session is created for every client that connects to the server. The session is where
all the messages are processed. Each session holds its own temporary buffer to read
the data coming in from the socket. Remember, data is received from a socket in small
chunks. So until the whole message is received, the partial data received is stored in a
holding buffer. Once the complete message is received, the message is then processed.
The messages could be login, chat, or any game state sent by the client.
Avatar manager
The avatar manager is responsible for keeping track of the properties specific to
the player in the game. The avatar keeps track of virtual cash, hit points, life, etc.
Usually, for each session, there exists only one active avatar.
Lobby and room manager
Lobby contains many rooms and rooms contain many players. This module keeps
track of where each player is and lets players know when a new room is
created, updated or purged.
Friends
Typically, friendship relations between avatars are persisted to DB. The relationships
are established upon player requests, also keeping track of any pending
friendship requests.
Chat
A chat module typically routes the messages from one player to many others or
privately to one other player.
Object synchronization
This module keeps track of all the current states of a game within a room. Any object
modified by the client must be updated to all other clients within the same
game instance within a room.
 
Search WWH ::




Custom Search