Proprietary MMO Server Technology and Method on Unity3D

Before last year holidays began, I wanted to find an easy-to-use MMO server platform for Unity3D, mainly because an online multi-player mode is essential to so many games in these days and age, and I realized that I had no working solution yet for Cartoon Boom! Boom!. After many hours digging the web for an already-existing platform, I figured out that all existing solutions were 1- hard and exhausting to set-up, especially for developpers (like me) that don't have a lot of technical knowledge about networks and servers and 2- quite expensive, both in the short-term and in the long-term. At that moment I felt like I should develop my own.

But the problem was, I first had to figure out if it was even possible, in any direction my imagination could guide me, to bypass the need to build my own server and network. Rather weird reasonning, uhm! But I kept ideas flowing from there.

It finally paid out when I realized that I could "borrow" some already-existing servers and networks.... what could be better than IRC servers!? After all, IRC servers are designed to let many connected users communicate remotely, exchanging text strings. And data is basically always text. Using IRC servers, I would eliminate the absolute need to worry with my own servers and a monster Internet connection. If one IRC server is saturated, or down/dead, after some detection it could also automatically migrate the players to another one. There are thousands of free and available IRC servers everywhere on the planet... A one-minute search on Google allowed me to discover that an IRC package was already available for Unity3D! Fantastic, let's try to start from that!!


I downloaded and installed it for testing. It was definetely not designed or programmed to serve my uncommon needs, but with some tweaking and extra coding, and with real-time float parsing to string conversion technique, I finally got Unity to send an object's X, Y and Z position coordinates at the desired framerate (quick framerate made the server kick me out, because of anti-spam security measures) to all other users over a public IRC channel. Then I programmed it to listen at the text sent by other connected players. But Unity does nothing with raw strings, so I forced it to retrieve the latest received string for every connected user, split the string down to arrays, and convert back each array element to a float value. Those float values are then passed as arguments to a function that moves the object. This function redefines a new Vector3 for the transform.position of the specific player object/mesh. This way, when a player moves, it moves at the exact same place in the scene, and changes can be seen on screen of all connected users. Tons of data can be passed in a very same string, so I can include details about inventory, player's health, functions to remotely launch, pause or stop an animation sequence, change a texture or material for another, etc. Anything needed can be passed, supporting both variables and functions. The only technical limitation is the maximum characters length per message allowed by the remote IRC server.

The best solution for indie developpers that may want to use my tech and method would be to create their own adapted IRC server. Its ease of integration, high flexibility, and near-zero exploitation costs are making it a viable and interesting MMOG platform. Something also worth mentionning, is that I can control the in-game object position by sending hand-written axis coordinates to a connected player using a vanilla version of the famous mIRC chatroom client! The game running on the remote computer can react instantly to mIRC conversations sent to the public chatroom, which is quite cool and unusual. This may eventually lead to new gameplay possibilities.

I still don't know if I will use this new piece of tech soon in any of my Unity projects. I may end up selling it or licensing it over the Unity Assets Store as a MMOG API, once more polished. But for now I prefer to keep it for me. 

Comments

Popular Posts