Horde & Wave Spawning System

VerifiedSafe

Wave spawning system for Tower Defense and Survival games. Configures waves, enemy types, intervals, and difficulty scaling via ScriptableObjects. Use for timed enemy assaults, Horde Mode, or Boss Waves.

Sby Skills Guide Bot
DevelopmentIntermediate
806/2/2026
Claude Code
#spawner#horde#waves#enemies#tower-defense

Recommended for

Our review

Wave spawning system for Tower Defense and survival games using ScriptableObject configurations.

Strengths

  • Uses ScriptableObjects for designer-friendly configuration without code
  • Clear separation between controller, config, and spawner logic
  • Encourages object pooling for performance
  • Customizable waves with spawn rate and enemy types

Limitations

  • Requires a separate object pooling system implementation
  • Does not handle enemy behavior after spawning
  • No built-in difficulty scaling across waves
When to use it

Use this pattern for any game requiring timed, scripted enemy waves (Tower Defense, Horde Mode).

When not to use it

Avoid if your game does not need structured waves or uses event-based non-timed spawning.

Security analysis

Safe
Quality score92/100

The skill provides game development design patterns with C# code examples. It does not instruct any destructive, exfiltrating, or unsafe operations. The allowed tools (run_command, list_dir, write_to_file) are typical for a coding agent and are not misused in this context.

No concerns found

Examples

Wave Config Data
Create data for a wave. Use a ScriptableObject with fields for enemy prefab, count, and spawn rate.
Spawner Logic
Write a coroutine that spawns a wave of enemies with a configurable delay between each spawn.

name: horde-wave-logic description: "Wave spawning system for Tower Defense and Survival games. Configurable waves, enemy types, intervals, and difficulty scaling." version: 1.0.0 tags: ["spawner", "horde", "waves", "enemies", "tower-defense"] argument-hint: "action='StartWave' config='Wave1' OR spawn='Zombie_Fast'" disable-model-invocation: false user-invocable: true allowed-tools:

  • run_command
  • list_dir
  • write_to_file

Horde & Wave Logic

Overview

Manages the pacing and spawning of enemy units. Uses ScriptableObjects to define wave configurations, allowing designers to tweak difficulty without touching code.

When to Use

  • Use for Tower Defense games
  • Use for "Horde Mode" survival
  • Use for timed enemy assaults
  • Use for testing combat balance
  • Use for creating "Boss Waves"

Architecture

┌─────────────────────────────────────────────────────────────┐
│                    WAVE CONTROLLER                          │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  WAVE CONFIG (Asset)      SPAWNER (MonoBehaviour)           │
│  ┌────────────────┐      ┌───────────────────────────┐      │
│  │ Wave 1:        │      │ State: Waiting/Spawning   │      │
│  │ - 10 Zombies   │─────▶│ Timer: 30s                │      │
│  │ - Rate: 0.5s   │      │ Coroutine: SpawnLoop()    │      │
│  └────────────────┘      └─────────────┬─────────────┘      │
│                                        │                    │
│                                        ▼                    │
│    OBJECT POOL            ┌───────────────────────────┐     │
│  ┌────────────────┐       │ Instantiate / GetFromPool │     │
│  │ Zombie Prefab  │◀──────│ Set Position (SpawnPoint) │     │
│  └────────────────┘       └───────────────────────────┘     │
│                                                             │
└─────────────────────────────────────────────────────────────┘

Best Practices

  • ✅ Use Object Pooling for enemies (Critical for performance).
  • ✅ Define Waves as ScriptableObjects (List of Waves).
  • ✅ Include "Warmup" time between waves.
  • ✅ Support multiple Spawn Points.
  • ✅ Implement "Wave Cleared" logic (Track active enemy count).
  • NEVER Instantiate enemies during the loop without pooling.
  • NEVER use InvokeRepeating (hard to control); use Coroutines.

Few-Shot Examples

Example 1: Wave Config Data

User: "Create data for a wave."

Agent:

[CreateAssetMenu]
public class WaveData : ScriptableObject
{
    public GameObject EnemyPrefab;
    public int Count;
    public float SpawnRate;
}

Example 2: Spawner Logic

User: "Spawn the wave."

Agent:

IEnumerator SpawnWave(WaveData wave)
{
    for (int i = 0; i < wave.Count; i++)
    {
        SpawnEnemy(wave.EnemyPrefab);
        yield return new WaitForSeconds(wave.SpawnRate);
    }
}

Related Skills

  • @object-pooling-system - Required for spawner
  • @unit-population-ai - AI for spawned units
  • @unity-events-messaging - "Wave Start/End" events
Related skills