How do I start writing an MMO game server?

Baccari
  • How do I start writing an MMO game server? Baccari

    I am developing a multi-player on-line game.

    I just started coding the server but I have no idea how to do it. Do I have to use threads ?

    And if i do, do I need one thread for every client?

    Knowing that I am using UDP, can I use multiple sockets in different threads to send packets on the same port?

    edit:

    server does:
    
    -listen for client connections
    
    -when a client connects:
    
        -update files (send new files to the client)
    
        -retrieve data from database
    
        -loop to retrieve and update live data
    
    -when client disconnects:
    
        -update data in database
    

  • I may be wrong, but your question makes it seem like you are missing a lot of knowledge in order to successfully write an MMO server. I know this message will likely fall on deaf ears because I was in your position when I started programming.

    My answer: If I were you I would start smaller. If you want to learn to write an MMO server I would do the following.

    • Write a TCP based p2p chat client.
    • Extend that chat client to work with NAT routers
    • Extend the chat client to have a central server that authenticates and stores message history
    • Extend it to have a secure handshake with the server to verify the client software and server software/location
    • Write a high level architecture of what you would want your MMO server to be
    • Read some articles on MMO server architectures
    • Start expanding your high level architecture into more and more detail
    • Write essential user stories for your architecture
    • start implementing your server

    The answer you probably want:

    • Write a thread for the listener to accept incoming connections using TCP
    • Once the player is connected, use TCP for chat messages and sector changes
    • Use UDP for in-sector movement
    • Each connection gets its own thread for the messaging
    • UDP can be implemented with threads (if you really want) but I would probably use some sort of queue on one thread that accepts movement messages. Or spread it out depending on how many connections you get.

Tags
c++ networking mmo server multithreading
Related questions and answers
  • I am trying to build and run Doom 3 from the open source release in order to better understand how the engine works. Unfortunately I am not able to run the game from the binary I built. I just get the console, but cannot run the actual game. Here is what I did: Downloaded the source code from the game repo Downloaded and installed the DirectX SDK Purchased, downloaded and installed Doom 3 from... if the warning I am getting is the problem or if there is something else. Also, this is when the configuration being used is "Dedicated release", but I have also tried with "Dedicated Debug". It is my

  • going to use the enet library. I was thinking that each time a game session starts, I push a new Game and I map the client IPs to that table, then I just route messages from those clients to that Game. Since enet supports channels I was thinking of using 2 channels per table, one for the game messages and one for in game chat. Would something like this work? Does anyone have any advice... not need any information from the lobby, they see the card table and the data about the other players and so forth. I've programmed the server portion for the game itself. The clients connect to my

  • I'm trying to find a solid architecture for authenticating users against a database. I have a game client, which I plan to serve up a request with. The transport doesn't really matter... and if I can leverage Shiro's session features then that's a bonus. My real question is about the handshake between the client and server. If I use WS-Security isn't all that taken care of for me? Does that alone make the overhead worth it? If not, what should I do here? I want to make sure all of the requests from the client are authenticated but I also don't want to have to jump through hoops to make

  • for my needs. Ah and I forgot to mention that nodes can have hierarchy, but this is not a problem if the frame data is reduced. The structure instances don't get duplicated unless any value changes. When... in particular or contains any game attributes, it's just keyframed animation data and some IDs for them and to reference API objects. I use objects such as CFrame to hold pointers to frame data... that make really hard to work with when coding some functions that use them. I was thinking of making ie. SimpleMesh and HierarchyMesh objects, which will also require that the renderer can deal

  • components total. Or is this even feasible? How much I can accomplish with this approach? In essence I want to be able to do something like this with reasonable efficiency: moving_update(DB...I am studying entity indexed components and came up with a naive C++ implementation which just iterates over all entity "hash tables" and applies update/delete/insert functions in place. I'm having trouble maintaining a logical view of the game world (i.e. updates shouldn't be visible while iterating) and there is no attempt at maintaining spatial or temporal coherence of data. I wonder whether

  • So I'm trying to start a C++, OpenGL project on Visual Studio 2010, and I have put glut.h and glut32.dll in the project directory, along with the glut.dll and glut32.lib files in a folder named "glut" in the project directory. I have also gone to "Porject Properties -> Linker -> Input -> Additional dependencies" and I have typed in "glut32.lib" at the end, and made sure I am not missing a semicolon. when I try doing #include "glut.h" in the Main.cpp file, it complains error LNK1104: cannot open file 'glut32.libkernel32.lib' Am I missing any files? What am I doing wrong here?

  • are examples of actual calculated interpolation value i.e. the proportion of the physics update that is complete at the time the frame is being drawn. I am going to have to change the draw code to draw...Questions: When we draw with interpolation, where should the collision detection code be? Is it worth implementing interpolation in the following situation? This is for Scrolling Asteroids. I have... collide with a rock. Now I am considering improving it to use interpolation as per all the good articles recommend: http://www.koonsolo.com/news/dewitters-gameloop/ and http://gafferongames.com/game

  • I'm looking into designing and implementing an online RPG (or more accurately, redesigning an existing piece of server software). One of the problems is that of managing visibility. Update data for other players should only be sent to a game client if their player is near the other players (i.e. you shouldn't get health updates for people you can't see on the other side of the map). The main... when an update needs to be broadcasted. The existing system uses grids to organize players, and only uses only players in the current and neighbouring grids to do updates. There are some problems

  • So I'm starting work on a multi-player space shooter. And I've run into some issues. As I type this, my system is currently: //Main While Loop Gather Input Update Own Sprites Based on Input Send Position Information to Server. [Owner,Obj#,Image,X,Y,Theta] (TCP) Receive All Position Information for All Objects From Server Update Game Screen. Now I won't end up using this, it's for the initial... with bullets Should I implement a second port for these important events, or just use the same UDP proto? 3: (Side Question) How should I regulate my framerate with the networked game? I don't want

Data information