OK. I know there are a lot of threads by newbies who’ve never programmed a line of code in their life wanting to know how to make Skyrim or WoW…
But for those of us who are a little more experienced in game making/web developing/etc. Let’s have a proper discussion on the practicalities of making an MMORPG focused on indie developers rather than big companies with a lot of money.
Here’s my thoughts on how one would go about it. Please feel free to add your own optimisation ideas:
A basic top-down 2D Unity MMOPRG using
- Unity3D
- A cloud engine (e.g. Google Cloud, Amazon AWS, or Microsoft Azure.
We assume that the game world will be stored on the cloud. (This is not a given since feasibly it is possible to create a distributed file system like Napster where the world data is shared amongst players).
There are basically two methods of using the cloud:
- To use a cloud engine to run instances of your Unity Game as a server
- To use as an advanced player matching service.
The general idea is that the world is broken up into sections. As you move through the world new sections are loaded through background AJAX calls. As you move into new sections you update the cloud database with your position. You also check how many other players are within adjacent sections of the map.
So far, nothing very complicated, it has the same basic functionality as Google Maps.
The tricky bit is when two or more players are in the same section and need to react. Again there are several options
- The movements of the players are sent to the server. This may be slow if you are writing the positions to databases instead of communicating with an instance of Unity on the server.
- The server establishes a P2P connection between the players. This has it’s own difficulties.
Also consider the scenario: Players A,B,C
A------B------C
A and B are near enough for P2P and so are B and C. We need to establish separate P2P between each pair. (Otherwise potentially every player on the game would have to be on the same P2P network which would cripple whichever player is the “server”). I’m not even sure this is possible in Unity.
Also, consider that player A has made some changes to his section, maybe pushed around some rocks, but the world has not yet updated to the server. Then player B enters that section. You must decide whether the section should be continually updated on the server, or the current state of the section is just shared between the players by P2P and only occasionally updated on the server.
Part 2 - Storing the world
Some games like Minecraft store the game world sections in a binary tree folder structure as files.
Another method would be to store the sections in a giant database or datastore either as files or “blobs”.
Some methods are more scalable than others. For example SQL databases are not very scalable.
Also, don’t forget that your system should include away to extend your world if you suddenly decide you’d like it 4x bigger. (Or perhaps it dynamically increases as more players join.)
Part 3 - Finance
Using a cloud engine is a good way to scale, as assuming that all your players are subscribers, the game should pay for itself in terms of cost of the could engine. A one time fee and then letting your players play the game indefinitely is a more risky way to go. It is also important to design the game so that not too much data is sent from the servers.
OK. Well, those are my thoughts. I have begun creating a game using these principles but am at the very early stages. So take some of what I said with a pinch of salt. And please offer your own experience and better ideas!