   Some questions on MMORPG server design.
  I have done quite a bit of research and in the past have found some gems here and there but can't seem to find them any more. I have a couple questions for a game I want to start working on. The game will be a top down mmorpg similar in style to Diablo I guess. The game will probably only have <100 players at any given time at first but I would like to code for efficiency/scalability. I am willing to sacrifice some of that if it makes coding a lot easier but it really depends on the situation. I plan to use TCP because I think that it needs to be pretty reliable as this will be a faster paced game and would hate for players to die if they miss a heal.Now for the questions I have in particular.1. Database (SQL Server/MySql) vs file system. I read an article about this a while back and can't seem to find much anymore but what do you suggest? I would think going with SQL Server would be fine and more efficient than MySql but offers a lot more usefulness than a file system.  What do most games use? Also do they tend to update constantly or rather use some buffer system and do it in chunks?2. Sockets... I read somewhere that using even winsock is not a good idea for larger scale. I can not remember for the life of me what was suggested but the author seemed to think it was a lot more efficient and used much less resources on the server with more connections. Any ideas? What do you suggest?3. Handling connections. What is a typical design for handling many connections? My thought is something like having a main thread for the game processing and then having a thread that receives the packets and processes them by either putting them into a queue in their raw form and the main thread processes that raw packet or processing them in the thread that receives them into some sort of  data. I do not like the second method at all because it seems like the design would be complicated because you have to store everything for the main thread to process and may be redundant. What is the best way to handle this? I read that some games use threads per player but that seems like it would get bad once you have tons of players. I really just want players to see stuff happen when they do it. So I will implement priorities I guess but I want to be able to process this stuff as fast as possible in the best way. I am open to any ideas on any of this stuff. Thanks![Edited by - valleyman86 on May 28, 2010 1:51:46 PM]
  For a 1-man or small team MMOG you are going to want to use as much off-the-shelf as possible if you want it playable in any reasonable time frame. IMHO:- use RakNet or Lidgren or some other networking library or you'll be spending as much time writing the networking as the game itself. Thus #2 and #3 are taken care of. Many companies use RakNet so experience with it can't hurt if you are looking to get hired.- As for #1, I'm no database expert, but for 100 players the type of database likely won't matter. AFAIK MMOG aren't especially database intensive anyway. Number of connections and bandwidth will be bottlenecks before the database will.   ;  If you want to host on Windows, SQL Server might be a reasonable solution. MySQL is no less efficient than SQL Server as far as I know, though.If you want to host on Linux, there is no SQL Server, so that choice becomes easy :)You might want to compare different hosting plans for Linux versus Windows "root servers" or "virtual servers" to figure out which way you want to go.When it comes to communications, use TCP, one connection per client, and a simple queue of updates of entity movement and game rule effects. Lidgren, RakNet, or even XDR would help for marshaling packets between clients and servers.For < 100 players, I wouldn't worry about threading or anything. Instead, you might want to scale by adding more, different areas/maps. And, when you run out of horsepower, you can always shard your world, and/or make instanced zones.Although, for a < 100 player game, you could probably get away with using an existing game engine, even something like Torque could probably deliver that just fine!;  Thanks for the replies! Yea I plan on developing in XNA for the client. I am familiar with that and if I decide to use Torque I may test out their Torque X. I plan on using a Windows server and have access to SQL Server and I am better versed in that vs MySql. As you can tell I'm mostly a Windows programmer. :)I probably will do instances but mostly for certain aspects of the game play. Never really thought about using it to help load balance/scale. I am definitely not against using off the shelf stuff. I know someone has probably done a better job at it than I can do in a reasonable amount of time so yea if it suites my needs then definitely.;  Oh if you are doing XNA definitely check into Lidgren network library. http://code.google.com/p/lidgren-network-gen3/That or whatever comes with Torque. Never tried Torque networking stuff, but Lidgren is very user-friendly. It has built-in reliable UDP, multiple channels, compression, and a some XNA specific options. There's a bunch of samples on the site.   ;  I don't really have issues with sockets or anything as far as the client is concerned. Im sure that it really doesn't matter what I use for the client as almost I will look into that however. My big concern is the server which will be a c++ app and needs to handle many connections efficiently. I was not sure what the best ways to do that are.   ;  In my opinion, the best parts of Torque were the parts that got shipped as part of Tribes games. Anything that's come after that has been of less quality, less support, and less usefulness. Anything totally new, such as Torque X, or Torque 3D, generally has not been battle tested in any real way. I'd rather look at Lidgren, or roll my own.;  I decided to roll my own. After looking at Torque it was advertised well but does not have a lot of people vouching for it. I found way too many negative comments about their support and it being immature. I will just use XNA and code the features I need for my game. Will take a bit more work but shouldn't have any issues with stability or "Why doesn't this work like it supposed to?".   ;  Why not use Ogre3D and Raknet? With XNA your stuck with Windows and Xbox 360 where as Ogre3D has a very active community and can use DirectX or OpenGL. Also Raknet was designed with MMOs in mind and is free until you make more then like 200k in a year at which time there is a 5k license fee.   ;  Well I like Ogre and thought about it. That said I wanted to do this in C#. I know about Axiom and may mess with that in the future but for now XNA fits well. I don't really care to develop for more than just Windows right now anyhow. If I was expecting more of a player base (more than like 100 people) then I would add support for other platforms. Besides that I have no way of even testing on multiple platforms reasonably.I may look into using Raknet even with XNA.If anything I can always prototype in XNA and if I feel I want to expand I can grab Ogre3D. I really want to look into Axiom more and see if it has limitations compared to Ogre3D in c++ and if so what they may be.   