Game Development Reference
In-Depth Information
The chat feature
Chatting is one of the essentials of a multiplayer game, which we never see in a
single player game. There are several types of chatting that can occur among players.
• Private chat
° Team chat
• Public chat
° Lobby chat
° Room chat
• System chat
Private chat or one-on-one chatting occurs in private between only two players.
A public chat is when the player message is relayed to more than one player. Players
in a lobby could broadcast a message to a large group of other players, and also in
the lobby at the time. A room chat is where the players' messages are received by all
the people within the game room that the player is in currently. Team chat is both
public and private: public because it is broadcast to more than one player, but private
because it is only sent to a select few. The team chat happens if the game supports
some kind of team structure, where one team is battling another. For example, team
chat enables private communication among the members to talk strategy.
System chat is where a system administrator broadcasts a message to all players
that are currently logged in. These are mainly used for letting players know of some
important event, or perhaps to let players know that the server is coming down
for maintenance.
The chat API
The following chat API allows the game to send chat messages either to a specific
player or to all the players in the lobby or to every player in the room.
public function sendChat(recipient:String, msg:String):void {
In order to send it to every player in the lobby, the player must be in the lobby. The
recipient in this case must be set to null. To send a chat message to everyone in the
game room, the player must be inside a game room and a null for recipient should be
passed. To send a message to a specific player, the player's name must be passed in
for the recipient parameter.
 
Search WWH ::




Custom Search