Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm trying to decide how to implement player movement in an MMORPG. Player positions must be synchronized in a way that meets the following requirements:

  • Low lag
  • Difficult to hack or cheat
  • Authoritative server with constant accurate knowledge of player positions
  • Fairly simple to implement

I already know of two approaches:

  1. The client sends position: Every so often, the client sends the player's current position to the server. This is simplest.

  2. The client sends input: Basically the player's machine sends keypresses to the server, and the server handles all simulation and state, sending back the player's position every so often.

Both systems have their advantages and disadvantages. Is either one superior to the other, or is there a better alternative?

share|improve this question
1  
It's not 100% clear what your question is. Do you want to know if it's common in MMORPGS for the server to approve every action the player takes before it is executed? –  Roy T. May 26 '12 at 12:26
    
I have detailed my question –  jean May 26 '12 at 14:26

1 Answer 1

up vote 1 down vote accepted

Neither is better than the other.

You can send cheat positions with the first method but it is easy for the server to check them so it is rare to gain an advantage this way - just compare the current position with a past position and see if the distance travelled is further than the character's speed would allow. This method may require a bit more data being sent but it is easy to form and to process.

The second method cuts down on bandwidth but usually you have to send positions one way or the other anyway to keep the two sides synchronised, as jitter (change in latency) will mean that the client and the server will end up with different ideas of how long a character spends travelling, which adds up to a large error if not corrected. It can also get complex if there are different types of movement

Neither approach has significantly worse latency than the other - one or both sides will predict future positions anyway, where necessary, but that is always a tradeoff with accuracy, because any change in velocity takes time to reach the server from the client, during which the prediction is incorrect.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.