Stage 1 · Lesson 1 of 7
The game loop
Every game runs the same loop many times a second. It reads input (keys, mouse, ), updates the world (moves things, checks hits, changes the score), then draws a new picture on screen, called a . At 60 frames per second, each pass through this game loop has about 16.7 milliseconds.
The engine runs the loop for you and calls your code at set points in it. That is why you write functions such as 's Update or 's _process rather than a main loop of your own. Knowing the loop explains three things.
Slow code shows up as . Movement must scale with the time each frame took. And physics often runs on its own fixed tick.
Common trapdoing something slow, like loading a file or searching every object, inside code that runs every frame.
A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock
Resources for this stage
Start with
- VideoFreeGame Maker's Toolkit
Mark Brown (YouTube)
Short, clear video essays on why games work, so you start thinking about design from your first clone
Practise
Keep handy
Also worth your time
A clear, free chapter on how the loop your engine runs actually works