🔒 Locked
Coding a Massive Multiplayer Server
Advertisement
Original Post
I guess this question gets asked a lot. I'm getting ready to start coding network support for a game. Hoping to aim for 5,000 players. Was hoping perhaps someone knows of a paper or book I should order? I was thinking to use TCP/IP What part of a multiplayer server is multithreaded btw? Do I just code a single listener and then pass on events to another thread? you know like receive event -> store to queue -> another thread will grab events in the queue at their leasure So I'm just looking at two threads? one for listener then another thread I suppose for my game code? Just need some basic tips to get me pointed in right direction by the way my client is already multi-core and pretty well fleshed out its the server that scares me
Quote:
More then 2000 TCP connection is hard for OS.
These days, if you use the appropriate I/O primitive (IOCP on Windows, various poll/epoll variants on UNIX), 2000 TCP connections isn't so bad. However, if each of them sends commands that require collision testing, 30 times per second, that's hard for the server :-)
You know, this is an insanely difficult question to really answer well, I'd personally prefer if we could start some sticky handbook to list many of the concepts which goes into an MMO as it's a very hot and interesting topic.
For starters, what you want to have is not a single computer running your MMO, even if it's feasible. If you go with such a solution you will have poor reliability, and a higher maintenance cost. A much more common and preferable choice is to go with a distributed computing model, which you will have to tailor for you needs to be able to have good load balancing. I've also seen that Blizzard is currently hiring people experienced in Control Theory which I guess makes sense in terms of load balancing...
Second to this you start of simple and try to evolve you concept so that you can design a lot of the base systems that goes into your MMO. One thing to start considering early on is bandwidth and latency issues, as they tend to impact every aspect of the game.
As far as performance and multithreading goes it obviously important, but what’s more important is that you agree upon how your distributed computing model is to be updated to allow concurrent interactions to give good overall performance. Such things can vastly improve your game, or end up biting you in the ass. This is also were you have to decide how persistent your world really is, and what persistent means in your game. Not everything has to be persistent, but it helps to start discussing what’s persistent and what’s transiting and how transitions of data between those two states occur. Also the concept of lockstep needs to be discussed, which simply put is that some actions either change the state or they don’t. Never something in-between.
At this point you’re pretty much done with the basics, but need to evolve your idea/concept and game. It’s not that unrealistic to start off with a simple game and make it MMO capable, as it would be to make a full-blown AAA title.
For starters, what you want to have is not a single computer running your MMO, even if it's feasible. If you go with such a solution you will have poor reliability, and a higher maintenance cost. A much more common and preferable choice is to go with a distributed computing model, which you will have to tailor for you needs to be able to have good load balancing. I've also seen that Blizzard is currently hiring people experienced in Control Theory which I guess makes sense in terms of load balancing...
Second to this you start of simple and try to evolve you concept so that you can design a lot of the base systems that goes into your MMO. One thing to start considering early on is bandwidth and latency issues, as they tend to impact every aspect of the game.
As far as performance and multithreading goes it obviously important, but what’s more important is that you agree upon how your distributed computing model is to be updated to allow concurrent interactions to give good overall performance. Such things can vastly improve your game, or end up biting you in the ass. This is also were you have to decide how persistent your world really is, and what persistent means in your game. Not everything has to be persistent, but it helps to start discussing what’s persistent and what’s transiting and how transitions of data between those two states occur. Also the concept of lockstep needs to be discussed, which simply put is that some actions either change the state or they don’t. Never something in-between.
At this point you’re pretty much done with the basics, but need to evolve your idea/concept and game. It’s not that unrealistic to start off with a simple game and make it MMO capable, as it would be to make a full-blown AAA title.
Quote:
Original post by hplus0603 Quote:
More then 2000 TCP connection is hard for OS.
These days, if you use the appropriate I/O primitive (IOCP on Windows, various poll/epoll variants on UNIX), 2000 TCP connections isn't so bad. However, if each of them sends commands that require collision testing, 30 times per second, that's hard for the server :-)
I wrote one stress-test for on of my server. Works good for 2000 connection, but if you have more then 2000 connection and 10 of them grops about 30% packets ... FreeBSD, Linux unpredictable fades on 50-300ms, and it's very bad for "real-time" servers. I don't know why, but droped packet "kills" TCP server with big number of connection. I must to rewrite one of them for use UDP transport, and I'm happy, I've fogot about connection lost and server freeze.
For windows I can't say .... I've not tested.
There was a project that used C# and TCP/IP to make a MMO server for some old MMORPG so clients could connect. Anyways, didn't that one server have like 5000 players on it or something insane (concurrently)? Wow, my memory is fading fast, old age is setting in (28...)! Anyways it was pretty impressive, sadly I read about it over a year ago.
Quote:
Original post by hplus0603
These days, if you use the appropriate I/O primitive (IOCP on Windows, various poll/epoll variants on UNIX), 2000 TCP connections isn't so bad. However, if each of them sends commands that require collision testing, 30 times per second, that's hard for the server :-)
Money right there. Understanding the io model of whichever OS you're running on will have the biggest payouts. You will have to be multithreaded.
Happy coding.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement