aether-shards/specs/Procedural_Missions.spec.md
Matthew Mone 2c86d674f4 Add mission debrief and procedural mission generation features
- Introduce the MissionDebrief component to display after-action reports, including XP, rewards, and squad status.
- Implement the MissionGenerator class to create procedural side missions, enhancing replayability and resource management.
- Update mission schema to include mission objects for INTERACT objectives, improving mission complexity.
- Enhance GameLoop and MissionManager to support new mission features and interactions.
- Add tests for MissionDebrief and MissionGenerator to ensure functionality and integration within the game architecture.
2026-01-01 16:08:54 -08:00

4.6 KiB

Procedural Mission Specification: Side Ops

This document defines the logic for generating "Filler" missions (Side Ops). These missions provide infinite replayability, resource grinding, and recovery options for the player.

1. System Architecture

Class: MissionGenerator
Responsibility: Factory that produces temporary Mission objects adhering to the Mission.ts interface.
Triggers:

  • Daily Reset: When the campaign day advances.
  • Mission Complete: Replenish the board after a run.

2. Generation Logic

To generate a Side Op, the system inputs the Campaign Tier (1-5) and Unlocked Regions.

A. Naming Convention

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

Noun Selection (Context-Aware):
The noun is selected based on the Mission Archetype to imply the goal.

  • Skirmish (Combat): Thunder, Storm, Iron, Fury, Shield, Hammer, Wrath, Wall, Strike, Anvil.
  • Salvage (Loot): Cache, Vault, Echo, Spark, Core, Grip, Harvest, Trove, Fragment, Salvage.
  • Assassination (Kill): Viper, Dagger, Fang, Night, Shadow, End, Hunt, Razor, Ghost, Sting.
  • Recon (Explore): Eye, Watch, Path, Horizon, Whisper, Dawn, Light, Step, Vision, Scope.

Adjective Selection (General Flavor):

  • Silent, Broken, Red, Crimson, Shattered, Frozen, Burning, Dark, Blind, Hidden, Lost, Ancient, Hollow, Swift.

Legacy Logic (Series Generation):
The generator checks the player's MissionHistory.

  • If "Operation: Silent Viper" was completed previously, the new mission is named "Operation: Silent Viper II".
  • This creates the illusion of persistent, ongoing military campaigns.

B. Biome Selection

  • Randomly select from Unlocked Regions.
  • Weighting: 40% chance for the most recently unlocked region (to keep content relevant).

C. Mission Archetypes (Objectives)

The generator picks one of four templates and hydrates it with specific data.

1. Skirmish (Standard Combat)

  • Objective: ELIMINATE_ALL.
  • Description: "Clear the sector of hostile forces."
  • Config: Standard room count, Medium density.
  • Turn Limit: None.

2. Salvage (Loot Run)

  • Objective: INTERACT with 3-5 "Supply Crates".
  • Description: "Recover lost supplies before the enemy secures them."
  • Config: High density of obstacles/cover.
  • Reward Bonus: Higher chance for ITEMS or MATERIALS.

3. Assassination (Elite Hunt)

  • Objective: ELIMINATE_UNIT (Specific Target ID).
  • Description: "A High-Value Target has been spotted. Eliminate them."
  • Config: Spawns a named Elite Unit (e.g., "Krag the Breaker") with +50% Stats.
  • Reward Bonus: High CURRENCY payout.

4. Recon (Scouting)

  • Objective: REACH_ZONE (3 separate zones on the map).
  • Description: "Survey the designated coordinates."
  • Config: Large map size, Low enemy density (Mobility focus).
  • Turn Limit: Tight (Speed is key).

3. Scaling & Rewards

Difficulty Tiers

The generator adjusts difficulty_tier in the config, which the GameLoop uses to scale enemy stats.

Tier Name Enemy Lvl Reward Multiplier
1 Recon 1-2 1.0x
2 Patrol 3-4 1.5x
3 Conflict 5-6 2.5x
4 War 7-8 4.0x
5 Suicide 9-10 6.0x

Reward Generation

Rewards are calculated dynamically:

  • Currency: Base (50) _ TierMultiplier _ Random(0.8, 1.2).
  • Items: 20% chance per Tier to drop a Chest Key or Item.
  • Reputation: +10 Reputation with the Region's owner (e.g., Missions in Rusting Wastes give +Cogwork Rep).

4. Example Generated JSON

{
  "id": "SIDE_OP_170932",
  "type": "SIDE_QUEST",
  "config": {
    "title": "Operation: Crimson Viper II",
    "description": "The target escaped last time. Finish the job in the Crystal Spires.",
    "difficulty_tier": 2,
    "recommended_level": 3
  },
  "biome": {
    "type": "BIOME_CRYSTAL_SPIRES",
    "generator_config": {
      "seed_type": "RANDOM",
      "size": { "x": 20, "y": 12, "z": 20 },
      "room_count": 6
    }
  },
  "deployment": { "squad_size_limit": 4 },
  "objectives": {
    "primary": [
      {
        "id": "OBJ_HUNT",
        "type": "ELIMINATE_UNIT",
        "target_def_id": "ENEMY_ELITE_ECHO",
        "description": "Eliminate the Aether Echo Prime."
      }
    ]
  },
  "rewards": {
    "guaranteed": {
      "xp": 300,
      "currency": { "aether_shards": 120 }
    },
    "faction_reputation": { "ARCANE_DOMINION": 15 }
  },
  "expiresIn": 3
}