Game Development Reference
In-Depth Information
How it works...
Spending time and defining what messages should contain is a good way to get a grip of
the project as a lot of the architecture will revolve around them. The message we created in
this recipe is called ServerMessage , because it is used to send a lot of information from
the server to the client.
The next class we created was MessageListener . The only thing it does upon receiv-
ing the message is print it to the console. We added it to the client, and also stated that it
should specifically listen for ServerMessages .
By default, calling broadcast will send the message to all the connected clients. In this
case, we just want to send a message to a specific client or a group of clients (like a team).
Broadcast can also be called with Filter . It can also send messages to a specific channel,
to which a team or group of players might be assigned.
Search WWH ::




Custom Search