How to prevent stuttering on devices with >60Hz displays?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By pip

Godot runs very smoothly on my iPhone X but it stutters a lot on my (much more powerful) iPad Pro. I think that’s because of the ProMotion display, which supports frequencies up to 120Hz.

I have tried the following things to no avail:

  • force Godot to use 60/120 FPS in the preferences
  • switch VSync on/off
  • manually set the refresh rate to the monitor setting on level start using
 Engine.set_iterations_per_second(Performance.get_monitor(Performance.TIME_FPS))

And I could not figure out what “Engine.physics_jitter_fix = 0.5” does.

I would be grateful for suggestions on how to solve this.

:bust_in_silhouette: Reply From: Seubmarine

It depends on what is stuttering, everything that is supposed to move using physicsbody should go in _process_physics, I did get stutering because my camera movement where moving in the input function and I moved it to _physics_process and everything is good now, try changing the process time if you use a clipped camera, and use interpolated camera.

Thank you for your answer. I am using an interpolated camera which points at a camera target which itself is a child to the player-node. It is a 3D game but its is using only horizontal movement like a 2D game.

The Player is moved using something like this:

func _physics_process(delta):
	velocity = move_and_collide(move_vec * MOVE_SPEED * delta)

The move_vec vector is then changed according to the user input.
The player itself looks smooth but the background is stuttering a lot during camera movement. The stutter is not constant - there seem to be smooth phases from time to time. It pretty much looks like the stutter example from the official documentation (https://docs.godotengine.org/de/latest/tutorials/misc/jitter_stutter.html).

What do you mean by “changing the process time”? The physics FPS?

pip | 2020-04-09 22:32