Godot Game Loop Waves logo

Godot Game Loop Waves

Community
thedivergentai
godot-game-loop-waves

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.

Overview

Publisherthedivergentai
RepositoryGD-Agentic-Skills
Skill namegodot-game-loop-waves
Stars
727
Forks
43
Bundled files
7
LicenseLGPL-3.0
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 7 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by thedivergentai on GitHub. Read the source before you install it.

Installation

Install the Godot Game Loop Waves AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/thedivergentai/GD-Agentic-Skills.git /tmp/GD-Agentic-Skills
mkdir -p .claude/skills
cp -r /tmp/GD-Agentic-Skills/skills/godot-game-loop-waves .claude/skills/godot-game-loop-waves
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Godot Game Loop Waves in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Godot Game Loop Waves on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Godot Game Loop Waves is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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

  • Manager: Orchestrates the timeline. Handles delays between waves and tracks "Victory" conditions (all enemies dead).
  • Spawner: Decoupled nodes that provide spatial context for where enemies appear (wave_spawner.gd / wave_weighted_spawner.gd).
  • Resource: Immutable data containers that allow designers to rebalance the game without touching code.

Density Decision Tree (pick scale before coding)

Live densityApproachMANDATORY loads
Under ~80 SceneTree enemiesNode manager + Marker spawnerswave_manager.gd, wave_spawner.gd, wave_resource.gd
Swarm visuals / hundredsMultiMesh + weighted compositionwave_loop_patterns.gd (MultiMesh / async path), wave_weighted_spawner.gd
~10k bodiesPhysicsServer / NavigationServer RIDs (no per-mob Node)wave_loop_patterns.gd server-RID patterns; do not scale wave_manager node spawns

wave_manager.gd is the SceneTree golden path (deferred add_child, group/signal clear counts, optional pool). Treat it as prototype→mid-scale — for RID swarms, follow wave_loop_patterns.gd instead of instantiating thousands of nodes.

Composition Golden Path

  1. Author a wave_resource.gd composition table.
  2. Place wave_spawner.gd Markers (or wave_weighted_spawner.gd when variety weights matter).
  3. Point wave_manager.gd spawner at that Marker; manager defers spawn and clears via &"enemies" group + signals.
  4. When weights replace fixed counts, call WaveWeightedSpawner.spawn_enemy() from the composition loop (or set manager spawner to the weighted node).

Expert Code Patterns

1. The Async Wave Trigger

Use await timers in wave_manager.gdMANDATORY read before writing a custom timeline. Spawns use call_deferred(&"add_child", …); clear via signals/groups (not get_children() scans).

2. Composition-Based Spawning

Define variety in wave_resource.gd; place units with wave_spawner.gd / wave_weighted_spawner.gd. Do not hardcode scene paths in the manager.

Master Decision Matrix: Progression

PatternBest ForLogic
LinearStory missionsHand-crafted list of WaveResource.
EndlessSurvival modesCode-generated WaveResource with multiplier math.
TriggeredRPG EncountersWave starts only when player enters an Area3D.

NEVER Do

  • NEVER iterate through get_children() to find all enemies — This is extremely slow. Always add enemies to an "enemies" group and use get_tree().get_nodes_in_group(&"enemies") for efficient access.
  • NEVER constantly instantiate() and queue_free() hundreds of enemies — This causes garbage collection stutters. Use an object pool to reuse existing enemy instances.
  • NEVER spawn thousands of separate MeshInstance3D nodes for swarms — This will tank your draw calls. Use MultiMeshInstance3D to batch thousands of meshes into a single GPU call.
  • NEVER calculate pathfinding for hundreds of agents on the main thread — This will freeze your game. Enable use_async_iterations on your navigation regions or use NavigationServer3D.query_path().
  • NEVER forget to check is_inside_tree() before adding a child — If the spawner is queued for deletion, adding a child will crash. Always verify the spawner is still active in the tree.
  • NEVER assign a preloaded resource (like stats.tres) directly to spawned mobs — They will all share the exact same health/stats. Always call base_stats.duplicate_deep() to give each mob its own unique data.
  • NEVER use standard strings for high-frequency group calls — Always use StringName (&"enemies", &"take_damage") for optimal hash performance and to avoid unnecessary string allocations.
  • NEVER spawn entities directly inside physics callbacks synchronously — Instantiating nodes during physics steps can corrupt the physics state. Always use call_deferred(&"add_child", enemy).
  • NEVER leave CollisionShapes on dead enemies active — Corpses will block towers and navigation. Use set_deferred("disabled", true) immediately upon death.
  • NEVER synchronize complex Object types via MultiplayerSynchronizer — It only supports primitive types. For complex data, sync a UID or ID and look up the data locally on the client.
  • NEVER auto-start waves without player feedback — Always provide a UI countdown, a visual "Wave Incoming" effect, or a start button to maintain player agency.
  • NEVER hardcode spawn positions at (0,0,0) — Use Marker3D nodes in the editor so you can visually adjust spawn points without digging into code.
  • NEVER check wave completion by counting children every frame — It's too expensive. Maintain a local counter or use a signal-based system to track active enemy counts.
  • NEVER use the same navigation map for every entity type — If you have flying and walking enemies, use separate navigation maps to prevent pathing issues.
  • NEVER scale collision shapes non-uniformly for spawners — This breaks the collision detection math. Adjust the shape resource properties instead.

Available Scripts

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

wave_loop_patterns.gd

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

wave_manager.gd

Orchestrates the timeline, delays between waves, and tracks clear via group counts + signals. Uses call_deferred add_child; optional pool via use_pool / recycle_enemy.

wave_resource.gd

Data containers for wave compositions and difficulty settings.

wave_spawner.gd

Marker3D spatial portal — get_spawn_position() with optional radius jitter. Wire as WaveManager.spawner.

wave_weighted_spawner.gd

Weighted random enemy selection at a Marker. Use when composition variety is probability-driven rather than fixed counts.


Expert Wave Patterns

1. Occlusion Culling for Swarms

To optimize performance with hundreds of enemies, enable Occlusion Culling.

  • Setup: Add an OccluderInstance3D to your arena and bake it.
  • Result: Enemies completely hidden behind walls/pillars won't be processed by the GPU, significantly boosting FPS.

2. Wave UI Architecture

Decouple your wave data from the UI using a CanvasLayer and signals.

  • Wave Counter: Display current/total waves.
  • Health Bars: Use a TextureProgressBar on a CanvasLayer for bosses, or Sprite3D with a viewport texture for individual enemy health bars.

Expert knowledge (on demand)

LLM-ignorance rule: If a general agent would not know it before reading, load the reference — never delete expert deltas.

Reference

Progressive disclosure: open Official Documentation links only when researching a specific API; load Related Skills when routing to a peer domain — do not preload the whole lattice.

Official Documentation

  • ResourcesWaveResource compositions and delays stay designer-editable without hardcoding spawn tables in managers.
  • Nodes and scene instancesPackedScene.instantiate() plus add_child / call_deferred is the safe spawn path for wave enemies.
  • Groups — track live mobs with StringName groups and get_node_count_in_group instead of scanning children every frame.
  • Idle and Physics Processing — keep pacing on timers/await; never instantiate mid-physics callback without deferring.
  • SceneTreeTimer — pre-wave delays and spawn-rate gaps via create_timer without a forever _process countdown.
  • Using signalswave_started / wave_cleared / all_waves_complete decouple UI, audio, and combat from the manager timeline.
  • Background loadingResourceLoader.load_threaded_request bosses/heavy waves so first spawn does not hitch.
  • Random number generation — weighted composition and spawn jitter with RandomNumberGenerator.rand_weighted.
  • Using MultiMesh — batch swarm visuals when hundreds of minions would explode draw calls.
  • Occlusion culling — hide off-camera arena mobs so dense waves stay GPU-affordable.
  • Navigation introduction (3D) — async agent paths and separate maps for flying vs walking wave units.
  • Using Servers — PhysicsServer3D/NavigationServer3D RID swarms when SceneTree nodes cannot scale.

Related Skills

Prerequisites
Complements
Downstream / consumers
Master
  • godot-master — library router and mirrored module entry for cross-skill discovery.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Godot Game Loop Waves AI skill do?

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.

Why use Godot Game Loop Waves on TypingMind?

Because you install it once and use it with any model. Godot Game Loop Waves is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Godot Game Loop Waves in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/thedivergentai/GD-Agentic-Skills/tree/main/skills/godot-game-loop-waves. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Godot Game Loop Waves?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Godot Game Loop Waves?

As many as you like. As long as a model supports skills, you can use Godot Game Loop Waves with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Godot Game Loop Waves AI skill free?

Yes. It is published on GitHub by thedivergentai under the LGPL-3.0 license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇