Godot game loop waves

From nix-community/nur-combined · View interactive version

Godot game loop waves is an AI agent skill from the GitHub repository nix-community/nur-combined. Expert patterns for managing combat waves, difficulty scaling, and automated enemy spawning in Godot 4. Use when building wave-based shooters, tower defense, or arena games.

How to use this skill

Skill file

Wave Loop: Combat Pacing

[!NOTE]

Resource Context: This module provides expert patterns for Wave Loops. Accessed via Godot Master.

Architectural Thinking: The "Wave-State" Pattern

A Master implementation treats waves as Data-Driven Transitions. Instead of hardcoding spawn counts, use a WaveResource to define "Encounters" that the WaveManager processes sequentially.

Core Responsibilities

Expert Code Patterns

1. The Async Wave Trigger

Use await and timers to handle pacing without cluttering the _process loop.

# wave_manager.gd snippet
func start_next_wave():
    # Delay for juice/prep
    await get_tree().create_timer(pre_delay).timeout 
    wave_started.emit()
    _spawn_logic()

2. Composition-Based Spawning

Manage enemy variety using a Dictionary-based composition strategy in your WaveResource.

# wave_resource.gd
@export var compositions: Dictionary = {
    "Res://Enemies/Goblin.tscn": 10,
    "Res://Enemies/Orc.tscn": 2
}

Master Decision Matrix: Progression

| Pattern | Best For | Logic |

| :--- | :--- | :--- |

| Linear | Story missions | Hand-crafted list of WaveResource. |

| Endless | Survival modes | Code-generated WaveResource with multiplier math. |

| Triggered | RPG Encounters | Wave starts only when player enters an Area3D. |

NEVER Do


Available Scripts

MANDATORY: Read the appropriate script before implementing the corresponding pattern.

[wave_loop_patterns.gd](scripts/wave_loop_patterns.gd)

10 Expert patterns: MultiMesh swarms, async pathfinding, background preloading, and server-side physics mobs.

[wave_manager.gd](scripts/wave_manager.gd)

Orchestrates the timeline, delays between waves, and tracks "Victory" conditions.

[wave_resource.gd](scripts/wave_resource.gd)

Data containers for wave compositions and difficulty settings.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.