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,120 @@
1
+ ---
2
+ id: genre-tower-defense
3
+ title: Tower Defense
4
+ kind: genre
5
+ tags: [tower-defense, td, waves, towers, counters, lanes, build-order]
6
+ summary: Build decisions that matter — near-hard counters, range-ring geometry, and wave curves that breathe.
7
+ use-when: You want a spatial build-and-defend loop where placement and counter-picks decide the run, not tower count.
8
+ composes-with: [system-counter-systems, system-enemy-archetypes, system-difficulty-and-dda, system-economy, system-encounter-design]
9
+ anchors: [anchor-into-the-breach]
10
+ verify-with: docs/FUN.md#8--tower-defense
11
+ ---
12
+
13
+ # Tower Defense
14
+
15
+ **What it is.** Enemies walk a path; you spend a shared economy building
16
+ **towers** that fire on them. The whole game is *where you place what* — a
17
+ spatial optimisation puzzle that plays out in real time across escalating waves.
18
+
19
+ **Player fantasy / why it's fun.** *"I read the wave, I built the counter, I
20
+ watched my machine hold the line."* The satisfaction is a plan surviving contact
21
+ — then the finale wave that almost breaks it and doesn't.
22
+
23
+ ## Pillars
24
+
25
+ 1. **Counters must bite.** A counter is near-*hard*, not a soft resist. Soft
26
+ resists get erased by tower-count scaling — if stacking one tower beats
27
+ everything, there are no build decisions.
28
+ 2. **Coverage is geometry.** range × distance-to-lane = the fire-window chord. A
29
+ tower's worth is *how long it can shoot each enemy*. The **range ring is the
30
+ genre's most important UI**.
31
+ 3. **Waves breathe.** Pressure then relief. Runner waves are breaks; the curve
32
+ ramps in envelope, not monotone HP. A wall of ever-bigger numbers is a
33
+ spreadsheet, not tension.
34
+
35
+ ## The loop stack
36
+
37
+ | Scale | The beat |
38
+ |---|---|
39
+ | **Moment** | Place/upgrade a tower; watch its ring cover the lane; a leaker slips and you patch the gap. |
40
+ | **Encounter** | A wave: read its archetype mix → the economy you saved buys the counter → it holds or leaks. |
41
+ | **Session** | A map, ~10 waves: opening eco vs defence tension, a midwave spike, a finale that peaks. |
42
+ | **Meta** | Unlock towers, maps, difficulty tiers; carry a build-order intuition between runs. |
43
+
44
+ ## Essential systems
45
+
46
+ | System | Why it's load-bearing |
47
+ |---|---|
48
+ | [[system-counter-systems]] | The duel matrix. Each enemy archetype has a near-hard answer; picking it is the decision. |
49
+ | [[system-enemy-archetypes]] | The alphabet a wave is spelled from — fast/armored/flying/swarm/shielded. |
50
+ | [[system-difficulty-and-dda]] | The wave curve: ramp, breathers, finale peak — gate on shape, not raw HP. |
51
+ | [[system-economy]] | The spend that makes placement a *choice* — build now vs save for the counter. |
52
+ | [[system-encounter-design]] | Composing archetypes into a wave that demands a mixed build. |
53
+
54
+ ## Content & difficulty model
55
+
56
+ - **Wave = an archetype recipe.** Author waves as mixes (8 fast + 2 armored),
57
+ not HP totals. Difficulty is the *mix* forcing a broader build, plus tighter
58
+ timing.
59
+ - **Gate the curve on shape.** Assert "each wave ≥ 55% of the previous, finale
60
+ peaks" — not monotone HP. Runner waves are intentional dips.
61
+ - **The bare-lane baseline.** A lane with no towers must fall early (null-strategy
62
+ proof, FUN.md law 4). A "threat" a do-nothing survives isn't a threat.
63
+ - **Mixed beats mono.** The intended mixed build survives 10/10; a mono build on
64
+ a *bigger* budget fails. That gap is the proof the counters matter.
65
+
66
+ ## Signature-mechanic seeds
67
+
68
+ - **TD but you also walk the path** *(perspective)* — a hero unit you steer
69
+ between builds; placement and positioning share your attention.
70
+ - **TD but the towers are the enemies' path** *(mechanic-swap)* — every tower
71
+ you place reshapes the maze; maze-building becomes the core decision.
72
+ - **TD but the wave is a deck you drafted** *(structure)* — you *build the
73
+ attack* for a rival lane and defend theirs. Pairs [[system-build-diversity]].
74
+ - **TD but ammo is a shared resource that runs dry** *(constraint)* — towers
75
+ compete for a finite magazine; over-building starves the finale.
76
+ - **TD but towers age and crack** *(theme + tonal)* — Kentō stonework that
77
+ weathers each wave; repair vs expand becomes the economy tension.
78
+
79
+ The strongest TD twist bends the *decision*, not the theme: change what the
80
+ player builds against (a rival's drafted wave), what the towers cost (a shared
81
+ magazine), or where the path goes (maze-building). See [[process-the-twist]].
82
+
83
+ ## Common pitfalls
84
+
85
+ - **Soft counters.** A 20% resist vanishes under stacking. Make the counter
86
+ near-hard or the build collapses to "spam the best tower."
87
+ - **Monotone HP ramp.** Waves that only grow read as a slog. Breathers and a
88
+ peaked finale are the pacing.
89
+ - **Invisible range.** Without a visible ring, placement is guesswork and
90
+ coverage-as-geometry is illegible.
91
+ - **Economy with no tension.** If you can always afford everything, placement
92
+ isn't a decision — starve the player enough to force priorities.
93
+ - **Global upgrades over placement.** If flat "+damage" buttons beat clever
94
+ positioning, coverage-as-geometry is dead. Keep the map the puzzle.
95
+
96
+ ## Anchors
97
+
98
+ - [[anchor-into-the-breach]] — perfect-information spatial threat-reading; TD is
99
+ the real-time cousin. Steal its "read the telegraph, answer with placement."
100
+ - [[system-counter-systems]]'s duel matrix is the balance skeleton — treat each
101
+ tower↔archetype pair as a proven duel.
102
+
103
+ ## Verify
104
+
105
+ Prove it in **[FUN.md §8 · Tower defense](../../docs/FUN.md#8--tower-defense)**:
106
+ mixed build survives 10/10, a bigger-budget mono build fails, the bare lane
107
+ falls early, and counter duels resolve from both sides.
108
+
109
+ ## Composes with
110
+
111
+ - [[system-counter-systems]] — the near-hard duel matrix the whole game rests on.
112
+ - [[system-enemy-archetypes]] — the archetype alphabet waves are written in.
113
+ - [[system-difficulty-and-dda]] — the breathing wave curve.
114
+
115
+ ## See also
116
+
117
+ - [`sandboxes/pathfinding-demo`](../../sandboxes/pathfinding-demo) — lane/path and
118
+ flow-field wiring for enemy movement.
119
+ - [`examples/sokoban`](../../examples/sokoban) — the logic/view split reference:
120
+ keep wave resolution pure, the range rings and hit sparks cosmetic (law 6).
@@ -0,0 +1,69 @@
1
+ # 30-systems/ — The Modular Systems Library
2
+
3
+ The **parts bin**. Where [`20-genres/`](../20-genres/) gives you a whole
4
+ skeleton, this section gives you the *organs* — progression, economy, combat,
5
+ factions, AI, rewards — each a self-contained module you bolt onto a design and
6
+ tune. The [COMPOSE step](../README.md) of the pipeline lives here: pick the genre
7
+ template, then pull the `system-*` modules it needs and wire them together. Every
8
+ module says **what it is · when to use / when NOT · variants · tuning levers ·
9
+ how it wires to Hayao · fails when… · verify** — so you compose the known, then
10
+ bend it, and hand off proofs to [`docs/FUN.md`](../../docs/FUN.md).
11
+
12
+ Each entry links `verify-with` into FUN/JUICE/VERIFICATION rather than restating
13
+ the proof. Cross-link with `[[system-id]]`; follow `composes-with`.
14
+
15
+ ## Progression · economy · rewards
16
+
17
+ | id | title | summary |
18
+ |---|---|---|
19
+ | [[system-progression]] | Progression | XP / levels / the power curve; pacing power gain, vertical vs horizontal |
20
+ | [[system-skill-trees]] | Skill Trees | Branching unlocks; builds; meaningful exclusivity; respec as grace |
21
+ | [[system-meta-progression]] | Meta-Progression | Roguelite persistent unlocks; power-creep vs options; "always earn something" |
22
+ | [[system-mastery-curve]] | Mastery Curve | Learnable depth; skill ceiling; easy-to-learn-hard-to-master as a mechanism |
23
+ | [[system-economy]] | Economy | Faucets & sinks; currencies; inflation control; the pacing window |
24
+ | [[system-resource-loops]] | Resource Loops | Gather→convert→spend cycles; bottlenecks as pacing |
25
+ | [[system-crafting]] | Crafting | Recipes; combinatorial depth; discovery vs lookup |
26
+ | [[system-tech-tree]] | Tech Tree | Research gating; branch exclusivity; the ramp of options |
27
+ | [[system-reward-schedules]] | Reward Schedules | Variable-ratio drops/chests/loot; ethical compulsion, dark patterns to refuse |
28
+ | [[system-collectibles]] | Collectibles | Sets, completion, cosmetics; optional goals with pull |
29
+
30
+ ## Combat · factions
31
+
32
+ | id | title | summary |
33
+ |---|---|---|
34
+ | [[system-combat-model]] | Combat Model | Damage, resolution, timing; the shape of a hit |
35
+ | [[system-telegraphs]] | Telegraphs | Tells, windups, readable threat; reaction windows |
36
+ | [[system-status-effects]] | Status Effects | DoT / buffs / debuffs; stacking rules; build interaction |
37
+ | [[system-counter-systems]] | Counter Systems | Rock-paper-scissors; near-hard counters; the duel matrix |
38
+ | [[system-faction-asymmetry]] | Faction Asymmetry | Asymmetric identities that balance; "different but fair" |
39
+ | [[system-unit-rosters]] | Unit Rosters | Unit roles, tiers, diversity; a legible roster |
40
+ | [[system-boss-design]] | Boss Design | Phases, telegraphs, spectacle; the set-piece fight |
41
+ | [[system-build-diversity]] | Build Diversity | Weapons / loadouts / synergies; many viable strategies |
42
+ | [[system-grace]] | Grace | Coyote / i-frames / buffer / mercy as a system |
43
+ | [[system-enemy-ai]] | Enemy AI | Behavior, aggro / threat, steering; readable, beatable minds |
44
+ | [[system-enemy-archetypes]] | Enemy Archetypes | Tank / skirmisher / artillery / swarm / support; the enemy alphabet |
45
+ | [[system-encounter-design]] | Encounter Design | Composing archetypes into fights; pressure & pockets |
46
+
47
+ ## Structure · AI · procgen · meta · social
48
+
49
+ | id | title | summary |
50
+ |---|---|---|
51
+ | [[system-difficulty-and-dda]] | Difficulty & DDA | Difficulty curves; spikes / breathers; dynamic difficulty; assist |
52
+ | [[system-onboarding]] | Onboarding | Tutorialization; teach-by-doing; the first ten minutes |
53
+ | [[system-accessibility]] | Accessibility | Assist modes; remap; colour / contrast; readability floors |
54
+ | [[system-procgen-design]] | Procgen Design | Runs, seeds, variance as content; controlled randomness |
55
+ | [[system-session-structure]] | Session Structure | Run / campaign / level / world; session length & shape |
56
+ | [[system-save-and-checkpoint]] | Save & Checkpoint | Save, checkpoint, retry; respecting the player's time |
57
+ | [[system-emergent-systems]] | Emergent Systems | Nemesis-style memory, relationships, reputation; systemic story |
58
+ | [[system-coop-and-competition]] | Coop & Competition | Coop / PvP hooks; asymmetric coop; interdependence & rivalry |
59
+
60
+ ## Generate the content; don't hand-author it
61
+
62
+ Most of these systems produce *content* — levels, recipes, unlock curves, drop
63
+ tables. The Hayao way is to **generate and prove** it, not to hand-write forty
64
+ balanced rooms and hope. Point your progression/economy/loop pacing at
65
+ [`src/content/`](../../src/content/) — `generateLevels` (solver-verified,
66
+ in-band levels), `composeCampaign` (acts that ramp), `assertRamp`/`rampIssues`
67
+ (the curve has no deserts, no walls). The 42-level generated reference is
68
+ [`examples/lanternfold/`](../../examples/lanternfold/). Design the *shape* here;
69
+ let the generator fill it and the verify suite prove it.
@@ -0,0 +1,110 @@
1
+ ---
2
+ id: system-accessibility
3
+ title: Accessibility
4
+ kind: system
5
+ tags: [accessibility, assist, remap, colorblind, contrast, readability, a11y, salience]
6
+ summary: Assist modes, input remap, and colour/contrast that clear a readability floor — more players reach the game, none are shamed for it.
7
+ use-when: You want the game playable by more people — different hands, eyes, and skill levels — without a separate "easy" ghetto.
8
+ composes-with: [system-difficulty-and-dda, pattern-readability, world-aesthetic-direction, system-onboarding]
9
+ anchors: [anchor-celeste]
10
+ verify-with: docs/JUDGE.md
11
+ ---
12
+
13
+ # Accessibility
14
+
15
+ **What it is.** The set of choices that let **more people play the same game**:
16
+ assist modes (speed, invulnerability, skip), full **input remap**, and a
17
+ **colour/contrast** floor so threats and the avatar read for colour-blind and
18
+ low-vision players. Accessibility is not a difficulty setting bolted on — it's a
19
+ **readability and control floor** the whole design stands on.
20
+
21
+ **Player fantasy / why it's fun.** Everyone gets the *actual* fantasy, tuned to
22
+ their body. Celeste's assist mode doesn't make a lesser game — it makes the *same*
23
+ game reachable. The pull is dignity: the game meets the player where they are.
24
+
25
+ ## When to use / when NOT
26
+
27
+ | Use it when | Non-negotiable when |
28
+ |---|---|
29
+ | Any single-player game | *Colour/contrast is never optional* — it's a floor, always on |
30
+ | Skill games with a high ceiling | Remap: any keyboard/gamepad game — bodies differ |
31
+ | Games leaning on colour to signal | Assist modes: any game where "too hard" loses players you could keep |
32
+
33
+ > **Accessibility is a floor, not a mode.** Contrast, remap, and salience aren't
34
+ > a menu you *could* add — they're the baseline every player relies on, including
35
+ > the ones who never open the options screen. Build the floor first; the toggles
36
+ > are the ramp above it.
37
+
38
+ ## The axes
39
+
40
+ | Axis | What it covers | Cheapest win |
41
+ |---|---|---|
42
+ | **Motor** | remap, hold-vs-toggle, reduced APM, larger targets | full key/button remap |
43
+ | **Visual** | contrast, colour-blind-safe palette, non-colour cues, text size | shape/icon *plus* colour, never colour alone |
44
+ | **Cognitive** | clear goals, no time-pressure option, readable telegraphs | slower/optional timers |
45
+ | **Difficulty** | assist toggles (speed %, i-frames, skip) | per-axis, not one slider |
46
+
47
+ ## Tuning levers
48
+
49
+ | Lever | Effect | Watch for |
50
+ |---|---|---|
51
+ | **Contrast ratio** (avatar vs. field, text vs. bg) | legibility floor | measure it — don't eyeball it |
52
+ | **Redundant cues** | colour + shape + motion for each signal | colour-only = invisible to ~8% of players |
53
+ | **Remap coverage** | which actions are rebindable | a hard-coded key is an inaccessible wall |
54
+ | **Assist granularity** | per-axis toggles vs. one dial | one slider forces all-or-nothing |
55
+
56
+ ## How it wires to Hayao
57
+
58
+ - **Contrast is measurable.** `contrastRatio(a, b)` (grep `docs/API.md`) gives the
59
+ WCAG-style ratio for any two hex colours — gate avatar-vs-field and text-vs-bg
60
+ against a threshold. The Kentō palette is *already* AA-gated
61
+ ([[world-aesthetic-direction]], `npm run palette`), so build on it.
62
+ - **Redundant cues ride readability.** The `src/verify/gates.ts` readability gate
63
+ checks the avatar out-contrasts its surroundings and threats telegraph — that
64
+ *is* the visual-accessibility floor made checkable. Pair colour with the
65
+ telegraph shape so the signal survives colour-blindness ([[pattern-readability]],
66
+ JUDGE).
67
+ - **Remap & assist are declared tuning.** Model assist axes as `tuning:` knobs
68
+ ([`docs/STUDIO.md`](../../docs/STUDIO.md)); resolved via `world.tune(key)`, they
69
+ stay in `world.hash()`, so an assisted or remapped run is still a first-class,
70
+ replayable artifact — never a cheat path.
71
+ - **Input is action-based.** Because UI intent flows through input *actions*
72
+ (CONVENTIONS), remapping a key is a lookup change, not a sim change — the action
73
+ log and determinism are untouched.
74
+
75
+ ## Fails when…
76
+
77
+ - **Colour carries a signal alone.** Red-vs-green danger with no shape cue is
78
+ invisible to a large minority — always add a second channel.
79
+ - **Hard-coded controls.** One unbindable key excludes anyone whose hands don't fit
80
+ it.
81
+ - **Assist as a lesser mode.** Withholding content/achievements on assist turns a
82
+ humane tool into a punishment (the opposite of Celeste's stance).
83
+ - **Contrast by vibe.** "Looks fine to me" fails the players it's for — measure
84
+ with `contrastRatio`.
85
+ - **Text-size afterthought.** Tiny fixed HUD text walls out low-vision players.
86
+
87
+ ## Verify
88
+
89
+ - **Contrast gate:** `contrastRatio(avatar, field)` and text-vs-bg pass a threshold
90
+ (build on the AA-gated Kentō palette, `npm run palette`).
91
+ - **Readability floor:** avatar out-contrasts surroundings, threats telegraph —
92
+ [`src/verify/gates.ts`](../../src/verify/gates.ts) + [JUDGE.md](../../docs/JUDGE.md)
93
+ (the headless SVG look).
94
+ - **Assist stays deterministic:** golden-hash a run per assist setting; tuning is
95
+ in `world.hash()` (STUDIO knob semantics).
96
+ - **Remap covers every action:** lint that no gameplay action is bound to an
97
+ unremappable key.
98
+
99
+ ## Composes with
100
+
101
+ - [[system-difficulty-and-dda]] — assist modes are difficulty's accessible face.
102
+ - [[pattern-readability]] — the salience floor accessibility depends on.
103
+ - [[world-aesthetic-direction]] — the AA-gated Kentō palette is your contrast head-start.
104
+ - [[system-onboarding]] — a readable first ten minutes is an accessibility win.
105
+
106
+ ## See also
107
+
108
+ - [`docs/JUDGE.md`](../../docs/JUDGE.md) — the readability/look bar, judged headlessly.
109
+ - [`src/verify/gates.ts`](../../src/verify/gates.ts) — the readability feel gate.
110
+ - [[anchor-celeste]] — assist mode as the field's humane benchmark.
@@ -0,0 +1,126 @@
1
+ ---
2
+ id: system-boss-design
3
+ title: Boss Design — the set-piece fight
4
+ kind: system
5
+ tags: [boss, phases, telegraph, spectacle, set-piece, mercy, encounter]
6
+ summary: The multi-phase set-piece — a fight that teaches, escalates, and telegraphs, with mercy on every phase transition so a death is fair, not cheap.
7
+ use-when: You need a climactic fight — a boss, an elite, a chapter finale — that's a spectacle and a skill test, not just a big HP bar.
8
+ composes-with: [system-telegraphs, system-combat-model, system-encounter-design, system-grace, system-enemy-ai]
9
+ anchors: [anchor-hades, anchor-into-the-breach]
10
+ verify-with: docs/FUN.md#7-bullet-hell
11
+ ---
12
+
13
+ # Boss Design — the set-piece fight
14
+
15
+ **What it is.** The **climax**: a single opponent (or arena) built as a multi-phase
16
+ performance — it teaches a pattern, escalates it, and pays off mastery. A boss is
17
+ [[system-combat-model]] turned up to spectacle, held fair by heavy
18
+ [[system-telegraphs]] and structural [[system-grace]].
19
+
20
+ **Player fantasy / why it's fun.** The mountain. A boss is a wall you learn to
21
+ climb — first attempt you're overwhelmed, tenth attempt you dance through it. The
22
+ fun is the *arc of competence*, from panic to mastery, capped by a moment of
23
+ spectacle you earned.
24
+
25
+ ## When to use / when NOT
26
+
27
+ | Use a boss when… | Skip when… |
28
+ |---|---|
29
+ | You want a skill/knowledge checkpoint | Pacing needs a valley, not a peak |
30
+ | A pillar deserves a climactic test | The genre is flat by design (idle, cozy) |
31
+ | The player has the full toolkit to show off | Mechanics aren't taught yet (too early) |
32
+
33
+ A boss is a *test* — it should demand the mechanics the game has already taught,
34
+ not introduce them. Front-load teaching in encounters ([[system-encounter-design]]);
35
+ let the boss examine.
36
+
37
+ ## Phase structure — the arc
38
+
39
+ | Phase | Job | Design note |
40
+ |---|---|---|
41
+ | **Read** | teach the boss's vocabulary | slow, legible telegraphs; low punish |
42
+ | **Pressure** | escalate — faster, layered patterns | now the taught reads matter |
43
+ | **Desperation** | the spike; new wrinkle or tempo | the memorable peak; keep it *fair* |
44
+ | **(optional) Puzzle** | a gimmick that gates damage | reflect-the-shot, break-the-armor |
45
+
46
+ Each phase should re-use the previous phase's vocabulary plus one new element —
47
+ escalation by *addition*, so the player is never asked to relearn from scratch.
48
+
49
+ ## The mercy law — FUN.md law 5
50
+
51
+ > **Phase transitions are a grace point, not a gotcha.** FUN.md §7: mercy clears on
52
+ > death and phase transitions are *structural*, not polish — without them deaths
53
+ > cascade (you die to a bullet that spawned during the cutscene).
54
+
55
+ Concretely, on every transition:
56
+
57
+ - **Clear active threats** — no leftover bullet/hitbox from the last phase kills you
58
+ during the transition.
59
+ - **Buffer input across the pause.** Any freeze the transition injects must re-emit
60
+ the player's intent (FUN.md law 5; §4 hit-stop rule). A dropped dash on a phase
61
+ change is the cheapest, worst death in the game.
62
+ - **Checkpoint the phase** if the fight is long — respect the player's time
63
+ ([[pattern-anti-frustration]]); losing phase 3 shouldn't replay phase 1 for the
64
+ twentieth time.
65
+
66
+ ## Tuning levers
67
+
68
+ | Lever | Does | Healthy range |
69
+ |---|---|---|
70
+ | **Phase HP split** | pacing across the fight | roughly even; a short desperation phase reads as a sprint |
71
+ | **Telegraph window** | reactability per attack | ≥ the §4 floor; longer for the big committal moves |
72
+ | **Punish window** | your damage opening after a whiff | real but bounded — the fight has rhythm |
73
+ | **Pattern density** | simultaneous threats | coherent, not a wall (§7 — density that *reads*) |
74
+ | **Mercy window** | i-frames / clears on transition | specced in frames, proven edge-in/edge-out |
75
+ | **Attempt cost** | retry friction | low — instant retry keeps momentum (FUN.md law 5) |
76
+
77
+ ## How it wires to Hayao
78
+
79
+ - **Every attack telegraphs.** Feed each threat's timeline to
80
+ `telegraphIssues(timeline, minFrames)` (in `@hayao`) — a boss move that goes live
81
+ cold is an unfair death (FUN.md §4/§7). See [[system-telegraphs]].
82
+ - **The desperation phase is a dodge-bot proof.** FUN.md §7: a greedy lookahead
83
+ dodger must clear the pattern deathless — if the bot dies, humans die unfairly.
84
+ Pure state + `world.rng` makes that bot free (law 7).
85
+ - **Mercy windows are gate-proven.** `graceWindowIssues(label, windowFrames, accepts)`
86
+ frame-pumps the transition i-frames and asserts accepted-inside / refused-outside
87
+ to the exact frame (FUN.md law 5).
88
+ - **Spectacle is cosmetic.** Shake, particles, hit-stop are view (`Shaker`,
89
+ `Particles`, JUICE Part 1) — bounded by `feedbackIssues` (death shake ≈ 0.5,
90
+ hit-stop ≤ 12 frames), out of `world.hash()`.
91
+
92
+ ## Fails when…
93
+
94
+ - **HP sponge.** No phases, no new vocabulary — just a long health bar. Tedium, not
95
+ a climax.
96
+ - **Untelegraphed spike.** The desperation phase adds an attack with no tell —
97
+ `telegraphIssues` fails; it should.
98
+ - **Transition death.** A leftover bullet or a dropped input during the phase change
99
+ kills you (the exact §7 cascade the mercy law prevents).
100
+ - **Teaches in the exam.** Introduces a mechanic the game never taught — the boss is
101
+ a filter, not a lesson.
102
+ - **Retry friction.** Long walk-back or slow retry breaks the learn-by-dying loop
103
+ (FUN.md law 5).
104
+
105
+ ## Verify
106
+
107
+ - **[FUN.md §7](../../docs/FUN.md)** — dodge bot clears each phase deathless; peak-bullet
108
+ count asserted; mercy clears on death and transition.
109
+ - **[FUN.md §4](../../docs/FUN.md)** — every attack telegraphed (`telegraphIssues`).
110
+ - **[FUN.md law 5](../../docs/FUN.md)** — transition i-frames proven edge-in/edge-out
111
+ (`graceWindowIssues`).
112
+ - Feel: death/boss-hit shake and hit-stop inside envelope (`feedbackIssues`) →
113
+ **[JUICE.md Part 3](../../docs/JUICE.md)**, **[VERIFICATION Channel 4](../../docs/VERIFICATION.md)**.
114
+
115
+ ## Composes with
116
+
117
+ - [[system-telegraphs]] — a boss is a telegraph showcase; readability is the whole test.
118
+ - [[system-grace]] — mercy on transitions, i-frames, instant retry are structural here.
119
+ - [[system-encounter-design]] — the boss examines what the encounters taught.
120
+ - [[system-combat-model]] — the boss is your combat model at maximum expression.
121
+
122
+ ## See also
123
+
124
+ - [`docs/FUN.md`](../../docs/FUN.md) §7 (mercy + dodge bot), §4 (telegraphs), law 5 (grace).
125
+ - [`docs/JUICE.md`](../../docs/JUICE.md) — spectacle within the feedback envelope.
126
+ - [[anchor-hades]] — bosses as repeatable, learnable set-pieces across runs.
@@ -0,0 +1,120 @@
1
+ ---
2
+ id: system-build-diversity
3
+ title: Build Diversity — many viable strategies
4
+ kind: system
5
+ tags: [builds, loadouts, synergy, diversity, dominant-strategy, viability, balance]
6
+ summary: Many strategies that all win — weapons, loadouts, and synergies tuned so the fun is choosing a build, not solving for the one correct build.
7
+ use-when: The player assembles a strategy from parts (weapons, cards, relics, skills) and you need more than one path to be worth taking.
8
+ composes-with: [system-status-effects, system-counter-systems, system-skill-trees, system-reward-schedules, system-meta-progression]
9
+ anchors: [anchor-slay-the-spire, anchor-vampire-survivors, anchor-hades]
10
+ verify-with: docs/FUN.md#11-roguelike-deckbuilder
11
+ ---
12
+
13
+ # Build Diversity — many viable strategies
14
+
15
+ **What it is.** The discipline of keeping **many builds viable** — so a player
16
+ assembling weapons, cards, relics, or skills faces *choices*, not a solved optimum.
17
+ The enemy of build diversity is the **dominant strategy**: the one loadout that
18
+ outperforms all others, collapsing the build screen into a lookup.
19
+
20
+ **Player fantasy / why it's fun.** *Expression.* "This is *my* run — poison stacks,
21
+ or crit-and-glass, or turtle-and-scale." Build diversity is what makes a roguelite
22
+ replayable: the mechanics are fixed, but the *strategy you author* is new each time.
23
+
24
+ ## When to use / when NOT
25
+
26
+ | Use it when… | Less critical when… |
27
+ |---|---|
28
+ | The player composes from many parts | There's one fixed kit |
29
+ | Replayability comes from strategy variety | Content variety carries replay instead |
30
+ | Synergies/[[system-status-effects]] exist | The game is short/linear |
31
+
32
+ ## Variants — where the diversity lives
33
+
34
+ | Source | Diversity from | Anchor |
35
+ |---|---|---|
36
+ | **Loadout** | pick a weapon/kit, whole run reorganizes | [[anchor-hades]] weapons/aspects |
37
+ | **Synergy engine** | parts combo multiplicatively | [[anchor-slay-the-spire]] archetypes; [[anchor-balatro]] jokers |
38
+ | **Passive stacking** | choices compound into a style | [[anchor-vampire-survivors]] evolutions |
39
+ | **Skill tree** | branch exclusivity forces identity | [[system-skill-trees]] |
40
+ | **Draft** | reward-of-N shapes the deck over time | Slay the Spire card-reward-of-3 + skip |
41
+
42
+ ## The anti-dominant-strategy discipline
43
+
44
+ A build system is healthy when **several distinct strategies clear the game at a
45
+ similar rate**. Four levers keep it that way:
46
+
47
+ 1. **Multiple engines, none strictly best.** Poison, crit, block-scaling, summons —
48
+ each should win in the hands of a pilot who commits. If one wins with *no* commit,
49
+ it's dominant. Cut or nerf it.
50
+ 2. **Near-hard counters keep any single engine honest.** A build with no weakness is
51
+ a dominant build; give each strategy a matchup it dreads
52
+ ([[system-counter-systems]]). Diversity and counters are the same problem.
53
+ 3. **Meaningful exclusivity.** If you can take *everything*, there's no build — just
54
+ a checklist. Force trades: branch exclusivity ([[system-skill-trees]]), deck size,
55
+ slot limits, opportunity cost.
56
+ 4. **Reward the synergy, not the pile.** Diversity comes from parts that *interact*
57
+ ([[system-status-effects]] combos), not from a longer list of flat +damage. Flat
58
+ stacking always converges on one optimum.
59
+
60
+ > **The proof is the delta, not the roster.** A big list of weapons proves nothing.
61
+ > What proves diversity is: *pilot build A, it wins; pilot build B, it wins; pilot
62
+ > the null / flat-stack build, it loses.* (FUN.md law 2, §11 draft-delta.)
63
+
64
+ ## Tuning levers
65
+
66
+ | Lever | Does | Healthy range |
67
+ |---|---|---|
68
+ | **Win-rate spread across builds** | how even the top strategies are | tight — no build ≫ the field |
69
+ | **Synergy multiplier** | payoff of a combo'd build | big enough to reward commitment, not so big it's mandatory |
70
+ | **Exclusivity** | how much you must give up to specialize | real trades; you can't have it all |
71
+ | **Floor build power** | how the "no plan" run does | it *loses* — the null baseline (law 2) |
72
+ | **Ramp/scaling** | how builds keep pace with difficulty | multiplicative build vs superlinear threat (§6) |
73
+
74
+ ## How it wires to Hayao
75
+
76
+ - **Pilot bots per build.** Pure state + `world.rng` (FUN.md law 7) lets you script a
77
+ greedy pilot for each archetype, run it, and compare win-rates. Assert the intended
78
+ builds land inside a win window and the null build falls below it (FUN.md §11).
79
+ - **The draft delta is the direct test.** Same pilot, drafting *off*, must lose much
80
+ more (Slay the Spire's 17→9). That single assertion catches "the build doesn't
81
+ matter" and "one build dominates" at once.
82
+ - **Synergies are pure status/state** — no special API; it's your data (grep
83
+ [`docs/API.md`](../../docs/API.md)). Reward drops via `weightedPick`/`pickEntry`
84
+ through `world.rng` keep the offer fair and replayable ([[system-reward-schedules]]).
85
+ - Reference: [[anchor-slay-the-spire]] DNA (draft-of-3 + skip, archetype engines).
86
+
87
+ ## Fails when…
88
+
89
+ - **A dominant strategy.** One build ≫ the field; every run converges on it, the
90
+ build screen is a lookup. The single most common diversity failure.
91
+ - **Flat stacking.** +damage on +damage always has one optimum; no interaction, no
92
+ identity ([[pattern-emergence]] is absent).
93
+ - **No exclusivity.** You take everything → there's no build, just accumulation.
94
+ - **Trap options.** Choices that are *always* wrong aren't diversity — they're
95
+ padding. Every offered part should win *somewhere*.
96
+ - **Diversity that doesn't survive scaling.** Builds that all work at easy but only
97
+ one keeps pace with the ramp (§6) — that's a dominant build in slow motion.
98
+
99
+ ## Verify
100
+
101
+ - **[FUN.md §11](../../docs/FUN.md)** — greedy pilot per build in the win window;
102
+ never-draft/null build below it; the draft delta.
103
+ - **[FUN.md law 2](../../docs/FUN.md)** — each viable build beats the null build by a margin.
104
+ - **[FUN.md §6](../../docs/FUN.md)** — builds keep pace with a superlinear ramp (for
105
+ horde/survivor builds).
106
+ - Determinism: golden hash of a scripted run per build.
107
+
108
+ ## Composes with
109
+
110
+ - [[system-status-effects]] — the interacting parts that make synergy engines.
111
+ - [[system-counter-systems]] — near-hard counters keep any single build honest.
112
+ - [[system-skill-trees]] — branch exclusivity is a primary diversity source.
113
+ - [[system-reward-schedules]] — how build parts are offered (draft-of-N, drops).
114
+ - [[system-meta-progression]] — persistent unlocks widen the build space over time.
115
+
116
+ ## See also
117
+
118
+ - [`docs/FUN.md`](../../docs/FUN.md) §11 (draft-delta), §6 (build-vs-tide), law 2 (skill delta).
119
+ - [[anchor-slay-the-spire]], [[anchor-balatro]] — synergy engines that stay diverse.
120
+ - [[pattern-emergence]] — diversity comes from interacting parts, not longer lists.
@@ -0,0 +1,108 @@
1
+ ---
2
+ id: system-collectibles
3
+ title: Collectibles — Sets, Completion & Optional Pull
4
+ kind: system
5
+ tags: [collectibles, sets, completion, cosmetics, optional-goals, 100-percent, checklist]
6
+ summary: Optional goals that pull without shoving — sets to complete, cosmetics to earn; the compulsion of the almost-full grid, kept honest.
7
+ use-when: You want optional content that rewards thoroughness and gives self-directed players a goal, without gating the main game behind it.
8
+ composes-with: [system-reward-schedules, system-meta-progression, system-economy, system-mastery-curve, system-collectibles]
9
+ anchors: [anchor-stardew-valley, anchor-dead-cells, anchor-vampire-survivors]
10
+ verify-with: docs/FUN.md#15-farminglife-sim
11
+ ---
12
+
13
+ # Collectibles — Sets, Completion & Optional Pull
14
+
15
+ **What it is.** **Optional goals with pull.** Things to find, fill, and complete —
16
+ a bestiary, a museum, a costume rack, a map's every corner. Collectibles give
17
+ self-directed players a *reason to keep going* after the critical path ends,
18
+ without making that content mandatory.
19
+
20
+ **Player fantasy / why it's fun.** "Just one more, and the set's complete." The
21
+ almost-full grid is a magnet; the empty slot is an itch. The pull is *closure* —
22
+ the collector's satisfaction of a thing made whole.
23
+
24
+ ## When to use / when NOT
25
+
26
+ | Use it when | Skip it when |
27
+ |---|---|
28
+ | You want optional long-tail goals for completionists | It would pad a tight, focused game with busywork |
29
+ | Exploration/thoroughness deserves a reward channel | The reward is required progress (then it's not optional) |
30
+ | Cosmetics give a low-power, high-pull earn | Everything must matter mechanically |
31
+
32
+ The discipline: collectibles are **optional**. The moment a set gates *required*
33
+ power or the ending, it stops being a pull and becomes a tax. Keep the rewards
34
+ *expressive* (cosmetics, lore, bragging rights) or *modest* (small bonuses) —
35
+ never the only path to core power.
36
+
37
+ ## Variants
38
+
39
+ | Variant | The pull is | Reward | Example |
40
+ |---|---|---|---|
41
+ | **Sets to complete** | Closure of a grid | Completion bonus / status | Bestiary, card album, museum |
42
+ | **Cosmetics** | Expression, status | Looks, zero power | Skins, dyes, titles |
43
+ | **Map completion** | Thoroughness | Reveal, %, secret | "100% map" ; hidden rooms |
44
+ | **Cumulative unlocks** | Milestone counting | New content at N | "Kill 100 → unlock weapon" ([[system-meta-progression]]) |
45
+ | **Lore/knowledge** | Curiosity | Story, world depth | Codex entries; audio logs ([[world-narrative-delivery]]) |
46
+ | **Living dex / catch-em-all** | The complete roster | Prestige, function | Pokédex; VS character unlocks |
47
+
48
+ ## Tuning levers
49
+
50
+ | Lever | What it controls | Healthy range / rule |
51
+ |---|---|---|
52
+ | **Set size** | Effort to complete | Big enough to be a journey, small enough to finish. Subdivide huge sets |
53
+ | **Progress visibility** | The itch | *Show the empty slots* — the grid with gaps IS the pull |
54
+ | **Acquisition clarity** | Fair vs guessy | The player should know *how* to get a missing one (or where to look) |
55
+ | **Reward weight** | Power vs cosmetic | Keep low-power / expressive; optional means optional |
56
+ | **Completion payoff** | The reason to finish | Give the 100% a *real* moment — a costume, a title, a secret |
57
+ | **Missable density** | Anxiety | Minimise permanently-missable items, or players stress-play |
58
+
59
+ ## How it wires to Hayao
60
+
61
+ - **Collection is state; the grid is chrome.** Owned/seen flags live in
62
+ `world.state` (or the meta slice via `SaveManager` for cross-run dexes); the
63
+ collection *screen* is `showScreen()` DOM, `cosmetic` where it renders in-world
64
+ (CLAUDE.md invariant 4, **[[FUN.md law 6]]**).
65
+ - **Prove completability.** Assert every collectible is *reachable/obtainable* —
66
+ no item stranded behind a cut path or an impossible drop. This is the same
67
+ connectivity sweep the roguelike runs on loot (**[[FUN.md §10]]**), and it
68
+ catches the cruelest bug: a 99%-completable set.
69
+ - **Show the player-critical number.** "3 of 12 found", "2 nights left to catch it"
70
+ — surface it, the way farming surfaces nights-in-season (**[[FUN.md §15]]**).
71
+ Knowledge the completionist needs, made visible.
72
+ - **Persist across runs** with `SaveManager` + `SAVE_FORMAT_VERSION` for meta
73
+ dexes; the collection round-trips and hashes.
74
+
75
+ ## Fails when…
76
+
77
+ - **99% completable.** One item unreachable (a cut spawn, a bugged drop) poisons the
78
+ whole set. The reachability sweep is non-negotiable.
79
+ - **Mandatory sets.** A collectible gating the ending or core power isn't optional —
80
+ it's a chore with extra steps.
81
+ - **Invisible progress.** No visible grid, no "N of M" — the pull evaporates.
82
+ - **Missable minefield.** Many permanently-missable items → anxious, guide-dependent
83
+ play. Minimise or make everything re-obtainable.
84
+ - **Hollow 100%.** Completing the set gives nothing — the payoff must *land*.
85
+
86
+ ## Verify
87
+
88
+ - Every collectible reachable/obtainable — connectivity sweep across seeds:
89
+ **[[FUN.md §10]]**.
90
+ - Surface the completion number (found/total, time-left): **[[FUN.md §15]]**.
91
+ - Collection state persists & hashes (save round-trip): **[[FUN.md law 7]]**.
92
+ - The main game clears without completing any set (optional-means-optional):
93
+ **[[FUN.md law 4]]**.
94
+
95
+ ## Composes with
96
+
97
+ - [[system-reward-schedules]] — variable-ratio drops feed set completion.
98
+ - [[system-meta-progression]] — cross-run dexes and cosmetic unlocks.
99
+ - [[system-economy]] — cosmetics as a currency sink with no power creep.
100
+ - [[system-mastery-curve]] — hard-to-get collectibles reward skill, not just time.
101
+ - [[world-narrative-delivery]] — lore collectibles deliver story with little text.
102
+
103
+ ## See also
104
+
105
+ - [`docs/FUN.md`](../../docs/FUN.md) §10 (reachability) · §15 (surfaced number) —
106
+ the collectible proofs.
107
+ - **[[anchor-stardew-valley]]** (museum/bundles) · **[[anchor-vampire-survivors]]**
108
+ (character unlock roster).