• Edited

I'm trying to make a pixel perfect game in Godot 4.2.1. Problem is: when camera moves, all objects inside the game move by in-game pixels, which makes the game look jittery. I've followed this tutorial: and made the game run in a SubViewport with a shader, that adjusts for subpixels.


While it helped with the initial problem, two new were created. Now the character is jittering instead of the background. And when the character stops, the camera is still moving for about a second to reach him.
First of all, I want to know, which function should I use for camera movement: process() or physics_process(). I've seen people doing both. It seems to me, that the character jitter is related to the function choice, cause the player always moves in physics_process(). However, simply changing the function doesn't help.
If it's not the case, then what is the problem and how can I fix this issues?
P.S. It may be important that my monitor is 144 Hz, I've heard that may cause trouble.

    Engi
    a stupid question:
    you wrote "...And when the character stops, the camera is still moving for about a second to reach him.
    First of all, I want to know, which function should I use for camera movement: process() or physics_process() ..."
    why not attach the camera as child to your character and it followes automatic and you dont need processes??

      PeterRiviera as far as i understand process() waits for all the processes to finish the frame then it starts another.. while physics calculates many times per frame..

      As for add camera to character, sometimes you want to implement smooth camera, meaning its not rigid and have some sort of a follow along type so that the movement is more fluid..

      as for the OP, why dont you go and try each function to see which one fixes your problem 😃

      @kuligs2 I figured it out. So, the drag that I got after the character stops was caused by the second lerp, that the guy in the video used. I got rid of it, and moved * delta to the first lerp to smoothen the character. That helped a bit, but not too much. Eventually I realized that what I'm trying to do is not achievable. When the character hits the border of camera's "drag window" his position on the monitor becomes fixed, while the background is moving. If I add subpixels on the borders to compensate for the jittery movement (as suggested in the video) it will indeed make background smooth, however, it will also make the character shake. As long as the background moves in integer pixels related to the character, one or the other will always jitter.
      So I think, I'll drop the pixel-perfect style.