Chef Online
Chef Online is an MMOG (massively multiplayer online game) chat system. This required me to implement both a game client, and several server programs that interact to simulate the game world. All of the programming was done in C++ for the Windows platform using the WinSock 2 API. I used a multi threaded approach to the networking code that allowed me to eliminate any risk of blocking in the main thread running the server logic.
Server Design
Chef Online uses a server design based on the information I could discover about current commercially successful MMOGs. I designed Chef Online as if I intended to create a fully functional MMOG, rather than just implementing a simple single server to handle chatting.
Chef Online has a single proxy server at the front of the server cluster. When a client connects to Chef Online, they always connect to the proxy server. The proxy server verifies their login details before opening a connection to the player server on the clients behalf. As the clients have no direct connection to the rest of the servers in the cluster, this proxy server acts as a filter for non game related packets. Only messages sent to the proxy server on the correct port from a verified client will be forwarded on to the player server.
The master control server stores the IP addresses for all the other servers in the Chef Online network cluster, and provides these on demand to the other servers as needed. When the other server programs are started, they will only require that the IP address of the master control server is entered and that the master control server is the first server to be started. The master control server is responsible for allocating new players to available proxy servers, and could be extended to load balance areas of the game world between the area servers.
The player simulation servers are responsible for handling all input from the player clients, and directing them as needed to the area simulation servers. This layout allows for the possibility of splitting the simulation of an area over several area servers.
The primary function of the area server is to run the simulation for areas of the game world. This involves tasks such as calculating combat results and running the AI. The design could be altered to move AI onto dedicated AI servers acting in a similar fashion to the player simulation servers if process intensive AI was required in the game. As Chef Online is focused on the creation of a basic chat system, there was no need for this feature in this project.
The database handler is responsible for processing requests for data by the other servers in the system. In Chef Online, the small amount of game data required is stored in XML files that are loaded when the server starts. This would be impractical in a commercial MMOG but, as there are no requirements for the data to change after the server program is running, this approach improves the portability of the server system by removing the dependence on a third party database such as MySQL.