Godot version:
master 805eec7
OS/device including version:
Win7, Intel HD 4000
Issue description:
I have a monitor which turns out by default is at 59Hz Refresh rate with options to change it to 50, 59 and 60Hz in the Intel graphics control panel. I have always noticed there being a stutter about every 15 seconds or so, Printing the game fps shows the game running at 60 instead of 59. I find the Game fps actually does become 59 when I minimize the game while running.
I tried changing my Refresh Rate to 50 and the Game Fps shows 50 fps and I made sure I changed my physics fps to 50 too, else it leads to jitters, as stated here. Refresh Rate of 60Hz showed similar results with no issues.
| Refresh Rate | Physics Fps | Game Fps | Stutter or Jitter |
| ------------- | ------------- | ------------- | ------------- |
| 59 | 60 | 60(59 when minimized) | stutter every 15 seconds |
| 59 | 59 | 60(59 when minimized) | semi random jitters about 15 seconds |
| 60 | 60 | 60 | no stutter |
| 50 | 50 | 50 | no stutter |
The first row was the default settings and the problem I had, it makes me think if 59Hz is actually the default in many monitors and might be the cause for stutters that some users are reporting.
So the issue is the Vsync is not matching the refresh rate of 59 and makes the game fps 60 instead, the game fps becomes 59 when the game is minimized
Steps to reproduce:
Try changing the refresh rate to 59 in your graphics control panel and run a game in godot with moving sprites.
Try Alt+Tabbing and notice the game fps goes to 59.
Minimal reproduction project:
Any project with a moving sprite to look for stutters and jitters.
https://github.com/qarmin/Sea-of-Ground
@qarmin Hope its alright to link your repo, was running my tests with it.
Can you try turning off V-Sync from the settings and see if that helps? It's under "Display -> Window"
Actually the issue here is how Vsync in godot seems to handle certain refresh rates, turning it off would lead to uncapped fps based on the device performance and its not what we want here or in an usual release build of most games. It also leads to screen tearing.
Oh I see. Well I remember that I had the same issue recently this week.
Windows 10 Nvidia 1080ti.
I can't confirm now but I'll test again to make sure.
Are you testing the project in fullscreen or windowed mode? On Windows, there's going to be more stutter in windowed mode compared to fullscreen.
I am testing in fullscreen mode, I am aware that windowed mode has its own stuttering issue that isn't present in fullscreen mode. The stutters due to windowed mode is because of the opengl drivers in windows and not due to godot. The stutter I mentioned above is due to Vsync in godot and how it handled 59Hz in particular, even after changing the physics fps to 59 to match it, which can be another source of stutter or jitter if there is a mismatch.
Do note that, there is no stutters when when I try a refresh rate of 50 or 60Hz and made sure that physics fps is set to match those refresh rate and also that I run it in fullscreen.
Duplicate of... all the other stutter-reated issues, this problem may need a tracker because all opened issues have links or tests that may be useful in the future or for anyone who may want to create a patch to their games, until Godot can finally have a solution in the engine...
No I don't think its a duplicate, stutter had many causes, one of them being the driver issue and other is the physics and refresh rate mismatch and I believe this is but another source of it. While the ultimate problem is a stutter in this case, I am trying to emphasize how the vsync fails to handle 59Hz which then leads to a stutter. I agree a tracker would be nice to keep track of all the stutter issues.
I also have stutter in my game with vsync on (2D game, Linux, GTX1070) but I have also noticed that turning off vsync make my game run smoother (not always) but using yield(get_tree().create_timer(0.10), "timeout") is not working anymore...
@grevius5 The stutter may or may not be due to this issue, you may want to refer to other stutter issues here on github for potential solutions but I would suggest you try some of the following:
All of the above helped in my case, other solutions that were suggested, which I cant attest for, were:
Most helpful comment
Duplicate of... all the other stutter-reated issues, this problem may need a tracker because all opened issues have links or tests that may be useful in the future or for anyone who may want to create a patch to their games, until Godot can finally have a solution in the engine...