# **Procedural Mission Specification: Side Ops**

This document defines the logic for generating "Side Ops" that match the fidelity of Story Missions.

## **1. System Architecture**

Class: MissionGenerator  
Responsibility: Factory that produces temporary Mission objects.  
Triggers: Daily Reset, Mission Complete.

## **2. Generation Logic**

### **A. Naming & Flavor (The Hook)**

Missions use a context-aware "Operation: [Adjective] [Noun] [Numeral]" format.

- **Skirmish Nouns:** _Thunder, Storm, Iron, Fury, Shield, Hammer._
- **Salvage Nouns:** _Cache, Vault, Echo, Spark, Harvest, Trove._
- **Assassination Nouns:** _Viper, Dagger, Fang, Night, Razor, Sting._
- **Recon Nouns:** _Eye, Watch, Path, Horizon, Whisper, Scope._

### **B. Narrative Synthesis (Dynamic Context)**

Unlike Story missions which link to static files, Side Ops generate a **Narrative Sequence** on the fly to give context.

- **Intro Template:**
  - _Speaker:_ Faction Representative (e.g., General Kael for Iron Legion requests).
  - _Text:_ "Commander, [Faction] scouts report [EnemyType] activity in the [Biome]. We need you to [ObjectiveVerb] them immediately."
- **Outro Template:**
  - _Speaker:_ Faction Representative.
  - _Text:_ "Target neutralized. Funds transferred. Good hunting, Explorer."

_The Generator creates these JSON blobs and registers them with the NarrativeManager using a generated ID (e.g., NARRATIVE_SIDE_123_INTRO)._

### **C. Biome & Hazards**

- Select Unlocked Region.
- **Roll Density:** Low (Scouting), Medium (Standard), High (Warzone).
- **Roll Hazards:** 30% chance to add a Biome-specific hazard (e.g., HAZARD_POISON_SPORES for Fungal Caves) to make the tactical layer interesting.

### **D. Mission Archetypes (Objectives)**

#### **1. Skirmish (Combat Focus)**

- **Objective:** ELIMINATE_ALL.
- **Icon:** assets/icons/mission_sword.png.
- **Config:** Medium Density, Standard Rewards.

#### **2. Salvage (Resource Focus)**

- **Objective:** INTERACT with 3-5 "Supply Crates".
- **Icon:** assets/icons/mission_coin.png.
- **Config:** High Cover Density.
- **Reward Bonus:** Items/Materials.

#### **3. Assassination (Boss Focus)**

- **Objective:** ELIMINATE_UNIT (Named Elite).
- **Icon:** assets/icons/mission_skull.png.
- **Config:** Spawns a Unit with stats: { hp: 200%, attack: 150% } and a unique name (e.g., "Gorgon the Rot").
- **Reward Bonus:** High Currency.

#### **4. Recon (Speed Focus)**

- **Objective:** REACH_ZONE (3 Zones).
- **Icon:** assets/icons/mission_search.png.
- **Config:** Large Map, Low Density.
- **Turn Limit:** 8 Turns.

## **3. Rewards Scaling**

- **Currency:** Base (50) _ TierMultiplier _ Random(0.8, 1.2).
- **Reputation:** +10 to Patron Faction.
- **Loot:** 20% chance for a Chest Key or Consumable Bundle.

## **4. Implementation Prompt**

"Create src/systems/MissionGenerator.js.

1. **Templates:** Define text templates for Intros/Outros for each Faction Leader.
2. **Generate:** Implement generateSideOp(tier, regionId).
   - Construct the Mission object.
   - Construct the Narrative objects (Intro/Outro) dynamically.
   - Register Narratives to NarrativeManager (or return them to be registered).
3. **Hazards:** Map Biomes to valid Hazards and roll for inclusion."

## **5. Detailed Example (Generated Output)**

This is what the output JSON looks like—indistinguishable from a Story Mission to the Game Engine.

```json
{
  "id": "SIDE_OP_170932",
  "type": "SIDE_QUEST",
  "config": {
    "title": "Operation: Crimson Viper II",
    "description": "General Kael requests the elimination of a high-value target in the Crystal Spires.",
    "difficulty_tier": 2,
    "recommended_level": 3,
    "icon": "assets/icons/mission_skull.png"
  },
  "biome": {
    "type": "BIOME_CRYSTAL_SPIRES",
    "generator_config": {
      "seed_type": "RANDOM",
      "seed": 982374,
      "size": { "x": 22, "y": 12, "z": 22 },
      "room_count": 0,
      "density": "MEDIUM"
    },
    "hazards": ["HAZARD_GRAVITY_FLUX"]
  },
  "deployment": {
    "squad_size_limit": 4
  },
  "narrative": {
    "intro_sequence": "NARRATIVE_SIDE_170932_INTRO",
    "outro_success": "NARRATIVE_SIDE_170932_OUTRO",

    "_dynamic_data": {
      "intro": {
        "id": "NARRATIVE_SIDE_170932_INTRO",
        "nodes": [
          {
            "id": "1",
            "type": "DIALOGUE",
            "speaker": "General Kael",
            "portrait": "assets/images/portraits/vanguard.png",
            "text": "Scouts have spotted 'Krag the Breaker' in this sector. He's dangerous. Put him down.",
            "next": "END"
          }
        ]
      },
      "outro": {
        "id": "NARRATIVE_SIDE_170932_OUTRO",
        "nodes": [
          {
            "id": "1",
            "type": "DIALOGUE",
            "speaker": "General Kael",
            "portrait": "assets/images/portraits/vanguard.png",
            "text": "Target confirmed KIA. Good work, soldier. Funds transferred.",
            "next": "END"
          }
        ]
      }
    }
  },
  "objectives": {
    "primary": [
      {
        "id": "OBJ_HUNT",
        "type": "ELIMINATE_UNIT",
        "target_def_id": "ENEMY_ELITE_ECHO_KRAG",
        "description": "Eliminate Krag the Breaker."
      }
    ]
  },
  "rewards": {
    "guaranteed": {
      "xp": 350,
      "currency": { "aether_shards": 150 }
    },
    "faction_reputation": { "IRON_LEGION": 15 }
  },
  "expiresIn": 3
}
```
