ai-behavior-trees-util…
Build a production behavior-tree runtime (Blackboard, action/condition leaves, sequence/selector/parallel composites, decorators) and a Utility AI system…
Structure a Godot 4.7 project with the scene tree and node composition: build reusable scenes, instance PackedScenes at runtime, navigate the tree safely, and register autoload singletons. Use when designing .tscn scenes, deciding how to split nodes, spawning instances with
$ npx -y skills add gamedev-skills/awesome-gamedev-agent-skills --skill godot-nodes-scenes --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/godot-nodes-scenesContext preview
The summary Claude sees to decide when to auto-load this skill.
Structure a Godot 4.7 project with the scene tree and node composition: build reusable scenes, instance PackedScenes at runtime, navigate the tree safely, and register autoload singletons. Use when designing .tscn scenes, deciding how to split nodes, spawning instances with
name: godot-nodes-scenes description: > Structure a Godot 4.7 project with the scene tree and node composition: build reusable scenes, instance PackedScenes at runtime, navigate the tree safely, and register autoload singletons. Use when designing .tscn scenes, deciding how to split nodes, spawning instances with instantiate(), wiring autoloads, or fixing "node not found"/freed-node errors in a Godot project.
Compose games from nodes and scenes, instance them at runtime, and access the tree without crashing on freed or missing nodes. Targets **Godot 4.7**.
instancing a `PackedScene` (bullets, enemies, UI), or setting up autoload singletons.
previously freed instance".
**When _not_ to use:** GDScript language/syntax → `godot-gdscript`; signal-based decoupling → `godot-signals-groups`; physics bodies/collisions → `godot-physics`.
1. **Model with composition.** A scene is a tree of nodes saved as `.tscn`. Build small, single-purpose scenes (Player, Bullet, Enemy) and compose larger scenes from them. Favor adding child nodes over deep inheritance. 2. **Make a scene reusable** by giving its root a script and exposing `@export` config. Save it; it becomes a `PackedScene` you can instance many times. 3. **Instance at runtime** with `preload`/`load` → `scene.instantiate()` → `add_child(instance)`. Set position/state _after_ adding (or before, both work). 4. **Access nodes safely.** Use `@onready var x = $Path` for fixed children; use unique names (`%Name`) for nodes deep in the tree; never assume a node still exists. 5. **Use autoloads for global state/services** (game state, audio, scene switching) — registered in Project Settings > Globals (Autoload), accessible by name everywhere. 6. **Free nodes with `queue_free()`** and guard later access with `is_instance_valid()`.
extends Node2D
const BULLET := preload("res://bullet.tscn") # preload: loaded at compile time
func shoot(at: Vector2, dir: Vector2) -> void:
var bullet := BULLET.instantiate() # create an instance of the scene
bullet.global_position = at
bullet.direction = dir # set exported/public state
add_child(bullet) # now it's in the tree and runs@onready var label: Label = $UI/Label # $ is sugar for get_node("UI/Label")
@onready var health_bar: ProgressBar = %HealthBar # % = scene-unique name (rename-proof)
func update() -> void:
var optional := get_node_or_null("Maybe/Missing") # returns null instead of erroring
if optional:
optional.queue_free()# game_state.gd — add in Project Settings > Globals > Autoload as "GameState".
extends Node
var score := 0
signal score_changed(value: int)
func add_score(points: int) -> void:
score += points
score_changed.emit(score) # any scene can: GameState.score_changed.connect(...)func go_to_level_2() -> void:
# Swaps the current scene for another. Frees the old scene tree.
get_tree().change_scene_to_file("res://levels/level_2.tscn")
# Or, with a preloaded PackedScene:
# get_tree().change_scene_to_packed(LEVEL_2)isn't in the tree yet. Use `@onready`, verify the path matches the scene, or use `get_node_or_null()` for optional nodes.
> Access as Unique Name) so deep references survive renames and reparenting.
`queue_free()` (deletes at end of frame) and check `is_instance_valid(node)`.
runs _after_ it enters the tree — don't expect its `@onready` vars before that.
An autoload can't depend on the main scene existing yet.
time (path must be constant); `load` runs at runtime (path can be a variable).
scene at the end of the current frame. Any code after the call still runs against the _old_ tree, and `get_tree().current_scene` isn't the new scene until next frame. Don't read the new scene's nodes on the same line; do it from the new scene's `_ready()`.
unique names, and node-path edge cases, read `references/tree-and-instancing.md`.
<img src="docs/assets/banner.png" width="820" alt="awesome-gamedev-agent-skills — game-dev skills for AI coding agents.
Repo: gamedev-skills/awesome-gamedev-agent-skills
Build a production behavior-tree runtime (Blackboard, action/condition leaves, sequence/selector/parallel composites, decorators) and a Utility AI system…
Implement game audio practice — bus/mixer architecture and gain in decibels, ducking (sidechain), adaptive/dynamic music via layering and re-sequencing, SFX…
Build game cameras that feel good — 2D follow with a deadzone, look-ahead, smoothing, and level-bounds clamping; 3D third-person orbit with collision and…
Plan, generate, source, normalize, and validate cohesive visual game assets. Use for art direction, style bibles, sprites, tilesets, backgrounds, UI art,…
Build branching dialogue and narrative — a node/choice graph with conditions, variables, and localization hooks — and choose between authoring tools Ink and…
Design NPC and enemy decision-making with finite state machines, behavior trees, steering behaviors, and A* pathfinding — engine-neutral algorithms that pair…