The game runs in slow motion or fast-forward after the window loses focus
Online games must advance in equal small time slices so everyone computes the same movement, yet screens refresh at different speeds, and a stalled tab can leave seconds to make up. Catching up all at once freezes the game, ignoring it makes players slow. Here is how to split time and where to give up.
Why this works
If the world advances by equal steps, it plays the same on any screen and any machine can check it. A limit on catching up is the safety net: after a long stall it is better to skip time than to race through it and fall further behind.
When not to use it
Skip it for a purely visual toy or a turn-based game where nothing depends on exact timing. A single step per drawn picture, scaled by the elapsed time, is simpler and good enough when two machines never need to agree.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 3 common mistakes and the fix
- 23 lines of example code with 4 checks that pass
- How your AI shows you that it works
Say this to your AI
Use the Spielerando entry "The game runs in slow motion or fast-forward after the window loses focus" (read_entry online-fixed-steps-with-a-catch-up-limit) in my game. Build it step by step, and show me how you checked that it works.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP