Hacker News new | ask | show | jobs
by ReactiveJelly 1002 days ago
Yep in gamedev it's called frame pacing. If you have a 16 ms frame budget and you know rendering will take about 4 ms, you can sleep for 10 ms, sample the latest possible inputs, and kick off rendering just in time to make the deadline.

If you estimate wrong, you start missing frames. If you don't do any frame pacing, the game always has a little bit of preventable input lag.

I only learned about this a couple years ago, but I think I felt it years ago - One of my games just seemed to feel better with a 10 millisecond sleep right after I submitted each OpenGL frame. In a world where you can't control hardware and OS lag, that 10 ms of free lag reduction is wondrous.