Topics / Building a game

Core concepts

Game loop and tick

The game loop is the heartbeat: many times a second the game reads input, updates the world, then draws it. One pass is a tick or a frame.

Watch: see it in 30 seconds

Video coming soon
A 30-second visual explanation

Why it matters for your game

  • Everything that moves or changes is code that runs every tick. 'Add a day-night cycle' means 'every tick, advance the clock a little and tint the scene'.
  • Update and draw are separate steps. A thing can exist and move without being drawn, and be drawn without moving.
  • Work that is too slow for one tick (loading, pathfinding across the whole map) has to be spread out or done in the background, or the game freezes.

How it comes up when you talk to your AI

  • 'Update', 'render', 'tick', 'frame', 'fixed timestep' (physics runs at a steady rate even when drawing stutters).
  • If your AI talks about 'doing it in update' it means every tick; 'on start' means once.

Ask your AI about it

Paste this into the assistant you build with. It is written to get a useful answer for your own project, not a textbook page.

Explain the game loop: input, update, render, and what a tick is. Then explain why a fixed timestep for physics is separate from the drawing rate, in plain language, for a 2D village game in the browser.

Related terms