2 ms·
Not using a fixed update rate is why i have to run a framecapping software on my fast PC in pretty much every game that is older than a few years. Do not bothe
by badsectoracula 6y ago
Not using a fixed update rate is why i have to run a framecapping software on my fast PC in pretty much every game that is older than a few years.
Do not bother, Carmack couldn't get it right, Sweeney couldn't get it right, the guys at Monolith couldn't get it right, pretty much nobody could get it right. Even if you think your code works, it wont work. Floating point doesn't like operations like "thing += delta * speed", especially when delta varies from frame to frame.
Use a fixed time step for all updates (not just physics updates), use a high update rate like 60Hz to avoid any perceptible delays, interpolate the visible state in intermediate frames and if your game really needs immediate response (in practice this is only visible with mouse look in high refresh rate screens - other forms of input are not perceptible), do the visual change on the input event (e.g. rotate the camera when you move the mouse, play the sound effect when you hit fire or whatever) but let the game logic still run at the fixed update rate.
Consider anything else and you will have a broken game.