Game Stuttering again

jgraumanjgrauman Posts: 41Member

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!

Josh

Comments

  • jgraumanjgrauman Posts: 41Member

    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: 1,748Admin

    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:
    https://docs.godotengine.org/en/3.1/tutorials/misc/jitter_stutter.html

  • jgraumanjgrauman Posts: 41Member

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

  • cyberealitycybereality Posts: 340Member

    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: 41Member

    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: 41Member

    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: 1,748Admin
    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:
    https://github.com/godotengine/godot/pull/33414

    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: 41Member

    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: 25Member

    @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: 25Member

    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.

Leave a Comment

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