Special Encounter Manager

Overview

The Special Encounter Manager controls when and how “special” enemies or encounters appear in your game. It evaluates a Special Profile on an interval, checks all rule conditions, and spawns encounters through the active RuntimeSpawner.

Special encounters are designed to:

  • Layer rare, high-impact enemies on top of the baseline population.

  • React dynamically to pacing (steps, pressure, player HP).

  • Use flexible spawn anchors or fallback radial placement.

Inspector Properties

Special Profile

  • A SpecialProfile ScriptableObject containing all rules and global constraints.

  • Inline editing supported directly in the Manager inspector.

Create / Open Profile Buttons

  • Create a new profile asset in your project.

  • Ping/open an existing profile asset for editing.

Telemetry Provider

  • Optional field. Accepts a SpecialsTelemetryProvider ScriptableObject.

  • Supplies dynamic values like Pressure and Average Player HP to rule conditions.

  • If not set, rules that require telemetry will safely fail their conditions (no spawn).

Placement / Line of Sight (Occluder Mask)

  • Defines which layers block line-of-sight when a rule requires Require No LOS.

  • Anchors behind occluders become eligible for spawning.

Runtime Status (Play Mode)

  • Shows live scheduling data:

    • Next Spawn At (absolute Time.time)

    • Time Until Next Spawn (seconds)

    • Last Spawn At

    • Next Planned Tag (best-effort debug hint)

  • Includes an Editor-only Force Roll Now button to immediately test rule evaluation.


Profile Fields

Each SpecialProfile defines global caps and a set of rules:

  • Max Simultaneous Specials – Global cap of active specials.

  • Min Gap Seconds – Global cooldown between any special spawns.

  • Rules – List of SpecialRule objects.

SpecialRule Properties

  • Name – Identifier (used in metadata and debugging).

  • Spawn Entry – Prefab/agent to spawn.

  • Max Alive – Max of this type simultaneously.

  • Cooldown Seconds – Per-rule cooldown after a spawn.

  • Eval Every Seconds – Interval between condition checks.

  • Step Range – Intensity steps where this rule is valid.

  • Distance Range – Min/max distance from player to spawn.

  • Require No LOS – Only eligible if an occluder exists between player and anchor.

  • Spawn Tag – Optional filter for matching specific anchors.

  • Min Pressure – Requires telemetry; minimum Pressure threshold.

  • Min Avg Player HP – Requires telemetry; minimum average HP threshold.



Usage Patterns

  • Controlled Surprises – e.g. flankers spawn only if players are healthy.

  • Boss Gates – e.g. minibosses appear only at later steps and high pressure.

  • Replayable Variants – Swap profiles to change encounter mix per level/difficulty.

  • Dynamic Difficulty – Telemetry conditions let specials react to player stress.


Debugging & Validation

  • Runtime Inspector shows live scheduling, timers, and next tag hints.

  • Force Roll Now (Editor only) to immediately test rule evaluation.

  • Events available:

    • OnScheduleChanged – fired when next spawn time changes.

    • OnSpecialSpawned(string tag) – fired when a special spawns.

  • Best practice: Hook these events into your HUD/logs while tuning encounters.


Example

// Setup in code
var manager = FindObjectOfType<SpecialEncounterManager>();
manager.Profile = mySpecialProfile;
manager.SetTelemetryProvider(new MyGameTelemetry());
manager.SetRunning(true);

// Listen for spawns
manager.OnSpecialSpawned += tag => Debug.Log($"Special triggered: {tag}");

Also see:

Special Profile

Last updated