Devin W.C. Ryan

Tron Game

This was a group project in which my role was to handle the networking / multiplayer aspect of the game.  This application implements the Model-View-Controller (MVC) pattern.

The server runs in a thread and handles all client connections.  Each client connection is represented by its own class (Client) which handles sending a message to the individual client and receiving data from a particular client to the server.  Each client runs in its own thread.  The run function listens for messages from a particular client and handles it by the message type.  While the length of the message is less than the message length data is read from the socket and added to a message variable.   A check is done as to where the end of message flag is and adds the overflow into the buffer and then passes the message type and packed message to be processed by the server.

The client runs in a thread and handles all communication between the client and the server.  Interpreting messages received from the server and packing messages prior to sending them to the server.

The server controller runs server side to handle updates from the client and the client server runs client side to handle events from the user interface to be sent to the server as well as to update the view based on messages received from the server.

Figure 1 and 2 show UML diagrams for the key components of the application I worked on, the server and the client respectively.

Tron Server UML Diagram
Figure 1: Tron Server UML Diagram
Tron Client UML Diagram
Figure 2: Tron Client UML Diagram

Leave a Comment

Your email address will not be published. Required fields are marked *