When do we handle events in fixed timestep?

Question

Fixed timestep sounds good to me. However, in any given game loop iteration, there might be zero, one, or multiple calls to update, depending on how much time has accumulated.

This creates the question "when to handle events?"

It seems like there's two places we could handle events:

while game loop is running:
    // handle events here at the start of each game loop iteration
    for each update that has accumulated:
        // or handle events here at the start of each update
        update()
    render()

I think there is a problem either way:

  • Handle events at the start of the game loop iteration: If enough time has accumulated, multiple update() steps could occur without polling events between them.
  • Handle events before each update: If not enough time has accumulated, there might be zero updates to do, and event polling will not occur in this game loop iteration.

Is there a canonical way that events should be handled in fixed timestep?

I'm not finding much about this online.

Thank you

Posted Sep 6, 2025, 8:56 PM UTC

12
Loading comments…