Skip to content

Procedural Generation Pipeline Architecture

Status: RESOLVED — July 19, 2026


Approach

MVP: Editor-crafted maps using grammar rules. Runtime: load pre-generated maps.

The grammar engine runs at editor time, not runtime. A designer uses the grammar rules + rule configs to generate maps, tweak results, and export validated maps. Runtime loads the exported map files. No runtime generation for MVP.

This approach:

  • Makes map editing possible (designer can hand-tune grammar output)
  • Gives a more crafted experience at launch
  • Keeps the grammar engine available for future procedural generation
  • Eliminates runtime generation bugs and performance concerns

Future: Runtime Generation

The same grammar engine can be wired to runtime in v0.2+ when full procedural variety is needed. This is architecture-compatible — runtime just calls the same grammar pipeline with a seed instead of loading an exported file.


Pipeline (Editor Time)

BIOME SELECT → TEMPLATE SELECT → GRAMMAR GENERATE → ENEMY PLACE → VALIDATE + POLISH → EXPORT

Editor Tool: Grammar Window

A custom Unity Editor window that exposes:

  • Biome selector dropdown
  • Template selector dropdown
  • Grammar rule configs (sliders for density, toggle rules on/off)
  • "Generate" button
  • "Validate" button
  • "Export to Runtime Asset" button
  • Seed display (for reproducible generation)

Export Format

Maps are exported as JSON or ScriptableObject assets consumed by the runtime battle scene:

ExportedMap
├── biomeId: string
├── templateId: string
├── tiles[8][12]: TileData
│   ├── height, terrainType, hazard?, cover?
├── deployZones: PlayerDeployZone, EnemyDeployZone
├── enemyPlacements[]: EnemySpawnData
└── dynamicEvent?: DynamicEventConfig

Grammar Engine

Approach

  • Rule-based grammar — define rules like "every +3 tile must have a ramp within 2 tiles."
  • Simpler than Wave Function Collapse, transparent, designer-tunable.
  • Rules are configurable via ScriptableObjects (GrammarRuleConfig assets).

Rule Categories

CategoryExample Rule
Heighthill_cluster(x, y, radius, maxHeight)
Coverwall_line(start, end, hp)
Hazardhazard_pool(center, radius, type)
Pathall_tiles_reachable_from(deployZone)

Validation

Same solvability checks from the design doc, but run in editor:

  • No one-shot kills on turn 1
  • At least 2 valid opening moves
  • No surround traps
  • Map connectivity
  • Casters target valid tiles

Maps for MVP

  • 2 biomes × 4 templates = 8 editor-crafted map types
  • ~3 variants each = 24 total exported maps
    • 2 hand-crafted boss arenas
    • 1 tutorial map
  • Total: ~27 maps to author

Editor grammar tools should reduce per-map creation time from hours to minutes.


Open Questions

  • [ ] How many map variants per template? 3 each = 24 maps. Is this enough for launch replayability?
  • [ ] Grammar rule config: ScriptableObject per biome, or unified config file?
  • [ ] Export format: JSON (diffable) or ScriptableObject (faster loading)? Both?
  • [ ] When does runtime generation ship? v0.2 with Island 3?

Markdown is the canonical GDD source.