Smooth MultiPlayer movement

Fredrik Widerberg picture Fredrik Widerberg · Jan 18, 2011 · Viewed 14.2k times · Source

i am developing a multiplayer roleplaying game, (No, its not a mmorpg. ;)

My current setup is like this.

Client tells the server "I want to move forward"/"I want to move backwards", the server then updates your entity, and informs all clients in the area about the change. The server is also updating each entity every 20ms and sending updates every 100ms to the clients, these updates contains position, velocity, rotation etc.

So far so good, however i have nothing in store for smoothing the movement between the packets on the client side, and i must say, i can not get it working. I have been reading up on prediction, interpolation, deadreackoning but its all a big mess for me.

So right now i am just doing something like "Position = Packet.Position", which causes a very stuttering movement.

So, what i want help with is, how do i get a more smooth movement? Have been looking at the XNA Prediction Sample, but i could not get it right.

Thanks //F

Answer

I82Much picture I82Much · Jan 18, 2011

Read Valve's description of their multiplayer protocol. It should be instructive, and gives a very clear example on how you do the prediction/interpolation.