If you already use VS Code every day, learning Godot does not have to mean adopting a separate coding workflow. A smoother setup is: Godot handles scenes and nodes, VS Code handles GDScript, and the Codex extension helps analyze the project, generate scripts, debug errors, and make small refactors.
This approach does not ask AI to generate a complete game on day one. A steadier method is to build the real node tree in Godot first, then let Codex write scripts around the actual scene structure. That gives it the project layout and reduces wrong guesses about node names and paths.
Recommended split
For VS Code users, the cleanest split is:
- Godot: create scenes, nodes, collision shapes, animations, and UI layout.
- VS Code: write and manage GDScript.
- Codex: analyze the project, generate scripts, debug errors, and make small scoped refactors.
- Git: commit after each runnable feature.
In other words, Godot remains the main project editor, VS Code becomes the code workspace, and Codex acts as a collaborative coding assistant.
Install VS Code extensions
Install two extensions in VS Code:
- Codex
The official OpenAI extension can read, modify, and run files in the current project. Sign in with your ChatGPT account.
- godot-tools
This extension is built for Godot GDScript development. It provides syntax highlighting, completion, go-to-definition, LSP diagnostics, and the ability to launch and debug Godot from VS Code.
Do not rely only on a basic GDScript highlighting extension. Prefer godot-tools.
Make Godot open VS Code
In Godot, open:
|
|
Enable:
|
|
On Windows, the executable path should point to code.cmd. You can check it in a terminal:
|
|
A common result looks like this:
|
|
Set the execution arguments to:
|
|
Godot 4.5 and later can usually detect these arguments automatically, but filling them in manually is fine.
Then open:
|
|
Enable automatic reload after scripts are modified externally. After that, double-clicking a script in Godot should jump to the matching file and line in VS Code.
Open the project root in VS Code
Do not open only the scripts folder. VS Code should open the project root that contains project.godot.
Recommended structure:
|
|
Open it like this:
|
|
Then open the same project in Godot.
Godot’s language server usually expects the project to be open in the Godot editor. The default LSP port is 6005, and the DAP debug port is 6006. During normal development, keep Godot open and let VS Code handle code editing.
Configure VS Code debugging
Create this file in the project:
|
|
Add:
|
|
You can then press F5 in VS Code to launch and debug the game.
If F5 cannot find Godot, search VS Code settings for:
|
|
Set it to your Godot executable path, for example:
|
|
godot-tools supports this setting for the Godot 4 editor path.
Create AGENTS.md
Create AGENTS.md in the project root. Treat it as the project rulebook that Codex reads before making changes.
|
|
This file is valuable because it defines project boundaries for Codex. It lowers the chance that Codex rewrites scenes, changes architecture, or uses outdated Godot APIs.
Initialize Git first
Run this in the VS Code terminal:
|
|
Create .gitignore:
|
|
Make the first commit:
|
|
Before letting Codex modify the project, create a Git checkpoint. It makes experiments much easier to roll back.
Make the first project 2D
Even if you know VS Code well, the first Godot project should still start with 2D. Do not begin with a large 3D project, complex UI, or a full RPG system.
A good practice project is:
|
|
Minimal features:
- Player movement
- Mouse aiming
- Bullet firing
- Enemy chasing
- Collision damage
- Score
- Restart
Recommended directory:
|
|
First prompt for Codex
In the VS Code Codex panel, do not ask Codex to write code immediately. First ask it to read the project, split the work, and confirm the boundaries.
Use a prompt like this:
|
|
After Codex finishes the analysis, ask it to do only the first feature: player movement.
|
|
The key is to do only one feature at a time. The earlier you limit the scope, the easier Codex changes are to verify.
Recommended development loop
Build one feature at a time:
|
|
For debugging, use this prompt:
|
|
Do not only say “it errored.” Give Codex the full error, scene structure, and relevant script paths so it can locate the issue.
Codex permission advice
When you first use the Codex extension, start with normal Agent mode.
Do not leave Agent Full Access enabled from the beginning. Normal Agent mode can already read files, modify the project, and run approved commands. Full Access is better used temporarily after you understand the task boundary.
A good starting stack is:
- Godot 4.x
- GDScript
- VS Code
- godot-tools
- Codex
- Git
You do not need to learn C# first, and you do not need Codex to generate an entire scene automatically. Build the node tree in Godot first, then let Codex write scripts around the real node structure. That gives you the highest success rate.