Pixel-Perfect Jittery Movement

SomnivoreSomnivore Posts: 102Member

I can't seem to get things to move smoothly. When set to move by delta in _fixed_update(), my objects will occasionally stutter left and right while moving forward, but otherwise appear to move smoothly. They have no collision so that can't be the problem. I've changed numerous settings in project settings, but I can't seem to get completely smoothed out movement. Anyone else have this issue?


  • SomnivoreSomnivore Posts: 102Member

    Here is what I've learned through my experiments:

    First, I'll explain my setup: I'm upscaling a small resolution game (640 x 360) by double (1280 x 720); this should also work with 1920 x 1080, as they're all in 16:9. The scaling method is set to viewport, and stretching is off (kept). 2D Snapping is set to on.

    Filtering smooths out the movement of objects by quite a bit, at least for what the player sees on their system. However this is useless for pixel-perfect since you're supposed to have that turned off. In my tests with a larger resolution game using large HQ sprites with filtering on, movement appears to be perfectly smooth and stable.

    Changing my desktop environment from KDE Plasma to XFCE4 appears to have improved the game's framerates overall, and the objects seem to move smoothly at a very consistent pace, but will still, albeit more rarely, jitter. I'm not sure if this is because of the different window manager or just that the system is using a lighter desktop, but that seems to have played a role.

    I'm yet uncertain if there's something that can be done on my side that can get movement to be entirely smooth--e.g. lerping the movement, which is something I'd rather avoid if possible--but for now I've moved on to other things. If anyone has encountered something similar and would like to chip in I'd be happy to hear, but as of right now with a native 4K resolution and filtered sprites, things are looking quite perfect, so I'm going to roll with that instead.

  • robrtsqlrobrtsql Posts: 1Member

    I realize this may not be useful, since this discussion is months old, but in case any wanderers find it on Google:

    I think the problem is probably related to the physics loop and game loop not being perfectly in sync. I opened an issue on the Godot Engine github repo about this. https://github.com/godotengine/godot/issues/10388

    Unfortunately, I think the correct solution here is to lerp. Otherwise, you could put all game logic, including physics, into your draw loop (in the _process() methods).

Sign In or Register to comment.