This article lets your agent write a game for you. Give this article (there's a one-click copy button at the top right of the page, which includes the prompts and links) directly to an agent like Claude Code or Codex, and it will know how to use Godot to write a playable game step by step: how to set up the project, how to write it, how to run commands to check for errors on its own, and how to make changes one at a time based on what you say. You don't need to know code. Just say what you want, press F5 to play, and tell it what's wrong.
What you'll get
Using the free game engine Godot together with an AI agent (Claude Code, Codex, etc.), you'll make your first small game: a square dodges falling obstacles on the screen, with scoring and restart.
No programming experience needed. The agent writes the code. You handle three things: explain what you want, press run, and tell it what's wrong.
This tutorial only covers a very simple 2D game. The goal is to take you through the full flow from idea to playable. Complex games come later.
Some terms to know first
- Godot: a free, open-source (MIT license) game engine. No account registration needed. You can think of it as "the software for making games."
- GDScript: Godot's built-in programming language. Its syntax is close to Python, and agents know it well.
- Project: a folder containing a file called
project.godot. Godot uses it to recognize that this is a game. - Scene: one "screen" of the game. Scene files have the
.tscnextension.
Step 1: Install Godot (5 minutes)
- Open the official site godotengine.org/download and download the version for your operating system.
- Choose the standard version, not the one with ".NET" or "C#". For beginners, GDScript is enough, and agents write it more reliably.
- The download is a zip archive. Unzip it and you can run it directly, no installation needed.
As of when this tutorial was written, the latest official stable version is 4.7.2. Any version number starting with 4 is fine. Don't download 3.x, which is an older version with different syntax.
You can also install it from the command line: on Mac, use brew install godot; on Windows, use scoop install godot (you need to install Scoop first). This puts Godot directly in the command line, which makes it easier later when you ask the agent to check errors for you.
Step 2: Create an empty project
- Open Godot. You'll see the project manager. Click New Project.
- Give it a name, such as
my-first-game, and choose an empty folder to put it in. - Keep the other options at their defaults and click create.
Now a project.godot file will appear in the folder. Don't rush to click around in Godot yet. Hand the next part over to the agent.
Step 3: Have the agent write the game
Open a terminal, go into the project folder you just created, and start Claude Code (or whichever agent you use):
cd your-project-folder-path
claude
Then send it the following message:
Sign in to unlock this key section
New accounts get 10 free credits, plus 1 more for each daily check-in. Spend 1 credit to unlock and it stays open for you.
It will create main.tscn and main.gd, and update project.godot.
Why it's set up this way: Without image assets, the agent won't fail because files are missing. Putting everything in one script makes it easy for you to look at and change later.
Step 4: Run the game
- Go back to the Godot project manager. If your project isn't in the list, click Import and select the
project.godotfile in the project folder. - Open the project and enter the editor.
- Press F5 (or click the "Run Project" play button in the top right). The game window will pop up, and you can play with the arrow keys.
If Godot says some files were modified on disk, choose Reload. The files were changed by the agent, not by you in Godot.
Step 5: Have the agent check for errors itself
Code written by the agent sometimes has syntax errors. You don't need to read through it yourself. Have it run a check:
Use the command line to check whether this project has any errors:
godot --headless --path . --quit-after 120
Read the errors in the output, and if there are any, fix them.
This command runs the game without opening a window, for 120 frames, and then quits. Any errors are printed in the terminal. (If it says godot can't be found, that means it isn't on the command line path. Ask the agent to use the full path to the Godot program you unzipped instead.)
Step 6: Make changes one at a time
Once the game runs, tell the agent in plain language what's wrong or what you want:
- "The red squares fall too fast. Slow them down a bit."
- "Add another kind of green square. Collecting it adds 5 points."
- "Show the all-time high score after the game ends."
- "I want 3 lives. Each hit costs one life."
A few habits that will save you trouble:
- Change one thing at a time. After each change, run the game to make sure nothing broke before moving on to the next.
- If there's an error, copy the exact error text to the agent. Don't summarize it yourself. The "Output" and "Debugger" panels at the bottom of Godot show error messages.
- Save a snapshot every time the game works. Ask the agent to run
git initand commit once. If something breaks, you can roll back instead of starting over.
Step 7: What to learn next
- Follow the official tutorial. The Godot official documentation has a complete 2D beginner tutorial, "Dodge the Creeps!", which is very similar to the game we just made. Reading it will help you understand what the agent wrote. The official docs say it assumes some programming experience. Pure beginners can read the scripting basics section first, or ask the agent questions as they read.
- Add assets. If you want to replace the colored blocks with real images and sounds, first find free assets that allow commercial use, then ask the agent how to import them.
- Try MCP tools. The community has MCP tools that let an agent control the Godot editor directly, such as godot-mcp, which can launch the editor and run projects. You don't need them at first. Try them after you're comfortable with the basic workflow.
FAQ
- The code the agent wrote is full of red error messages. The most common cause is that it used the old Godot 3 syntax. Reply with "Please use only Godot 4 GDScript syntax," and paste the exact error text.
- The window flashes and disappears. Most likely there's an error in the script. Follow Step 5 and have the agent check from the command line.
- Pressing F5 says there's no main scene. The main scene isn't set correctly in
project.godot. Ask the agent to check therun/main_sceneentry. - Want to use C#? Hold off. Beginners should use GDScript, which the official docs also recommend as the starting language.
Notes
- The agent will modify files in your project. So it's best to work in a dedicated empty folder, not next to important files.
- Download Godot from the official source. Only download from godotengine.org or the official GitHub. Don't use "cracked" versions or bundles from unknown sources.
- Don't expect a masterpiece from one sentence. A small game can be built quickly, but making it fun takes repeated playtesting and adjustment on your part.


Comments (0)
No comments yet. Start the conversation.