Smooth setVelocity with Multiple Refresh Rates

Hello, I’m sure this question has been covered a thousand times, but I’m having difficulty finding a clear answer.

Using the provided making your first Phaser 3 game tutorial, the setVelocity stutters depending on the refresh rate of the monitor.

From what I’ve gathered, this is because Update() isn’t called at a fixed rate? So the effect will differ depending on the frame rate.

I also tried multiplying my setVelocity with delta and the problem persists.

What do I need to add to make the physics smooth?

Any help is appreciated.

By default, Arcade Physics steps by a fixed delta. Never multiply velocity by a delta.

You may see a low display frame rate (stuttering?) but you shouldn’t see physics time distortion (slowdown) — with some brief exceptions.

Are you moving a browser window between two monitors?

Hello,

After I read your message it occurred to me that I should try it on the primary monitor (165hz), and everything is now smooth. I’m guessing the Arcade Physics sets its fixed delta to the primary monitor’s refresh rate? So if I set all the monitors to the same refresh rate (60hz) then everything is smooth.

It might also be something with Windows, where on the desktop chrome trys to force the primary refresh rate (165hz) even if the window is on a 60hz monitor.

Nontheless, it is no longer an issue, thank you for your help.

The Arcade Physics step rate is 60hz by default, no matter what, but you can change that (fps) in its config.

In that case then the game should stay around 60 frames per second? In chrome the fps goes to the refresh rate of the primary monitor (165hz). Seems weird that moving the tab to the 165hz monitor would eliminate the stuttering.

No, the Arcade Physics step rate and the game step rate are independent (unless you set fixedStep: false). The game step rate comes from requestAnimationFrame and generally follows the display refresh rate.

Not sure what’s going on but you can check https://cdpn.io/pen/debug/KbdXad on both your displays.

Quite odd, both monitors show the same stats:
image