Pages

Wednesday, November 9, 2011

MULTITHREADING

One of the more advanced topics many programmers may eventually come to face: running multiple things at once. Today I wrote a simple multi-threaded chat server. It may seem trivial but the more advanced application would be to easily upgrade it with protocols to tell your clients what the server looks like.

There are two types of MMO servers:
Server Heavy or Client Heavy.

Server Heavy: This requires a more powerful server, as the name may hint. In this format the client simply sends a command to the server that the player is moving forward, not that the player moved x amount forward. This type of server is less liable to hacking but requires more processing power as the server is doing all the calculating and not the client machine.

Client Heavy: This is the inverse of the above. The client does all the heavy lifting and the server only relays positions of other players back to the client and the game state.

For an MMO server, one must multi-thread. You should have a thread for each player or their connection. In my server, a new thread is spawned for each new connection made to the server.

More to come,
TNariksan

No comments:

Post a Comment