Game Stuttering again

jgraumanjgrauman Posts: 46Member

Hi all,

I'm pretty much finished with my game and am really happy with it. It's fun to play and looks great (almost perfect except for this bug!). For some reason, when my RigidBody2Ds are moving quickly, there is a stuttering problem, maybe every .5 to 1 second. When I look at the monitor, the fps hovers around 112, and process is around .001s at the highest, and physics_process is around .002s at the highest. So I really can't figure out why there is a stutter. The stutter happens even when I am not applying any forces or doing anything to a RigidBody2D, but it just has momentum and so Godot should be updating its position. Any ideas about what to look into would be greatly appreciated!



  • jgraumanjgrauman Posts: 46Member

    As an additional update, even when I cut out pretty much all the game logic, and I get 380 fps for the game, I still have the stuttering. So it looks pretty clear that the stuttering has to do with bliting the sprites together, all the lighting effects (I have lights and normal maps on the sprites) etc. I'm running on a laptop with not a great graphics card, but I thought if I had high enough fps, then everything would be smooth. So I guess the graphics engine runs in another thread or something and it is what is having the slowdown? Anyone have more information about what I can do to improve performance?

  • MegalomaniakMegalomaniak Posts: 2,773Admin

    Is this on Windows and is the game in windowed mode? If so I think 3.2 has a fix for a jittering/stuttering situation.

    Also look through this page:

  • jgraumanjgrauman Posts: 46Member

    I am on Linux. I've tried Godot_v3.1.1-stable_x11.64 and Godot_v3.1.2-stable_x11.64.

  • cyberealitycybereality Posts: 926Moderator

    I see stuttering sometimes too (Ubuntu Linux in windowed mode). I don't think it's a performance issue, since I have a 2080 Ti and can get over 1000 fps in a blank/simple scene. However, my setup is kind of unique: 166Hz monitor with G-Sync, so I assumed it just some weird issue stemming from that.

  • jgraumanjgrauman Posts: 46Member

    I just tried 3.2 beta 5 as well, and it still has the issue. I will try on some other computers when I get a chance. Thanks for the suggestion.

  • jgraumanjgrauman Posts: 46Member

    So I tried on a Linux desktop with pretty fast CPU and no GPU and it is perfectly smooth. So I guess it's just an issue with my laptop. Thanks for the suggestions.

  • MegalomaniakMegalomaniak Posts: 2,773Admin
    edited January 14

    When you say no GPU you mean no dedicated GPU, right? It's certainly possible that it's a stutter that only appears below certain frame-times(that is high FPS).

    Heres the patch I mentioned before:

    I think I misrecalled and it might actually be applicable to other OS's too, so try 3.2 beta again and try either the command line option or the option from project settings mentioned there.

    Nah, it pretty clearly states windows. Something similar might exist on linux as an issue too though. May warrant a issue report perhaps.

  • jgraumanjgrauman Posts: 46Member

    Yes, no dedicated GPU. I get around the same framerate on the laptop with Intel Core i7-8550U and a GeForce MX150/PCIe/SSE2 as my desktop with a Intel Core i7-7700k with integrated HD Graphics 630. Both are running KDE, the laptop on Kubuntu and the desktop on Linux Mint. If I get a chance I'll try some other systems too, but at this point I'll just consider it an issue with my laptop and not Godot.

  • novaleafnovaleaf Posts: 83Member

    @jgrauman are you using C#?

    also, be sure that VSync is enabled in options.

    and, I see that using the interpolating camera makes jitter 10x worse.

    hope that helps.

  • novaleafnovaleaf Posts: 83Member

    I found another cause of stutter: GC. (using C#)

    For some reason when you set VSync, the random GC times screws up VSync and I see frame rates jump.

    I verified this by setting VSync on and then adding a node with this:

    public override void _Process(float delta) { GC.Collect(GC.MaxGeneration, GCCollectionMode.Optimized, false, false); }

    That will attempt, not force GC collection every frame. doing this smoothed out the jitter.

  • novaleafnovaleaf Posts: 83Member

    Related to the GC (my last post) sorry but my analysis seems off.

    After I created my MonoDiagLabel (MIT licensed) I see that the cause of stutter was not due to the GC (My test game doesn't trigger the GC)

    however, manually calling the GC does stop the jitter. As GC takes time, I suspect there is some bug in how VSync is working, and so when each frame costs more (when I call GC.Collect() every frame) it's forcing a smooth-out.

    I suspect that "real" games don't see this bug because their frame time is already high enough to smooth out this VSync hickup. only toy prototypes like mine (aprox 300fps) are able to see the vsync bug.

    As OpenGLes3 is dead (in godot) I'm not going to bother filing a bug. Will do so if I see this in the Vulkan renderer though.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file