hayao 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/design/00-process/README.md +49 -0
  2. package/design/00-process/composition.md +148 -0
  3. package/design/00-process/core-loop.md +146 -0
  4. package/design/00-process/intent-to-brief.md +128 -0
  5. package/design/00-process/pillars.md +139 -0
  6. package/design/00-process/refine-and-handoff.md +156 -0
  7. package/design/00-process/the-twist.md +108 -0
  8. package/design/10-anchors/README.md +99 -0
  9. package/design/10-anchors/age-of-empires.md +103 -0
  10. package/design/10-anchors/baba-is-you.md +127 -0
  11. package/design/10-anchors/balatro.md +132 -0
  12. package/design/10-anchors/celeste.md +136 -0
  13. package/design/10-anchors/civilization.md +101 -0
  14. package/design/10-anchors/dead-cells.md +125 -0
  15. package/design/10-anchors/factorio.md +100 -0
  16. package/design/10-anchors/hades.md +127 -0
  17. package/design/10-anchors/into-the-breach.md +125 -0
  18. package/design/10-anchors/it-takes-two.md +104 -0
  19. package/design/10-anchors/loop-hero.md +131 -0
  20. package/design/10-anchors/nuclear-throne.md +130 -0
  21. package/design/10-anchors/outer-wilds.md +107 -0
  22. package/design/10-anchors/overcooked.md +102 -0
  23. package/design/10-anchors/peggle.md +133 -0
  24. package/design/10-anchors/reigns.md +99 -0
  25. package/design/10-anchors/return-of-the-obra-dinn.md +108 -0
  26. package/design/10-anchors/rimworld.md +101 -0
  27. package/design/10-anchors/shadow-of-mordor.md +106 -0
  28. package/design/10-anchors/slay-the-spire.md +127 -0
  29. package/design/10-anchors/starcraft.md +98 -0
  30. package/design/10-anchors/stardew-valley.md +103 -0
  31. package/design/10-anchors/tetris.md +122 -0
  32. package/design/10-anchors/vampire-survivors.md +122 -0
  33. package/design/20-genres/README.md +62 -0
  34. package/design/20-genres/action-adventure.md +126 -0
  35. package/design/20-genres/auto-battler.md +121 -0
  36. package/design/20-genres/bullet-hell.md +123 -0
  37. package/design/20-genres/city-builder.md +124 -0
  38. package/design/20-genres/coop-chaos.md +124 -0
  39. package/design/20-genres/deckbuilder.md +122 -0
  40. package/design/20-genres/exploration.md +131 -0
  41. package/design/20-genres/farming-sim.md +122 -0
  42. package/design/20-genres/grid-puzzle.md +126 -0
  43. package/design/20-genres/horde-survival.md +128 -0
  44. package/design/20-genres/incremental.md +120 -0
  45. package/design/20-genres/match3.md +120 -0
  46. package/design/20-genres/metroidvania.md +132 -0
  47. package/design/20-genres/narrative-decisions.md +122 -0
  48. package/design/20-genres/physics-arcade.md +124 -0
  49. package/design/20-genres/precision-platformer.md +127 -0
  50. package/design/20-genres/racing.md +126 -0
  51. package/design/20-genres/rhythm.md +125 -0
  52. package/design/20-genres/roguelike.md +122 -0
  53. package/design/20-genres/rts.md +169 -0
  54. package/design/20-genres/stealth.md +125 -0
  55. package/design/20-genres/survival-horror.md +124 -0
  56. package/design/20-genres/tactics.md +123 -0
  57. package/design/20-genres/tower-defense.md +120 -0
  58. package/design/30-systems/README.md +69 -0
  59. package/design/30-systems/accessibility.md +110 -0
  60. package/design/30-systems/boss-design.md +126 -0
  61. package/design/30-systems/build-diversity.md +120 -0
  62. package/design/30-systems/collectibles.md +108 -0
  63. package/design/30-systems/combat-model.md +113 -0
  64. package/design/30-systems/coop-and-competition.md +118 -0
  65. package/design/30-systems/counter-systems.md +115 -0
  66. package/design/30-systems/crafting.md +115 -0
  67. package/design/30-systems/difficulty-and-dda.md +114 -0
  68. package/design/30-systems/economy.md +117 -0
  69. package/design/30-systems/emergent-systems.md +114 -0
  70. package/design/30-systems/encounter-design.md +107 -0
  71. package/design/30-systems/enemy-ai.md +121 -0
  72. package/design/30-systems/enemy-archetypes.md +117 -0
  73. package/design/30-systems/faction-asymmetry.md +144 -0
  74. package/design/30-systems/grace.md +124 -0
  75. package/design/30-systems/mastery-curve.md +116 -0
  76. package/design/30-systems/meta-progression.md +114 -0
  77. package/design/30-systems/onboarding.md +115 -0
  78. package/design/30-systems/procgen-design.md +118 -0
  79. package/design/30-systems/progression.md +120 -0
  80. package/design/30-systems/resource-loops.md +112 -0
  81. package/design/30-systems/reward-schedules.md +124 -0
  82. package/design/30-systems/save-and-checkpoint.md +113 -0
  83. package/design/30-systems/session-structure.md +113 -0
  84. package/design/30-systems/skill-trees.md +111 -0
  85. package/design/30-systems/status-effects.md +111 -0
  86. package/design/30-systems/tech-tree.md +112 -0
  87. package/design/30-systems/telegraphs.md +106 -0
  88. package/design/30-systems/unit-rosters.md +123 -0
  89. package/design/40-worldbuilding/README.md +49 -0
  90. package/design/40-worldbuilding/aesthetic-direction.md +155 -0
  91. package/design/40-worldbuilding/faction-identity.md +136 -0
  92. package/design/40-worldbuilding/naming-and-tone.md +130 -0
  93. package/design/40-worldbuilding/narrative-delivery.md +129 -0
  94. package/design/40-worldbuilding/theme-vectors.md +134 -0
  95. package/design/40-worldbuilding/worldbuilding-scaffold.md +132 -0
  96. package/design/50-patterns/README.md +54 -0
  97. package/design/50-patterns/anti-frustration.md +121 -0
  98. package/design/50-patterns/emergence.md +121 -0
  99. package/design/50-patterns/feedback-loops.md +121 -0
  100. package/design/50-patterns/juice-choreography.md +124 -0
  101. package/design/50-patterns/mastery-and-flow.md +121 -0
  102. package/design/50-patterns/pacing-and-tension.md +120 -0
  103. package/design/50-patterns/readability.md +121 -0
  104. package/design/50-patterns/risk-reward.md +120 -0
  105. package/design/CONTRIBUTING.md +183 -0
  106. package/design/INDEX.md +133 -0
  107. package/design/README.md +86 -0
  108. package/design/_TEMPLATE.md +69 -0
  109. package/design/index.json +2720 -0
  110. package/dist/anim/blend.d.ts +68 -0
  111. package/dist/anim/clip.d.ts +87 -0
  112. package/dist/anim/ik.d.ts +40 -0
  113. package/dist/anim/skeleton.d.ts +64 -0
  114. package/dist/hayao.global.js +12 -12
  115. package/dist/index.d.ts +11 -1
  116. package/dist/index.js +1683 -516
  117. package/dist/index.js.map +4 -4
  118. package/dist/index.min.js +12 -12
  119. package/dist/render/canvas2d-core.d.ts +4 -0
  120. package/dist/render/commands.d.ts +19 -0
  121. package/dist/render/lightRun.d.ts +35 -0
  122. package/dist/render/svgString.d.ts +8 -3
  123. package/dist/scene/clipPlayer.d.ts +58 -0
  124. package/dist/scene/ikTarget.d.ts +25 -0
  125. package/dist/scene/light.d.ts +80 -0
  126. package/dist/scene/shadow2d.d.ts +25 -0
  127. package/dist/scene/skeletonDebug.d.ts +28 -0
  128. package/dist/verify/gates.d.ts +25 -0
  129. package/docs/API.md +66 -8
  130. package/docs/CONVENTIONS.md +56 -0
  131. package/package.json +2 -1
@@ -0,0 +1,122 @@
1
+ ---
2
+ id: genre-roguelike
3
+ title: Roguelike
4
+ kind: genre
5
+ tags: [roguelike, procgen, permadeath, runs, connectivity, discovery, turn-based]
6
+ summary: Fair discovery through procedural dungeons that always connect and turns that always replay — variance as content, not chaos.
7
+ use-when: You want run-based exploration where each seed is a fresh, fair puzzle and death is the loop.
8
+ composes-with: [system-procgen-design, system-meta-progression, system-session-structure, system-enemy-archetypes, system-save-and-checkpoint]
9
+ anchors: [anchor-nuclear-throne, anchor-dead-cells]
10
+ verify-with: docs/FUN.md#10--traditional-roguelike
11
+ ---
12
+
13
+ # Roguelike
14
+
15
+ **What it is.** A run-based game of **procedural dungeons** and **permadeath**.
16
+ Each seed generates a fresh, connected world; you descend, adapt to what you're
17
+ dealt, and die — then run again, wiser. Variance is the content: no two runs are
18
+ the same, and every one is fair.
19
+
20
+ **Player fantasy / why it's fun.** *"I read this seed's hand and played it
21
+ well."* The pull is fair discovery — surprise that never feels cheated, mastery
22
+ of a system rather than a memorised map, and the "one more run" that a fresh
23
+ seed always promises.
24
+
25
+ ## Pillars
26
+
27
+ 1. **Fairness ≈ connectivity.** Procgen that *always connects* — stairs and all
28
+ loot reachable — is the floor. Prove it across ~50 seeds *before* tuning any
29
+ number. An unreachable objective is the genre's cardinal sin.
30
+ 2. **Turns that always replay.** Deterministic, seeded, turn-based: input edge =
31
+ one world step. Pure-data state makes runs reproducible and bots possible —
32
+ the sim is its own proof engine.
33
+ 3. **Discovery, not memorisation.** The challenge is reading *this* seed's
34
+ items, enemies, and layout — a systemic mastery that transfers across seeds,
35
+ not a memorised route.
36
+
37
+ ## The loop stack
38
+
39
+ | Scale | The beat |
40
+ |---|---|
41
+ | **Moment** | One turn: read the tactical situation → the move that reads it best → the world steps. |
42
+ | **Encounter** | A room/fight: positioning, resources, and item synergies vs an archetype mix. |
43
+ | **Session** | A run: descend floors, build from what drops, push your luck deeper, die or win. |
44
+ | **Meta** | Between runs — unlocks, new items in the pool, knowledge of the systems. |
45
+
46
+ ## Essential systems
47
+
48
+ | System | Why it's load-bearing |
49
+ |---|---|
50
+ | [[system-procgen-design]] | The engine of the genre — seeds, connectivity, variance-as-content, controlled randomness. |
51
+ | [[system-meta-progression]] | The between-run pull; unlocks that add *options*, ideally, over raw power. |
52
+ | [[system-session-structure]] | Run length and shape; floor count, descent pacing, the win condition. |
53
+ | [[system-enemy-archetypes]] | The threat alphabet each room composes from — readable, beatable minds. |
54
+ | [[system-save-and-checkpoint]] | Respecting time under permadeath: save-and-quit, run history, retry friction. |
55
+
56
+ ## Content & difficulty model
57
+
58
+ - **Content is the pool + the generator.** Author items, enemies, and room
59
+ templates; the generator combines them. Depth comes from *interactions* in the
60
+ pool, not from more rooms.
61
+ - **Difficulty ramps by depth.** Deeper floors mix nastier archetypes and
62
+ tighter resources. The generator scales the mix, not a global HP multiplier.
63
+ - **Variance with guardrails.** Seed the RNG; clamp the range so a run is never
64
+ DOA (no floor with zero healing available). Prove winnability with
65
+ full-knowledge bots — they show a *line exists*, which is the honest claim for
66
+ procgen (not that a human will find it).
67
+ - **Meta adds options, not a floor of power.** Guard against the run being
68
+ decided at the menu; unlocks should widen the pool, not trivialise it. See
69
+ [[system-meta-progression]].
70
+
71
+ ## Signature-mechanic seeds
72
+
73
+ - **Roguelike but the dungeon is a language you edit** *(mechanic-swap)* — Baba-
74
+ style rule tiles you rearrange between floors; the systemic mastery becomes
75
+ literal. Pairs [[anchor-baba-is-you]].
76
+ - **Roguelike but every death leaves a corpse that persists** *(structure)* —
77
+ Nemesis-lite memory across runs; past selves become this run's threats. Pairs
78
+ [[system-emergent-systems]].
79
+ - **Roguelike but you see the whole seed once, then it's dark** *(constraint)* —
80
+ a memory/planning roguelike; the discovery is front-loaded.
81
+ - **Roguelike but turns cost light** *(theme + constraint)* — a Kentō lantern
82
+ descent; every step spends a finite glow, making exploration a resource.
83
+ - **Roguelike but two heroes on one seed, alternating turns** *(perspective)* —
84
+ co-op descent; connectivity must serve two paths.
85
+
86
+ ## Common pitfalls
87
+
88
+ - **Unreachable objectives.** A seed where stairs or required loot are walled off
89
+ is unshippable. Connectivity sweep, always, first.
90
+ - **Memorisation over mastery.** If the "best" play is learning fixed seeds, the
91
+ procgen is decorative. Variance must matter.
92
+ - **Meta decides the run.** If a menu unlock makes runs trivial, discovery dies.
93
+ Options over power.
94
+ - **Variance that punishes randomly.** A seed with no healing or an unwinnable
95
+ drop feels cheated. Clamp the generator's worst case.
96
+
97
+ ## Anchors
98
+
99
+ - [[anchor-nuclear-throne]] — the tight run-based mastery loop; steal its
100
+ legible enemies and instant-restart momentum.
101
+ - [[anchor-dead-cells]] — the roguelite structure of permanent unlocks over
102
+ impermanent runs; steal its meta-progression shape.
103
+
104
+ ## Verify
105
+
106
+ Prove it in **[FUN.md §10 · Traditional
107
+ roguelike](../../docs/FUN.md#10--traditional-roguelike)**: seeded
108
+ reproducibility, a connectivity sweep, a full-knowledge bot wins 10/10 random
109
+ seeds, and turn-log replay determinism.
110
+
111
+ ## Composes with
112
+
113
+ - [[system-procgen-design]] — the connectivity-proven generator at the core.
114
+ - [[system-meta-progression]] — the between-run hook that keeps runs coming.
115
+ - [[system-enemy-archetypes]] — the threat alphabet each seed spells with.
116
+
117
+ ## See also
118
+
119
+ - [`sandboxes/procgen-lab`](../../sandboxes/procgen-lab) — seeded generation and
120
+ connectivity wiring in isolation.
121
+ - [`examples/sokoban`](../../examples/sokoban) — the pure `Puzzle<State,Move>`
122
+ logic/view split; a roguelike turn is the same shape at scale.
@@ -0,0 +1,169 @@
1
+ ---
2
+ id: genre-rts
3
+ title: Real-Time Strategy
4
+ kind: genre
5
+ tags: [rts, strategy, factions, asymmetry, macro, micro, pathfinding, spectacle]
6
+ summary: Mass under command — hundreds of wall-aware units, three asymmetric-but-fair factions, and battles that read as spectacle.
7
+ use-when: You want a game of commanding armies where economy, tech, faction identity, and positioning decide impressive battles.
8
+ composes-with: [system-faction-asymmetry, system-unit-rosters, system-economy, system-enemy-ai, system-tech-tree, system-counter-systems, system-difficulty-and-dda]
9
+ anchors: [anchor-starcraft, anchor-age-of-empires]
10
+ verify-with: docs/FUN.md#9--rts-lite
11
+ ---
12
+
13
+ # Real-Time Strategy
14
+
15
+ **What it is.** You command an army — not a unit. You **gather → build → tech →
16
+ army → engage**, all in real time, against an opponent doing the same. The game
17
+ is *macro* (economy and tech decisions) layered over *micro* (positioning a
18
+ fight), with faction identity coloring every layer.
19
+
20
+ **Player fantasy / why it's fun.** *"I out-thought them — my build read theirs,
21
+ my army answered it, and the battle was glorious."* RTS is the fantasy of
22
+ command: hundreds of units obey one intent, and a well-composed army crashing
23
+ into a bad one is the payoff shot.
24
+
25
+ ## Pillars
26
+
27
+ 1. **Mass under command.** Hundreds of units path around walls and answer
28
+ orders as one. Flow fields (one BFS per goal tile, cached *outside* state)
29
+ give wall-aware mass pathing cheaply — pathing is the genre's hardest tech
30
+ and its most load-bearing.
31
+ 2. **Asymmetry that balances.** Factions are *different, not reskinned* — and
32
+ still fair. Distinct rosters, one balance. This is the deep well; get it
33
+ right and every matchup is a new game.
34
+ 3. **The intended line beats attack-move.** Strategy is the balance test. A
35
+ thinking plan (turtle → tech → counterpush) must beat brute attack-move, or
36
+ there is no strategy — just a bigger blob.
37
+
38
+ ## The loop stack
39
+
40
+ | Scale | The beat |
41
+ |---|---|
42
+ | **Moment** | Issue an order — a group micro (focus fire, retreat, flank); units path and arrive. |
43
+ | **Encounter** | An engagement: your composition vs theirs, terrain and positioning decide it in seconds. |
44
+ | **Session** | A match: opening build → scout → adapt tech to the enemy → the decisive push. |
45
+ | **Meta** | Learn each faction's build orders, matchup counters, and timing windows. |
46
+
47
+ ## Essential systems
48
+
49
+ | System | Why it's load-bearing |
50
+ |---|---|
51
+ | [[system-faction-asymmetry]] | The genre's soul. Different-but-fair identities; the design of asymmetric balance. |
52
+ | [[system-unit-rosters]] | A legible roster of roles and tiers per faction — the vocabulary of composition. |
53
+ | [[system-economy]] | Gather/faucet-sink macro; the eco-vs-army tension every decision trades against. |
54
+ | [[system-tech-tree]] | The ramp of options and power spikes; branch choices commit you to a plan. |
55
+ | [[system-enemy-ai]] | The AI opponent (and unit behaviour): readable, beatable, order-obeying minds. |
56
+ | [[system-counter-systems]] | The NvN duel matrix that makes composition a real decision. |
57
+
58
+ ## Strategic depth — where the game lives
59
+
60
+ Depth is the *stack of layered decisions*, each with tension:
61
+
62
+ - **Economy vs army.** Every worker is delayed military. The eco/army/tech
63
+ triangle (AoE ages, StarCraft supply timings) is the core macro tension.
64
+ - **Build order as a plan.** An opening commits you — greedy-eco vs early
65
+ pressure vs tech rush. Scouting is the info that lets you punish or adapt.
66
+ - **Composition as a puzzle.** Counters ([[system-counter-systems]]) make army
67
+ mix a rock-paper-scissors under fog. No unit is unconditionally best.
68
+ - **Timing windows.** A power spike (age-up, a tech completing) opens a window
69
+ where you're temporarily ahead — attacking on-spike is the skill.
70
+ - **Positioning micro.** Terrain, high ground, concave/surround, focus-fire.
71
+ Same armies, different outcomes by *how* they meet.
72
+
73
+ ## Faction asymmetry — go deep here
74
+
75
+ The flagship difference. See [[system-faction-asymmetry]] for the full design;
76
+ the genre-level rules:
77
+
78
+ | Axis of difference | Example |
79
+ |---|---|
80
+ | **Economy shape** | One faction gathers faster but caps lower; another snowballs late. |
81
+ | **Roster identity** | Swarm-and-remax vs elite-and-expensive vs defensive-and-teched. |
82
+ | **Tech philosophy** | Wide/cheap upgrades vs deep/spiky ones. |
83
+ | **Signature mechanic** | One unique verb per faction (a build mechanic, a resource) that only they play. |
84
+
85
+ Balance them not by making them equal but by making each **strong at a different
86
+ timing** — asymmetry balances *across* the game clock, not within a single stat.
87
+ Ground every faction's fiction in [[world-faction-identity]] so the mechanics
88
+ *read* as a culture, not a stat block.
89
+
90
+ ## Battle spectacle — the payoff shot
91
+
92
+ The reason to watch: two armies colliding must look *impressive* and stay
93
+ *readable*.
94
+
95
+ - **Legibility first.** Silhouette and color-code unit roles so a 100-unit fight
96
+ parses at a glance — [[pattern-readability]]. Spectacle that can't be read is
97
+ noise.
98
+ - **Choreography is cosmetic.** The sim resolves the fight; the view replays hit
99
+ flashes, death animations, dust, screen-shake — all deletable without changing
100
+ a sim bit (FUN.md law 6). Never let spectacle touch `world.hash()`.
101
+ - **Scale legibly.** Pooled sprites and flow-field movement keep hundreds of
102
+ units cheap; the *mass* is the spectacle.
103
+
104
+ ## Content & difficulty model
105
+
106
+ - **Balance is the content.** Matchups, not levels. The intended line beating
107
+ attack-move (law 2 skill-delta) is the health check.
108
+ - **AI tiers = economy handicaps + better build orders**, not stat cheats the
109
+ player can't see. See [[system-difficulty-and-dda]].
110
+ - **Skirmish maps** are the container; procedural or hand-made, they must be
111
+ symmetric-fair (equal resources, mirrored expansions).
112
+
113
+ ## Signature-mechanic seeds
114
+
115
+ - **RTS but you ARE one hero in the battle** *(perspective)* — Shadow-of-War
116
+ scale flip; command from inside the fight, morale as your reach.
117
+ - **RTS but no base — the army is all you get** *(constraint)* — one-loop
118
+ attrition; every unit lost is permanent, forcing preservation micro.
119
+ - **RTS but time advances in pulses you trigger** *(structure)* — semi-turn-based
120
+ mass tactics; a bridge to [[genre-tactics]] at army scale.
121
+ - **RTS but the map is a living tide** *(theme + mechanic-swap)* — terrain
122
+ floods/regrows on a clock; positioning fights the map, not just the enemy.
123
+ - **RTS but one faction plays the economy and one plays the army** *(perspective
124
+ + coop)* — asymmetric two-player command. Pairs
125
+ [[system-coop-and-competition]].
126
+
127
+ ## Common pitfalls
128
+
129
+ - **Attack-move wins.** If a-move beats every plan, macro and composition are
130
+ decorative — the whole game collapses. This is the first thing to disprove.
131
+ - **Reskin factions.** Same units, different colors = no asymmetry, no replay.
132
+ Differentiate the *economy and roster*, not the palette.
133
+ - **Pathing that clumps or stalls.** Units that pile at walls or block each other
134
+ break "mass under command." Flow fields, cached outside state, are the fix.
135
+ - **Unreadable battles.** A gorgeous fight you can't parse is a loss for the
136
+ player. Legibility gates spectacle.
137
+ - **Snowball with no comeback.** A single lost fight ending the match kills
138
+ tension — leave comeback vectors (defensive tech, eco recovery). See
139
+ [[pattern-feedback-loops]].
140
+
141
+ ## Anchors
142
+
143
+ - [[anchor-starcraft]] — three rosters, one balance; the reference for asymmetry
144
+ done right. Steal the "strong at different timings" balance philosophy.
145
+ - [[anchor-age-of-empires]] — the eco/tech ramp and age-up power spikes; steal
146
+ build orders and the economy-as-tension model.
147
+
148
+ ## Verify
149
+
150
+ Prove it in **[FUN.md §9 · RTS-lite](../../docs/FUN.md#9--rts-lite)**: every
151
+ counter edge wins its NvN duel, the commander/intended-line bot beats
152
+ attack-move, a walled-off unit routes around, and ms/step holds at peak unit
153
+ count.
154
+
155
+ ## Composes with
156
+
157
+ - [[system-faction-asymmetry]] — the different-but-fair identities that give the
158
+ genre its replay value.
159
+ - [[system-economy]] — the macro tension every strategic decision trades against.
160
+ - [[system-enemy-ai]] — the order-obeying, beatable minds behind the mass.
161
+
162
+ ## See also
163
+
164
+ - [`sandboxes/pathfinding-demo`](../../sandboxes/pathfinding-demo) — flow-field
165
+ mass pathing; the load-bearing tech for hundreds of wall-aware units.
166
+ - [`sandboxes/particle-studio`](../../sandboxes/particle-studio) — pooled sprites
167
+ and effects for cheap, legible battle spectacle (cosmetic, law 6).
168
+ - [docs/JUICE.md](../../docs/JUICE.md) — impact feel for the payoff shot without
169
+ touching the sim.
@@ -0,0 +1,125 @@
1
+ ---
2
+ id: genre-stealth
3
+ title: Stealth
4
+ kind: genre
5
+ tags: [stealth, vision-cone, patrol, noise, plan, heist, guard, route]
6
+ summary: Plannable danger — vision cones and noise you can read, so the tension is the gap between a route you can see and a route you can execute.
7
+ use-when: Designing a game where the fun is reading enemy perception and routing through it, not out-shooting it.
8
+ composes-with: [system-enemy-ai, system-telegraphs, system-encounter-design, system-save-and-checkpoint, system-onboarding, system-difficulty-and-dda]
9
+ anchors: [anchor-shadow-of-mordor]
10
+ verify-with: docs/FUN.md#5--stealth
11
+ ---
12
+
13
+ # Stealth
14
+
15
+ **What it is.** Guards with legible **vision cones** and **noise** radii patrol a
16
+ space. You are weak in the open and safe in the seams. The game is a live routing
17
+ puzzle: read perception, find the gap, move through it, don't be seen.
18
+
19
+ **Player fantasy / why it's fun.** *"I threaded the needle."* The held breath of
20
+ slipping behind a guard whose cone you *watched*, timing your dash to the exact
21
+ beat his back turns. Power fantasy inverted: you win by being unseen, and the
22
+ world is more dangerous than you.
23
+
24
+ ## Pillars
25
+
26
+ 1. **Perception is legible.** Cones, hearing radii, and alert states are drawn or
27
+ inferable. The player plans against *visible* danger — a threat you can't read
28
+ is a cheap death, not tension (FUN.md §5 demands both-ways affordance proofs).
29
+ 2. **Concealment actually conceals.** Shadows hide, cover blocks sight, a distraction
30
+ pulls a gaze — reliably, through a full patrol loop. If hiding is a coin flip,
31
+ planning is pointless (pillar 1's dual).
32
+ 3. **Exposure is punished fast.** Being seen escalates quickly — an alert, a hunt,
33
+ a fail-or-flee. The knife-edge between hidden and caught is where the genre
34
+ lives.
35
+
36
+ ## The loop stack
37
+
38
+ | Scale | The loop |
39
+ |---|---|
40
+ | **Moment** | Watch a cone sweep; time a move through the gap it leaves. |
41
+ | **Encounter** | Cross one guarded room: read the patrol, find the safe pocket, chain single-guard windows. |
42
+ | **Session** | A level/heist: string encounters into a route to an objective and back out. |
43
+ | **Meta** | Optional ghost (0-alert) runs, alternate routes, tools that reshape perception — mastery of the space. |
44
+
45
+ ## Essential systems
46
+
47
+ | System | Why it's needed |
48
+ |---|---|
49
+ | [[system-enemy-ai]] | Patrols, gaze, alert-state escalation, aggro/threat — readable, beatable minds; the danger *is* the AI. |
50
+ | [[system-telegraphs]] | The alert ramp (suspicion → search → chase) must be telegraphed so the player can react before it's terminal. |
51
+ | [[system-encounter-design]] | Composing cones and pockets; the safe-pocket-at-midpoint and chained-single-guard rules live here. |
52
+ | [[system-save-and-checkpoint]] | Getting caught should rewind to a fair, recent checkpoint — long re-stealth is punishment tax, not tension. |
53
+ | [[system-onboarding]] | Teach cone-reading and noise in a no-fail room before the first real guard. |
54
+ | [[system-difficulty-and-dda]] | Difficulty = cone density and window tightness; assist options widen windows or slow patrols. |
55
+
56
+ ## Content & difficulty model
57
+
58
+ - **Balance on cone-shadow duration, not guard distance.** The real constraint is
59
+ *how long* the safe gap in a guard's sweep stays open along your path — the chord
60
+ of shadow, not raw spacing (FUN.md §5). Compute it against the actual route.
61
+ - **A safe pocket at every long traversal's midpoint.** No open crossing longer
62
+ than a player can hold under one window; give a place to breathe (FUN.md §5).
63
+ - **Chain single-guard windows; never require joint phases.** Waiting for two
64
+ patrols to align by chance explodes combinatorially into unfair wait times —
65
+ design so each step depends on *one* guard's timing (FUN.md §5).
66
+ - **Prove affordances both ways.** Exposure punished fast AND hiding conceals
67
+ through a full loop. "The bot got through" proves neither on its own — you need
68
+ the punished-exposure and concealment-holds assertions.
69
+
70
+ Reference wiring: [`examples/veilstep`](../../examples/veilstep) — the canonical
71
+ stealth sim: cones drawn from `world.state`, the heist-bot 0-alarm run plus the
72
+ punished-exposure and concealment-holds proofs. Grep [`docs/API.md`](../../docs/API.md)
73
+ for the raycast/FOV and audio primitives.
74
+
75
+ ## Signature-mechanic seeds
76
+
77
+ "X but Y" ([[process-the-twist]]) — bend *what perceives you* or *what you control*.
78
+
79
+ - **Stealth but you control the guards' distractions, not the thief** — you route
80
+ an AI thief by pulling gazes. (perspective)
81
+ - **Stealth but light is your resource** — you carry the only lamp; every step lit
82
+ is a step seen, so you ration your own visibility. (constraint — pairs with survival-horror light)
83
+ - **Stealth but the guards remember and adapt** — patrol a room twice the same way
84
+ and they pre-empt it. (mechanic-swap — see [[anchor-shadow-of-mordor]])
85
+ - **Stealth but sound is the only sense** — no cones; guards are blind and you hide
86
+ in silence, routing by noise alone. (constraint)
87
+ - **Stealth but you're the guard hunting an invisible intruder** — read *their*
88
+ noise, cut off *their* route. (perspective)
89
+
90
+ ## Common pitfalls
91
+
92
+ - **Illegible perception.** Cones you can't see or infer make stealth a save-scum
93
+ lottery. Draw the danger.
94
+ - **Concealment that doesn't.** If shadow only *sometimes* hides, the player stops
95
+ trusting the map and starts fleeing — the loop collapses. Prove it holds a full
96
+ loop.
97
+ - **Joint-phase gates.** Requiring two patrols to align is an unfair wait. Chain
98
+ single-guard windows.
99
+ - **Pocketless marathons.** A long open crossing with no midpoint refuge is a
100
+ memorisation gauntlet, not a plan.
101
+ - **Combat as the out.** If fighting your way through is easier than sneaking, it's
102
+ a shooter with cones. Make exposure genuinely costly.
103
+
104
+ ## Anchors
105
+
106
+ - [[anchor-shadow-of-mordor]] — systemic guard memory; enemies that adapt to your
107
+ routes turn stealth into an evolving rivalry.
108
+
109
+ ## Verify
110
+
111
+ Prove it with **[FUN.md §5 · Stealth](../../docs/FUN.md#5--stealth)** —
112
+ heist bot 0-alarm run + a punished-exposure assertion + a concealment-holds
113
+ assertion, balanced on cone-shadow duration with a midpoint pocket per long
114
+ traversal. Design the plannable danger here; prove both affordances there.
115
+
116
+ ## Composes with
117
+
118
+ - [[system-enemy-ai]] — readable, beatable patrol minds are the danger.
119
+ - [[pattern-pacing-and-tension]] — the hidden/caught knife-edge is a tension curve.
120
+ - [[system-encounter-design]] — cones and pockets composed into a route.
121
+
122
+ ## See also
123
+
124
+ - [`examples/veilstep`](../../examples/veilstep) — the reference stealth sim + proofs.
125
+ - [`docs/FUN.md §5`](../../docs/FUN.md#5--stealth) — the proof playbook.
@@ -0,0 +1,124 @@
1
+ ---
2
+ id: genre-survival-horror
3
+ title: Survival Horror
4
+ kind: genre
5
+ tags: [survival-horror, dread, resource, fuel, light, darkness, tension, scarcity]
6
+ summary: Scarcity-driven dread where difficulty lives in resource arithmetic — dread you can budget, not monster stats you can't.
7
+ use-when: Designing a survival-horror game whose fear is scarcity you must ration, with light/dark and a fuel economy as the pressure.
8
+ composes-with: [system-economy, system-grace, pattern-pacing-and-tension, system-resource-loops]
9
+ anchors: [anchor-outer-wilds]
10
+ verify-with: docs/FUN.md#16--survival-horror
11
+ ---
12
+
13
+ # Survival Horror
14
+
15
+ **What it is.** A hostile dark you must cross with too little to cross it. Fuel, light,
16
+ ammo, and health are scarce; the monster is a pressure, not a stat-check. You budget
17
+ your way to dawn — every lit second spends a resource you can't get back.
18
+
19
+ **Player fantasy / why it's fun.** *"I can survive this if I spend right — and I'm not
20
+ sure I can afford it."* The fear is **dread you can budget**: horror that lives in
21
+ arithmetic, so the player is always calculating, never merely reacting. Tension is a
22
+ ledger with a monster leaning over it.
23
+
24
+ ## Pillars
25
+
26
+ 1. **Difficulty is resource arithmetic.** The night is hard because the **fuel economy**
27
+ is tight, not because the monster hits for more. Balance lives in a spreadsheet you
28
+ expose to the player as scarcity.
29
+ 2. **Camping is impossible; the night is winnable — from the same numbers.** One fuel
30
+ inequality must prove *both*: you cannot hide until dawn, and dawn is reachable if
31
+ you spend well. That single arithmetic sets the whole difficulty.
32
+ 3. **Wound before death; grace over instadeath.** One grab is a story; two is a death.
33
+ The genre's mercy is a [[system-grace]] system — a wound state and buffered intent —
34
+ not a coin-flip kill.
35
+
36
+ ## The loop stack
37
+
38
+ | Layer | The beat |
39
+ |---|---|
40
+ | **Moment** | Spend light to see → move through danger → the meter drops. |
41
+ | **Encounter** | A room/threat: cross it on a fuel budget, take a wound or spend to avoid it. |
42
+ | **Session** | A night: reach dawn before the economy runs dry. |
43
+ | **Meta** | Nights, upgrades, map knowledge; scarcity eases as mastery grows. |
44
+
45
+ ## Essential systems
46
+
47
+ | System | Why this genre needs it |
48
+ |---|---|
49
+ | [[system-economy]] | Fuel/light/ammo faucets and sinks ARE the difficulty; a tight, honest ledger is the whole tension. |
50
+ | [[system-grace]] | The wound-before-death mercy; one grab buffers, two kills — grace as a system, unit-tested to the frame. |
51
+ | [[pattern-pacing-and-tension]] | Dread needs valleys (safe rooms, saved light) to make the peaks (a chase, a dark corridor) land. |
52
+ | [[system-resource-loops]] | Gather light/fuel → spend to survive → find more; the bottleneck is the pacing. |
53
+ | [[system-save-and-checkpoint]] | Horror respects the player's time between dread spikes; a punishing retry loop turns fear into resentment. |
54
+ | [[system-enemy-ai]] | The monster must be readable and beatable — a pressure with tells, not an invisible dice roll. |
55
+
56
+ ## Content & difficulty model
57
+
58
+ - **Prove both halves of the fuel inequality.** From one arithmetic: a **keeper/camping
59
+ bot must die** (you can't hide to dawn) AND a diligent bot **survives to dawn** (the
60
+ night is winnable). If camping survives, there's no threat; if nothing survives, it's
61
+ unfair.
62
+ - **Light must collide with the world.** Anything that interacts with light must collide
63
+ with the light's occluders — or shadows hide invisible, unfair killers. Prove
64
+ *light-repels* and *darkness-kills* each as a rule, against the actual geometry.
65
+ - **Difficulty = tighter budget, not bigger numbers.** A harder night gives less fuel,
66
+ a longer dark, fewer safe rooms — never a monster with more HP. Scarcity scales; the
67
+ monster stays a pressure.
68
+ - **Wound honesty.** A grab wounds visibly and buffers; the next is lethal. Assert the
69
+ grace window frame-exactly (same shape as any grace system).
70
+ - **Content is nights + map.** New nights add a new arithmetic wrinkle (a new sink, a
71
+ darker map); knowledge of the map is the real progression.
72
+
73
+ ## Signature-mechanic seeds
74
+
75
+ - **Survival horror but cozy by day, dread by night** — you tend and rebuild in light,
76
+ then defend on a fuel budget in the dark (tonal + structure; splices
77
+ [[genre-farming-sim]]'s calm against the night's ledger).
78
+ - **Survival horror but knowledge is the only weapon** — no combat; you survive by what
79
+ you've learned about the monster's rules (mechanic-swap toward [[anchor-outer-wilds]];
80
+ dread becomes deduction).
81
+ - **Survival horror but the light is a shared resource in coop** — two players, one fuel
82
+ ledger, forced communication in the dark (perspective + constraint; pairs with
83
+ [[system-coop-and-competition]]).
84
+ - **Survival horror but every death rewrites the house** — the map remembers and mutates
85
+ around your failures (structure; systemic memory à la [[system-emergent-systems]]).
86
+ - **Survival horror but one candle, one screen, sixty seconds** — a hard constraint that
87
+ makes every second of light a decision (constraint).
88
+
89
+ ## Common pitfalls
90
+
91
+ - **Difficulty in monster stats.** Scaling HP/damage makes horror a stat-check, not a
92
+ budget; the fear evaporates into a health bar. Scale scarcity instead.
93
+ - **Light without occlusion.** Shadows that don't collide become invisible killers — the
94
+ single most unfair bug the genre invites.
95
+ - **Campable nights.** If hiding survives to dawn, there's no threat; the fuel inequality
96
+ exists to forbid it.
97
+ - **Instadeath.** A coin-flip kill reads as unfair and breaks the budgeting fantasy; wound
98
+ first, buffer intent, then kill.
99
+ - **Relentless dread.** Unbroken tension goes numb; without safe valleys the peaks stop
100
+ spiking. [[pattern-pacing-and-tension]] is load-bearing here.
101
+
102
+ ## Anchors
103
+
104
+ - [[anchor-outer-wilds]] — knowledge as the only progression; the reference for the
105
+ no-combat, dread-as-deduction bend, and for a curiosity-gated dark to explore.
106
+
107
+ ## Verify
108
+
109
+ Keeper bot survives to dawn; light-repels and darkness-kills each proven; fuel solvency
110
+ inequality; golden night → **[docs/FUN.md §16 · Survival horror](../../docs/FUN.md#16--survival-horror)**.
111
+ Author the ledger and the mood-predicate here; prove the inequality there.
112
+
113
+ ## Composes with
114
+
115
+ - [[system-economy]] — the fuel/light ledger that IS the difficulty.
116
+ - [[system-grace]] — the wound-before-death mercy that keeps dread fair.
117
+ - [[pattern-pacing-and-tension]] — the valleys that make the dread spikes land.
118
+
119
+ ## See also
120
+
121
+ - [docs/FUN.md §16](../../docs/FUN.md#16--survival-horror) — mechanical truth + verify recipe.
122
+ - [docs/JUICE.md](../../docs/JUICE.md) — feel gates for the light/shadow and wound choreography.
123
+ - [`sandboxes/`](../../sandboxes/) — the light/physics lab to prove occlusion and a fuel
124
+ budget before building a night.
@@ -0,0 +1,123 @@
1
+ ---
2
+ id: genre-tactics
3
+ title: Turn-Based Tactics
4
+ kind: genre
5
+ tags: [tactics, turn-based, grid, telegraphs, perfect-information, puzzle, positioning]
6
+ summary: Rewriting a telegraphed future — perfect information, honest tells stored as directions, and every fight a solvable positioning puzzle.
7
+ use-when: You want a grid combat game where you see the enemy's plan and the fun is redirecting it, not out-rolling it.
8
+ composes-with: [system-telegraphs, system-enemy-archetypes, system-encounter-design, system-combat-model, system-difficulty-and-dda]
9
+ anchors: [anchor-into-the-breach]
10
+ verify-with: docs/FUN.md#12--turn-based-tactics-into-the-breach-like
11
+ ---
12
+
13
+ # Turn-Based Tactics
14
+
15
+ **What it is.** Grid combat where the enemy **shows you their whole plan**, then
16
+ you act. No hidden rolls, no fog — the fun is *rewriting a telegraphed future*
17
+ with positioning: push an enemy so its attack hits another enemy, block a spawn,
18
+ bump a unit off a ledge. Each fight is a solvable puzzle, not a dice game.
19
+
20
+ **Player fantasy / why it's fun.** *"I saw the disaster coming and turned it
21
+ against them."* Perfect information makes you feel like a chess master: the win
22
+ is *found*, not *rolled*, and a clean multi-enemy redirect is pure satisfaction.
23
+
24
+ ## Pillars
25
+
26
+ 1. **Rewrite the telegraph.** Store telegraphs as **directions on units**, not
27
+ target tiles — so pushing a unit *re-resolves* what it hits. The telegraph is
28
+ a live plan you edit, which is the entire game.
29
+ 2. **Perfect information, perfect honesty.** What's shown is exactly what
30
+ resolves. No hidden variance. The genre's trust is that the display is the
31
+ truth (law 6).
32
+ 3. **Both proofs, every scenario.** A scenario needs a *winning line* AND a
33
+ *losing do-nothing*. If passivity survives, there's no threat; if no line
34
+ exists, it's unfair. The first cut's bug is usually "can't even reach the
35
+ objective."
36
+
37
+ ## The loop stack
38
+
39
+ | Scale | The beat |
40
+ |---|---|
41
+ | **Moment** | Read a telegraph → move/push a unit → watch the future re-resolve in your favor. |
42
+ | **Encounter** | A scenario: protect an objective from telegraphed threats over N turns using positioning. |
43
+ | **Session** | A mission chain / island: escalating scenarios, limited resources carried between them. |
44
+ | **Meta** | Unlock squads, mechs, and mechanics; learn the redirect vocabulary. |
45
+
46
+ ## Essential systems
47
+
48
+ | System | Why it's load-bearing |
49
+ |---|---|
50
+ | [[system-telegraphs]] | The whole loop. Stored as directions, resolved after your move — the editable future. |
51
+ | [[system-enemy-archetypes]] | The threat roles whose telegraphs you redirect — melee, artillery, spawner, boss. |
52
+ | [[system-encounter-design]] | Composing archetypes + objectives into a scenario with a findable line and a losing null. |
53
+ | [[system-combat-model]] | Push, bump, redirect resolution — the deterministic rules a scenario is built on. |
54
+ | [[system-difficulty-and-dda]] | Threat density and turn count as the ramp; harder = tighter lines, not hidden rolls. |
55
+
56
+ ## Content & difficulty model
57
+
58
+ - **Content is scenarios, not stats.** A scenario is a board + objective + a
59
+ telegraphed threat sequence with a *provable* solution. Hand-authored or
60
+ generated, each must pass the two proofs.
61
+ - **Difficulty = tighter solution space.** More threats, fewer turns, harder
62
+ objectives — the line still exists but demands more precision. Never add hidden
63
+ variance to raise difficulty.
64
+ - **Every mechanic proven in isolation.** Push, bump, redirect, spawn-block each
65
+ get a unit test before they combine (law 3 / derive-don't-vibe).
66
+ - **Bots are real defenders.** A 1-ply greedy planner over `structuredClone`
67
+ scoring is a genuine baseline — it should perfect-clear a solvable scenario and
68
+ the do-nothing bot should lose everything.
69
+
70
+ ## Signature-mechanic seeds
71
+
72
+ - **Tactics but you command the enemies too** *(perspective)* — set both sides'
73
+ telegraphs, then a rival edits yours; a duel of redirects.
74
+ - **Tactics but the grid is a deck you draft** *(structure)* — Into-the-Breach
75
+ meets Slay-the-Spire; your moves are cards. Bridges [[genre-deckbuilder]].
76
+ - **Tactics but one push ripples through a chain** *(mechanic-swap)* — dominoes:
77
+ every shove can cascade, turning the board into a physics puzzle.
78
+ - **Tactics but you protect a city that remembers** *(theme + structure)* —
79
+ Kentō town rebuilt between missions; buildings saved persist as bonuses.
80
+ - **Tactics but the future is shown only for one turn** *(constraint)* — a memory
81
+ variant; you plan several moves against a telegraph you can no longer see.
82
+
83
+ ## Common pitfalls
84
+
85
+ - **Telegraphs stored as tiles.** If a tell targets a *tile*, pushing the
86
+ attacker doesn't rewrite it — and the core verb (redirect) silently breaks.
87
+ Store directions on units.
88
+ - **Hidden variance.** Any concealed roll violates the perfect-information trust;
89
+ a "miss" the player couldn't foresee feels like a betrayal.
90
+ - **Passive survives.** A scenario a do-nothing bot lives through has no threat.
91
+ Always assert the losing null.
92
+ - **No line exists.** An unsolvable scenario is unfair. Prove the winning line
93
+ before shipping (greedy bot perfect-clears).
94
+ - **Objective unreachable.** The classic first-cut bug — the plan can't even
95
+ touch the goal. Test reachability.
96
+
97
+ ## Anchors
98
+
99
+ - [[anchor-into-the-breach]] — the definitive reference: perfect information,
100
+ telegraphed grid, redirect-the-future. Steal the whole model.
101
+ - [[genre-deckbuilder]] — a natural blend (moves-as-cards); shares the
102
+ telegraph-honesty and skill-delta discipline.
103
+
104
+ ## Verify
105
+
106
+ Prove it in **[FUN.md §12 · Turn-based
107
+ tactics](../../docs/FUN.md#12--turn-based-tactics-into-the-breach-like)**: the
108
+ greedy bot perfect-clears, the do-nothing bot loses everything, each mechanic
109
+ (push/bump/redirect) is proven in isolation, and a golden end-state replays.
110
+
111
+ ## Composes with
112
+
113
+ - [[system-telegraphs]] — the editable future that IS the loop.
114
+ - [[system-enemy-archetypes]] — the threat roles you redirect.
115
+ - [[system-encounter-design]] — scenarios with a findable line and a losing null.
116
+
117
+ ## See also
118
+
119
+ - [`examples/sokoban`](../../examples/sokoban) — the pure `Puzzle<State,Move>`
120
+ logic/view split and clone-and-score bot; tactics is that pattern with
121
+ telegraphs (laws 6, 7).
122
+ - [docs/FUN.md](../../docs/FUN.md) Part 1 — laws 3, 6, 7 underwrite this genre's
123
+ determinism and honesty.