In Pygame, normalizing game-speed across different fps values

Games use a fixed-timestep for physics, while allowing the video timestep (fps) to vary. This means your update(delta) function gets called with a constant delta value. This maintains stability.

This means in practice, update may end up being called multiple times on average per single call of draw(), depending on how much time elapses.

For details see: Gaffer’s “fix your timestep”

A larger (python) example is at cookbook: ConstantGametime

Leave a Comment