MMORPG Server architecture: How to handle player input (messages/packets) while the server has to update many other things at the same time?
- by Renann
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.