Before you touch GDScript, you need the mental model. Godot is aggressively componential, and almost every confusion newcomers have comes from trying to impose patterns from other engines (or worse, from MVC web frameworks). Ten minutes of model correction here saves ten hours of "why isn't this working" later.
| Concept | What it is | SWE analogue |
|---|---|---|
Node | A unit of behavior. Has a name, a parent, children, and a type. | Component. Or a React element. Or an Actor. |
Scene | A reusable tree of nodes, saved as a .tscn file. | A reusable component bundle. A prefab. Think "React component definition saved to disk." |
SceneTree | The live, running hierarchy of all instantiated nodes in the game. | The DOM. Actually yes โ Godot even has get_node("Player/Hand/Card") which is basically querySelector. |
Everything in a Godot game is a node. A sprite is a node (Sprite2D). A camera is a node (Camera2D). A text label is a node (Label). A physics body is a node (CharacterBody2D). A timer is a node (Timer). Scripts attach to nodes.
There are hundreds of built-in node types. You compose them into trees:
Card (Node2D)
โโโ Background (Sprite2D)
โโโ LetterLabel (Label)
โโโ ValueLabel (Label)
โโโ TouchArea (Area2D)
โโโ CollisionShape (CollisionShape2D)
That's a card. Five nodes. No new classes required โ you configured existing types and saved the tree as Card.tscn.
A scene is a serialized subtree. When you save Card.tscn, you can instance it anywhere โ load it by filename, stamp out copies, place them in a Hand node. Each instance is independent. Modifying one doesn't affect the others. Modifying the .tscn file does affect all future instances (and, if they inherit, existing ones).
This is where Godot diverges sharply from code-first engines. You don't instantiate scenes in code except when strictly dynamic. For static hierarchies, you drag a scene into another scene in the editor, and the editor serializes the composition. The editor is the composition tool; code is behavior.
When the game runs, Godot maintains a single SceneTree. The root is typically a Window with your main scene hanging off it. Everything you can see or tick is somewhere in that tree.
Every frame, Godot walks the tree and calls two methods on every node that defines them:
func _process(delta: float) -> void:
# Called every rendered frame. delta = seconds since last frame.
pass
func _physics_process(delta: float) -> void:
# Called on a fixed physics tick (default 60Hz). Use this for movement.
pass
There's also _ready() (fires once when the node enters the tree), _input(event) (fires on input events), and a few others. These are hook methods โ you override them in your script to inject behavior.
useEffect(() => {...}, []) and useEffect(() => {...}), you've written _ready and _process. Same idea: lifecycle hooks on a tree node.A Godot project is a folder with a project.godot file. It has exactly one main scene โ the one that loads when you hit Play. Everything else is instanced from or navigated to from there.
You'll set this up in the next exercise. For now, understand: one project, one main scene, many scenes instanced inside it.
| Term | What it means |
|---|---|
| Instance | An in-memory copy of a scene placed into the tree. |
| Instantiate | Verb. The act of creating an instance, usually via PackedScene.instantiate(). |
| Script | A .gd file attached to a node. Adds behavior. Always extends a node type. |
| Root | The topmost node in a scene. Also the topmost node in the SceneTree. |
| Owner | Which scene a node belongs to. Matters when you save or instance. |
| PackedScene | A scene loaded but not yet instanced. The "class" form of a scene. |
| Autoload | A scene or script that lives at the SceneTree root, globally. Godot's singleton pattern. |
You will spend most of your time in the Godot editor: dragging nodes, tweaking inspector values, attaching scripts. That's normal and healthy. But under the hood, every editor action is serializing data into .tscn and .tres files (both are INI-like text formats, which means they diff well in git). When things break or get weird, open the scene file in a text editor โ it's readable.
# Example of what a Card.tscn looks like on disk:
[gd_scene load_steps=2 format=3]
[ext_resource type="Script" path="res://scripts/card.gd" id="1"]
[node name="Card" type="Node2D"]
script = ExtResource("1")
[node name="Background" type="Sprite2D" parent="."]
position = Vector2(0, 0)
lexicon-duel and save it somewhere you'll remember.That's the mental model. Next up: GDScript.