Core Concepts

The Runtime Spawner Package (com.pixelwizards.runtimespawner)

Core Concepts

The Runtime Spawner system is built from a small number of simple components that you can combine in different ways to create encounters, waves, or dynamic difficulty. This section explains the core building blocks and how they relate to each other.

1. Runtime Spawner

The Runtime Spawner is the central component. It is responsible for:

  • Tracking active spawns.

  • Respecting global caps (alive limits, spawn windows).

  • Executing spawns via locators (where) and executors (how).

  • Managing waves, delays, and cooldowns.

Think of it as the engine — it does the actual spawning work, but relies on other components to decide when and what to spawn.

2. Spawn Entries

Spawn Entries define what the spawner can create. Each entry includes:

  • A prefab reference.

  • Weighting for probability.

  • An optional spawn tag (used by rules or placement filters).

Entries are grouped into Waves or referenced by Rules in a profile.

3. Waves & Looping

A Wave is a collection of spawn entries with timing and repetition controls.

  • Spawn count min/max.

  • Delay between spawns.

  • Wave interval.

  • Looping mode:

    • Duration: repeat this wave for a set number of seconds.

    • Max Loops: repeat this wave a fixed number of times.

    • Until Signal: repeat until explicitly told to stop.

This makes it possible to design encounters that sustain pressure for a while before moving on, rather than always firing once and ending.

4. Spawn Director

The Spawn Director drives progression across multiple waves or encounter phases. It references an Intensity Profile to decide pacing, difficulty, and global limits.

At runtime the Director:

  • Selects the active step in the profile.

  • Applies step settings to the spawner (alive caps, spawn multipliers, etc.).

  • Can automatically advance steps based on time, or manually via code/events.

This gives you a simple way to implement escalating difficulty without scripting.

5. Intensity Profiles

An Intensity Profile is a ScriptableObject that defines a ladder of steps. Each step can configure:

  • Concurrent alive cap.

  • Global spawn window (min/max).

  • Spawn rate multiplier.

  • Wave rate multiplier.

Profiles let you design difficulty curves outside of the scene — reusable, tweakable, and sharable across multiple spawners.

6. Special Encounters

Special Encounters are rule-based conditional spawns that can happen alongside normal waves. They are managed by a Special Encounter Manager, which references a Special Profile.

Each Special Rule defines:

  • What to spawn.

  • Caps & cooldowns (e.g., only 1 alive at a time, 90s cooldown).

  • Step ranges (only valid at certain intensity steps).

  • Player/pressure gates (e.g., average HP, global pressure level).

  • Placement constraints (min/max distance, require no line-of-sight).

  • Optional spawn tags to select specific spawn zones.

This allows for “boss-like” behavior, flankers, or situational units that add variety to encounters without scripting.

7. Profiles

Both Intensity Profiles and Special Profiles are Scriptable Objects. This means:

  • They can be created and reused across scenes.

  • Designers can tune values in one place and see changes applied everywhere.

  • They keep scene hierarchies lightweight — most logic lives in assets, not GameObjects.

8. Extensibility

The system is designed to be extensible:

  • Replace the Spawn Locator to change how positions are chosen.

  • Replace the Spawn Executor to change how spawns are instantiated.

  • Add your own rules or signals to integrate with other systems (AI director, narrative events, etc.).

Putting It Together

  • A Runtime Spawner executes spawns.

  • Waves define repeatable chunks of spawns.

  • A Spawn Director with an Intensity Profile escalates difficulty over time.

  • A Special Encounter Manager with a Special Profile injects boss-like or situational spawns.

The Object Pool Package (com.pixelwizards.objectpool)

The Object Pool package has no editor-facing functionality itself, but implements a clean interface for creating and managing reusable pools of objects for your games.

You can find the API documentation for the Object Pool package online here:

https://www.megacrush.app/api/object-pool/

Last updated