PluginBench
Skill
Pass
Audit score 90

godot-signals-groups

gamedev-skills/awesome-gamedev-agent-skills

Decouple Godot 4.x gameplay with signals and node groups instead of hard-coded references.

What is godot-signals-groups?

Build event-driven architecture in Godot 4.7 using signals (custom events emitted and connected with Callables) and groups (broadcast to many nodes at once). Use this when wiring node communication, replacing tight coupling with the observer pattern, or porting Godot 3.x signal code.

  • Declare and emit typed custom signals on nodes to notify listeners of events without holding direct references
  • Connect signals with Callables, including one-shot connections and bind() to pass extra arguments
  • Broadcast method calls to all nodes in a named group using call_group() or iterate with get_nodes_in_group()
  • Await signals inline to pause execution until an event fires (e.g., animation_finished)
  • Guard against duplicate connections and manage disconnection before freeing long-lived listeners

How to install godot-signals-groups

npx skills add https://github.com/gamedev-skills/awesome-gamedev-agent-skills --skill godot-signals-groups
Prerequisites
  • Godot 4.7 installed
  • Basic familiarity with GDScript syntax and node structure (see godot-gdscript and godot-nodes-scenes)
Claude Code
Cursor
Windsurf
Cline

How to use godot-signals-groups

  1. 1.Declare a typed signal on the emitter node (e.g., signal collected(value: int))
  2. 2.Emit the signal when the event occurs (e.g., collected.emit(10))
  3. 3.In the listener node, connect the signal with a Callable in _ready() (e.g., coin.collected.connect(_on_coin_collected))
  4. 4.Optionally use CONNECT_ONE_SHOT flag for fire-once behavior or bind() to append extra arguments
  5. 5.For broadcast, add nodes to a group via code (add_to_group("enemies")) or the editor, then call get_tree().call_group("enemies", "method_name", args)

Use cases

Good for
  • Emit a signal when a coin is collected and have the parent level connect to update the score without the coin knowing about game state
  • Pause all enemies at once by calling a method on every node in the 'enemies' group
  • Connect a door's opened signal with one-shot flag so a handler fires exactly once then auto-disconnects
  • Await an animation_finished signal to pause execution and spawn loot only after the animation completes
  • Port Godot 3.x connect("died", self, "_on_died") code to the new 4.x Callable syntax
Who it's for
  • Godot 4.x game developers building event-driven gameplay
  • Developers porting Godot 3.x projects to 4.x signal syntax
  • Level designers and programmers wiring communication between scenes and subsystems

godot-signals-groups FAQ

How do I convert Godot 3.x connect() calls to 4.x?

Replace connect("signal_name", self, "_method") with signal_name.connect(_method). The target is now implied by the Callable, and the string-based method name form no longer works.

Why are my signal handlers firing multiple times?

You likely connected the same signal multiple times without checking. Guard with if not sig.is_connected(cb): sig.connect(cb) to avoid duplicate connections.

What's the difference between signals and groups?

Signals are one-to-many event notifications with typed arguments; groups are a way to address many nodes by category and call methods on them all at once. Use signals for events, groups for bulk operations.

Can I await a signal with a timeout?

Yes, use await signal.or_timeout(seconds) to pause until the signal fires or the timeout expires. See references/signal-patterns.md for details.

Do I need to disconnect signals when a node is freed?

Godot auto-disconnects when the connected object (the listener) is freed, but you should manually disconnect long-lived listeners before freeing them to avoid stale references.

Full instructions (SKILL.md)

Source of truth, from gamedev-skills/awesome-gamedev-agent-skills.


name: godot-signals-groups description: > Build event-driven, decoupled Godot 4.7 gameplay with signals and node groups: declare and emit custom signals, connect with Callables (incl. bind/one-shot), and broadcast to many nodes via groups and call_group. Use when wiring node communication in a Godot project, replacing tight references with signals, emitting/connecting events, or porting 3.x connect("sig", self, "method") code.

Godot Signals & Groups (4.x)

Decouple nodes with the observer pattern (signals) and act on many nodes at once (groups), instead of hard-coding references between scenes. Targets Godot 4.7.

When to use

  • Use when a node needs to tell others "something happened" (player died, item picked up, wave cleared) without holding direct references to them.
  • Use when you need to address a whole category of nodes at once ("pause all enemies", "save every checkpoint").

When not to use: raw signal syntax basics → godot-gdscript; scene structure and instancing → godot-nodes-scenes. For cross-scene global events, emit from an autoload (see godot-nodes-scenes).

Core workflow

  1. Decide the direction. A child/sub-scene should emit a signal upward; the parent connects to it. This keeps the child reusable and ignorant of who listens.
  2. Declare typed signals on the emitter; emit() them when the event occurs.
  3. Connect with a Callable (sig.connect(_on_sig)), optionally in the editor's Node dock. Use CONNECT_ONE_SHOT for fire-once, bind() to pass extra context.
  4. Use groups for broadcast: add nodes to a named group, then iterate get_tree().get_nodes_in_group(...) or call_group(...).
  5. Disconnect when needed (e.g. before freeing a long-lived listener) and check is_connected() to avoid duplicate connections.

Patterns

1. Emit upward, connect from the parent

# coin.gd (reusable pickup — knows nothing about the player or HUD)
extends Area2D
signal collected(value: int)

func _on_body_entered(body: Node) -> void:
    if body.is_in_group("player"):
        collected.emit(10)
        queue_free()
# level.gd (the parent wires the coin to game state)
func _ready() -> void:
    for coin in get_tree().get_nodes_in_group("coins"):
        coin.collected.connect(_on_coin_collected)

func _on_coin_collected(value: int) -> void:
    GameState.add_score(value)

2. Connect flags: one-shot and bind extra arguments

func _ready() -> void:
    # Fire exactly once, then auto-disconnect.
    $Door.opened.connect(_on_door_opened, CONNECT_ONE_SHOT)
    # bind() appends arguments supplied at connect time (after the signal's own args).
    $RedButton.pressed.connect(_on_button.bind("red"))

func _on_button(color: String) -> void:
    print("Pressed the %s button" % color)

3. Groups: broadcast to many nodes

func pause_all_enemies() -> void:
    # Call a method on every node in the "enemies" group (no-op if missing).
    get_tree().call_group("enemies", "set_paused", true)

func count_enemies() -> int:
    return get_tree().get_nodes_in_group("enemies").size()

Add a node to a group from code or via the editor's Node > Groups tab:

func _ready() -> void:
    add_to_group("enemies")        # remove_from_group("enemies") to leave

4. Await a signal inline

func open_chest() -> void:
    $AnimationPlayer.play("open")
    await $AnimationPlayer.animation_finished   # pause until it emits
    spawn_loot()

Pitfalls

  • 3.x connect signature is gone. connect("died", self, "_on_died") → died.connect(_on_died). The target is implied by the Callable. The legacy Object.connect("died", Callable(self, "_on_died")) works but the method-name string form does not.
  • Duplicate connections fire handlers multiple times. Connecting again in _ready() after re-adding a node stacks callbacks. Guard with if not sig.is_connected(cb): sig.connect(cb).
  • Connecting to a freed node errors. Disconnect long-lived listeners, or rely on Godot auto-disconnecting when the connected object is freed (it does for nodes).
  • Groups are global to the SceneTree, not per-scene. Two levels using the same group name share membership. Namespace group names if that matters.
  • call_group silently ignores nodes lacking the method. Typos in the method name fail quietly — prefer a typed signal when the contract matters.
  • Signal args must match. Emitting with the wrong arg count/types raises an error; declare typed params and emit exactly those.

References

  • For connection flags, deferred connections, custom signal arguments, awaiting with timeouts, and signals vs. direct calls trade-offs, read references/signal-patterns.md.

Related skills

  • godot-gdscript — signal/await syntax fundamentals.
  • godot-nodes-scenes — autoloads for global event buses.
  • game-ai — state machines that often drive and consume these events.