Monday, April 13, 2009

Developing distributed software

After development of the first version of the "Legends Of Noobia" server (MMORPG game server, written on .Net) I thought about later versions of it where the distributed features should be surely included. And here comes the main question - how to extend an existing application to support distribution ?
Here what came on my mind first - distributed TCP messageing system. because this component will let me attach the same game server (for this special case, but can be any other application) instance on different servers, where the DTMS (Distributed TCP/IP Messaging Server) node will be configured and run in the same way as it was used to.
Now let's go deeper into details to understand the idea of the DTMS. Imagine a graph, where each node is a configured instance of the system. Let's call each node a Physical Node. Each physical node is simple TCP/IP Server which accepts client connection. But - here comes the main idea - it also accepts connections from neighbour nodes (Physical Nodes from other servers, or even from the same server but another instance) and becomes a node of the distriubuted messaging graph. When a client sends a message - the server distributes this messages through all the neighbour nodes. This let's two clients, being connected to different physical nodes send/receive messages with/to each other.
To support private messaging we can add the recepient identifier to the header of the message. Each node, receiving the message, checks whether the recepient is connected to the system through it and if so, it sends the message to the client, otherwise it distributes the message to all nodes, except the one, which from it received the message.
In the same - easy, way the system can also support group messaging simply adding a group identifier to each message.

No comments: