I'm working on a basic 2D flash MMO. The first alpha will contain the basics: players can move around. This is, I think, also the most important part to be highly optimized. As movement happens all the time and costs a lot of bandwidth.
This is how my current system works:
- All movement is calculated by the client
- When a client changes turning mode (turning left, not turning or turning right) this is being send to the server. The server then sends this new mode to all players that are near.
- Same thing happens for movement mode (moving forward or not moving, there is no moving backwards).
- Because of something (I think it's lag or delays between the client changes a mode and that new package actually being received by the clients that are near) the position of the other clients are not 100% accurate. So, every few seconds (I currently set it to 2) each client sends his current real position to the server, after which the server informs the near clients with the accurate position. Positions are checked with time-based range checks to avoid cheating.
Now, the problem is, that this "correction" (step 4) is actually so big that you see the other clients "warping" to the real location every 2 seconds. So, I have 2 questions:
- Is my "algorithm" efficient, smart and good? Or do you suggest (minor or mayor) changes, or a completely different way of doing this?
- How should I solve the problem where the correction is actually too big so that the near clients are warping to their corrected location every 2 seconds?