In order to ensure that players with a higher framerate don’t actually move faster I want to incorporate deltatime into my main game loop. However, several issues have arisen when trying to implement this in babylon.The following examples are based on the answers given in: fps-affects-game-speed-framerate-independence (on this forum).
First, when I just update the position with engine.getDeltaTime() * speed, there is a very noticeable jitter:
This is actually to be expected because the deltatime varies quite a bit, leading to erradic movement.
The movement is still jittery on a 60 hz monitor and extremely jittery on a 144 hz monitor. I understand that this might be because there is still a little bit of time left over in the delta variable after updating the player’s position. The article describes a solution for this:
Passing the percent of a timestep that hasn’t been simulated yet to the draw() function allows it to interpolate between frames. This visual smoothing helps reduce stuttering even at high frame rates.
But I don’t believe there is support for this in babylon.
Extra backstory in short:
It’s for a basic multiplayer game. I’m trying to ensure that all players move at the same speed + ensure that the client simulates movement at the same speed as the server which is currently doing it at 60 updates per second.
Edit: I had to reference some links by title and author because I’m only allowed to post 2 links.
Thank alot in advance!