Main Loop
2025/12/27
- Type
- Learning Resource
- Format
- Glossary Article
- Version
- General
- Subject Tags
- Created
- Updated
- 2026/02/16
- 2025/12/27
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, including Godot, 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 per second as it can, and calls other functions to update the game's physics, logic, and rendering.
Don't stop here. Step-by-step tutorials are fun but they only take you so far.
Try one of our proven study programs to become an independent Gamedev truly capable of realizing the games you’ve always wanted to make.
Get help from peers and pros on GDQuest's Discord server!
20,000 membersJoin ServerThere are multiple ways you can join our effort to create free and open source gamedev resources that are accessible to everyone!
Sponsor this library by learning gamedev with us onGDSchool
Learn MoreImprove and build on assets or suggest edits onGithub
Contributeshare this page and talk about GDQUest onRedditYoutubeTwitter…