The best AI for GDScript: what good output looks like

2 min read

By Eduardo Orellana ·

You do not need to write GDScript to judge AI-written GDScript. A handful of patterns tell you whether a model knows modern Godot or is guessing from old tutorials. Here are the ones to look for.

Leer en español

Typed variables

For the full roundup, with a price and a verdict on every AI tool for Godot, read the best AI tools for Godot.

Good Godot 4 code often uses static types: var speed: float = 200.0, func jump() -> void. Types catch mistakes early and make the editor's autocomplete work.

A model that never writes types is not wrong, but one that writes them consistently usually knows the language well.

@export and @onready

Values you want to tune in the editor should be marked @export. Nodes fetched when the scene loads use @onready var sprite = $Sprite2D.

Old Godot 3 code writes export var and onready var without the @ sign. Seeing that is the quickest sign the model is out of date.

Signals as objects, and await

Godot 4 treats signals as objects: body_entered.connect(_on_body_entered), and you emit them with died.emit(). Waiting uses await get_tree().create_timer(1.0).timeout.

Godot 3 used connect("body_entered", self, "_on_body_entered") and yield. Both still appear in model output, and both fail in Godot 4.

The physics body names

CharacterBody2D and CharacterBody3D replaced KinematicBody. move_and_slide() now takes no arguments and uses the body's velocity property.

If an AI writes move_and_slide(velocity, Vector2.UP), it is writing Godot 3.

How to get better GDScript from any model

Say "Godot 4.x, GDScript" in the first message, with your exact version. Paste the full error from the output panel when something breaks. Ask for one script at a time.

If it keeps writing old syntax, paste a correct example of your own project's style and ask it to match. Models copy what is in front of them better than they recall.

A short example of each era

Godot 3: export var speed = 200, then move_and_slide(velocity, Vector2.UP) inside a KinematicBody2D script. Godot 4: @export var speed: float = 200.0, set velocity, then move_and_slide() in a CharacterBody2D script.

If you paste both into a chat and ask which is Godot 4, a good model answers instantly and explains the difference. That is another quick test of whether it knows the engine.

If you would rather not read GDScript at all

The Flockbay app writes GDScript for you into a Godot 4.7.2 project, from plain-language requests, after you approve a brief. You can open every script in the project folder, and never have to.

Flockbay

The free AI game maker for Mac or Windows PC.