See all glossary terms

Main Loop

In traditional game programming, the "Game Loop" is a function that runs continuously, updating the game state and rendering the game world. It's the heart of the game.
Here's a pseudo main loop in a fake language that looks like gdscript:
while true:
  process_inputs()
  update_physics()
  update_game()
  render_game()
In all modern engines, and Godot as well, you don't have to write the main loop by hand; it is handled behind the scenes for you. Nonetheless, the core structure of any game engine remains similar to the above; some core function runs as many times a second as it can, and calls other functions to update the game's physics, logic, and rendering.