I am trying to follow an RPG tutorial. I used the code for the camera following from there, but in my case for some reason all sprites jitter every time the camera moves, and also when some NPCs move.

Maybe there's something new in GameMaker that I should be implementing, as the tutorial I'm following is 5 years old. I tried using round() as some solutions said it might help, but it didn't.

enter image description here

Here is my code for the camera following in obj_camera in its Create event:

following = obj_player;
h_border = 60;
v_border = 30;

Here is my code for the camera following in obj_camera in its Step event:

    x = round(clamp(x,(following.x) - h_border, (following.x) + h_border));
    y = round(clamp(y,(following.y) - v_border, (following.y) + v_border));

And in the Room's Viewports, I enabled the object following and set it to obj_camera:

And here are my settings for the graphics; I have 60 FPS:

I know I should probably use another camera setup, but this one was shown in the tutorial by FriendlyCosmonaut and I just thought I might use it as it was working for her. Also, I use a Mac computer, maybe it has something to do with that.

I would really appreciate any help, thanks.

  • \$\begingroup\$ What are your screen refresh rate and room_speed respectively? \$\endgroup\$
    – liggiorgio
    Jul 29, 2022 at 20:54
  • \$\begingroup\$ Hi, I used this code to see what screen refresh frequency is show_debug_message("screen rate " + string(display_get_frequency())) and got 60 as a result. And room_speed is 60 as well. \$\endgroup\$
    – nadiavi
    Jul 30, 2022 at 8:09
  • \$\begingroup\$ Linked question. \$\endgroup\$
    – Vaillancourt
    Jul 30, 2022 at 11:47

2 Answers 2


After trying to open the same project on Windows I figured out that the jitter had something to do with Mac OS and M1 as there was no camera jitter on PC. So there was nothing wrong with the code or settings, Game Maker just works like that on M1 in my experience.


The subtle jitter movement of your camera could be due to different reasons:

  • Rounding: since you force integers when updating the camera position, it results in a non-uniform displacement at each frame, e.g. moving 2.5-2.5-2.5-2.5 pixels vs. moving 3-2-3-2 pixels over time. Fix: force your character (and camera) movement to integer increments, and use no decimals in your movement logic; this will let you get rid of round() functions.
  • Interpolation: you aren't using interpolation for rendering, I guess because you want to achieve a pixel-perfect look for your game. However, it works best with very low resolutions (e.g. 320x240, 160x120), so scaling up the application surface to the screen size will show very few artefacts. Fix: enable interpolation to smooth pixels during rendering. This is very effective if you don't round() your character/camera position during movement, and interpolation will smooth pixels when rendering at the current position.
  • V-sync: lack of vertical synchronisation may lead to screen tearing. It happens because the OS tries to render new frames as fast as possible, without trying to stick to a constant flow rate. Fix: enable synchronisation and check if the final result improves the visual quality of your game.
  • Fixed timestep/game loop decoupling: while room_speed defines how many updates the game performs each second, this quantity doesn't necessarily synchronise well with the screen refresh rate. It may occur to skip a render frame once in a while because the game update cycle tries to keep up with the real-time; on the other hand, the same render frame may be drawn multiple times on the screen because the screen refresh has occasionally run faster than the game loop.
    GameMaker Studio uses a game loop where rendering is strictly coupled with game logic: each update step implies a new frame to draw. You can disable drawing, but you can't actually tell GMS to "use room_speed 30, but render at 60 FPS". It just doesn't support that. Fix: there's nothing simple I can think of. You may implement a new game loop yourself and nest its logic beneath the three Step Events, but it's going to be quite a convoluted code and I believe you just want to develop your actual game rather than some boilerplate logic for it.
  • \$\begingroup\$ Thank you so much fir this detailed answer! You are the best :) I will try implementing all of these solutions and see how it affects the jitter. \$\endgroup\$
    – nadiavi
    Jul 30, 2022 at 10:29
  • \$\begingroup\$ I tried all solutions except for the last one. There was an improvement with V-sync when the camera wasn't moving everything looked ok including npcs, the player and the background tiles. But when the camera started movings everything started shaking again. I tried using round() for both player and the camera and it didn't help for some reason. Interpolation helped a little but even with small screen size the pixels looked smudged and blurry. Maybe it is some kind of Game Maker bug, I will try to update Game Maker and see if this helps. \$\endgroup\$
    – nadiavi
    Jul 30, 2022 at 11:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .