# Specials Telemetry System

The **Telemetry System** allows the **Special Encounter Manager** to react to real-time game conditions - such as combat intensity, player health, or resource scarcity - when deciding whether to spawn special enemies or events.

Rather than hard-coding how “intense” or “safe” the world feels, telemetry lets you feed in your own metrics directly from your gameplay systems.

***

### **Why It Exists**

Every game measures pacing and difficulty differently.

Some track the number of enemies alive, others monitor player stress, survival time, or health averages.

The Runtime Spawner makes no assumptions about your systems - instead, it exposes a **Telemetry Provider** interface that you can implement to tell the **Special Encounter Manager** things like:

* **Pressure:** how intense the game currently feels
* **Average Player HP:** how healthy the team is overall

Rules in your **Special Profile** can then include thresholds such as:

> “Only spawn this special when Pressure ≥ 0.8 and Avg HP ≥ 0.5.”

If no telemetry provider is available, any rule that depends on telemetry simply **fails safely** - no spawns, no errors.

***

### **System Flow**

```mermaid
    A [SpecialEncounterManager] --> B[Special Rules (Profile)]
    B -->|Needs telemetry?| C{Telemetry Provider?}
    C -->|Yes| D[Reads Pressure / Avg HP]
    C -->|No| E[Condition fails safely]
    D --> F[Compare vs thresholds]
    F -->|Pass| G[Spawn special encounter]
    F -->|Fail| H[Skip rule]
```

***

### **Ways to Provide Telemetry**

You can supply telemetry in two ways:

| Method                         | Description                                                                                                     | Use Case                                            |
| ------------------------------ | --------------------------------------------------------------------------------------------------------------- | --------------------------------------------------- |
| **ScriptableObject Provider**  | Create a subclass of `SpecialsTelemetryProvider`. Feeds data through the Inspector or reads from game services. | Simple, designer-friendly setup.                    |
| **Runtime Interface Provider** | Implement `ISpecialsTelemetry` in your gameplay code and inject it at runtime with `SetTelemetryProvider(...)`. | Direct connection to live systems or DI frameworks. |

The package includes a **BasicSample provider** you can create immediately for testing.\
It exposes simple sliders for Pressure and Average HP — perfect for proving the system works before wiring real data.

***

### **Safe Defaults**

If you don’t supply telemetry:

* Rules that **require telemetry** won’t spawn until data is available.
* Rules **without telemetry conditions** continue to run normally.

This ensures incomplete setups never cause errors or unexpected spawns.

***

### **Typical Threshold Examples**

<table><thead><tr><th width="202.7999267578125">Encounter Type</th><th>Condition Example</th></tr></thead><tbody><tr><td><strong>Miniboss</strong></td><td>Pressure ≥ 0.75 and Avg HP ≥ 0.5</td></tr><tr><td><strong>Flankers</strong></td><td>Pressure ≥ 0.5 and Avg HP ≥ 0.6 and Require No LOS</td></tr><tr><td><strong>Emergency Healers</strong></td><td>Avg HP ≤ 0.3 (any Pressure)</td></tr></tbody></table>

***

### **Next Steps**

* **Using the Sample Telemetry Provider** - See it working instantly with no code.
* **Creating a Custom Provider** - Connect your real gameplay data.
* **Integration & Troubleshooting** - Verify setup order and fix common issues.

***

#### **In Short**

Telemetry gives the **Special Encounter Manager** context - how hard the game feels and how healthy the players are - so your *special* encounters happen **at the right time, for the right reasons**.
