Server initial layout

Typically when approaching a problem like a client/server architect I like to start at the backend to get a basic framework established so that come time to begin to work on the client aspect there’s something to action against.

So after mulling this around in my head I’ve settled on the follow approach for structuring the backend.

The lay of the land. 
The lay of the land. 

To begin with on the server I’ve defined the classes illustrated above. Each of which is responsible for a particular area within the overall application. A quick rundown of the elements is below. 

Application class

This class represents the main program thread and is responsible for setting up the various components used by the system. 

SocketMgr class

The SocketMgr class handles the UDP socket created to receive client requests. We’re using UDP since it’s a lightweight transport suitable for shifting small packets quickly. Since this is a connection-less transport the SocketMgr passes the requests it receives to the ClientMgr which maintains client state. 

ClientMgr class

The ClientMgr class handles the allocation of data to the currently connected clients, each of which state is held in a collection of Client objects stored by the class. 

Client class

This class identifies a unique remote device ‘connected’ to the server, they will also contain a reference to World Entity instance which represents the user in game.

World class

This the model space for the game storing at items within it, including the player avatars. These are represented by Entity class instances. 

Entity class

At it’s most basic this represents any actionable item within the game. 

The plan here is to keep these nicely decoupled such that for example on the client the World class can be easily included to maintain a local client copy of the current server world state (or thereabouts).

I’m a lazy programmer, so reuse reuse reuse.

2 thoughts on “Server initial layout”

Comments are closed.