Creating a MMO

So I’m in the process of designing an MMORPG, and my main questions are with client/server relations. Mainly I get that each client needs to send data to the server, and then the server validates this before the client updates the data. Now what I’m wondering is basically the content that goes into the Server, and the content that goes into the Client.


  1. Does the client contain asset files(Models, Scenes, Textures, etc.) or does it load the data from the server?
  2. How would you go about updating data(HP, trading, etc.) on the client side across all clients.

    etc.





    I know an answer I’ll be getting a lot is “If this is your first game, then you should make it single player, and then move to multiplayer.” which sounds fine, but I have no interest in making a single player game, as the game is designed to have interactions between players. (Imagine playing wow/runescape completely by yourself, boring plz).



    Basically I’m just looking for answers to the mechanics behind Server/Client relations, what each one does(Sending/Receiving Data, Loading Assets, etc.)



    Any constructive comments are greatly appreciated and if you have any reference links those will be too. Thank you

It’s a HUGE topic. This is why people recommend starting smaller.



Generally, the server is authoritative. Clients send commands to the server and they get their updates from the server. Beyond that is “prediction” which is another order of magnitude in complexity.



Entity Systems are very popular because they are relatively easy to network without having to add new network code every time you add some feature. They are a whole different way of thinking, though.



Standard links on networking:

Source Multiplayer Networking - Valve Developer Community

Latency Compensating Methods in Client/Server In-game Protocol Design and Optimization - Valve Developer Community



If you find it hard to understand those then networking your game will be really hard. You will likely underestimate how hard, in fact. If you read through them once and instantly think you understand… it’s likely that you don’t. :slight_smile: Probably three times before it sinks in fully.

1 Like

kinda in between finding it hard to understand and instantly thinking i understand :stuck_out_tongue:





but i found another reference tutorial that was very helpful and suggest to anyone else that is a complete noob at networking:

http://gafferongames.com/networking-for-game-programmers/



thanks for the feedback pspeed

Hi there,



(this post might be a bit unformated, its a huge topic)

I dont know the tutorials that are posted in this thread, but I have a few common advices for MMO-Development.



0. Dont develop this alone!

No matter how good you think you are, anything MMO will prove you wrong.

You need a small team of developers.

My team e.g. consists of:

  • Project Manager (Project Management, Programming, 2d-Graphics)
  • Lead Programmer (Programming, Software engineering)
  • person A (Programming, 3d-Modeling, Music composition)
  • Person B (Programming, Music composition)
  • Person C (3d-Modeling, Art, has basic understanding of Programming)



    2-4 Programmers should be enough, the key elements though are:
  • dedicated project management
  • Art
  • Software engineering (something all our programmers are good in)



    1. The Client doesnt control anything

    Everything the client does it a request.

    Think of the client as “The graphical Input towards the player infront of the screen” and “The Keyboard/Mouse Input towards the server”



    So if the player moves, you send a “request to move”. The Server must validate this data.



    2. Don’t believe anything the client tells you.

    Think paranoid about this one: Check anything your client wants to send before it is sent,

    but check it again on the server. The first check before its sent reduces bandwidth for clearly wrong input.

    The second check on the server is more important: Every Player can modify his ram if he knows how.

    This is how hacks are born. If you do not check on the server, a player might just tell you where he wants to be. Teleport

    (Worse, he can modify his damage numbers etc)



    3. Use Software engineering methods.

    If you don’t know about software engineering, your chances of success arent too big.

    Get together with people that know software engineering, get into a course at university or so if you can.



    If you are not enrolled in a university, free university courses can be found here:

    https://www.coursera.org/category/cs-programming

    This course goes in the direction of Software engineering https://www.coursera.org/course/posa



    My Advice if you cannot get into a software engineering course:

    Get someone into your team whos good at it. Chances are good that people who shine in software engineering can code quite well.


Again I cannot emphasize how important software engineering is.
All of our projects members know software engineering,
and 4 of 5 are very good at it.

The most important part is simply to develop in a team.
Our team started jmonkey with no 3d knowledge 2 months ago.
Now we have a functioning tiled 3d Mapeditor that generates a single Geometry (Voxels)
The code is a prototype and will be rewritting in the next vacation, but thats just to tell you
how fast a team can develop. Even a team of 3 People can be extremely fast if the people are interested.

Its a huge post and still hardly anything covered. meh.
If you have any questions, ask xD
3 Likes

Making a game is hard. Making a multiplayer game is 10* as hard. Making an MMO is 100 times as hard.



You need to understand scaling, contention, concurrency, networking, threading, server administration, databases (including choosing the right kind of database in the first place), security (including encryption protocols at least enough to be able to choose and implement one in the relevant areas), latency, etc, etc.



And that’s just for the server…the list is just as long but different client side.

The questions you pose are routinely asked to you by your own code when you write a game this scale. If you struggle to answer them then you will encounter many many situations in which you can’t go on cause you won’t know what to do. There is no one way to do it “right”, its always your own creativity and knowledge defining that. Even if you would look at complete code and somebody would tell you what he did you still wouldn’t know, you just would think you understand whats going on and try to imitate it.



We have code for a complete MMO (not based on jme3) in the gc repo, we have an example for a simple networking app in a repo too… Take a look at these and see if you can at all understand the code, then come back with more concise questions and an actual implementation of what you think should be done up to then.

It occurs to me, I once heard “Neverwinter Nights” referred to as “one of the first MMOs”… even though you’d struggle to have more than 64 players on a server unless you had a pretty beefy linux box sitting right on a fat pipe.



I start to wonder if people have replaced “massively multiplayer” with just “multiplayer” but still call it an MMO.



A true “massively” multiplayer game, as normen rightly points out, has to deal with “massive” scale right from the very beginning. You have to have zones to handle load, etc… And if you don’t use an entity system in this case, I think even the industry at large would agree that you are crazy.



Personally, I believe that an indie developed MMO is impossible just from the data center requirements. I wait in anticipation to be proven wrong someday… but toiling away at nights writing code for years is the easy part compared to getting investment into a million dollar data center and ramping up content creation to keep users happy from month to month. I still hope to be proven wrong.



If your requirements are more modest then that’s important to know in any such discussions. Maybe as a rule we should ask any new MMO-developer-wanna-bes what their target specs are, number of users, size of world, etc…

@pspeed does this count?

I would say it does from the scale, also its even in java, it’s mostly done by one person in the initial versions as well (of course it grew later a bit) :wink:



http://www.wurmonline.com/

http://jenn001.game.wurmonline.com/mrtg/paying.html

@EmpirePhoenix said:
@pspeed does this count?
I would say it does from the scale, also its even in java, it's mostly done by one person in the initial versions as well (of course it grew later a bit) ;)

http://www.wurmonline.com/
http://jenn001.game.wurmonline.com/mrtg/paying.html


It's unclear how many players a single server can handle. I poked around and couldn't find anything.

3444 split over nine servers... where users can play for free... is far from what I'd consider "massive".

In my opinion, it's still better to target making a game where users can run their own servers... which while some call that "MMO", I don't. You don't have to worry as much about infrastructure.

Running your own servers worked well for minecraft (for example) but it works better for some game styles than others. MMO is tricky to define but with the right game design, server specs, etc you can get thousands of players per shard and scale up across multiple shards reasonably smoothly.



Remember wow only supports a few thousand players per shard. Eve Online are the only people really trying to keep everything on a single “server” (which in their case is a room full of top of the range hardware).

@EmpirePhoenix said:
@pspeed does this count?
I would say it does from the scale, also its even in java, it's mostly done by one person in the initial versions as well (of course it grew later a bit) ;)

http://www.wurmonline.com/
http://jenn001.game.wurmonline.com/mrtg/paying.html

Wurm is a pretty naive project I have to say. I admire the will to get it there and whats been implemented but it rather looks like theres many huge limitations. They kind of thought in a few years the computers will be able to handle the code like they did it (kind of like when people start to make their whole worlds physics based here) but I guess they will have to see that its their implementations that cannot be handled per se ;)

Yeah. I don’t know if it is relevant here but quite a few people’s plans went south when Moore’s law shifted from single to multiple cores.

1 Like
@zarch said:
Running your own servers worked well for minecraft (for example) but it works better for some game styles than others. MMO is tricky to define but with the right game design, server specs, etc you can get thousands of players per shard and scale up across multiple shards reasonably smoothly.

Remember wow only supports a few thousand players per shard. Eve Online are the only people really trying to keep everything on a single "server" (which in their case is a room full of top of the range hardware).


A few thousand players per shard is still pretty massive... and their shards are pretty beefy.

Here was the first link I found about statistics re: WoW's data centers:
http://www.datacenterknowledge.com/archives/2009/11/25/wows-back-end-10-data-centers-75000-cores/

Pretty crazy.

Neverwinter Nights supported portaling from one server to another but admins had to go through lots of hacky hoops to support any kind of character transfer between servers. For Mythruna, I plan to support portaling natively for paid users... server admins will have to specifically enable it between their servers, though. We'll see if that ever has any bite.

zanval: thanks for link, interesting site. i do have one question and its just… where do you look for developers/designers to collaborate? lol.





and ok, in reply to everything else





i guess the world i want is really only like up to 1000-1500 players on 1 server.

concerning the database, i was just gonna use MySQL. is that a bad choice?

@dannybarrett said:
zanval: thanks for link, interesting site. i do have one question and its just... where do you look for developers/designers to collaborate? lol.


and ok, in reply to everything else


i guess the world i want is really only like up to 1000-1500 players on 1 server.
concerning the database, i was just gonna use MySQL. is that a bad choice?


1500 players online at the same time?

Is it like a Farmville type of "sort of MMO social game" or an action RPG with interacting players and stuff? What kind of hardware and network connection do you expect to support 1500 players?

Well mysql should be possible, i prefer postgre tho, since it gives me more options to optimize. (eg when the database runs on ssd, i can change the harddisk seek time assumed for the query optimizer).



But basically any database will mostly do, since you will acces it where possible asynchron(via background workers) anyway.

Any relational database should be a good fit for an entity system, MySQL and Postgres is the major open source alternatives.

HeroDex uses MySQL for the relational database side and I’ve been very pleased with it so far. Having used Microsoft, Oracle and MySQL I actually prefer MySQL!



All immediate data is stored in RDS which is backed by a NoSQL (Berkely) database though. The SQL is used for historical records, audit trails, etc.



Early tests show that we should be able to comfortably handle a few thousand simultaneous players per shard and allow smooth transfers between shards (although the actual transferring isn’t written the architecture is designed to allow it so it should be pretty painless when needed - users can just select which shard to connect to whenever they log on and all their cards and heroes transfer to that shard).



HeroDex was designed from the start to be low bandwidth and low server load though since as an indie we have a limited amount of money to throw at servers!

@pspeed said:
1500 players online at the same time?

Is it like a Farmville type of "sort of MMO social game" or an action RPG with interacting players and stuff? What kind of hardware and network connection do you expect to support 1500 players?



im more or so referring to runescape(http://runescape.com/)

and i dont know lol, thats why im asking. obviously runescape can hold up to 2k players on each of their servers which is all based in java(the server code)

Your main limitations on players-per-server include things like:



RAM/CPU per user - how much memory and processing you need for all the data on one player and the connection etc. This is linear growth so fairly predictable. If a 512mb server can support 100 users then a 1024mb one can support 200 (give or take a bit of overhead).



Contention - how much the processing for each of those players is holding up other players as they try to access the data. This tends to rise as number of players increase and can be both very unpredictable and can end up horribly messy. You need someone who knows threading and contention very well or otherwise you can end up deadlocking your server and/or wasting a lot of cycles trying to resolve contention. (Examples - two players try and interact with the same object at once, three players all cross the finish line of a race, one player enters an area at the same time as another leaves it, etc.) The server needs to handle all of those cases and make the deterministic decision on what actually happens. Who gets the object, who wins the race, does the person arriving see the person leaving, etc, etc.



n-squared - How many of those players all decide to move into the same area and hence need to be able to all see each other. 10 people seeing each other = 100 updates. 20 = 400 updates. 100 = 10000 updates, etc…





Reduce the overhead per player, reduce the likelihood of players to cluster, avoid contention situations…and I’m just starting to scratch the surface!



Your algorithms are far more important than your choice of language here. Java or C or whatever - your server needs to work smart, not work hard.