- Server has a variable: currentFrame of type Long. This is updated 10 times a second, each time adding 3 frames to currentFrame. This is done via:
SmartFoxServer.getInstance().getTaskScheduler().scheduleAtFixedRate(...);
. The client updates at 30 frames per second. This number is sent to the client when the client joins the room and periodically the client gets an update on this number to make sure it's not gotten too far ahead / behind.
- When a user changes their input, all these are set as UserVariables (the thought being that user variables only update to users in the AoI in an MMO room)
- their current position is set using: new SetUserPositionRequest();
- their current rotation is set using single float value (it's 3D, but they can only really turn around in circles)
- their current speeds are set using a float array (forward speed, rotation speed)
- the frame on which this update started is set as "Update set at" variable
With this, the clients would be able to interpolate accurately with very little overhead on the server side?