MMORPG Server architecture: How to handle player input (messages/packets) while the server has to update many other things at the same time?

Posted by Renann on Game Development See other posts from Game Development or by Renann
Published on 2012-11-06T18:47:45Z Indexed on 2012/11/06 23:21 UTC
Read the original article Hit count: 141

Filed under:
|

Yes, the question is is very difficult.

This is more or less like what I'm thinking up to now:

while(true)
{
    if (hasMessage)
    {
        handleTheMessage();   
    }
}

But while I'm receiving the player's input, I also have objects that need to be updated or, of course, monsters walking (which need to have their locations updated on the game client everytime), among other things.

What should I do? Make a thread to handle things that can't be stopped no matter what? Code an "else" in the infinity loop where I update the other things when I don't have player's input to handle? Or even: should I only update the things that at least one player can see? These are just suggestions... I'm really confused about it. If there's a book that covers these things, I'd like to know.

It's not that important, but I'm using the Lidgren lib, C# and XNA to code both server and client.

Thanks in advance.

© Game Development or respective owner

Related posts about XNA

Related posts about mmo