> For the complete documentation index, see [llms.txt](https://megacrush.gitbook.io/megacrush-unity-assets/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://megacrush.gitbook.io/megacrush-unity-assets/runtime-ambient-ai/runtime-ambient-ai-user-manual/feature-summary.md).

# Feature Summary

### 1. Core Concept

Ambient AI is a **lightweight population and behavior system** designed to make game spaces feel alive without requiring full NPC simulation.

It focuses on:

* Background characters
* Environmental activity
* Low-cost AI behaviors
* Scalable population density

Built to integrate directly with **Runtime Spawner v2** and service-driven architecture.

### 2. Spawn-Driven AI Lifecycle

Ambient AI is fundamentally **spawn-centric**, not simulation-centric.

#### Key Features

* Uses Runtime Spawner for:
  * Placement
  * Distribution
  * Density control
* AI entities are **ephemeral**:
  * Spawn → Perform behavior → Despawn/Recycle
* Supports:
  * Distance-based activation
  * Budget-based spawning
  * Area/context-aware spawning

#### Why this matters

* No persistent AI overhead
* Scales cleanly with large scenes
* Works naturally with pooling + networking

### 3. Ambient Behavior System

Instead of full behavior trees, Ambient AI uses **simple, composable behavior units**.

#### Behavior Types (Current / Planned)

* Idle (stand, sit, smoke, etc.)
* Wander / Patrol (local movement)
* Look / React (head turns, interest points)
* Use Prop (lean, interact, phone, etc.)
* One-shot actions (enter, exit, gesture)
* Interruption System
  * Panic / Flee

#### Design Approach

* Short-lived, loopable behaviors
* Low decision complexity
* Minimal state

#### Extensibility

* Behaviors are modular and can be:
  * Script-based
  * Data-driven (future metadata integration)

### 4. Context-Aware Spawning

Ambient AI can adapt to **where and when** it spawns.

#### Context Inputs

* Spawn area type (street, interior, club, etc.)
* Time of day (future)
* Threat level / alert state (future)
* Faction presence (ties into gameplay systems)

#### Examples

* Busy crowd in markets
* Sparse NPCs in hostile zones
* Different behavior sets per district

### 5. Spawn Entries & Variation

Ambient AI leverages extend Runtime Spawner **SpawnEntry-style definitions**.

#### Features

* Multiple prefab options per entry
* Weighted random selection
* Variation without duplication
* Hooks for:
  * Animation sets
  * Behavior presets
  * Visual diversity

#### Planned Enhancement

* Prefab collections per entry (currently on roadmap)

### 6. Integration with Runtime Spawner v2

Ambient AI is not a separate system—it **rides on top of the spawner architecture**.

#### Uses Existing Systems

* SpawnRequest / SpawnContext
* Distribution + placement logic
* ObjectFactory (local or networked)
* Pooling via ISpawnHandle

#### Result

* No duplication of spawning logic
* Fully compatible with:
  * Local pooling
  * PUN / Fusion backends

### 7. Lightweight AI Controller

Each ambient entity runs a **minimal controller**.

#### Responsibilities

* Execute assigned behavior
* Handle simple transitions (optional)
* Track lifetime / despawn conditions

#### Non-Goals

* No heavy planners
* No complex combat logic
* No deep decision trees

### 8. Despawn & Recycling

Critical for performance and scalability.

#### Triggers

* Distance from player
* Time elapsed
* Completion of behavior
* Budget constraints

#### Behavior

* Return to pool (not destroyed)
* Clean state reset for reuse

### 9. Performance & Scalability

Designed to support **large populations cheaply**.

#### Techniques

* Object pooling (via Runtime Spawner pool system)
* Spawn budgeting
* Distance-based activation
* Minimal per-frame logic

#### Future Considerations

* GPU instancing for crowds
* LOD-style behavior simplification
* Batch updates

### 10. Networking Compatibility

Ambient AI is compatible with the Runtime Spawner **networked spawning model with full support for PUN 2+ and Photon Fusion**

#### Modes

* Server-authoritative spawning (Fusion / PUN master)
* Local-only ambient (non-critical visuals)

#### Use Cases

* Shared world ambiance (networked)
* Client-side dressing (non-networked)

### 11. Editor & Workflow (Planned / Partial)

#### Goals

* Fast iteration
* Visual setup
* Reusable presets

#### Expected Tooling

* Ambient spawn profiles
* Behavior presets
* Area-based configuration
* Integration with Runtime Spawner Setup Window pattern (future / planned)

### 12. Future / Pending Work

Tracked gaps and next steps:

#### Behavior Expansion

* Death handling
* Crowd reactions
* Group behaviors

#### System Features

* Vendor / activity loops (queued interactions)
* Faction-aware behavior shifts
* Time-of-day variation

#### Architecture

* Abstract NavMesh dependency
* Plug in alternate movement systems

### 13. Key Design Philosophy

* **Spawn, don’t simulate**
* **Cheap, believable over complex, accurate**
* **Composable behaviors over monolithic AI**
* **Leverage existing systems (Spawner, Pooling, Networking)**
