How do I fix fixed timestep and interpolation for smooth 2D movement?
#1
I’ve been trying to implement a proper game loop in my 2D engine prototype, but I can’t seem to get the fixed timestep and interpolation right for smooth movement. Every time I think I’ve decoupled the update rate from the frame rate, something feels either too jittery or weirdly sped up.
Reply
#2
I wrestled with a fixed timestep and an accumulator for weeks. It helped stabilize physics, but when frame times bloated the motion still jittered or snapped forward. I capped the delta to about 0.033s and kept render interpolation simple, which reduced the twitch a bit, but it never felt perfect in long frames.
Reply
#3
I tried fully decoupling update and render and used a consistent dt of 1/60. I looped updating while acc >= dt and then drew with an alpha based on acc/dt. In clean runs it looked smoother, but in scenes with lots of sprites the updates slipped and the motion would stall for a frame or two during big fps drops.
Reply
#4
Maybe the root cause isn’t the loop itself. I chased jitter for days and started wondering whether the issue is in how interpolation is applied to positions or how the camera follows the player. Is the delta being clamped?
Reply
#5
One time I drifted into checking whether VSync or the window’s redraw timer was throwing things off. It felt off topic for a while, then I came back to the simple habit: keep the physics updates at a steady pace, render with a smoothed factor, and don’t chase every tiny frame. Still not a perfect result, but it helps me sleep at night.
Reply


[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Forum Jump: