Stutter and freezes on very simple game (on Linux+NVIDIA).

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

I need your help fixing some weird framedrops / stutter / jitter I have on my Godot 3.2 project.

It’s a simple 3D game I’ve started to create recently - It’s currently just a train running on simple, straight track, through a town and a forest.

The game is so simple it doesn’t even use 1% of my CPU (Ryzen 7 3800X) and about 10% of my GPU (Titan Xp). Even though it’s nothing that could stress the PC I see weird stuttering or framedrops while the train is in motion. If you look at the environment you will see that the movement is not nice and smooth and sometimes there is a brief freeze, just like few frames would be completely skipped.

Profiler won’t help me - it says that frametime is consistent and way below 16 ms. Even if I see framedrops, profiler keeps reporting perfect performance.

If you would have time to help me, please download my project and try it yourself. To move the train you have to slowly rise the throttle by dragging the lever on the right of using arrow keys.

Add details about the OS and drivers you are using, also the monitor refresh rate.

If on windows (which has known problems with OpenGL) you can try enabling the option of vsync via compositor on Display>window settings and see if changes something.

eons | 2020-05-16 18:31

I’m on Linux Mint 19.3 with NVIDIA driver 440.64.
I’m having a 144 Hz display running in Free-Sync. No issues with other games.
I’ve experimented with vsync settings, fullscreen, forcing FPS, Jitter-Fix settings ect. Nothing works :frowning:

Skipperro | 2020-05-16 19:39

Out of desperation I took this project:
https://github.com/godotengine/godot-demo-projects/tree/3.2-57baf0a/loading/threads

and simply added this function:

func _process(delta):
var rot = $Sprite.rotation_degrees
rot += delta*360
if rot > 360:
	rot -=360
$Sprite.rotation_degrees = rot

It simply rotates the image, so I can see some action.
The movement is broken the same way as in my project - little shaky and once per about 15 seconds it freezes for a moment.
Anyone encountered this behavior before?
Could it be my system?
If yes - how can I fix it?

Skipperro | 2020-05-16 22:08

:bust_in_silhouette: Reply From: Skipperro

OK, I found the solution.

It was nothing with the Godot or my project.
If you are having similar issue on Linux with NVIDIA - reinstall the NVIDIA driver.

I’ve purged everything NVIDIA related, restarted PC, installed same driver version, restarted again and now every Godot project is running smooth as butter.

Thank you for this!

I was going crazy when there was constant stutter and nothing was showing up in the profiler. Reinstalling the driver and rebooting fixed it.

hank29a | 2021-04-08 22:41