MMORPG Client/Server Coding

user21826 picture user21826 · Oct 17, 2008 · Viewed 10.3k times · Source

How are the UDP and TCP protocols used in MMORPG client/server communication?

For example:

Does the client broadcast (player position, etc) via UDP to the server? or vice versa?

Or is it more like using TCP where the Client requests that the server move the player. The server receives the request, moves the player and sends back to the client that the player is now at position xyz?

The chat channels must be implemented using TCP?

Are there any good articles/books on this? I've found bits and pieces but it seems the real meat and potatoes are won from experience.

Answer

Ed Altorfer picture Ed Altorfer · Oct 17, 2008

A lot of games use UDP for movement related activities--so, like, when you are walking, chances are, a bunch of UDP requests are being sent. The server still ultimately controls whether that's valid, but you don't necessarily care whether every single packet gets to the server. This is why a lot of game clients also use some kind of prediction mechanism.

In terms of your second mention, yes, it's very common for all control to be managed by the server. You don't want clients to be broadcasting anything to the server; you should do error and input handling server side to prevent people from hacking. You might also limit input per second.

Anyway, a combination of UDP and TCP would be appropriate--you just need to ask yourself, "Do I want reliability or speed?"