I have a MMOG server running on C++, using winsockets. My server won't support more than 200 players. I had the idea of redesigning it so it will use multiple servers instead of one, so, maybe, for example, each server could take care of a number of players, and, if it was too laggy, it could transfer the responsability of that player to other server. I'm not sure of how to program a consistent game logic like that, though. Are there techniques for this?
closed as too broad by user40980, GlenH7♦, gnat, Kilian Foth, Bart van Ingen Schenau Aug 6 '14 at 17:09
Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
You have 2 questions here.
The first what do i need to do to convert from a single server to a distributed computing environment?
You need to learn to program distributed computing applications. There are quite a few books on this out there. There are even college classes that teach this skill. Your can find some online classes as well. Once you have learned that you will need to redesign your game to work in a distributed system. Will probably require a nearly complete overhaul of your code.
Second how do I deal with my DDOS attacks from my competitors? This is off topic here but is a good question for IT Security SE
The first thing you must think is about partition. That is, split players in groups that don't usually interact. As much partitions you have you can have more servers (you can read more with PCAM methodology of partitioning http://www.mcs.anl.gov/~itf/dbpp/text/node15.html). On the other hand systems that make thinks like yours usually have their clients connected to more than one server at the same time in order to have a failover (but this is more harder to do).
The first thing you have to do is profile what's making it slow or "laggy". Understand the problem. Is it an OS limitation (too many sockets open)? Is the server using 100% CPU? Is the DDOS flooding the network and slowing it down? If not, can you do any profiling of your code to determine what the current bottlenecks are?
Is your code multi-threaded? If not, and if your game is CPU-bound, a good improvement might be to have multiple threads. This would be the first step towards a distributed system, too. You could have a client handler / connection pooler and a separate thread that represents the game state and takes actions from the handler and applies them. It's difficult to speculate without knowing more about the structure of your program.