How to synchronise the acceleration, velocity and position of the monsters on the server with the players?
- by Nick
I'm building an MMO using Node.js, and there are monsters roaming around. I can make them move around on the server using vector variables acceleration, velocity and position.
acceleration = steeringForce / mass;
velocity += acceleration * dTime;
position += velocity * dTime;
Right now I just send the positions over, and tell the players these are the "target positions" of the monsters, and let the monsters move towards the target positions on the client with a speed dependant on the distance of the target position. It works but looks rather strange.
How do I synchronise these properly with the players without looking funny to them, taking into account the server lag?
The problem is that I don't know how to make use of the correct acceleration/velocity values here; right now they just move directly in a straight line to the target position instead of accelerating/braking there properly. How can I implement such behaviour?