Can GDevelop smooth camera for pixel art games?

I think my question is related to this topic: Jerky Camera + Lerp + Low Resolution
Properties of game:

sprites 32x32 (16x16 * 2)
tiled bg sprites 640x360 (320x180 * 2)

Problem: background layers does not move smoothly, it’s jerky.

Can I make them move smoothly or GDevelop can’t do it in 640x360 resolution and with Scale mode: Nearest?

If it can be done please fix my example or any other help will do:

Thank you.

In the thread you linked, 4ian’s post near the bottom gives a detailed explanation on how the engine renders.

That said, the stutter you’re having happen is irregular, so I can’t speak to why that is occurring and it is unlikely to be related to the engine itself (it would likely at a regular interval then).

However, you can always do what some other engines do in regards to scaling up the rendered resolution:

  1. Via scaling the physical assets and bumping up the resolution (3x size of assets, making your game 1920x1080)
  2. Via the method I mention in the other thread you linked: Jerky Camera + Lerp + Low Resolution - #7 by Silver-Streak, which involves scaling up the backend native resolution by an integer factor (1x, 2x, 3x, etc), then zooming in the camera (for each layer) by that same factor.

I was tinkering around with making the 2nd option an extension, but there’s some oddness with cameras that makes it difficult to do via extensions currently.

Here’s Not-A-Vania without any changes other than resolution (and hiding the GUI to see more of the screen) and forcing the max FPS to 60 like you have in your project. Do you have the stutter still on this one? edit: Forgot to turn off a setting,

1 Like

it’s regular. When moving to the right or left, the “BG2” and “BG3” layers stutter always.

No, it’s smooth moving.
If I change Not-A-Vania example: 640x360, and Platformer Object Max.Speed = 165, Acceleration/Deceleration = 1500/1500 - it’s jerky. If Max.Speed = 500 - smooth moving. And the same thing happens in my example.
This is because of the low speed of the Platformer Object (Max.Speed = 165). That’s the problem.

Hmmm… I would imagine it’s because at that speed you’ve set, the character is moving only 2-3 pixels per frame at 165 speed (pixels per second, 165/60=2.75 pixels per frame if you’re getting 60 seconds), and then if you’re using any type of parallax movement for your background, that’s moving a percentage of a pixel per frame.

Camera movement via events happens as part of the normal frame rendering (since the camera position will only update when the event occurs) and graphics can only render where there are pixels available (no subpixels for graphic rendering unless you want distortion/shimmering), so I imagined there is a lower limit to speed possible (for parallax, mostly, because you’re reducing it to a fraction of a fraction).

Here’s a slightly tweaked example for you:

Max speed set to 200, accel/decell set to 1500, and the parallax on the backgrounds tweaked a bit (before was 0.06 for the first BG and 0.02 for the 2nd BG, now set to 0.15 and 0.10).

This seems smooth to me still with those settings.

Outside of that, I think the only option would be to scale up your assets and resolution I mentioned as #1 above, since that gives you more pixels to work with when rendering.

1 Like

I will try some of this. I hope I succeed. Thank you very much.

1 Like