Back to Prompts
Coding Assistant

Create a Basic Game Loop

Start here when building any new game From the Game Loop AI Coding Building Block.

Prompt
Create a basic game loop for my [language/framework, e.g., Python/Pygame, JavaScript/Canvas, C++/SDL].

I need the loop to:
1. Track time between frames (delta time)
2. Process player input
3. Update game state (positions, physics, AI)
4. Render everything to screen
5. Cap frame rate to [target FPS, e.g., 60]

Include:
- A simple moving object that uses delta time for consistent speed
- Basic structure I can expand later
- Comments explaining each section

I'm learning game development, so explain why we need delta time and how it makes the game run the same on fast and slow computers.
1 views 0 copies