Sponsored By

Building an indie Server for a MOBA/MMORPG

A study of some of the current available types of game servers for our games

Juan Belon Perez, Blogger

April 1, 2015

10 Min Read
Game Developer logo in a gray background | Game Developer

Some time ago, I started developing a new cars arena multiplayer game (MOBA indie style),and I found a lot of libraries to do the networking with Unity 3D Engine, I chose Google Play Game Services to start with... But, what would happen if the game get traction? Will I need to test it in real time with a huge amount of users?

Well, last year I wrote this article about MMO servers in 2013. Since then, we have new options and right now we are going to explore some of them to do multiplayer games, scalable and easy to build and maintain.

As indies we should know a lot of tools, now servers are another tool in our toolset, we can mount a server for big data storage and use external server for real time. Let's explore the kind of servers you can choose nowadays: web servers and socket servers.

HTTP (Web) Servers  

This first kind of servers is perfect if you don't need realtime action, to just read/write data in a NoSQL DataBase, in fact, you can make a social game with it: HTML5 games or those Flash games like The Settlers Online, Facebook games like FarmVille 2, and so on. You also can make the same game with a multi-platform engine or different clients with the same API.
The same goes for MOBAs, the game can be made in a multiplatform engine using this server to store persistent data and a small part of the game server logic.
Now, choose between a lot of different server options:

JavaScript server:

node.js,  etc. : JavaScript for code , JSON for data that can be stored in a mongo DB or HBase,Cassandra, Couchbase,etc. you choose. This type of server is good if you need a design with a big scalability, to handle hundred of thousands of users at the same time.


 Apache Server 

(a server set like lamp),PHP for scripts and MySQL,MongoDB,MariaDB,etc. for data. It is not good to handle millions of users but it will work well for a smaller number of users.
angular.js is a javascript framework for web apps you can use.

There are other versions of Apache if you can choose the faster, maybe better for your project: nginx, Lighthttpd, Cherokee,etc. Hadoop as filesystem.

Java Server

 

Glassfish:

 Java. Good for engineering, not cheap though.

Others

 - External cloud server (third party): API using JSON or XML : fast development, not cheap
 - your choice: search and you will find more options

Web server logic

Once you have your server online, you need the server side logic, and another layer to communicate with the client in the game using http/s ports you have to decide the plain text data format : XML, plain text, JSON, serialized data with your own format,etc, and try to connect to it and download data (POST or GET method).

It is recommended to encode your data to travel from point to point over the Internet, you can use your own function with base64 and md5, sha1 for hashing and veryfing data integrity. 


Example: The Settlers Online encryption for urls and sent/received data chunks , they use different servers in subdomains for each purpose, chat, multimedia, data, etc. A good idea if you have to deliver a big amount of data per user (images, sounds, texts,...) is to use a CDN and this also allow parallel downloads using threads like browsers do, increasing the overall broadcast speed and it uses the nearest physically server to the client (less physical distance = less latency / hops).

As start point you can go with a single test, like, get a data set from your data model, and then do more complicated things gradually, like checking what friends are connected and retrieve their last positions,messages, and other information to be used in the current scene...
 

Engines to use with your web server

The engines I used to do the tests


 

ShiVa 2(example)

Unity 4.6 ( example )

Unreal4.

You also can use a Simple WebSocket server,

XML API for ShiVa, libwebsocket for Unreal.

If you choose an external server from a big company as a service, these are the prices, for example: ParseGoogle App Engine,Amazon,MS Azure, etc. ,to summarize check this table from Mongolab ...if the game reaches 500k-1M users, it is going to need a High Replication Data Service for the server/cluster (like the one in those examples) or your server is going to get disconnected.

Pros:

 - if you use your own server it's really cheap, until the number of concurrent users reach the limits 
 - Easy and fast to code
 - There is a lot of documentation, other examples and everything you want to dosomeone did it before
 - The scalability for this system can be easy, also you can move the server to another place with no big consequences
 - You don't need extra libraries for each platform, just open a http socket, send/receive a call from your server logic and you are done
- Configure security for this server can be done with server rules, basic security stuff, and external services like cloudflare (avoid ddos attacks)

Cons:

 - Design the scalability strategy must be done at the beginning, so we wont need change the architecture 
 - A server with high capacity can be expensive
 - It requires to write all the logic in both sides
 - Servers can go down even with protection, and if our game depend on it you can figure out what are the consequences.

 

Host /client Socket Server, p2p solutions, cloud servers - a real time server

using an API or other binary sockets sources.

There are plenty of options to use a server with APIs: Unity Unet serverGP Game Services serversYahoo! games serversPhoton CloudSmartFoxServerGamooga , App WarpUnion Platform, Unity Cloud, ...others.

The prices are affordable with this kind of servers for indie games, as long as you keep a good income of revenue from your users, whose generate the traffic that you pay.

These are servers (except for some like Photon Cloud that includes another option to mount in your own machine) runs on Internet machines connected with players along the world -clusters-, you can choose the nearest node to your location and it shares the server logic

Pros

 - security is in hands of the servers
 - your code in the server logic part is minimal if any
 - if you start small, it is a good choice as for price is low 

Cons

 - you have to wait until the server is fixed if it hangs or fails 
 - can be expensive ,depending on the number of messages and users they have to handle online

Now, some code examples for Photon Cloud: Unity, ShiVa, Unreal.

To write the client part of the game, you have to set the limit of space for a room using these servers, it's perfect for MOBAs because in these games you only need 8 + a small number of spectators, and you have 16 users per room MAX in some of those cloud servers.These servers API DLLs contains components to aggregate to our Game Objects, and sync the data using a particular load balanced algorithm, compressing and encrypting the data we select automatically. We need then to process the data, it should be cool to use some prediction functions here, to know what player execute an action before other not depending on lag but with server timing. 

To write this post I made various games testing the different kind of game servers with different engines. I managed to test these websocket servers: GAE, MongoLab, Glassfish, Apache, node.js; and,these realtime cloud servers: AppWarp, Photon Cloud. As an example of a hybrid strategy I made this game: Join The Pack case studyParse SDK integration with mongolab and an Apache server + PHP + mysql. 

AAA Examples

Now, what are other people doing?, let's do an approximation to games as cases of study.

MMORPGs like WoW: a set of servers for login, sync data from datastore, sync real time online information with balanced loading like we saw in the MMO post from 2013. No major changes, well, the integration with other and fresh new, services and web portals, for example the authenticator.

They need a group of servers for each different part of the world to balance the load of users, and it is not trivial/easy/cheap to connect the servers from two different groups, EU-US for example, via AWS, so they store different data/users/you pick, and the teams managing them are also not the same.

MOBAs : Multiplayer Battle Arena

- DOTA, League of Legends: same as MMORPG with an user client API to make calls and know stats, and other information (recently changed), example of use of the API: lolsumo.
- Heroes of the Storm
- HearthStone: BattleNet Game Server Info is a socket server (Aurora), you connect there, once you are logged in the BattleNet auth system via web auth.

If we could make a "selfie" of the network activity of a MOBA, I can see something like this

continuously checking the services to keep alive the connections, sending and receiving data from data stores, realtime servers, and so on.

While on screen you just see your char

It's clear that the social part of a game in game design is getting really important as games evolve, and the current evolution of MOBAs from the times of Warcraft 3 multi-player maps to DOTA and HoTS is basically the same: improve the game connection, suit a balanced play based on players level, give different experiences based on the analytics of the big data, etc.

Indies MOBAs:

- Hybrid Cloud: Happy Wars,  Games of Glory, Prime World: Thrones, Dragons and Titans, etc
- SmartFoxServer: Worms, The Settlers - My City, etc
- Photon Cloud: Das Tal, Heroes of Rune,etc.

It is a exciting time to build a MOBA.

Let's go indies!

Thanks to Andrej Kriukov for helping with the translation and Costa Caruso for his corrections 
 

Read more about:

Featured Blogs
Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like