The central code loop responsible for handling the running gameplay. At its most basic state, it accepts input, resolves the actions of entities, and renders the scene.

The game loop is designed to ensure the persistence of action in a game. Unlike many other software applications, games do not stall and wait for input. The world continues to run while the player watches, which importantly allows timing to play a role.

The game loop is responsible for allowing this, by continually rendering the scene without requiring the player's input. A rudimentary game loop might run like the following:

  1. Accept player input if any exists, resolve actions for player as a result of any input
  2. Resolve AI decisions and actions
  3. Determine collisions and resolve their impact
  4. Render the resulting scene

Use this tag when you're asking questions such as the proper structure, optimization and efficiency strategies, or debugging errors in the main game loop code.