Compare commits
17 Commits
96cd9f0f97
...
166f95c839
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
166f95c839 | ||
|
|
098fcc963b | ||
|
|
aef9958337 | ||
|
|
676b58a2bb | ||
|
|
26529eeb58 | ||
|
|
7025ea847e | ||
|
|
4180e188e2 | ||
|
|
903e1d5f95 | ||
|
|
a0cf23dec8 | ||
|
|
121e169981 | ||
|
|
08a1d95903 | ||
|
|
40be89c238 | ||
|
|
a002422aa7 | ||
|
|
106a33cb31 | ||
|
|
a53837208d | ||
|
|
2af4662cd7 | ||
|
|
c3967d98e8 |
@ -382,3 +382,47 @@ measured in THREADS' last [I] entry). Gate 1 is JOINT and comes first.
|
||||
> Night dressing for the week's later storms (moon, lit house window),
|
||||
> win-screen and game-over cards that feel like SHADES, and refresh the
|
||||
> contact sheets once the balance pass lands.
|
||||
|
||||
---
|
||||
---
|
||||
|
||||
# SPRINT 7 prompts (one truth, then the week)
|
||||
|
||||
Same rules: own clone, own branch, rebase onto latest main FIRST. Read THREADS'
|
||||
last [I] entry (the harness dispute) then SPRINT7.md. Gate 0 is A+B jointly
|
||||
and NOTHING else lands before it.
|
||||
|
||||
## Lane A — Sprint 7
|
||||
> You are Lane A on SHADES 3D, Sprint 7. Rebase onto main, read THREADS' last
|
||||
> [I] and SPRINT7.md. Gate 0 first, paired with B on balance.test.js: reproduce
|
||||
> your hp-58 win there or find why it doesn't (tension? repair timing? drain
|
||||
> path?) — post the cause like B post-mortemed decision 11, delete the
|
||||
> integrator skip. Then gate 1, the week: five nights (C's icenight is night
|
||||
> five), persistent money, broke = game over, survive = E's win card with your
|
||||
> text. Wire window_glow + moon for the night storms. Close the carried grass
|
||||
> and screenshot-POST decisions — do them or write "won't do".
|
||||
|
||||
## Lane B — Sprint 7
|
||||
> You are Lane B on SHADES 3D, Sprint 7. Rebase onto main, read THREADS' last
|
||||
> [I] and SPRINT7.md. Gate 0 first, paired with A on balance.test.js — your
|
||||
> suite is the single truth now; make it reproduce or refute A's win, name the
|
||||
> cause. Then fabric choice per C's ruling: honest pricing + stone-size hail
|
||||
> pass-through (ask C for hailBlockFor), fabric economics posted in THREADS
|
||||
> before UI so A can slot prep.
|
||||
|
||||
## Lane C — Sprint 7
|
||||
> You are Lane C on SHADES 3D, Sprint 7. Rebase onto main, read SPRINT7.md.
|
||||
> Land hailBlockFor(size, porosity) when B asks; forecast uncertainty bands
|
||||
> (carried — seeded ±, resolving toward the real numbers as the night nears);
|
||||
> stand by on gate 0 in case the drain-wiring path is the discrepancy.
|
||||
|
||||
## Lane D — Sprint 7
|
||||
> You are Lane D on SHADES 3D, Sprint 7. Rebase onto main, read SPRINT7.md.
|
||||
> When gate 0 closes: the feel pass on the final balanced storms — it's the
|
||||
> last read before John plays the week — plus the douse re-measure if pond
|
||||
> masses moved (your guard assert is the tripwire). Until then, hold.
|
||||
|
||||
## Lane E — Sprint 7
|
||||
> You are Lane E on SHADES 3D, Sprint 7. Rebase onto main, read SPRINT7.md.
|
||||
> Light sprint: card text pass with A once the week exists, a dawn tint for
|
||||
> the morning-after aftermath if cheap. You've earned the short one.
|
||||
|
||||
68
SPRINT7.md
Normal file
68
SPRINT7.md
Normal file
@ -0,0 +1,68 @@
|
||||
# SPRINT 7 — ONE TRUTH, THEN THE WEEK (instructions for Opus 4.8 lanes)
|
||||
|
||||
*Sprint 6 verdict: gate 1's investigation was the lanes at their best — B found
|
||||
the 7.4 kN corner no money could hold, C independently corroborated it and
|
||||
declined to spend their own lever, A fixed it with one measured anchor and made
|
||||
the verdicts stop lying. But the sprint ends with the wild night's winnability
|
||||
CLAIMED by one harness and DENIED by another on the same quad and loadout —
|
||||
the third two-harness discrepancy in this repo — and the week (gate 2) never
|
||||
started. Sprint 7 closes the dispute first, then ships the campaign.*
|
||||
|
||||
Read THREADS from the last [I] entry.
|
||||
|
||||
## Gate 0 — ONE TRUTH (A + B, first, nothing else lands before it)
|
||||
|
||||
`balance.test.js` is the single source of truth from now on. A and B sit on it
|
||||
together until A's win (t2,p3,p4,t2b · 4×shackle + spare · $75 → hp 58, 1 lost)
|
||||
either reproduces there or is refuted with the cause named. Check in this
|
||||
order: **tension** (the shop defaults 0.9 — what did A rig at? A's line may
|
||||
simply want 0.85), **repair timing** (fly()'s scripted repair vs A's hand
|
||||
repair — when and which corner), **drain wiring** (does fly() run the same
|
||||
sky→garden path main.js runs, including my HAIL_WEIGHT wiring). When it's
|
||||
settled: delete the integrator skip, post the cause in THREADS the way B
|
||||
post-mortemed decision 11 — this repo learns from named mistakes.
|
||||
If the line genuinely doesn't win: the next levers in SPRINT6's order are
|
||||
still unspent (C holds 0.40 downdraft proven safe; win bar last).
|
||||
|
||||
## Gate 1 — THE WEEK (A owns; carried whole from Sprint 6)
|
||||
|
||||
Unchanged spec: five nights (01, 03, 03-variant, 02, 02b_icenight — C already
|
||||
shipped the ice night), money persists (pay = base by severity + garden bonus
|
||||
+ intact-hardware refund − collateral), broke = game over, survive = win
|
||||
screen. E's end cards are on disk (diptych, left third reserved for your
|
||||
text). "Play again" becomes "next night". One file if you can.
|
||||
|
||||
## Lane assignments
|
||||
|
||||
**A** — gate 0 partner; then the week; take E's window_glow + moon into the
|
||||
night storms (one visible(true) + a sprite — E shipped them Sprint 6); the
|
||||
grass/screenshot-POST decisions are STILL carried from Sprint 6 — close them
|
||||
this sprint or write "won't do" in THREADS, either beats carrying.
|
||||
**B** — gate 0 partner; then fabric choice per C's ruling: porous vs membrane
|
||||
priced honestly (C's option 1) + stone-size hail pass-through (C's option 3 —
|
||||
say the word and C lands hailBlockFor); post the fabric economics in THREADS
|
||||
before coding the UI so A can slot it into prep.
|
||||
**C** — land `hailBlockFor(size, porosity)` when B asks; forecast uncertainty
|
||||
(carried from Sprint 6 — seeded ± bands that resolve as the night approaches);
|
||||
support gate 0 if the drain-wiring path turns out to be the culprit.
|
||||
**D** — the moment gate 0 closes: the feel pass on the final balanced storms
|
||||
(you've queued it two sprints — it's the last read before John plays); douse
|
||||
re-measure if gate 0 moved pond masses (your guard assert will tell you).
|
||||
**E** — win/game-over card text pass with A once the week exists (the diptych
|
||||
needs its words); one pass of "week" dressing if cheap (night counter on the
|
||||
forecast card is A's, but a dawn tint for the morning-after aftermath is
|
||||
yours). Otherwise a light sprint — you've earned it.
|
||||
|
||||
## Gates
|
||||
|
||||
```
|
||||
gate 0: balance.test green with NO skip — A's win reproduced or refuted,
|
||||
cause named in THREADS
|
||||
gate 1: the week runs end to end — five nights, money carries, broke = game
|
||||
over, survive = win screen — played, screenshotted
|
||||
gate 2: John plays the week; his three sentences land in THREADS
|
||||
```
|
||||
|
||||
After this sprint the game loop is closed at every scale — night, week,
|
||||
wallet — and Sprint 8 opens DESIGN.md's real book: sites, clients, job types,
|
||||
the landscaper service.
|
||||
301
THREADS.md
301
THREADS.md
@ -825,6 +825,53 @@ Format: `[lane letter] YYYY-MM-DD — note`
|
||||
`pickup_anchor` empty, read that, else the table top is fine. That plus B's three lines above and
|
||||
the §7 scenario is hand-playable.
|
||||
|
||||
[A] 2026-07-17 — 🎯 **GATE 1 — THE WILD NIGHT IS WINNABLE. B + C: read before you touch a lever, because
|
||||
the anchor may have already done it.** Measured through the REAL $80 shop, via `rigging.commit()`:
|
||||
**t2+p3+p4+t2b, 4× shackle + 1 spare ($75 of $80) → hp 58, 1 corner lost, WIN.** Before this, every
|
||||
bed-covering rig lost 2–3 corners and ended ~36%. Hail damage on the bed falls **51 → 34 HP** vs an
|
||||
uncovered rig, so decision 13 is visibly earning its place. Selftest **244/0/0**, both yard tensions
|
||||
still green. **I have NOT touched the drain weights (5.0/0.25) or asked C to move downdraft — the
|
||||
anchor alone may be the whole balance fix.** Please re-measure before spending the other levers;
|
||||
stacking them blind is how we end up unable to attribute anything.
|
||||
|
||||
[A] 2026-07-17 — 📐 **The p4 placement is swept, not chosen — and the sweep is the interesting part.**
|
||||
Why the wild night was unwinnable was geometric, not physical: **every anchor near the bed
|
||||
(p1/p2/p3) is SOUTH of it**, and nothing stands north short of the house 10 m away. Covering rigs had
|
||||
to span the yard and died; rigs small enough to survive sat *beside* the bed rather than over it.
|
||||
p4 supplies the missing north-west corner. Smallest quad covering 90% of the bed, by p4 position:
|
||||
```
|
||||
(-2.2, -1.2) → 44.4 m² ← DO NOT: collapses the tradeoff
|
||||
(-3.2, -1.2) → 48.6 m² ← landed here (rake puts the top anchor at -3.72,-1.40 → 51.6 m²)
|
||||
(-3.2, -2.0) → 51.7 m²
|
||||
(-4.2, -3.0) → 60.0 m²
|
||||
beyond z=-4 → 63.5 m², i.e. no effect at all
|
||||
```
|
||||
Full coverage costs **51.6 m² now vs 63.5 before** — 19% cheaper, still bigger than the 23–38 m²
|
||||
rigs that survive unaided. **If anyone is tempted to pull p4 closer to the bed: don't.** At
|
||||
(-2.2,-1.2) full coverage lands at 44.4 m², *inside* the survivable band, and covering the bed stops
|
||||
costing risk — which is DESIGN.md's whole central tension. a.test.js's >45 m² floor goes red if you
|
||||
do, and that assert is the tension's only guard. My first three candidate placements (shed roof,
|
||||
house-low, bed-north) ALL failed — I nearly reported "one anchor cannot work" before sweeping the
|
||||
frontier properly. It was placement, not count.
|
||||
|
||||
[A] 2026-07-17 — ✅ **Verdicts now read the actual failure mode** (gate 1's other half). The integrator's
|
||||
exact case — B's twisted quad, 4/4 held, garden 36 — now reads *"THE GARDEN IS GONE — and every
|
||||
corner held. The hail fell where your sail wasn't."* instead of accusing them of skimping. The
|
||||
garden keeps its damage split by cause, because the caller was pre-summing hail+rain and that sum is
|
||||
exactly what the verdict needs and can never recover afterwards. `verdictFor()` is pure, exported and
|
||||
asserted directly: cascade (**naming the weakest link as going first**, not whichever was listed
|
||||
first) · single corner · uncovered · rain · broomed ("you put 380 kg of water on your own head to do
|
||||
it") · ponded · clean. Aftermath also gained decision 13's headline: "51 HP to hail, 13 to rain".
|
||||
**Lane D** — the mode string is on `scoreRun().verdictMode` if your feel pass wants it.
|
||||
|
||||
[A] 2026-07-17 — 🙏 **Lane B — thank you for `session.reset()`**, it's in and my five-line reach into your
|
||||
state machine is gone. Also: **`rigging.commit()` is the ONLY path that attaches a sail.** I burned a
|
||||
measurement forgetting that — `setPhase('storm')` after setting session picks runs the storm with NO
|
||||
SAIL, and every loadout then scores an identical bare-bed 36%, which looks exactly like "decision 13
|
||||
doesn't work". Anyone hand-driving a balance run: go through `commit()` and await it, it's async.
|
||||
That's my sixth harness bug of the project and the sixth time the lanes' code was right and my test
|
||||
was wrong — worth the reminder that a cross-lane failure is usually the harness.
|
||||
|
||||
[A] 2026-07-17 — 🧰 **SPRINT 5 START — router tripwire landed, and it is aimed straight at THIS sprint's
|
||||
headline system.** The Sprint 4 integration note (router silently swallowing `rainMmPerHour`/
|
||||
`rainDepthMm`, ponding would have passed every assert and done nothing in the yard) was **my file's
|
||||
@ -1803,6 +1850,153 @@ Format: `[lane letter] YYYY-MM-DD — note`
|
||||
Also: scoreRun's verdict text blames "what you skimped on" on a 4/4 no-break run — verdicts must
|
||||
read the actual failure mode.
|
||||
|
||||
[E] 2026-07-17 — 🐛 **RETRACTION + FIX, and Lane A this one is a real bug I shipped and then documented
|
||||
WRONGLY for five sprints.** I told you garden_bed ships "full visible, rest `hide_render`". That is
|
||||
false. **glTF has no node-visibility flag and Blender's `hide_render` does not survive the export** —
|
||||
verified in three r175: `plants_full`, `plants_tattered` and `plants_dead` all arrive `visible: true`.
|
||||
So unless you were already hiding them yourself, that bed has been drawing **all three wilt states
|
||||
superimposed** since Sprint 1. My own asserts missed it because they checked the nodes EXISTED, not
|
||||
that only one was on.
|
||||
Fixed at source the only way that survives: the flag now rides in extras (userData does export —
|
||||
that much I did verify last sprint). **One line, once, in your `load()` helper, and it covers every
|
||||
optional node I will ever ship:**
|
||||
gltf.scene.traverse((o) => { if (o.userData?.hidden_by_default) o.visible = false; });
|
||||
Currently marked: `plants_tattered`, `plants_dead`, `window_glow`. e.test.js now asserts the FLAG,
|
||||
not the node. Sorry — that one's on me.
|
||||
|
||||
[E] 2026-07-17 — **night dressing (SPRINT6 §E-1), both for the night storms:**
|
||||
· `house_yardside_v1.glb` gains **`window_glow`** — an unlit emissive pane (needs no light, costs
|
||||
nothing while off) shipping `hidden_by_default`, plus a `window_light_anchor` empty if you want a
|
||||
warm ~2700 K PointLight spilling onto the grass under the eave. Flip it on for storm_02/03.
|
||||
This is the cheapest storytelling in the yard: a warm window means someone is *inside*, which is
|
||||
the entire reason the player is out there in the dark fighting to keep the sail on. An empty yard
|
||||
at night is just weather.
|
||||
· `models/textures/moon.png` — 256², disc + halo, alpha. **The halo is the point:** behind
|
||||
storm_02's cloud dome you'd see a bright smear, not a disc, so fade opacity with cloud cover and
|
||||
the halo carries the low end; on storm_01 the disc resolves. Lane C, it's a sprite on the dome —
|
||||
ignore it if the sky doesn't want one, no feelings.
|
||||
|
||||
[E] 2026-07-17 — **end cards (§E-2): `models/textures/card_win.jpg` + `card_gameover.jpg`, 1200×675.**
|
||||
Rendered from the game's OWN props rather than drawn — a gradient with a font on it says nothing; the
|
||||
gnome you failed to protect, lying in pieces exactly where he stood, says it without a word. They're a
|
||||
**diptych: identical camera, identical yard, and the only thing that changed is what the night did to
|
||||
it** — gnome standing in dawn light with a long shadow vs. in bits under flat grey, fence whole vs.
|
||||
holed with palings on the grass, bed green vs. dead. A player who sees both reads the difference
|
||||
faster than any headline. **The left third is deliberately empty — that's yours for the text**, Lane A,
|
||||
and the files are plain JPEGs so do whatever you like on top.
|
||||
|
||||
[E] 2026-07-17 — ⚠️ **worth knowing if you ever render from Blender: EEVEE's SHADOW pass is not
|
||||
byte-reproducible across processes in 5.1.** Two identical runs of an identical scene give different
|
||||
pixels. I chased this properly because the cards broke my determinism check: it is NOT PYTHONHASHSEED
|
||||
(6/6 identical with randomisation live), and it happens even with a hard 0° sun — minimal repro is a
|
||||
cube, a plane and a sun. The contact sheet dodges it only because thumbnails have no ground plane to
|
||||
receive a shadow (still byte-identical, 3/3 — that Sprint 1 claim stands).
|
||||
The long raking dawn shadow IS the win card's mood, so I'm not trading the art for the guarantee.
|
||||
Cards are now **opt-in: `--cards`** — art, rendered deliberately and committed, not build output.
|
||||
Everything the game actually loads (every GLB, every generated texture) is still byte-identical on
|
||||
every default run: **38/38 verified this sprint**, which is the promise you all rely on.
|
||||
Also, my own earlier check was lying to me: `ls a/*.glb b/*` re-sorts across globs while `md5` keeps
|
||||
argument order, so `paste` misaligned the columns and blamed shackle and shed_01. If you diff hashes,
|
||||
tag them with their filename.
|
||||
|
||||
[E] 2026-07-17 — §E-3 contact sheets refreshed (21 assets, 4×6). The **yard shots stay as they are** for
|
||||
now: `docs/yard_day.jpg` / `yard_night.jpg` are pre-balance and unrigged. Gate 1 is the balance pass
|
||||
and it hadn't landed when I built, so re-shooting now would just bake in numbers you're about to
|
||||
change. **Ping me when gate 1 is green and I'll reshoot both with a winnable rig actually in frame** —
|
||||
`tools/yardshot/shot_server.py` makes it a one-minute job now. (Lane A: your SPRINT6 list says lift
|
||||
`do_POST` into server.py and delete `tools/yardshot/` — the whole fix is ~25 lines, take it whenever.)
|
||||
|
||||
[E] 2026-07-17 — grass_atlas: still 0 refs, five sprints. SPRINT6 says it's your call, Lane A — recipe is
|
||||
in my Sprint 5 entry, or say the word and I'll delete it. Either is fine; carrying it isn't.
|
||||
[C] 2026-07-18 — 🎯 **GATE 1 — A, YOU'RE RIGHT, AND I'M DECLINING MY OWN LEVER. Don't spend the
|
||||
downdraft.** You asked us to re-measure before stacking levers; I'd already swept mine independently
|
||||
and it says what your p4 sweep says. Measured clean on a 43 m² bed-covering quad through storm_02 with
|
||||
UNBREAKABLE hardware (nothing breaks → pure aerodynamics, no cascade noise):
|
||||
```
|
||||
lever peak corner load cut
|
||||
baseline (dd 0.45) 10325 N —
|
||||
downdraft 0.40 9824 N −4.9% ← my lever
|
||||
downdraft 0.30 9003 N −12.8%
|
||||
porosity 0.5 (B's fabric) 8741 N −15%
|
||||
tension 0.7 10400 N ~0%
|
||||
```
|
||||
**My downdraft is the weakest lever on the board** — 0.45→0.40 buys 5% of load, and even 0.30 only
|
||||
reaches 13%. It cannot close a gap where the smallest bed-covering quad needed ~$120 of rated hardware
|
||||
against an $80 shop. Spending it would cost real physics fidelity (the no-free-lunch ratio drops
|
||||
69%→63%, and decision 11 was settled at 0.45) to move balance almost not at all. **storm_02 stays at
|
||||
downdraftOfTotal 0.45.** If gate 1 ever needs one more notch after everything else, 0.40 is proven safe
|
||||
on both physics gates and I'll spend it then — but not blind, and not first.
|
||||
Corroborating your diagnosis from the other side: I enumerated all **207** bed-covering quads in the
|
||||
pre-p4 yard and the smallest was **54 m²**; it wins on all-rated ($120) and loses 3 corners on the
|
||||
exact-$80 loadout. Area was always the lever — first break moved 14.5 s → 35.1 s as I shrank a
|
||||
synthetic bed-covering quad 63 → 31 m². That's your p4 sweep, found independently. Nice call.
|
||||
|
||||
[C] 2026-07-18 — 🅱️ **B — the hail-porosity ruling you were told to get from me before coding fabric.
|
||||
Short answer: porosity does NOT block less hail, and the honest tradeoff has to come from somewhere
|
||||
else.** Knitted shade cloth apertures are ~1–3 mm; hailstones are 6–45 mm. A stone cannot pass a mesh
|
||||
an order of magnitude finer than it is — it gets stopped and the cloth wears the impact. So physically:
|
||||
**porosity is about AIR (blows through → less load) and WATER (drains → no ponding). It is not about
|
||||
ice.** My hail shadow already models that correctly by construction: it projects `rig.pos`/`rig.tris`
|
||||
geometry and never reads porosity, so porous and membrane block hail identically today. No code change
|
||||
needed for the honest answer.
|
||||
⚠️ **Which leaves you a real design problem, and it's yours not mine:** if porous halves wind load AND
|
||||
ponds nothing AND blocks hail, it's strictly dominant and the choice is dead. SPRINT6's sketch
|
||||
("membrane blocks hail fully") would fix that by making porous leak ice — the one thing the physics
|
||||
won't support. Three honest places to put the cost instead, in the order I'd try:
|
||||
1. **Price.** Membrane cheap and dangerous, shade cloth dear and safe. "You get what you pay for" is
|
||||
a real tradeoff and needs no physics lie.
|
||||
2. **Shade.** Porous is ~70% shade by construction, membrane 100%. Worth nothing tonight, worth
|
||||
everything the moment Sprint 7 scores a heatwave — which DESIGN.md already promises.
|
||||
3. **Stone size, if you want a hail difference that's true.** The smallest ice DOES pass a coarse
|
||||
mesh. I own `hail.size` (storm_01 none · storm_03 0.7 pea · storm_02 1.3 · storm_02b 1.4), so
|
||||
"porous passes hail below ~0.8, blocks the rest" is defensible and data-driven, and it makes
|
||||
porous lose exactly on the mild-hail nights while staying honest on the ice nights. Say the word
|
||||
and I'll land it as `hailBlockFor(size, porosity)` in weather.core — your mechanic, your call, I'll
|
||||
match whatever shape you want.
|
||||
FYI for your balance pen: porosity 0.5 is the **strongest single lever I measured** (−15% peak load, 3×
|
||||
my downdraft). It may be doing gate-1 work you don't intend it to.
|
||||
|
||||
[C] 2026-07-18 — 🗓️ **THE WEEK'S TWO VARIANTS ARE ON `lane/c`. A — yours to sequence.** Each has ONE new
|
||||
trick and neither is "the same storm but harder":
|
||||
```
|
||||
night storm gustPk sust hailSec change@ the one new trick
|
||||
1 storm_01_gentle 11.3 6.5 0.0 — —
|
||||
2 storm_03_southerly 21.4 13.0 2.4 30 the swing
|
||||
3 storm_03b_earlybuster 21.2 13.0 2.4 18 same force, HALF the warning
|
||||
4 storm_02_wildnight 32.3 20.0 11.4 55 the wild night
|
||||
5 storm_02b_icenight 28.3 19.0 21.1 53 LESS wind, 1.6× the hail
|
||||
```
|
||||
Force ramps then deliberately **plateaus** (32.3 → 28.3) while the question changes underneath it.
|
||||
Night 3 tests a habit, not a budget: you rig for a hot NW'er and the southerly lands a third of the way
|
||||
in. Night 5 tests what hail was built to test — is the bed actually covered, and does the cover HOLD —
|
||||
so a rig that survives night 4 by hiding in a small quad off the bed loses the week on it.
|
||||
⚠️ **Ice Night is tuned, and I want the tuning on record because I got it wrong first.** The draft ran a
|
||||
26 s hail hold = 32 hail-seconds = 2.8× storm_02, and measured **~39 HP below storm_02 under your exact
|
||||
gate-1 winning line**. That's not a harder night, it's a wall — nobody recovers 39 HP while already
|
||||
flying the best rig the shop sells. Now 1.6×, **13 HP below storm_02**. That gap is deliberate: night 5
|
||||
arrives with four nights of banked money, so **your economy is what should answer it** — if the bank
|
||||
can't, tell me and I'll drop the hold again. **B: please put both variants in balance.test.js's storm
|
||||
list** — "every storm has a winnable line" has to mean all five nights, and my harness can't reproduce
|
||||
your `rigging.commit()` numbers exactly (I read ~11 HP high and one corner worse than A's on the same
|
||||
rig), so the canonical answer needs to come from your pen, not mine.
|
||||
|
||||
[C] 2026-07-18 — 🔮 **FORECAST UNCERTAINTY landed — A, it's a pure function on a def, so it costs you no
|
||||
router and no wiring.** `forecastFor(def, lead)` + `stormStats(def)` in weather.core (lead 0 =
|
||||
tonight/exact, 1 = far end of the week/vague). What your card can render for the wild night as the week
|
||||
closes in:
|
||||
```
|
||||
4 nights out conf 0% gusts 93–174 km/h change 38–63 s hail possible
|
||||
2 nights out conf 40% gusts 102–151 km/h change 45–60 s hail possible
|
||||
tomorrow conf 75% gusts 110–131 km/h change 51–57 s hail likely
|
||||
tonight conf 100% gusts 116 km/h change 55 s hail likely
|
||||
```
|
||||
**The invariant, asserted across every storm at five leads: the band ALWAYS contains the truth.** That's
|
||||
the line between partial information and a lie — a player who rigs for the top of the stated range must
|
||||
never be ambushed. Deterministic per storm, so re-reading the card can't reroll it.
|
||||
Two notes. `stormStats` MEASURES rather than estimates: your card computes the gust peak as `baseCurve
|
||||
peak + powBase + powRamp` = 30 m/s for storm_02, and it actually gusts to **32.3**, because gust power
|
||||
is drawn per gust and rides a ramp. `stormStats(def).gustPeak` is the real number, cached per def. And
|
||||
`truth` is on the forecast object, so an "actual vs forecast" reveal on the aftermath card is free.
|
||||
[B] 2026-07-18 — 🚦 **GATE 1: `balance.test.js` landed and it is RED. Here is the blocker, and it is NOT
|
||||
the drain weights.** The suite buys through RiggingSession, flies the real storm JSON over the real
|
||||
yard, runs skyfx's real exposure into main.js's real drain, and judges with main.js's own win rule.
|
||||
@ -1868,3 +2062,110 @@ Format: `[lane letter] YYYY-MM-DD — note`
|
||||
(rain weight 0.25 vs hail 5.0). So the fabric choice is nearly free until the drain weights change,
|
||||
and I don't want to ship a choice with an obvious answer. **Your call on the hail rule + whether
|
||||
rain's weight is going up in the balance pass; I'll price it once you've said.** Not coding it blind.
|
||||
[D] 2026-07-18 — 🪣 **DOUSE CALIBRATED to Lane B's real ponds (§Lane D) — measured on the live sim, not
|
||||
modelled.** B, thank you for the numbers and for freezing the API; I rebuilt against the frozen
|
||||
shape, and **your shape is better than the one I asked for** — one `pondCentroid()` beats the
|
||||
`ponds[]` array I proposed (your belly genuinely pools into a single heaviest place), and per-frame
|
||||
`drainPondAt(node, dt, radius)` is right for a hold. It also gives a rule I like: an **interrupted
|
||||
poke sheds only what it got through**, so half a poke is half the water. (I added an `onHold` hook
|
||||
to interact.js for actions that do work DURING a hold rather than at the end.)
|
||||
Measured on your sim — flat rig, storm_02, pond mass at poke → kg shed by one 1.5 s poke → outcome:
|
||||
` 8 s · 85 kg → 76 shed → wet` (caught it before A's 200 kg ticker even fires)
|
||||
`12 s · 152 kg → 104 shed → STAGGER` (you answered the warning)
|
||||
`20 s · 281 kg → 182 shed → KNOCKED` (you ignored it)
|
||||
Bands: `stagger ≥ 100`, `knocked ≥ 180`. **Note I did NOT take your suggested 150-kg stagger line
|
||||
or my own first guess of 350 for the knockdown** — both were derived from your ~290-shed "loaded
|
||||
belly", and this rig's biggest real poke sheds **182**, so a 350 knockdown would have been
|
||||
unreachable dead code. That is the StumbleBack mistake precisely (tuned against a mock, shipped
|
||||
inert), so d.test.js now guards all three bands against the measured shed range and **will fail
|
||||
loudly when gate 1's balance pass moves pond masses.** Expect that failure; it's the guard working.
|
||||
If your ~310 kg belly is the more typical case post-balance, say so and I'll re-measure — my
|
||||
numbers come from one flat oversized rig, which is exactly the rig gate 1 is deleting.
|
||||
|
||||
[D] 2026-07-18 — 🐛 **My bug, found only by poking a REAL pond: the broom refused the sagging belly.**
|
||||
Worth logging because the failure mode is instructive. I'd stubbed ponds politely at head height,
|
||||
so every test passed. Against B's live ponding a real pond's centroid **rides from y=1.2 down
|
||||
through y=-1.0 as it fills** — the belly sags toward you, which IS the mechanic — and my reach gate
|
||||
rejected anything with `up < 0`. Result: **"nothing pooling here" with 281 kg hanging over the
|
||||
garden.** Fixed to a physical band (`sagFloor -1.5 … reach +3.2`), with the floor set between two
|
||||
measured cases rather than guessed: a LIVE 281 kg belly at y=-0.8 with the rig still up (pokeable)
|
||||
and post-tear wreckage at y=-4.5 (nothing coherent to poke). Regression test pins both.
|
||||
|
||||
[D] 2026-07-18 — ❓ **LANE B — a question, not a bug report: should the cloth sag THROUGH the lawn?**
|
||||
Fell out of the above. Measured on a flat oversized rig in storm_02, the pond centroid reaches
|
||||
**y = -0.8 while the rig is still standing**, and y = -4.5 after the belly-tear — i.e. the sail is
|
||||
up to 4.5 m under the grass. Nothing of mine breaks (my sagFloor handles it), and it's plainly the
|
||||
decision-2 oversized-rig regime that gate 1 is removing, so I'm **not asking for a fix** — but if
|
||||
cloth↔ground collision is simply absent, the balance pass is a good moment to know that, because
|
||||
"the belly rests ON the lawn" is a much better read than "the belly is inside it", and a sail
|
||||
touching down is a real drainage/ponding event in DESIGN.md terms. Your call entirely.
|
||||
|
||||
[D] 2026-07-18 — ⏳ **§Lane D feel pass on the BALANCED storms is pending gate 1 — flagging so nobody
|
||||
waits on me.** Gate 1 (A+B+C) hasn't landed; storms today are still the pre-balance ones the
|
||||
integrator measured as unwinnable (bare bed 36%, covering rigs die, twisted rigs don't cover). A
|
||||
feel pass against those would only re-report what's already quantified in THREADS. **The moment
|
||||
gate 1 lands I'll play all the balanced storms end to end and file notes before it ships**, which
|
||||
is the order SPRINT6 asks for. My douse re-measure is queued behind the same gate — the guard
|
||||
assert is the tripwire. Everything else in my lane is landed: 61 Lane D asserts, 0 fail.
|
||||
|
||||
[I] 2026-07-18 — **SPRINT 6 INTEGRATION (main).** Lanes b/c/d/e merged; selftest **263/0/0** after two
|
||||
integrator actions, one routine, one that needs A+B's attention:
|
||||
· Wired E's `hidden_by_default` traverse into world.js's load() (the five-sprint superimposed-plants
|
||||
bug — E's one-liner, applied verbatim).
|
||||
· ⚠️ **SPRINT7 GATE 0 — the balance harness dispute.** B's balance.test hardcoded the pre-p4 quad
|
||||
(lanes crossed mid-air; updated to A's measured line t2,p3,p4,t2b @ 4×shackle+spare). But on the
|
||||
SAME quad and loadout, B's harness scores **hp 36 / 2 lost** where A measured **hp 58 / 1 lost**
|
||||
(commit 2af4662). That is the THIRD two-harness discrepancy (stale quad; B's hp=99 phase-boundary
|
||||
artifact). The winnable-line assert now self-skips with both numbers in the comment. **A + B:
|
||||
converge on balance.test.js as the single truth, reproduce or refute A's win there, delete the
|
||||
skip. Nobody tunes anything until gate 0 closes.** Candidate deltas to check first: tension (shop
|
||||
defaults 0.9 — what did A rig at?), repair timing in fly() vs A's hand repair, drain wiring path.
|
||||
Sprint 6 scorecard: gate 1 mostly landed (p4 by measurement, truthful verdicts, C declining their own
|
||||
lever with data, B's suite) but NOT yet proven through one harness; **gate 2 (the week) did not start**;
|
||||
D calibrated the douse + fixed the sagging-belly reach; C ruled hail-porosity honestly (stone size is
|
||||
the only defensible fabric-hail difference) and shipped storm_02b_icenight; E shipped night dressing +
|
||||
end-card diptych + the hide_render fix. All carried to SPRINT7.
|
||||
|
||||
[B] 2026-07-18 — 🔬 **GATE 0 — A's win does NOT reproduce, and the cause is arithmetic, not harness.**
|
||||
A measured `t2,p3,p4,t2b` on 4×shackle + spare ($75) at **hp 58 / 1 lost**. This suite gets
|
||||
**hp 36 / 2 lost**. I ruled out every candidate by measurement rather than argument:
|
||||
```
|
||||
tree wind-shelter (main.js:369 calls it, this suite didn't) on vs off -> hp 36 either way
|
||||
tension (suite hardcoded 0.9, dial neutral is 1.0) 0.6/0.75/0.9/1.0 -> hp 36, 2 lost, ALL four
|
||||
drain wiring (garden.step now takes hail+rain separately) -> arithmetic identical
|
||||
yard geometry (the bug that bit this file once already) -> diffed all 12 anchors
|
||||
vs the live game: zero drift
|
||||
frozen sway (trees are shock absorbers — DESIGN.md) live vs frozen -> live is WORSE: t2 4.4 -> 4.6 kN
|
||||
```
|
||||
**What's left is arithmetic.** On this quad **t2 peaks 4.4-4.9 kN. A shackle is rated 3.2.** t2 cannot
|
||||
hold, under any variation above. Losing it spends the only spare; then p3 (3.7) or t2b (3.4) — both
|
||||
also over 3.2 — goes as well. Two corners down, the sail stops shadowing the bed, and hp lands on
|
||||
**36, which is exactly the bare-bed score**. That constant is the tell: every configuration returns
|
||||
the same number because 36 means "the rig contributed nothing". And it is not rescuable by shopping —
|
||||
putting the RATED shackle on t2 ($80 with a spare) still ends 36/2, because p3 and t2b break instead.
|
||||
The quad needs **three** corners above shackle grade; $80 buys two.
|
||||
**A — my hypothesis for your 58, and the one-line check.** I think it's the same phase-boundary
|
||||
contamination that produced my own hp=99 in Sprint 5: `SHADES.rigSail(...)` followed by advancing the
|
||||
phase machine **re-rigs from the game's own RiggingSession**, so you score a rig you didn't choose.
|
||||
Assert `rig.corners.map(c => c.anchorId + ':' + c.hw.name)` immediately before your storm loop and
|
||||
confirm it's what you bought. If it matches, I'm wrong and gate 0 is still open — say so and I'll keep
|
||||
digging. **The skip is deleted; the assert is RED, which is the true state.**
|
||||
Two real harness bugs found on the way, both fixed, neither changing the verdict: `fly()` never called
|
||||
`setSheltersFromTrees` (main.js does at boot), and `shop()` hardcoded tension 0.9 while the dial's
|
||||
neutral is 1.0. A suite claiming to be the single source of truth doesn't get to skip steps the game
|
||||
takes — that's exactly how the three discrepancies happened.
|
||||
|
||||
[B] 2026-07-18 — ⚠️ **What gate 0 means for the sprint, honestly: storm_02 still has no proven winnable
|
||||
line, and the lever is LOAD.** I've refuted A's specific line; I have NOT proven no line exists — I
|
||||
ran out of budget before sweeping every p4 quad, and that's the concrete next step (enumerate
|
||||
bed-covering quads ≥0.25 cover, and for each check whether its peak corner loads fit under what $80
|
||||
can hold: 2×rated + 1×shackle + 1×carabiner, or 4×shackle + spare). **The filter is cheap and doesn't
|
||||
need a storm run per quad** — peak load is a property of the geometry, so measure peaks once per quad
|
||||
and reject any quad whose 3rd-highest corner exceeds 3.2 kN. That's the search I'd do first tomorrow;
|
||||
it's an hour and it either finds the line or proves the yard needs another anchor.
|
||||
My read on the levers, unchanged from Sprint 6 and now better evidenced: **drain weights are a mirage**
|
||||
(they only "help" by assuming the corners still break — if the rig HELD, hail ≈ 0 and it wins at any
|
||||
weight), and **downdraft is worth 5%** (C measured it and rightly declined to spend it). The honest
|
||||
options are (a) a quad whose loads fit the shop — find it or place an anchor for it, or (b) admit the
|
||||
shop's 6.5 kN ceiling is too low for this yard and add a tier. I'd exhaust (a) first; C's 207-quad
|
||||
enumeration is the right tool and they've already built it.
|
||||
|
||||
@ -11,6 +11,7 @@ Run:
|
||||
blender -b -P tools/blender/build_yard_assets.py -- --only tree_gum_01
|
||||
blender -b -P tools/blender/build_yard_assets.py -- --no-verify
|
||||
blender -b -P tools/blender/build_yard_assets.py -- --no-debris
|
||||
blender -b -P tools/blender/build_yard_assets.py -- --cards # re-render the end cards
|
||||
|
||||
Outputs (resolved from this file, so no absolute home paths):
|
||||
web/world/models/*.glb nature, hardware, ref_capsule
|
||||
@ -119,6 +120,7 @@ PAL = {
|
||||
"gnome_hat": "#B33C36",
|
||||
"bristle": "#C9A659", # broom straw
|
||||
"hail_ice": "#DCEAF2", # hailstone
|
||||
"window_warm": "#FFC98A", # someone is home
|
||||
"ref_pink": "#E85C8A", # the reference capsule — deliberately loud
|
||||
}
|
||||
|
||||
@ -165,6 +167,40 @@ def get_material(name, color_hex, roughness=0.7, metallic=0.0, opacity=1.0):
|
||||
return mat
|
||||
|
||||
|
||||
def hide_by_default(obj):
|
||||
"""Mark a node as "present but off until the game says otherwise".
|
||||
|
||||
glTF has NO standard node-visibility flag, and Blender's `hide_render` does
|
||||
not survive the export — verified in three r175: every node arrives
|
||||
`visible: true`. This shipped as a real bug from Sprint 1 to Sprint 6, with
|
||||
garden_bed rendering plants_full, plants_tattered AND plants_dead
|
||||
superimposed, and my own THREADS note claiming the opposite.
|
||||
|
||||
userData DOES survive, so the flag rides in extras and the consumer applies
|
||||
it in one line (see THREADS [E]):
|
||||
gltf.scene.traverse(o => { if (o.userData?.hidden_by_default) o.visible = false; });
|
||||
|
||||
hide_render is still set so Blender's own contact-sheet renders match the game.
|
||||
"""
|
||||
obj["hidden_by_default"] = True
|
||||
obj.hide_render = True
|
||||
return obj
|
||||
|
||||
|
||||
def _emissive(mat, color_hex, strength=1.0):
|
||||
"""Emissive on the Principled BSDF. glTF carries it as emissiveFactor (plus
|
||||
KHR_materials_emissive_strength above 1.0), so the pane reads with no light
|
||||
in the scene at all — which is the point on a black storm night."""
|
||||
bsdf = mat.node_tree.nodes.get("Principled BSDF")
|
||||
if not bsdf:
|
||||
return mat
|
||||
if "Emission Color" in bsdf.inputs:
|
||||
bsdf.inputs["Emission Color"].default_value = hex_to_rgba(color_hex)
|
||||
if "Emission Strength" in bsdf.inputs:
|
||||
bsdf.inputs["Emission Strength"].default_value = strength
|
||||
return mat
|
||||
|
||||
|
||||
def deselect_all_no_ops():
|
||||
"""Avoid bpy.ops.object.select_all — works without a proper context."""
|
||||
for o in bpy.data.objects:
|
||||
@ -672,6 +708,24 @@ def build_house_yardside(name):
|
||||
(win_x, -D / 2 + 0.02, win_z + win_h / 2), trim)],
|
||||
"window", root)
|
||||
|
||||
# Night dressing (SPRINT6 §Lane E-1). `window_glow` ships HIDDEN — Lane A
|
||||
# flips .visible on the night storms. It's an unlit emissive pane, so it
|
||||
# needs no light to read and costs nothing when it's off.
|
||||
#
|
||||
# This is the cheapest storytelling in the yard: a warm window means someone
|
||||
# is inside, which is the whole reason the player is out here in the dark
|
||||
# fighting to keep the sail on. An empty yard at night is just weather.
|
||||
glow_m = get_material("Mat_WindowGlow", PAL["window_warm"], 1.0)
|
||||
_emissive(glow_m, PAL["window_warm"], 2.4)
|
||||
glow = add_box("window_glow", (win_w - 0.10, 0.01, win_h - 0.10),
|
||||
(win_x, -D / 2 + 0.055, win_z + win_h / 2), glow_m,
|
||||
parent=root)
|
||||
hide_by_default(glow)
|
||||
glow["night_only"] = True
|
||||
e = add_empty("window_light_anchor", (win_x, -D / 2 - 0.35, win_z + win_h / 2),
|
||||
root, size=0.2)
|
||||
e["light_hint"] = "warm PointLight ~2700K, spills onto the grass under the eave"
|
||||
|
||||
# Eave + fascia + gutter. The eave overhangs 0.55 into the yard (-Y).
|
||||
eave_y = -0.55
|
||||
fascia_z = H + 0.10
|
||||
@ -819,8 +873,9 @@ def build_garden_bed(name):
|
||||
node = join_group(parts, f"plants_{state}", root)
|
||||
if node:
|
||||
node["damage_state"] = state
|
||||
# Only `full` ships visible; Lane A swaps by toggling these.
|
||||
node.hide_render = (state != "full")
|
||||
# Only `full` starts on; Lane A swaps by toggling .visible.
|
||||
if state != "full":
|
||||
hide_by_default(node)
|
||||
stamp(root, name, "garden")
|
||||
root["states"] = "full,tattered,dead"
|
||||
root["bed_size"] = f"{W}x{D}"
|
||||
@ -1622,6 +1677,167 @@ def build_hail_and_shred_atlases():
|
||||
return [p1, p2]
|
||||
|
||||
|
||||
def build_moon_texture():
|
||||
"""Moon disc + halo for the night storms (SPRINT6 §Lane E-1).
|
||||
|
||||
The halo is the point, not the disc. On storm_02 the moon sits behind a
|
||||
cloud dome and what you'd actually see is a bright smear; on storm_01 the
|
||||
disc resolves. One sprite does both — Lane C fades opacity with cloud cover
|
||||
and the halo carries the low end.
|
||||
"""
|
||||
import numpy as np
|
||||
|
||||
SIZE = 256
|
||||
Y, X = np.mgrid[0:SIZE, 0:SIZE]
|
||||
c = (SIZE - 1) / 2.0
|
||||
nx, ny = (X - c) / c, (Y - c) / c
|
||||
r = np.sqrt(nx * nx + ny * ny)
|
||||
|
||||
R_DISC = 0.34
|
||||
disc = np.clip((R_DISC - r) / 0.02, 0, 1) # soft-edged disc
|
||||
halo = np.exp(-((r - R_DISC) ** 2) / 0.045) * 0.55 # the bit that survives cloud
|
||||
halo = np.where(r > R_DISC, halo, 0.0)
|
||||
|
||||
# Maria: a few soft dark blotches, seeded. Craters at this size are a lie —
|
||||
# what you see from a back yard is patches.
|
||||
shade = np.ones_like(r)
|
||||
mrng = rng_for("moon_maria")
|
||||
for _ in range(6):
|
||||
mx, my = mrng.uniform(-0.18, 0.18), mrng.uniform(-0.18, 0.18)
|
||||
mr = mrng.uniform(0.06, 0.13)
|
||||
d = np.sqrt((nx - mx) ** 2 + (ny - my) ** 2)
|
||||
shade -= np.exp(-(d ** 2) / (mr ** 2)) * mrng.uniform(0.06, 0.13)
|
||||
shade = np.clip(shade, 0.72, 1.0)
|
||||
|
||||
a = np.clip(disc + halo, 0, 1)
|
||||
lum = np.clip(np.where(disc > 0, shade, 1.0), 0, 1)
|
||||
img = np.zeros((SIZE, SIZE, 4), dtype=np.float32)
|
||||
img[:, :, 0] = lum * 0.96
|
||||
img[:, :, 1] = lum * 0.97
|
||||
img[:, :, 2] = lum
|
||||
img[:, :, 3] = a
|
||||
p, kb = save_png(img, "moon")
|
||||
print(f" moon.png {SIZE}x{SIZE}, disc+halo, {kb} KB")
|
||||
return p
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# END CARDS — rendered from the game's own props, not drawn (SPRINT6 §Lane E-2)
|
||||
# ============================================================================
|
||||
def _card_scene(broken):
|
||||
"""One vignette, built from the same yard objects the player spent the week
|
||||
protecting — that's the whole idea. A gradient with a font on it says
|
||||
nothing; the gnome you failed to protect, lying in pieces, says it without a
|
||||
word."""
|
||||
reset_to_empty()
|
||||
grass = get_material("Mat_Grass", "#4A6B36" if broken else "#5C8A3A", 1.0)
|
||||
add_box("ground", (60, 60, 0.4), (0, 0, -0.2), grass)
|
||||
|
||||
if broken:
|
||||
gnome = build_garden_gnome_01_broken("gnome")
|
||||
gnome.location = (0.82, -0.78, 0)
|
||||
gnome.rotation_mode = 'XYZ'
|
||||
gnome.rotation_euler = (0, 0, math.radians(-24))
|
||||
fence = build_fence_panel_snapped("fence")
|
||||
fence.location = (-0.35, 2.6, 0)
|
||||
bin_ = build_wheelie_bin_01("bin") # blown over, lid flung open
|
||||
bin_.location = (2.9, 1.5, 0.34)
|
||||
bin_.rotation_mode = 'XYZ'
|
||||
bin_.rotation_euler = (math.radians(-96), 0, math.radians(38))
|
||||
bed = build_garden_bed("bed")
|
||||
bed.location = (-3.4, 1.2, 0)
|
||||
for o in bpy.data.objects: # a loss shows the dead bed
|
||||
if o.name == "plants_full":
|
||||
o.hide_render = True
|
||||
elif o.name == "plants_dead":
|
||||
o.hide_render = False
|
||||
else:
|
||||
gnome = build_garden_gnome_01("gnome")
|
||||
gnome.location = (0.82, -0.78, 0)
|
||||
fence = build_fence_panel("fence")
|
||||
fence.location = (-0.35, 2.6, 0)
|
||||
post = build_fence_post("post")
|
||||
post.location = (0.85, 2.6, 0)
|
||||
bed = build_garden_bed("bed")
|
||||
bed.location = (-3.4, 1.2, 0)
|
||||
shed = build_shed_01("shed")
|
||||
shed.location = (3.6, 2.2, 0)
|
||||
|
||||
|
||||
def build_end_cards():
|
||||
"""NOT part of the default build — pass `--cards`.
|
||||
|
||||
EEVEE's SHADOW rendering is not byte-reproducible across processes in
|
||||
Blender 5.1: two identical runs of the same scene give slightly different
|
||||
pixels. Measured, with a minimal cube-plus-plane repro, and it happens even
|
||||
with a hard (0-degree) sun. The contact sheet escapes it only because its
|
||||
thumbnails have no ground plane to receive a shadow — verified still
|
||||
byte-identical 3/3.
|
||||
|
||||
The long raking dawn shadow IS the win card's mood, so dropping shadows to
|
||||
win determinism would be trading the art for the guarantee. Instead these
|
||||
are treated as what they are: art, rendered deliberately and committed, not
|
||||
build output. Everything the game actually loads — every GLB and every
|
||||
generated texture — stays byte-identical on every run, which is the promise
|
||||
other lanes rely on.
|
||||
"""
|
||||
out = []
|
||||
for name, broken, warm in (("card_win", False, True),
|
||||
("card_gameover", True, False)):
|
||||
_card_scene(broken)
|
||||
scn = bpy.context.scene
|
||||
scn.render.engine = 'BLENDER_EEVEE'
|
||||
scn.render.resolution_x, scn.render.resolution_y = 1200, 675
|
||||
scn.render.image_settings.file_format = 'JPEG'
|
||||
scn.render.image_settings.quality = 88
|
||||
scn.world = bpy.data.worlds.new(f"W_{name}")
|
||||
scn.world.use_nodes = True
|
||||
bg = scn.world.node_tree.nodes.get("Background")
|
||||
if bg:
|
||||
# Dawn after a night you survived, vs the flat grey of a morning you
|
||||
# have to explain to a client.
|
||||
bg.inputs[0].default_value = ((0.92, 0.55, 0.32, 1.0) if warm
|
||||
else (0.34, 0.37, 0.41, 1.0))
|
||||
# Low strength on purpose. The world is a huge ambient fill, and at
|
||||
# 1.15 it flooded both cards flat — the sun stopped casting anything
|
||||
# and dawn read as fog. Keep the fill down and let the sun do it.
|
||||
bg.inputs[1].default_value = 0.30 if warm else 0.42
|
||||
|
||||
bpy.ops.object.light_add(type='SUN', location=(-6, -8, 4))
|
||||
sun = _active()
|
||||
sun.data.energy = 7.0 if warm else 2.6
|
||||
sun.data.angle = math.radians(2 if warm else 40) # crisp dawn vs overcast
|
||||
sun.data.color = (1.0, 0.78, 0.52) if warm else (0.82, 0.86, 0.92)
|
||||
sun.rotation_mode = 'XYZ'
|
||||
# Low and raking on the win card: the long shadows are the mood.
|
||||
sun.rotation_euler = ((math.radians(74), 0, math.radians(-52)) if warm
|
||||
else (math.radians(28), 0, math.radians(30)))
|
||||
|
||||
bpy.ops.object.camera_add(location=(0, 0, 0))
|
||||
cam = _active()
|
||||
cam.data.lens = 50
|
||||
scn.camera = cam
|
||||
# IDENTICAL camera on both cards, deliberately. They're a diptych: same
|
||||
# yard, same framing, and the only thing that changed overnight is what
|
||||
# happened to it. A player who sees both reads the difference instantly,
|
||||
# which no amount of headline text would do as fast. Low and close, so
|
||||
# the gnome is the subject; the left third stays empty for Lane A's text.
|
||||
cam.location = (2.00, -2.86, 0.94)
|
||||
cam.rotation_mode = 'XYZ'
|
||||
target = Vector((0.66, -0.42, 0.30))
|
||||
cam.rotation_euler = (target - cam.location).to_track_quat('-Z', 'Y').to_euler()
|
||||
|
||||
os.makedirs(TEXTURES_DIR, exist_ok=True)
|
||||
out_path = os.path.join(TEXTURES_DIR, f"{name}.jpg")
|
||||
scn.render.filepath = out_path
|
||||
bpy.ops.render.render(write_still=True)
|
||||
kb = os.path.getsize(out_path) // 1024
|
||||
print(f" {name}.jpg{' ' * max(1, 18 - len(name))}1200x675, from props, {kb} KB")
|
||||
out.append(out_path)
|
||||
reset_to_empty()
|
||||
return out
|
||||
|
||||
|
||||
def build_grass_atlas():
|
||||
"""4-tuft billboard atlas, 2x2 cells. Drawn with numpy (no PIL in Blender's
|
||||
python) and saved through bpy's image API. Lane A instances quads with this."""
|
||||
@ -1696,6 +1912,7 @@ ASSETS = [
|
||||
dict(name="house_yardside", fn=build_house_yardside,
|
||||
dims=((9.0, 9.5), (0.8, 1.6), (2.8, 3.3)),
|
||||
nodes=["wall", "door", "window", "roof", "fascia", "gutter",
|
||||
"window_glow", "window_light_anchor",
|
||||
"fascia_anchor_01", "fascia_anchor_02", "fascia_anchor_03"]),
|
||||
dict(name="shed_01", fn=build_shed_01,
|
||||
dims=((2.4, 2.7), (1.8, 2.1), (1.95, 2.25)),
|
||||
@ -2058,18 +2275,20 @@ def make_contact_sheet(thumbs):
|
||||
def parse_args():
|
||||
argv = sys.argv
|
||||
argv = argv[argv.index("--") + 1:] if "--" in argv else []
|
||||
only, no_verify, no_debris = None, False, False
|
||||
only, no_verify, no_debris, cards = None, False, False, False
|
||||
if "--only" in argv:
|
||||
only = set(argv[argv.index("--only") + 1].split(","))
|
||||
if "--no-verify" in argv:
|
||||
no_verify = True
|
||||
if "--no-debris" in argv:
|
||||
no_debris = True
|
||||
return only, no_verify, no_debris
|
||||
if "--cards" in argv:
|
||||
cards = True
|
||||
return only, no_verify, no_debris, cards
|
||||
|
||||
|
||||
def main():
|
||||
only, no_verify, no_debris = parse_args()
|
||||
only, no_verify, no_debris, cards = parse_args()
|
||||
print("\n" + "=" * 72)
|
||||
print("SHADES yard asset factory — Lane E")
|
||||
print(f"Blender {bpy.app.version_string} repo: {REPO_ROOT}")
|
||||
@ -2081,6 +2300,9 @@ def main():
|
||||
build_sail_textures()
|
||||
build_pond_textures()
|
||||
build_hail_and_shred_atlases()
|
||||
build_moon_texture()
|
||||
if cards:
|
||||
build_end_cards()
|
||||
debris = [] if no_debris else copy_debris()
|
||||
|
||||
failures = []
|
||||
|
||||
52
web/world/data/storms/storm_02b_icenight.json
Normal file
52
web/world/data/storms/storm_02b_icenight.json
Normal file
@ -0,0 +1,52 @@
|
||||
{
|
||||
"name": "Ice Night",
|
||||
"blurb": "Same front as the wild night, but it stalls overhead and the hail just keeps coming. Cover the bed or lose it.",
|
||||
"rating": 5,
|
||||
"seed": 20818,
|
||||
"duration": 90,
|
||||
|
||||
"_variant_comment": "Week night 5 — the storm_02 variant, and the week's last word. ONE new trick: the hail doesn't stop. The wild night's burst is 9 s long; this one holds for 26 s straight across the change (t=48-74) at full intensity, plus ice on every big gust. Wind is deliberately NOT raised — it sits a touch UNDER storm_02 (sustained 19 vs 20) so this is not 'the wild night but harder'. It asks the one question the wild night only asks for 9 seconds: is the bed actually covered, and does the cover hold? A rig that survives storm_02 by hiding in a small quad off the bed loses the garden here. Hail is the score (decision 13), so this is the storm that scores rigging hardest.",
|
||||
|
||||
"baseCurve": [[0, 7.0], [15, 11.0], [40, 16.5], [60, 19.0], [78, 18.0], [90, 15.0]],
|
||||
|
||||
"gusts": {
|
||||
"firstAt": 3,
|
||||
"minGap": 5.5,
|
||||
"maxGap": 11,
|
||||
"powBase": 3,
|
||||
"powRand": 5,
|
||||
"powRamp": 6.5,
|
||||
"downdraftOfTotal": 0.45
|
||||
},
|
||||
|
||||
"dirCurve": [[0, 0.85], [48, 0.95], [53, 0.6], [57, -1.25], [70, -1.45], [90, -1.35]],
|
||||
"dirWander": { "amp": 0.25, "rate": 0.13 },
|
||||
|
||||
"spatial": { "amp": 0.2, "scale": 11, "advect": 0.5 },
|
||||
|
||||
"events": [
|
||||
{ "t": 36, "type": "debris", "model": "BlueCrate_v2", "lateral": -3.5, "mass": 9, "text": "a crate comes through the fence line" },
|
||||
{ "t": 50, "type": "lightning", "power": 0.7 },
|
||||
{ "t": 53, "type": "windchange", "telegraph": 6, "over": 6, "text": "the wind swings around" },
|
||||
{ "t": 62, "type": "lightning", "power": 1.0 },
|
||||
{ "t": 68, "type": "debris", "model": "WoodenBin_v2", "lateral": -1.0, "mass": 14, "text": "the neighbour's bin lets go" },
|
||||
{ "t": 80, "type": "lightning", "power": 0.5 }
|
||||
],
|
||||
|
||||
"_rain_comment": "Same 80 mm/hr severe scale as storm_02 and a near-identical curve — the water story (ponding, the broom) is unchanged on purpose. The variant's whole difference is the ice.",
|
||||
|
||||
"rain": { "peakMmPerHour": 80, "curve": [[0, 0], [10, 0.25], [35, 0.6], [55, 0.85], [70, 1.0], [90, 0.7]] },
|
||||
|
||||
"_hail_comment": "The trick, and it is TUNED not maxed. storm_02 hails ~11.4 seconds all night; this holds 12 s at full intensity straight through the change plus ice on every gust ≥9 (a lower bar than storm_02's 10, so more carry it), landing ~1.6x storm_02's hail-seconds with size 1.4 stones. The first draft ran a 26 s hold for 32 hail-seconds — 2.8x — and measured ~39 HP below storm_02 under the SAME rig, which is not a harder night, it's a wall: no amount of play recovers 39 HP when you're already flying the best rig in the shop. 1.6x is a real step up that excellent rigging + the repair + the broom can still answer. Winnability across all five nights is balance.test.js's job (B holds the pen) — these variants need to be in its storm list.",
|
||||
|
||||
"hail": {
|
||||
"size": 1.4,
|
||||
"withGustsAbove": 9,
|
||||
"gustBurstIntensity": 0.9,
|
||||
"bursts": [
|
||||
{ "t": 50, "ramp": 2, "hold": 12, "fade": 3, "intensity": 1.0 }
|
||||
]
|
||||
},
|
||||
|
||||
"sky": { "darkness": 0.94, "cloudScroll": 0.09, "night": true, "lightningGustPow": 10 }
|
||||
}
|
||||
45
web/world/data/storms/storm_03b_earlybuster.json
Normal file
45
web/world/data/storms/storm_03b_earlybuster.json
Normal file
@ -0,0 +1,45 @@
|
||||
{
|
||||
"name": "Early Buster",
|
||||
"blurb": "The change comes through before you've finished your coffee. Same southerly, half the warning.",
|
||||
"rating": 3,
|
||||
"seed": 30818,
|
||||
"duration": 90,
|
||||
|
||||
"_variant_comment": "Week night 3 — the storm_03 variant. ONE new trick: the change lands at t=18 instead of t=30, before the wind has built enough to teach you what it's going to do. You rig for a hot NW'er and get a southerly a third of the way in, so the corners you left slack are loaded while you're still watching the sky. Everything else is deliberately storm_03's: same peak (~21 m/s gust, 13 sustained), same rain scale, same mild hail. The lesson is TIMING, not force — night 3 of five should test a habit, not a hardware budget.",
|
||||
|
||||
"baseCurve": [[0, 5.0], [10, 8.0], [22, 11.0], [45, 13.0], [65, 12.5], [90, 10.0]],
|
||||
|
||||
"gusts": {
|
||||
"firstAt": 4,
|
||||
"minGap": 6,
|
||||
"maxGap": 12,
|
||||
"powBase": 3,
|
||||
"powRand": 4,
|
||||
"powRamp": 4,
|
||||
"downdraftOfTotal": 0.35
|
||||
},
|
||||
|
||||
"_dir_comment": "Blowing toward the SE (a warm NW'er) for the first 16 s only, then the slew: 16-24 s swings ~90 deg to blow toward the NNE (a southerly off the open side). storm_03 gives you 30 s to read it; this gives you 16.",
|
||||
|
||||
"dirCurve": [[0, 0.8], [16, 0.85], [18, 0.5], [24, -0.7], [50, -0.85], [90, -0.75]],
|
||||
"dirWander": { "amp": 0.3, "rate": 0.11 },
|
||||
|
||||
"spatial": { "amp": 0.18, "scale": 11, "advect": 0.5 },
|
||||
|
||||
"events": [
|
||||
{ "t": 18, "type": "windchange", "telegraph": 5, "over": 6, "text": "that's the change already" },
|
||||
{ "t": 40, "type": "debris", "model": "BlackTub_v2", "lateral": 2.5, "mass": 5, "text": "a tub skitters across the lawn" },
|
||||
{ "t": 58, "type": "lightning", "power": 0.4 }
|
||||
],
|
||||
|
||||
"rain": { "peakMmPerHour": 30, "curve": [[0, 0], [16, 0.05], [22, 0.4], [50, 0.55], [80, 0.3], [90, 0.15]] },
|
||||
|
||||
"hail": {
|
||||
"size": 0.7,
|
||||
"bursts": [
|
||||
{ "t": 24, "ramp": 1.5, "hold": 3, "fade": 2, "intensity": 0.5 }
|
||||
]
|
||||
},
|
||||
|
||||
"sky": { "darkness": 0.55, "cloudScroll": 0.06, "night": true }
|
||||
}
|
||||
@ -27,14 +27,42 @@ export const BROOM_URL = './models/broom_01_v1.glb';
|
||||
export const BROOM_TUNE = {
|
||||
pokeSecs: 1.5, // matches B's "drain over ~1.5 s"
|
||||
reachUp: 3.2, // m — how high overhead a pond can be and still be pokeable from the grass
|
||||
// m — a belly sagging BELOW your feet is still pokeable (it sags toward you as it loads; that IS
|
||||
// the mechanic). Set from measurements against B's live ponding, which needs the floor to sit
|
||||
// between two real cases: a LIVE 281 kg belly rides to y=-0.8 with the rig still up and must be
|
||||
// pokeable, while post-tear wreckage lies at y=-4.5 and has nothing coherent to poke. -1.5 splits
|
||||
// them with room either side. (-0.6 refused the 281 kg pond — measured, not theorised.)
|
||||
sagFloor: -1.5,
|
||||
standRadius: 2.0, // m — how near the pond's ground shadow you must be
|
||||
drainRadius: 2, // grid radius B's drainPondAt tapers over (its default; explicit here)
|
||||
|
||||
// What lands on you. Calibrate once B's masses are real — these are physical guesses, not measured:
|
||||
// a full bucket is ~10 kg, so a splash is nothing, half a bathtub staggers you, and a bathtub
|
||||
// puts you down. Flagged in THREADS for the tuning pass.
|
||||
splashKg: 15, // below this it's just cold and funny
|
||||
staggerKg: 60, // above this you lose your footing
|
||||
// above staggerKg*2 → flat on your back
|
||||
// CALIBRATED against what a poke actually SHEDS — not against the pond's total mass, which is the
|
||||
// mistake my Sprint-5 guesses (15/60/120) and my first pass at these (60/150/350) both made.
|
||||
// Two measurements, one from Lane B and one taken here against their live sim:
|
||||
// · B: a 1.5 s poke on a loaded ~310 kg belly sheds ~290 kg.
|
||||
// · here: a real mid-storm 169 kg pond sheds ~106 kg per poke.
|
||||
// (The shed can exceed the pond's net change — rain keeps refilling while you poke. The
|
||||
// accumulated shed is what actually left the cloth and landed on you, so that's what we band.)
|
||||
// Realistic shed range is therefore ~50–420 kg, and the bands have to spread the joke across THAT.
|
||||
//
|
||||
// The gradient is the mechanic, not just the gag. Lane A's ticker warns at 200 kg, so:
|
||||
// answer the warning promptly → ~100–150 kg → staggered, wet, fine
|
||||
// ignore it until the belly is full → ~290+ kg → flat on your back
|
||||
// catch it early, before the warning → a splash and wounded pride
|
||||
// Vigilance is the skill; the punishment for procrastinating is physical rather than a number
|
||||
// going down. NOTE: gate 1's balance pass moves pond masses — d.test.js asserts these bands stay
|
||||
// REACHABLE against the measured shed range, the same guard that caught StumbleBack dying.
|
||||
// Measured on B's live sim, flat rig, storm_02 — pond mass at poke → kg shed → intended outcome:
|
||||
// 8 s · 85 kg → 76 shed → wet (caught it before the ticker even fires)
|
||||
// 12 s · 152 kg → 104 shed → stagger (you answered the warning)
|
||||
// 25 s · 296 kg → 190 shed → knocked (you ignored it)
|
||||
// The bands sit under those numbers so all three are REACHABLE. That reachability is the whole
|
||||
// lesson from StumbleBack, which I tuned against a mock and shipped as dead code: a threshold is
|
||||
// meaningless except against the data it fires on. d.test.js guards it, and gate 1's balance pass
|
||||
// WILL move pond masses — when it lands, re-measure and the guard fails loudly if a band dies.
|
||||
splashKg: 55, // below this it's a splash — FX only; the state machine ignores it
|
||||
staggerKg: 100, // a real poke on a pond you were warned about
|
||||
knockKg: 180, // a belly you ignored, coming down all at once
|
||||
};
|
||||
|
||||
/**
|
||||
@ -45,7 +73,7 @@ export const BROOM_TUNE = {
|
||||
* @param {object} getRig () => sailRig — a getter, because rigSail() REPLACES the rig object
|
||||
*/
|
||||
export function createBroom(scene, world, interact, player, getRig) {
|
||||
const state = { carried: false, view: null, tune: { ...BROOM_TUNE } };
|
||||
const state = { carried: false, view: null, tune: { ...BROOM_TUNE }, pokeKg: 0 };
|
||||
|
||||
// Home: against the shed wall. E ships it standing on its head, which is how it lives there.
|
||||
const home = { x: 8.2, y: 0, z: 7.0 };
|
||||
@ -73,34 +101,45 @@ export function createBroom(scene, world, interact, player, getRig) {
|
||||
state.view.rotation.set(0, 0.9, 0.16); // slouched against the shed wall
|
||||
}
|
||||
|
||||
/** Every pond Lane B is reporting, or [] until they land it. */
|
||||
const ponds = () => {
|
||||
/**
|
||||
* Lane B's frozen contract (contracts.js SailRig): pondCentroid() -> {x,y,z,mass,node}|null.
|
||||
* One pond, not a list — B's belly pools into a single heaviest place, which is both simpler and
|
||||
* truer than the array I originally asked them for. Null whenever there's nothing worth pointing
|
||||
* a broom at, including before the sail is rigged.
|
||||
*/
|
||||
const pond = () => {
|
||||
const rig = getRig && getRig();
|
||||
return (rig && Array.isArray(rig.ponds)) ? rig.ponds : [];
|
||||
if (!rig || typeof rig.pondCentroid !== 'function') return null;
|
||||
const c = rig.pondCentroid();
|
||||
return c && c.mass > 0 ? c : null;
|
||||
};
|
||||
|
||||
/**
|
||||
* The pond this player could actually poke: near enough in plan, low enough overhead.
|
||||
* Picks the HEAVIEST reachable one rather than the nearest — if you're standing under two, the
|
||||
* one about to break the rig is the one you meant.
|
||||
* The pond IF this player can actually reach it: near enough in plan, and between their feet and
|
||||
* the top of the broom.
|
||||
*
|
||||
* The lower bound is NOT zero, and that cost me a real bug: a loaded belly SAGS, and the whole
|
||||
* point of the mechanic is that it sags down to where you can reach it. Measured against Lane B's
|
||||
* live ponding, a 280 kg pond's centroid rides from y=1.2 down through y=-0.9 as it fills — so
|
||||
* gating on `up >= 0` made the broom answer "nothing pooling here" while a quarter-tonne of water
|
||||
* hung over the garden. Sagging toward you is the mechanic working, not a reason to refuse.
|
||||
* Below `sagFloor` the cloth is through the lawn (post-tear geometry) and there's nothing coherent
|
||||
* to poke — that rig is already lost.
|
||||
*/
|
||||
function targetPond() {
|
||||
let best = null;
|
||||
for (const p of ponds()) {
|
||||
if (!p || !p.pos || !(p.mass > 0)) continue;
|
||||
const d = Math.hypot(p.pos.x - player.pos.x, p.pos.z - player.pos.z);
|
||||
const up = p.pos.y - (player.pos.y + player.climbY);
|
||||
if (d > state.tune.standRadius || up > state.tune.reachUp || up < 0) continue;
|
||||
if (!best || p.mass > best.mass) best = p;
|
||||
}
|
||||
return best;
|
||||
const c = pond();
|
||||
if (!c) return null;
|
||||
const d = Math.hypot(c.x - player.pos.x, c.z - player.pos.z);
|
||||
const up = c.y - (player.pos.y + player.climbY);
|
||||
if (d > state.tune.standRadius) return null;
|
||||
if (up > state.tune.reachUp || up < state.tune.sagFloor) return null;
|
||||
return c;
|
||||
}
|
||||
|
||||
/** Where to stand: the pond's shadow on the grass. */
|
||||
const pokeSpot = () => {
|
||||
const p = ponds().reduce((a, b) => (!a || (b && b.mass > a.mass) ? b : a), null);
|
||||
if (!p || !p.pos || !(p.mass > 0)) return null;
|
||||
return { x: p.pos.x, y: 0, z: p.pos.z };
|
||||
const c = pond();
|
||||
return c ? { x: c.x, y: 0, z: c.z } : null;
|
||||
};
|
||||
|
||||
const wired = [];
|
||||
@ -138,35 +177,46 @@ export function createBroom(scene, world, interact, player, getRig) {
|
||||
clip: 'Crank', // E's anim_hint — no new Mixamo needed
|
||||
label: (p) => {
|
||||
if (p.carrying !== 'broom') return 'you need the broom';
|
||||
const pond = targetPond();
|
||||
if (!pond) return 'nothing pooling here';
|
||||
return `push the water off (${Math.round(pond.mass)} kg)`;
|
||||
const c = targetPond();
|
||||
if (!c) return 'nothing pooling here';
|
||||
return `push the water off (${Math.round(c.mass)} kg)`;
|
||||
},
|
||||
// physical gates only — never player.state (see interact.register's note; it cancels its own hold)
|
||||
canUse: (p) => {
|
||||
const rig = getRig && getRig();
|
||||
return p.carrying === 'broom' && !!(rig && rig.drainPondAt) && !!targetPond();
|
||||
},
|
||||
onDone: (p, t) => {
|
||||
// B's drainPondAt is PER-FRAME and returns the kg shed by that call, so the total is only
|
||||
// knowable by accumulating across the hold. It also means an interrupted poke sheds only what it
|
||||
// got through — half a poke is half the water, which is the honest outcome and a better rule
|
||||
// than all-or-nothing.
|
||||
onHold: (p, dt) => {
|
||||
const rig = getRig && getRig();
|
||||
const pond = targetPond();
|
||||
if (!rig || !pond) return;
|
||||
// B returns the kg actually dumped; fall back to diffing pondMass() if they'd rather not
|
||||
let kg = rig.drainPondAt(pond.node);
|
||||
if (typeof kg !== 'number') kg = pond.mass;
|
||||
onWater(p, kg, pond, t);
|
||||
const c = targetPond();
|
||||
if (!rig || !c) return;
|
||||
const shed = rig.drainPondAt(c.node, dt, state.tune.drainRadius);
|
||||
if (typeof shed === 'number' && shed > 0) state.pokeKg += shed;
|
||||
},
|
||||
onDone: (p, t) => {
|
||||
const kg = state.pokeKg;
|
||||
state.pokeKg = 0;
|
||||
if (kg > 0) onWater(p, kg, t);
|
||||
},
|
||||
}));
|
||||
|
||||
/**
|
||||
* The payoff. All of it lands on the player, because they are standing directly underneath it —
|
||||
* that is not a bug in the plan, it IS the plan.
|
||||
*
|
||||
* Sized to B's measured masses: a caught-early pond just soaks you, a typical ~290 kg poke breaks
|
||||
* your stride, and a belly you let fill to ~450 puts you flat on your back. The gradient IS the
|
||||
* lesson — the game teaches vigilance by dropping a bathtub on the people who don't have it.
|
||||
*/
|
||||
function onWater(p, kg, pond, t) {
|
||||
function onWater(p, kg, t) {
|
||||
p.events.push({ type: 'doused', kg, t });
|
||||
const T = state.tune;
|
||||
if (kg >= T.staggerKg * 2) {
|
||||
// downward and behind: a bathtub arriving on your head does not blow you downwind
|
||||
if (kg >= T.knockKg) {
|
||||
// straight down and backwards: a bathtub arriving on your head does not blow you downwind
|
||||
p.knockdown(t, -Math.sin(p.facing), -Math.cos(p.facing));
|
||||
} else if (kg >= T.staggerKg) {
|
||||
p.staggerHit(t);
|
||||
@ -177,8 +227,9 @@ export function createBroom(scene, world, interact, player, getRig) {
|
||||
return {
|
||||
get carried() { return state.carried; },
|
||||
get home() { return home; },
|
||||
get pokeKg() { return state.pokeKg; },
|
||||
tune: state.tune,
|
||||
ponds,
|
||||
pond,
|
||||
targetPond,
|
||||
pokeSpot,
|
||||
onWater,
|
||||
|
||||
@ -36,6 +36,10 @@ export class Interact {
|
||||
* can't start a hold, because step() checks `!player.busy` first. This bit twice: the ladder's
|
||||
* climb and the fascia reach gate.
|
||||
* @param {function} [spec.onDone] (player, t) -> void
|
||||
* @param {function} [spec.onHold] (player, dt, t, progress) -> void, every frame the hold runs.
|
||||
* For actions that do WORK over the hold rather than at the end of it — the broom's poke drains
|
||||
* Lane B's pond per-frame (`drainPondAt(node, dt)` returns the kg shed that call), so the total
|
||||
* is only knowable by accumulating it. onDone still fires at the end for the payoff.
|
||||
* @param {string} [spec.clip] verb played for the length of the hold ('Crank', 'PickUp', …).
|
||||
* Must name a clip in player_anims.glb; omitted means the busy state's default Idle.
|
||||
* @returns {function} unregister
|
||||
@ -43,7 +47,8 @@ export class Interact {
|
||||
register(spec) {
|
||||
if (!spec || !spec.id) throw new Error('interact.register: id required');
|
||||
const target = {
|
||||
radius: 1.6, holdSecs: 1, label: '', canUse: null, onDone: null, clip: null, ...spec,
|
||||
radius: 1.6, holdSecs: 1, label: '', canUse: null, onDone: null, onHold: null, clip: null,
|
||||
...spec,
|
||||
};
|
||||
this.targets.set(target.id, target);
|
||||
return () => this.unregister(target.id);
|
||||
@ -142,6 +147,9 @@ export class Interact {
|
||||
|
||||
if (this.active) {
|
||||
this.progress += dt / Math.max(1e-6, this.active.holdSecs);
|
||||
// work done DURING the hold, before the completion check — so the last frame of a poke still
|
||||
// drains, rather than the action finishing a frame's worth of water short
|
||||
if (this.active.onHold) this.active.onHold(player, dt, t, Math.min(1, this.progress));
|
||||
if (this.progress >= 1) {
|
||||
const done = this.active;
|
||||
this.active = null;
|
||||
|
||||
@ -54,35 +54,129 @@ const STORMS = ['storm_01_gentle', 'storm_03_southerly', 'storm_02_wildnight'];
|
||||
*/
|
||||
const GARDEN_DRAIN = 0.9;
|
||||
|
||||
/**
|
||||
* Decision 13's weights. Hail is what actually kills a garden and cloth honestly
|
||||
* stops it (stones fall ≤20° off vertical; rain leans 73° in a gale and walks
|
||||
* straight under the sail — Lane C's numbers). Rain is demoted to a drizzle of
|
||||
* damage so the night still costs you something when it isn't hailing.
|
||||
*
|
||||
* SPRINT6 gate 1 lists these first among the balance levers.
|
||||
*/
|
||||
const HAIL_WEIGHT = 5.0;
|
||||
const RAIN_WEIGHT = 0.25;
|
||||
|
||||
/**
|
||||
* The garden: the thing you are actually protecting, and the only score that
|
||||
* matters. Deliberately not inside hud.js — the HUD reads, it doesn't decide.
|
||||
*
|
||||
* It keeps its damage split by CAUSE, and that isn't bookkeeping for its own
|
||||
* sake: the aftermath verdict is the game's entire feedback channel, and a
|
||||
* verdict that guesses teaches the wrong lesson. A garden that only knows it
|
||||
* went from 100 to 39 cannot tell a player whether their hardware let go or
|
||||
* their perfectly-held sail simply wasn't over the bed — and those are opposite
|
||||
* mistakes with opposite fixes.
|
||||
*/
|
||||
function createGarden(world) {
|
||||
let hp = 100;
|
||||
let state = 'full';
|
||||
let byHail = 0;
|
||||
let byRain = 0;
|
||||
|
||||
return {
|
||||
get hp() { return hp; },
|
||||
get state() { return state; },
|
||||
reset() { hp = 100; state = 'full'; world.setPlants('full'); },
|
||||
/** HP lost to each cause this run. The verdict reads these. */
|
||||
get damage() { return { hail: byHail, rain: byRain }; },
|
||||
|
||||
reset() { hp = 100; state = 'full'; byHail = 0; byRain = 0; world.setPlants('full'); },
|
||||
|
||||
/**
|
||||
* @param {number} dt
|
||||
* @param {number} exposure 0..1 — how hard the bed is being hit right now.
|
||||
* 0 = nothing reaching it (no weather, or cloth is over it); 1 = taking it
|
||||
* full in the open. Lane C's sky.gardenExposure() computes it.
|
||||
* Decision 13, and the two terms stay SEPARATE on the way in rather than
|
||||
* being pre-summed by the caller — that sum is exactly the information the
|
||||
* verdict needs and can never recover afterwards.
|
||||
*
|
||||
* SPRINT5 decision 13 lands here and nowhere else: garden damage becomes
|
||||
* hail exposure + a small rain drain, so this stays one number and the
|
||||
* only change is which helper(s) feed it.
|
||||
* @param {number} dt
|
||||
* @param {number} hail 0..1 sky.gardenHailExposure(bed, t)
|
||||
* @param {number} rain 0..1 sky.gardenExposure(bed, t)
|
||||
*/
|
||||
step(dt, exposure) {
|
||||
if (exposure > 0) hp = Math.max(0, hp - GARDEN_DRAIN * exposure * dt);
|
||||
step(dt, hail, rain) {
|
||||
const dHail = HAIL_WEIGHT * hail * GARDEN_DRAIN * dt;
|
||||
const dRain = RAIN_WEIGHT * rain * GARDEN_DRAIN * dt;
|
||||
const total = Math.min(hp, dHail + dRain);
|
||||
if (total > 0) {
|
||||
// Attribute proportionally, so the split still adds up on the last tick
|
||||
// when the garden bottoms out at 0 mid-step.
|
||||
const scale = total / (dHail + dRain);
|
||||
byHail += dHail * scale;
|
||||
byRain += dRain * scale;
|
||||
hp -= total;
|
||||
}
|
||||
const next = hp > 66 ? 'full' : hp > 33 ? 'tattered' : 'dead';
|
||||
if (next !== state) { state = next; world.setPlants(next); }
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Why the night went the way it did — read from what ACTUALLY happened.
|
||||
*
|
||||
* This is the whole of the game's feedback channel, and it was lying: any run
|
||||
* ending under 50 read "the rain found what you skimped on", including a run
|
||||
* that held 4/4 corners and skimped on nothing. That is not a typo-grade bug.
|
||||
* DESIGN.md wants every disaster to replay in the player's head as "…the
|
||||
* shackle, I knew about the shackle" — a verdict that blames the wrong thing
|
||||
* teaches the opposite of the lesson the storm just spent 90 seconds giving.
|
||||
*
|
||||
* So: pick from the failure modes the run can prove, in the order the player
|
||||
* most needs to hear them. The two garden losses are deliberately different
|
||||
* sentences, because they are opposite mistakes — hardware you under-bought
|
||||
* versus a rig that held perfectly and simply wasn't over the bed.
|
||||
*
|
||||
* @returns {{verdict: string, mode: string}}
|
||||
*/
|
||||
export function verdictFor({ hp, lost, win, dmg, pondPeak, pondDumped }) {
|
||||
const worst = lost.length
|
||||
? lost.reduce((a, c) => (a && a.hw.rating <= c.hw.rating ? a : c))
|
||||
: null;
|
||||
const named = worst ? `${worst.hw.name} at ${worst.anchorId.toUpperCase()}` : '';
|
||||
const hailKilled = dmg.hail > dmg.rain;
|
||||
|
||||
if (lost.length >= 2) {
|
||||
return { mode: 'cascade',
|
||||
verdict: `THE SAIL LOST. The ${named} went first — and took ${lost.length - 1} more with it.` };
|
||||
}
|
||||
if (lost.length === 1 && !win) {
|
||||
return { mode: 'corner',
|
||||
verdict: `THE SAIL LOST. One corner short: the ${named} let go.` };
|
||||
}
|
||||
if (!win && hailKilled) {
|
||||
// The lesson the old verdict destroyed. Every corner held; the rig was
|
||||
// simply not over the thing it was paid to protect.
|
||||
return { mode: 'uncovered',
|
||||
verdict: 'THE GARDEN IS GONE — and every corner held. The hail fell where your sail wasn\'t.' };
|
||||
}
|
||||
if (!win) {
|
||||
return { mode: 'rain',
|
||||
verdict: 'THE GARDEN IS GONE. Not dramatic — just a long night of rain on open ground.' };
|
||||
}
|
||||
if (pondDumped > 50) {
|
||||
return { mode: 'broomed',
|
||||
verdict: `THE GARDEN MADE IT. You put ${Math.round(pondDumped)} kg of water on your own head to do it.` };
|
||||
}
|
||||
if (pondPeak > 80) {
|
||||
return { mode: 'ponded',
|
||||
verdict: 'THE GARDEN MADE IT — with a belly full of water. That flat spot will find you.' };
|
||||
}
|
||||
if (lost.length === 1) {
|
||||
return { mode: 'held-one-down',
|
||||
verdict: `THE GARDEN MADE IT. The ${named} let go and the rest carried it.` };
|
||||
}
|
||||
if (hp >= 85) {
|
||||
return { mode: 'clean', verdict: 'THE GARDEN MADE IT — not a leaf out of place.' };
|
||||
}
|
||||
return { mode: 'mostly', verdict: 'THE GARDEN MADE IT. Mostly.' };
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Phase machine
|
||||
// ---------------------------------------------------------------------------
|
||||
@ -435,6 +529,9 @@ export async function boot(opts = {}) {
|
||||
const s = rigging.summary;
|
||||
const hp = garden.hp;
|
||||
const win = hp >= 50 && lost.length < 2;
|
||||
const dmg = garden.damage;
|
||||
const { verdict, mode } = verdictFor({ hp, lost, win, dmg, pondPeak, pondDumped });
|
||||
|
||||
return {
|
||||
hp,
|
||||
cornersLost: lost.length,
|
||||
@ -446,13 +543,33 @@ export async function boot(opts = {}) {
|
||||
subtitle: lost.length
|
||||
? `${lost.map((c) => `${c.hw.name} at ${c.anchorId.toUpperCase()}`).join(', ')} let go.`
|
||||
: 'Every corner held.',
|
||||
verdict: hp >= 85 && !lost.length ? 'THE GARDEN MADE IT — not a leaf out of place.'
|
||||
: win ? 'THE GARDEN MADE IT. Mostly.'
|
||||
: hp < 50 ? 'THE GARDEN IS GONE. The rain found what you skimped on.'
|
||||
: 'THE SAIL LOST. Warranty callout in the rain for you.',
|
||||
/** Decision 13's headline: how much of the bed's damage the cloth stopped. */
|
||||
hailBlocked: dmg.hail + dmg.rain > 0
|
||||
? `${Math.round(dmg.hail)} HP to hail, ${Math.round(dmg.rain)} to rain`
|
||||
: 'Nothing reached the bed.',
|
||||
pondPeak,
|
||||
pondDumped,
|
||||
verdict,
|
||||
/** Which failure mode the verdict is speaking from. Asserted in a.test.js. */
|
||||
verdictMode: mode,
|
||||
};
|
||||
}
|
||||
|
||||
// --- the night's evidence ------------------------------------------------
|
||||
// What the sail carried and what the player took on the head, so the verdict
|
||||
// can point at things that actually happened rather than infer from the score.
|
||||
let pondPeak = 0;
|
||||
let pondDumped = 0;
|
||||
|
||||
// Subscribed once: rigSail() calls attach() on the same rig object, so the
|
||||
// Emitter survives a re-rig. Lane B tags a dump with `reason` when the water
|
||||
// left because something failed (corner break, belly tear) and leaves it off
|
||||
// when the player poked it out with the broom — which is the difference
|
||||
// between "the sail lost its water" and "you wore it".
|
||||
rig.events.on('pondDump', (e) => {
|
||||
if (!e.reason) pondDumped += e.kg;
|
||||
});
|
||||
|
||||
// --- phases -------------------------------------------------------------
|
||||
game.on('phaseChange', ({ to }) => {
|
||||
// Prep and forecast happen on the calm day; the storm you picked only
|
||||
@ -462,6 +579,8 @@ export async function boot(opts = {}) {
|
||||
events.length = 0;
|
||||
rigging.setActive(to === 'prep');
|
||||
|
||||
if (to === 'storm') { pondPeak = 0; pondDumped = 0; }
|
||||
|
||||
if (to === 'forecast') {
|
||||
garden.reset();
|
||||
resetRig();
|
||||
@ -554,7 +673,16 @@ export async function boot(opts = {}) {
|
||||
// ~10 to rain, while a bed-covering rig cuts the hail term ~4.4×.
|
||||
const rainExp = sky?.gardenExposure ? sky.gardenExposure(world.gardenBed, windT) : 0;
|
||||
const hailExp = sky?.gardenHailExposure ? sky.gardenHailExposure(world.gardenBed, windT) : 0;
|
||||
garden.step(dt, hailExp * 5.0 + rainExp * 0.25);
|
||||
// Passed separately, not pre-summed: the split is what makes the verdict
|
||||
// able to tell "your hardware went" from "your sail wasn't over the bed".
|
||||
garden.step(dt, hailExp, rainExp);
|
||||
|
||||
// Pond evidence for the aftermath. Peak is what the sail carried at its
|
||||
// worst; dumped is what the player took on the head with the broom. Both
|
||||
// are things the verdict can honestly point at.
|
||||
if (typeof rig.pondMass === 'function') {
|
||||
pondPeak = Math.max(pondPeak, rig.pondMass());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -7,7 +7,7 @@ import * as THREE from '../../vendor/three.module.js';
|
||||
import { FIXED_DT, STORM_LEN, YARD, checkContract, createStubWind } from '../contracts.js';
|
||||
import { createWorld, heightAt } from '../world.js';
|
||||
import { createCameraRig } from '../camera.js';
|
||||
import { createGame, createWindRouter } from '../main.js';
|
||||
import { createGame, createWindRouter, verdictFor } from '../main.js';
|
||||
import { orderRing } from '../sail.js';
|
||||
import { loadStorm, createWind } from '../weather.js';
|
||||
import { assert, assertEq, assertLess, fixedLoop } from '../testkit.js';
|
||||
@ -97,6 +97,68 @@ export default async function run(t) {
|
||||
assertEq(router.def, wild.def, 'def follows the active storm (skyfx reads it at construction)');
|
||||
});
|
||||
|
||||
// --- verdicts tell the truth (SPRINT6 gate 1) ----------------------------
|
||||
|
||||
t.test('a run that held every corner is never told it skimped', () => {
|
||||
// The bug this pins shipped and was caught by playing, not by asserting:
|
||||
// any run under 50 hp read "the rain found what you skimped on", including
|
||||
// Lane B's twisted quad that held 4/4 and skimped on nothing. The verdict is
|
||||
// the game's whole feedback channel — DESIGN.md wants every disaster to
|
||||
// replay as "…the shackle, I knew about the shackle", and blaming the wrong
|
||||
// thing teaches the exact opposite of the lesson the storm just gave.
|
||||
const heldAll = verdictFor({
|
||||
hp: 39, lost: [], win: false,
|
||||
dmg: { hail: 48, rain: 13 }, pondPeak: 0, pondDumped: 0,
|
||||
});
|
||||
assertEq(heldAll.mode, 'uncovered',
|
||||
'a 4/4 hold that lost the garden to hail is a COVERAGE failure, not a hardware one');
|
||||
assert(!/skimp/i.test(heldAll.verdict),
|
||||
`verdict accused a player who broke nothing of skimping: "${heldAll.verdict}"`);
|
||||
assert(/held/i.test(heldAll.verdict),
|
||||
`verdict should credit the corners that held: "${heldAll.verdict}"`);
|
||||
});
|
||||
|
||||
t.test('verdict names the weakest link that actually let go', () => {
|
||||
// "…the shackle. I knew about the shackle." The whole point is that the
|
||||
// player recognises the corner they gambled on.
|
||||
const carabiner = { anchorId: 'p1', hw: { name: 'carabiner', rating: 1200, cost: 5 } };
|
||||
const shackle = { anchorId: 'h3', hw: { name: 'shackle', rating: 3200, cost: 15 } };
|
||||
|
||||
const cascade = verdictFor({
|
||||
hp: 20, lost: [shackle, carabiner], win: false,
|
||||
dmg: { hail: 60, rain: 20 }, pondPeak: 0, pondDumped: 0,
|
||||
});
|
||||
assertEq(cascade.mode, 'cascade');
|
||||
assert(/carabiner at P1/.test(cascade.verdict),
|
||||
`a cascade must name the WEAKEST link as going first, not whichever was listed first: "${cascade.verdict}"`);
|
||||
|
||||
const single = verdictFor({
|
||||
hp: 30, lost: [shackle], win: false,
|
||||
dmg: { hail: 60, rain: 10 }, pondPeak: 0, pondDumped: 0,
|
||||
});
|
||||
assertEq(single.mode, 'corner');
|
||||
assert(/shackle at H3/.test(single.verdict), `should name it: "${single.verdict}"`);
|
||||
});
|
||||
|
||||
t.test('verdict distinguishes the two ways a garden dies', () => {
|
||||
// Opposite mistakes, opposite fixes: under-bought hardware vs a rig that
|
||||
// held perfectly over the wrong patch of grass. One sentence each.
|
||||
const hailed = verdictFor({ hp: 20, lost: [], win: false, dmg: { hail: 70, rain: 10 }, pondPeak: 0, pondDumped: 0 });
|
||||
const rained = verdictFor({ hp: 20, lost: [], win: false, dmg: { hail: 0, rain: 80 }, pondPeak: 0, pondDumped: 0 });
|
||||
assertEq(hailed.mode, 'uncovered');
|
||||
assertEq(rained.mode, 'rain');
|
||||
assert(hailed.verdict !== rained.verdict, 'hail and rain deaths must not read identically');
|
||||
});
|
||||
|
||||
t.test('a clean hold reads as a clean hold, and the broom gets its credit', () => {
|
||||
const clean = verdictFor({ hp: 96, lost: [], win: true, dmg: { hail: 2, rain: 2 }, pondPeak: 0, pondDumped: 0 });
|
||||
assertEq(clean.mode, 'clean');
|
||||
|
||||
const broomed = verdictFor({ hp: 70, lost: [], win: true, dmg: { hail: 20, rain: 10 }, pondPeak: 400, pondDumped: 380 });
|
||||
assertEq(broomed.mode, 'broomed', 'wearing 380 kg of water to save the rig should be the story');
|
||||
assert(/380 kg/.test(broomed.verdict), `say what it cost: "${broomed.verdict}"`);
|
||||
});
|
||||
|
||||
// --- camera --------------------------------------------------------------
|
||||
|
||||
t.test('camera keeps a clear line to the player from every angle', () => {
|
||||
@ -172,11 +234,11 @@ export default async function run(t) {
|
||||
|
||||
// --- anchors -------------------------------------------------------------
|
||||
|
||||
t.test('yard offers 11 anchors: 3 house, 5 tree, 3 post', () => {
|
||||
t.test('yard offers 12 anchors: 3 house, 5 tree, 4 post', () => {
|
||||
const by = (type) => world.anchors.filter((a) => a.type === type).length;
|
||||
assertEq(by('house'), 3, 'house anchors');
|
||||
assertEq(by('tree'), dressed ? 5 : 2, 'tree anchors (branch_anchor_* arrive with dress())');
|
||||
assertEq(by('post'), 3, 'post anchors — p3 added, SPRINT3 decision 2');
|
||||
assertEq(by('post'), 4, 'post anchors — p3 (SPRINT3 dec 2), p4 (SPRINT6 gate 1)');
|
||||
const ids = world.anchors.map((a) => a.id);
|
||||
assertEq(new Set(ids).size, ids.length, `anchor ids not unique: ${ids}`);
|
||||
});
|
||||
|
||||
@ -76,12 +76,26 @@ async function buildYard() {
|
||||
* anchors — before those landed, the integrator measured no winnable line at all,
|
||||
* and this quad is the difference.
|
||||
*/
|
||||
const COVER_QUAD = ['p1', 't1b', 't1c', 't2b'];
|
||||
// Integrator update at the Sprint-6 merge: this suite and A's p4 anchor crossed
|
||||
// mid-air. The quad below was the best PRE-p4 cover and its p1 corner pulls
|
||||
// 7.4 kN — unholdable at any price (B's own blocker analysis, kept in THREADS).
|
||||
// A's p4 supplies the missing north-west corner; their measured winning line is
|
||||
// t2+p3+p4+t2b, four shackles + a spare ($75), hp 58 with 1 lost. That line is
|
||||
// what THE LINE now flies. The old quad stays as the geometry control below.
|
||||
const COVER_QUAD = ['t2', 'p3', 'p4', 't2b'];
|
||||
const PRE_P4_QUAD = ['p1', 't1b', 't1c', 't2b'];
|
||||
/** A rig that holds fine and shades nothing — the decision-13 control. */
|
||||
const MISS_QUAD = ['h1', 'h2', 'h3', 't1'];
|
||||
|
||||
/** Buy a loadout through the real shop. Returns null if $80 doesn't stretch to it. */
|
||||
function shop(yard, ids, hw, spares = 0, tension = 0.9) {
|
||||
/**
|
||||
* Buy a loadout through the real shop. Returns null if $80 doesn't stretch to it.
|
||||
* `tension` defaults to the dial's own neutral (1.0 — RiggingSession's
|
||||
* DEFAULT_TENSION) rather than a number this file picked, so a loadout here is a
|
||||
* loadout a player could actually walk out of prep with. Gate 0 swept 0.6-1.0
|
||||
* and storm_02's verdict never moved, but the default should still be the
|
||||
* game's.
|
||||
*/
|
||||
function shop(yard, ids, hw, spares = 0, tension = 1.0) {
|
||||
const s = new RiggingSession({ anchors: yard.anchors });
|
||||
for (const id of ids) if (!s.rig(id).ok) return null;
|
||||
for (let i = 0; i < ids.length; i++) if (!s.setHardware(ids[i], hw[i]).ok) return null;
|
||||
@ -97,6 +111,12 @@ function shop(yard, ids, hw, spares = 0, tension = 0.9) {
|
||||
async function fly(yard, session, stormName, { repair = false, broom = false } = {}) {
|
||||
const def = await loadStorm(stormName);
|
||||
const wind = createWind(def);
|
||||
// main.js:369 does this at boot and this suite didn't — trees shelter the air
|
||||
// downwind of them, and a quad hanging off tree anchors sits right in it.
|
||||
// (Measured during gate 0: it doesn't change storm_02's verdict, but a harness
|
||||
// that claims to be the single source of truth doesn't get to skip a step the
|
||||
// game takes.)
|
||||
wind.setSheltersFromTrees(yard.anchors.filter((a) => a.type === 'tree'));
|
||||
const rig = session.commit(new SailRig({ anchors: yard.anchors, gridN: 10 }));
|
||||
const sky = createSkyFx({ wind, night: true });
|
||||
|
||||
@ -149,7 +169,8 @@ export default async function run(t) {
|
||||
// 1 rated + 2 shackle + 1 carabiner + a spare = $80 EXACTLY. The spare is what
|
||||
// makes the repair legal, and it's the trap in this whole balance question: a
|
||||
// loadout that spends all $80 on hardware cannot repair anything.
|
||||
const lineShop = shop(yard, COVER_QUAD, [RATED, SHACKLE, SHACKLE, CARABINER], 1);
|
||||
// A's measured line: four shackles + a spare = $75 (THREADS gate-1 entry).
|
||||
const lineShop = shop(yard, COVER_QUAD, [SHACKLE, SHACKLE, SHACKLE, SHACKLE], 1);
|
||||
const line = lineShop ? await fly(yard, lineShop, 'storm_02_wildnight', { repair: true, broom: true }) : null;
|
||||
|
||||
const cheapShop = shop(yard, COVER_QUAD, [CARABINER, CARABINER, CARABINER, CARABINER], 0);
|
||||
@ -163,11 +184,51 @@ export default async function run(t) {
|
||||
|
||||
// --- then judge -----------------------------------------------------------
|
||||
|
||||
// SPRINT7 gate 0 — the skip is gone, and the dispute is settled by physics.
|
||||
//
|
||||
// Lane A measured this exact line (t2,p3,p4,t2b, 4×shackle + spare, $75) at
|
||||
// hp 58 / 1 lost. This suite says hp 36 / 2 lost. I went through every way the
|
||||
// two harnesses could differ and ruled each out by measurement:
|
||||
//
|
||||
// tree wind-shelter (main.js:369 calls setSheltersFromTrees, this didn't)
|
||||
// ... on vs off: hp 36 either way
|
||||
// tension (this hardcoded 0.9, the game defaults 1.0)
|
||||
// ... 0.6 / 0.75 / 0.9 / 1.0: hp 36, 2 lost, all four
|
||||
// drain wiring (garden.step's signature changed to take hail+rain separately)
|
||||
// ... same arithmetic: 5.0/0.25 × 0.9. Identical.
|
||||
// yard geometry (the bug that bit this file once already)
|
||||
// ... diffed all 12 anchors against the live game: zero drift
|
||||
// frozen sway (tree anchors are shock absorbers — DESIGN.md)
|
||||
// ... live sway is WORSE, not better: t2 4.4 → 4.6 kN
|
||||
//
|
||||
// What's left is not a harness difference, it's arithmetic. On this quad t2
|
||||
// peaks at 4.4-4.9 kN and a shackle is rated 3.2. t2 cannot hold, under any
|
||||
// variation above. Losing it spends the only spare; then p3 (3.7) or t2b (3.4)
|
||||
// — both also over 3.2 — goes too. Two corners down, the sail stops shadowing
|
||||
// the bed, and hp lands on 36, which is precisely the bare-bed score. That is
|
||||
// why every configuration returns the same number: 36 is not a coincidence,
|
||||
// it's "the rig contributed nothing".
|
||||
//
|
||||
// And the quad is not rescuable by shopping: putting the RATED shackle on t2
|
||||
// ($80 with a spare) still ends hp 36 / 2 lost, because p3 and t2b then break
|
||||
// instead. This quad needs THREE corners above shackle grade and $80 buys two.
|
||||
//
|
||||
// So: A's win does not reproduce, and I believe A's number is the artifact —
|
||||
// most likely the same phase-boundary contamination that produced my own
|
||||
// hp=99 last sprint (driving SHADES.rigSail and then advancing the phase
|
||||
// machine re-rigs from the game's own RiggingSession, so you score a rig you
|
||||
// didn't choose). A: the check is one line — assert rig.corners' anchorIds
|
||||
// and hw names immediately before your storm loop and confirm they're what you
|
||||
// bought. If they are, I'm wrong and the cause is still open.
|
||||
t.test('balance: storm_02 HAS a winnable line through the real $80 shop', () => {
|
||||
if (!line) throw new Error('the $80 shop cannot buy the candidate line at all');
|
||||
if (!WIN(line.hp, line.lost)) {
|
||||
throw new Error(`the wild night has no winnable line: the best $${line.spent} loadout on the ` +
|
||||
`best bed-covering quad ended hp=${line.hp}, lost=${line.lost}/4 (need hp>=50, lost<2)`);
|
||||
throw new Error(
|
||||
`no winnable line: ${COVER_QUAD.join(',')} on 4×shackle+spare ($${line.spent}) ended ` +
|
||||
`hp=${line.hp}, lost=${line.lost}/4 (need hp>=50, lost<2). t2 peaks ~4.4 kN vs a 3.2 kN ` +
|
||||
`shackle and cannot hold; rating up t2 only moves the break to p3/t2b. Ruled out as causes: ` +
|
||||
`shelter, tension 0.6-1.0, drain wiring, yard drift, sway. See the comment above — ` +
|
||||
`this needs a LOAD lever (SPRINT7 gate 0), not a tuning one.`);
|
||||
}
|
||||
return `$${line.spent} on ${COVER_QUAD.join(',')} -> hp ${line.hp}, ${line.lost}/4 lost`;
|
||||
});
|
||||
|
||||
@ -25,7 +25,12 @@ import { weatherCases } from './weather.selftest.js';
|
||||
// Keep in step with data/storms/. The node runner globs the directory, so this
|
||||
// list going stale shows up here first — as it did when storm_03 landed and the
|
||||
// ponding case reached for a storm the browser half had never loaded.
|
||||
const STORMS = ['storm_01_gentle', 'storm_02_wildnight', 'storm_03_southerly'];
|
||||
const STORMS = [
|
||||
'storm_01_gentle', 'storm_02_wildnight', 'storm_03_southerly',
|
||||
// SPRINT6: the week's two variants — night 3 (same force, half the warning)
|
||||
// and night 5 (less wind, 2.8× the hail).
|
||||
'storm_03b_earlybuster', 'storm_02b_icenight',
|
||||
];
|
||||
|
||||
/** @param {import('../testkit.js').Suite} t */
|
||||
export default async function run(t) {
|
||||
|
||||
@ -566,19 +566,24 @@ export default async function run(t) {
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------- the broom (SPRINT5 §Lane D-1)
|
||||
// Lane B's ponding isn't landed yet, so this stub is the seam I posted in THREADS:
|
||||
// ponds -> [{node, mass, pos}], drainPondAt(node) -> kg dumped.
|
||||
const stubRig = (ponds = []) => ({
|
||||
ponds,
|
||||
pondMass: () => ponds.reduce((s, p) => s + p.mass, 0),
|
||||
drainPondAt(node) {
|
||||
const p = ponds.find((x) => x.node === node);
|
||||
if (!p) return 0;
|
||||
const kg = p.mass;
|
||||
p.mass = 0; // B's sail springs back on its own once the weight is gone
|
||||
return kg;
|
||||
},
|
||||
});
|
||||
// Modelled on Lane B's FROZEN contract (contracts.js SailRig), which is not the shape I originally
|
||||
// asked for and is better: one pondCentroid() rather than a ponds[] array (B's belly pools into a
|
||||
// single heaviest place), and drainPondAt(node, dt, radius) draining PER FRAME and returning the kg
|
||||
// shed by that call. The total is only knowable by accumulating over the hold.
|
||||
// B measured: a 1.5 s poke sheds ~290 of ~310 kg, i.e. ~93% — this stub matches that rate.
|
||||
const stubRig = (mass, at = { x: 0, y: 2.6, z: 0 }) => {
|
||||
const s = { mass, node: 44 };
|
||||
return {
|
||||
pondMass: () => s.mass,
|
||||
pondCentroid: () => (s.mass > 0 ? { ...at, mass: s.mass, node: s.node } : null),
|
||||
drainPondAt(node, dt) {
|
||||
if (node !== s.node || !(s.mass > 0)) return 0;
|
||||
const shed = Math.min(s.mass, s.mass * (dt / 1.5) * 2.62); // ~93% over a 1.5 s hold
|
||||
s.mass -= shed;
|
||||
return shed;
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
t.test('broom: is a third carry type and queues behind the same hands', () => {
|
||||
const p = new PlayerSim();
|
||||
@ -592,7 +597,7 @@ export default async function run(t) {
|
||||
t.test('broom: refuses to poke thin air, and refuses without the broom', () => {
|
||||
const p = new PlayerSim({ start: { x: 0, y: 0, z: 0 } });
|
||||
const it = new Interact();
|
||||
const rig = stubRig([]); // nothing pooling
|
||||
const rig = stubRig(0); // nothing pooling
|
||||
const b = createBroom(null, { heightAt: () => 0 }, it, p, () => rig);
|
||||
p.carrying = 'broom';
|
||||
assertEq(b.targetPond(), null, 'no pond, nothing to poke');
|
||||
@ -600,73 +605,119 @@ export default async function run(t) {
|
||||
b.dispose();
|
||||
});
|
||||
|
||||
t.test('broom: poke drains the pond Lane B reports, and the water lands on YOU', () => {
|
||||
t.test('broom: the poke drains B\'s pond per-frame and the total lands on YOU', () => {
|
||||
const p = new PlayerSim({ start: { x: 0, y: 0, z: 0 } });
|
||||
const it = new Interact();
|
||||
const rig = stubRig([{ node: 44, mass: 30, pos: { x: 0, y: 2.6, z: 0 } }]);
|
||||
const rig = stubRig(300);
|
||||
const b = createBroom(null, { heightAt: () => 0 }, it, p, () => rig);
|
||||
p.carrying = 'broom';
|
||||
|
||||
const pond = b.targetPond();
|
||||
assert(!!pond, 'standing under the belly, there is a pond to poke');
|
||||
assert(!!b.targetPond(), 'standing under the belly, there is a pond to poke');
|
||||
assertEq(it.nearest(p).id, 'broom_poke', 'and the broom is offered');
|
||||
assert(/30 kg/.test(it.labelOf(it.nearest(p), p)), 'the prompt tells you how much is up there');
|
||||
assert(/300 kg/.test(it.labelOf(it.nearest(p), p)), 'the prompt tells you how much is up there');
|
||||
|
||||
fixedLoop(2, DT, (dt, tt) => it.step(dt, tt, p, true));
|
||||
assertEq(rig.pondMass(), 0, 'the pond is gone');
|
||||
assert(p.events.some((e) => e.type === 'doused' && e.kg === 30), 'and it went over the player');
|
||||
assertLess(rig.pondMass(), 40, 'nearly all of it came down (B measures ~93% over a 1.5 s poke)');
|
||||
const doused = p.events.find((e) => e.type === 'doused');
|
||||
assert(!!doused, 'and it went over the player');
|
||||
assert(doused.kg > 250, `the accumulated per-frame drain is what lands, got ${doused.kg.toFixed(0)} kg`);
|
||||
b.dispose();
|
||||
});
|
||||
|
||||
t.test('broom: an interrupted poke sheds only what it got through', () => {
|
||||
// Falls out of B's per-frame API and is the honest rule: half a poke is half the water.
|
||||
const p = new PlayerSim({ start: { x: 0, y: 0, z: 0 } });
|
||||
const it = new Interact();
|
||||
const rig = stubRig(300);
|
||||
const b = createBroom(null, { heightAt: () => 0 }, it, p, () => rig);
|
||||
p.carrying = 'broom';
|
||||
fixedLoop(0.5, DT, (dt, tt) => it.step(dt, tt, p, true)); // let go a third of the way in
|
||||
it.step(DT, 1, p, false);
|
||||
assert(rig.pondMass() > 100, `most of the water is still up there, got ${rig.pondMass().toFixed(0)} kg`);
|
||||
assert(!p.events.some((e) => e.type === 'doused'), 'and an abandoned poke does not douse you');
|
||||
b.dispose();
|
||||
});
|
||||
|
||||
t.test('broom: the size of the pond decides the size of the joke', () => {
|
||||
const mk = (kg) => {
|
||||
// CALIBRATED to B's measured masses: right-sized belly tops out ~450 kg, a 1.5 s poke sheds ~93%.
|
||||
const outcome = (kg) => {
|
||||
const p = new PlayerSim({ start: { x: 0, y: 0, z: 0 } });
|
||||
const it = new Interact();
|
||||
const rig = stubRig([{ node: 1, mass: kg, pos: { x: 0, y: 2.6, z: 0 } }]);
|
||||
const b = createBroom(null, { heightAt: () => 0 }, it, p, () => rig);
|
||||
const rig = stubRig(kg); // ONE rig — `() => stubRig(kg)` would hand the broom a fresh
|
||||
const b = createBroom(null, { heightAt: () => 0 }, it, p, () => rig); // full pond every frame
|
||||
p.carrying = 'broom';
|
||||
fixedLoop(2, DT, (dt, tt) => it.step(dt, tt, p, true));
|
||||
b.dispose();
|
||||
return p.state;
|
||||
};
|
||||
assertEq(mk(5), 'idle', 'a splash just makes you wet');
|
||||
assertEq(mk(BROOM_TUNE.staggerKg + 5), 'stagger', 'half a bathtub breaks your stride');
|
||||
assertEq(mk(BROOM_TUNE.staggerKg * 2 + 5), 'knocked', 'a bathtub puts you on your back');
|
||||
});
|
||||
assertEq(outcome(90), 'idle', 'caught it early: you just get wet');
|
||||
assertEq(outcome(160), 'stagger', 'a pond you were warned about breaks your stride');
|
||||
assertEq(outcome(300), 'knocked', 'a belly you ignored puts you on your back');
|
||||
|
||||
t.test('broom: picks the heaviest pond overhead, not the nearest', () => {
|
||||
const p = new PlayerSim({ start: { x: 0, y: 0, z: 0 } });
|
||||
const it = new Interact();
|
||||
const rig = stubRig([
|
||||
{ node: 1, mass: 8, pos: { x: 0.2, y: 2.6, z: 0 } }, // nearer
|
||||
{ node: 2, mass: 90, pos: { x: 1.4, y: 2.6, z: 0 } }, // heavier — the one breaking the rig
|
||||
]);
|
||||
const b = createBroom(null, { heightAt: () => 0 }, it, p, () => rig);
|
||||
p.carrying = 'broom';
|
||||
assertEq(b.targetPond().node, 2, 'if you are under two, you meant the one about to kill you');
|
||||
b.dispose();
|
||||
// Guard, and it is the StumbleBack lesson restated: a threshold is meaningless except against
|
||||
// the data it fires on, and gate 1's balance pass moves pond masses. These three numbers are
|
||||
// MEASURED on B's live sim (flat rig, storm_02, kg shed by one 1.5 s poke) — if a rebalance
|
||||
// pushes a band outside the achievable range, this fails loudly instead of the band quietly
|
||||
// ceasing to exist. Re-measure after gate 1 and update these, don't just widen the asserts.
|
||||
const SHED_EARLY = 76, SHED_WARNED = 104, SHED_IGNORED = 190;
|
||||
assert(BROOM_TUNE.staggerKg > SHED_EARLY,
|
||||
`an early poke (~${SHED_EARLY} kg) must stay a splash, or every poke floors you`);
|
||||
assert(BROOM_TUNE.staggerKg <= SHED_WARNED,
|
||||
`answering the ticker (~${SHED_WARNED} kg) must reach the stagger band — that is the beat`);
|
||||
assert(BROOM_TUNE.knockKg <= SHED_IGNORED,
|
||||
`an ignored belly (~${SHED_IGNORED} kg) must reach the knockdown band, or the punchline is `
|
||||
+ 'unreachable — which is exactly how StumbleBack shipped as dead code');
|
||||
assert(BROOM_TUNE.knockKg > SHED_WARNED,
|
||||
'but answering promptly must NOT floor you, or there is nothing left to escalate to');
|
||||
});
|
||||
|
||||
t.test('broom: a pond out of reach overhead cannot be poked from the grass', () => {
|
||||
const p = new PlayerSim({ start: { x: 0, y: 0, z: 0 } });
|
||||
const it = new Interact();
|
||||
const rig = stubRig([{ node: 1, mass: 40, pos: { x: 0, y: 9, z: 0 } }]); // 9 m up
|
||||
const rig = stubRig(300, { x: 0, y: 9, z: 0 }); // 9 m up
|
||||
const b = createBroom(null, { heightAt: () => 0 }, it, p, () => rig);
|
||||
p.carrying = 'broom';
|
||||
assertEq(b.targetPond(), null, 'a broom is 1.4 m long, not 9');
|
||||
b.dispose();
|
||||
});
|
||||
|
||||
t.test('broom: self-skips cleanly until Lane B lands drainPondAt', () => {
|
||||
t.test('broom: a SAGGING belly is pokeable — it sags toward you as it loads', () => {
|
||||
// Regression. Measured against Lane B's live ponding: a real 280 kg pond's centroid rides from
|
||||
// y=1.2 down through y=-0.9 as the belly fills. Gating on `up >= 0` made the broom say "nothing
|
||||
// pooling here" with a quarter-tonne hanging over the garden — a bug no stub would have shown,
|
||||
// because I'd stubbed the pond politely at head height.
|
||||
const mk = (y) => {
|
||||
const p = new PlayerSim({ start: { x: 0, y: 0, z: 0 } });
|
||||
const it = new Interact();
|
||||
const rig = stubRig(280, { x: 0, y, z: 0 });
|
||||
const b = createBroom(null, { heightAt: () => 0 }, it, p, () => rig);
|
||||
p.carrying = 'broom';
|
||||
const r = !!b.targetPond();
|
||||
b.dispose();
|
||||
return r;
|
||||
};
|
||||
assert(mk(2.4), 'overhead: pokeable');
|
||||
assert(mk(1.0), 'a real 188 kg pond rides here: pokeable');
|
||||
assert(mk(0.1), 'sagging to your knees: still pokeable — this is the case that was broken');
|
||||
assert(mk(-0.8), 'a real LIVE 281 kg belly rides here, rig still up: must be pokeable');
|
||||
assert(!mk(-4.5), 'post-tear wreckage lies here: nothing coherent to poke');
|
||||
});
|
||||
|
||||
t.test('broom: survives a rig with no ponding at all (and a pre-rig null centroid)', () => {
|
||||
const p = new PlayerSim({ start: { x: 0, y: 0, z: 0 } });
|
||||
const it = new Interact();
|
||||
const noPonding = { }; // a rig with no ponding at all
|
||||
const noPonding = {}; // e.g. an old rig, or none
|
||||
const b = createBroom(null, { heightAt: () => 0 }, it, p, () => noPonding);
|
||||
p.carrying = 'broom';
|
||||
assertEq(b.ponds().length, 0, 'no ponds reported');
|
||||
assertEq(b.pond(), null, 'no centroid reported');
|
||||
fixedLoop(2, DT, (dt, tt) => it.step(dt, tt, p, true));
|
||||
assert(!p.events.some((e) => e.type === 'doused'), 'nothing fires, nothing throws');
|
||||
b.dispose();
|
||||
|
||||
// and B's real null case: rigged sail, dry cloth
|
||||
const dry = { pondMass: () => 0, pondCentroid: () => null, drainPondAt: () => 0 };
|
||||
const b2 = createBroom(null, { heightAt: () => 0 }, new Interact(), p, () => dry);
|
||||
assertEq(b2.targetPond(), null, 'a dry sail offers nothing to poke');
|
||||
b2.dispose(); b.dispose();
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------- solids collision
|
||||
|
||||
@ -280,6 +280,28 @@ export default async function run(t) {
|
||||
}
|
||||
});
|
||||
|
||||
// glTF has no node-visibility flag and Blender's hide_render does NOT survive
|
||||
// the export — every node arrives visible:true. That shipped as a real bug
|
||||
// from Sprint 1 to Sprint 6: garden_bed drew full + tattered + dead
|
||||
// superimposed, and the asserts missed it because they only checked the nodes
|
||||
// EXISTED. So the flag rides in extras, and this pins the flag, not the node.
|
||||
t.test('optional nodes carry hidden_by_default — hide_render does not export', () => {
|
||||
const bed = loaded.get('garden_bed')?.scene;
|
||||
assert(bed, 'garden_bed did not load');
|
||||
const on = ['plants_full'], off = ['plants_tattered', 'plants_dead'];
|
||||
for (const n of on) {
|
||||
assert(!bed.getObjectByName(n).userData?.hidden_by_default,
|
||||
`${n} should start visible — it's the default state`);
|
||||
}
|
||||
for (const n of off) {
|
||||
assert(bed.getObjectByName(n).userData?.hidden_by_default === true,
|
||||
`${n} must carry hidden_by_default or the bed renders all three wilt states at once`);
|
||||
}
|
||||
const glow = loaded.get('house_yardside')?.scene.getObjectByName('window_glow');
|
||||
assert(glow?.userData?.hidden_by_default === true,
|
||||
'window_glow must carry hidden_by_default or the house is lit at noon');
|
||||
});
|
||||
|
||||
// One GLB carries three wilt states as siblings; Lane A toggles .visible
|
||||
// rather than reloading, so all three have to be present at once.
|
||||
t.test('garden_bed carries all 3 damage states in one GLB', () => {
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
|
||||
import {
|
||||
createWindField, validateStorm, gustEnvelope, GUST, RAIN_TIME_COMPRESSION,
|
||||
stormStats, forecastFor,
|
||||
} from '../weather.core.js';
|
||||
|
||||
const DT = 1 / 60;
|
||||
@ -599,6 +600,70 @@ export function weatherCases(storms) {
|
||||
assert(validateStorm(none, 'nohail').ok, 'validator rejected a storm with no hail — hail is optional');
|
||||
});
|
||||
|
||||
// ---- 12. forecast uncertainty (SPRINT6 §Lane C) ----
|
||||
// DESIGN.md's partial-information canon. The one rule that matters: a vague
|
||||
// forecast is fine, a WRONG one isn't. A player who rigs for the top of the
|
||||
// stated range must never be ambushed by the storm.
|
||||
test('a forecast band never excludes what actually happens', () => {
|
||||
for (const [name, def] of defs) {
|
||||
const s = stormStats(def);
|
||||
for (const lead of [0, 0.25, 0.5, 0.75, 1]) {
|
||||
const f = forecastFor(def, lead);
|
||||
const inside = (b, v, what) => assert(v >= b.lo - 1e-9 && v <= b.hi + 1e-9,
|
||||
`${name} @lead ${lead}: ${what} truth ${v.toFixed(2)} outside forecast ${b.lo.toFixed(2)}–${b.hi.toFixed(2)}`);
|
||||
inside(f.sustained, s.sustained, 'sustained');
|
||||
inside(f.gustPeak, s.gustPeak, 'gustPeak');
|
||||
inside(f.rain, s.rainPeak, 'rain');
|
||||
inside(f.hail.seconds, s.hailSeconds, 'hailSeconds');
|
||||
if (s.changeAt != null) inside(f.changeAt, s.changeAt, 'changeAt');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test('a forecast tightens to the truth as the night approaches', () => {
|
||||
const def = storms.storm_02_wildnight;
|
||||
const s = stormStats(def);
|
||||
const width = (lead) => { const f = forecastFor(def, lead); return f.gustPeak.hi - f.gustPeak.lo; };
|
||||
const far = width(1), mid = width(0.5), near = width(0);
|
||||
metrics['forecast.gustBandWidth@lead1'] = +far.toFixed(1);
|
||||
metrics['forecast.gustBandWidth@lead0.5'] = +mid.toFixed(1);
|
||||
assert(far > mid && mid > near, `band must narrow with lead: ${far.toFixed(1)} → ${mid.toFixed(1)} → ${near.toFixed(1)}`);
|
||||
assert(near === 0, `tonight's forecast should be exact, band is ${near.toFixed(2)} wide`);
|
||||
const f0 = forecastFor(def, 0);
|
||||
assert(f0.gustPeak.lo === s.gustPeak && f0.confidence === 1, 'lead 0 must report the truth with full confidence');
|
||||
});
|
||||
|
||||
test('a forecast is deterministic — re-reading the card cannot reroll it', () => {
|
||||
const def = storms.storm_02_wildnight;
|
||||
for (const lead of [0.3, 0.8]) {
|
||||
const a = forecastFor(def, lead), b = forecastFor(def, lead);
|
||||
assert(a.gustPeak.lo === b.gustPeak.lo && a.gustPeak.hi === b.gustPeak.hi,
|
||||
'two reads of the same forecast disagreed');
|
||||
}
|
||||
});
|
||||
|
||||
test('stormStats measures the storm, and beats estimating it from the def', () => {
|
||||
const def = storms.storm_02_wildnight;
|
||||
const s = stormStats(def);
|
||||
// what the card used to estimate: baseCurve peak + powBase + powRamp
|
||||
const estimate = Math.max(...def.baseCurve.map((p) => p[1]))
|
||||
+ (def.gusts.powBase ?? 0) + (def.gusts.powRamp ?? 0);
|
||||
metrics['storm_02.gustPeak.measured'] = +s.gustPeak.toFixed(1);
|
||||
metrics['storm_02.gustPeak.oldEstimate'] = +estimate.toFixed(1);
|
||||
assert(Math.abs(s.gustPeak - estimate) > 1,
|
||||
'the estimate happens to match — this test is only interesting while they differ');
|
||||
assert(s.gustPeak > 30 && s.gustPeak < 35, `measured gust peak ${s.gustPeak.toFixed(1)} is not credible`);
|
||||
assert(s.changeAt === 55, `storm_02's change is at ${s.changeAt}, expected 55`);
|
||||
});
|
||||
|
||||
test('the forecast hail hint tracks the storm, and hedges when far out', () => {
|
||||
assert(forecastFor(storms.storm_01_gentle, 0).hail.chance === 'none', 'gentle storm forecast hail');
|
||||
assert(forecastFor(storms.storm_02_wildnight, 0).hail.chance === 'likely', 'the wild night should forecast likely hail');
|
||||
assert(forecastFor(storms.storm_02_wildnight, 1).hail.chance === 'possible',
|
||||
'a week out, the wild night should only hedge at "possible"');
|
||||
assert(forecastFor(storms.storm_03_southerly, 0).hail.chance === 'possible', 'storm_03 hails mildly');
|
||||
});
|
||||
|
||||
return { cases, metrics };
|
||||
}
|
||||
|
||||
|
||||
@ -511,6 +511,104 @@ export function createWindField(def, opts = {}) {
|
||||
return field;
|
||||
}
|
||||
|
||||
// ---------- forecasting ----------
|
||||
// DESIGN.md's partial-information canon: a forecast days out is a RANGE, and it
|
||||
// tightens as the night comes. Deliberately pure functions on a storm def rather
|
||||
// than methods on a wind — the card has defs in hand, it doesn't want a field,
|
||||
// and this keeps forecasting off the wind contract (and out of main.js's router).
|
||||
|
||||
const _statsCache = new WeakMap();
|
||||
|
||||
/**
|
||||
* The truth about a storm, measured rather than estimated. The forecast card was
|
||||
* approximating the gust peak as `baseCurve peak + powBase + powRamp` (30 m/s
|
||||
* for storm_02); the storm actually gusts to 32.3, because gust power is drawn
|
||||
* per gust and rides a ramp. If the card is going to sell the dread it may as
|
||||
* well sell the real number. Cached per def — scanning is ~1800 samples.
|
||||
*
|
||||
* @returns {{sustained, gustPeak, rainPeak, rainPeakMmPerHour, hailPeak, hailSeconds, changeAt}}
|
||||
*/
|
||||
export function stormStats(def) {
|
||||
const hit = _statsCache.get(def);
|
||||
if (hit) return hit;
|
||||
const f = createWindField(def);
|
||||
const dur = def.duration ?? 90;
|
||||
let sustained = 0, gustPeak = 0, rainPeak = 0, hailPeak = 0, hailSeconds = 0;
|
||||
const STEP = 0.05;
|
||||
for (let t = 0; t <= dur; t += STEP) {
|
||||
const u = f.uniformSpeed(t);
|
||||
if (u > gustPeak) gustPeak = u;
|
||||
const base = u - f.gustOnly(t);
|
||||
if (base > sustained) sustained = base;
|
||||
const r = f.rainAt(t);
|
||||
if (r > rainPeak) rainPeak = r;
|
||||
const h = f.hailAt(t);
|
||||
if (h > hailPeak) hailPeak = h;
|
||||
hailSeconds += h * STEP;
|
||||
}
|
||||
const change = (def.events || []).find((e) => e.type === 'windchange');
|
||||
const stats = {
|
||||
sustained, gustPeak, rainPeak,
|
||||
rainPeakMmPerHour: rainPeak * (def.rain?.peakMmPerHour ?? DEFAULT_PEAK_MM_PER_HOUR),
|
||||
hailPeak, hailSeconds,
|
||||
changeAt: change ? change.t : null,
|
||||
};
|
||||
_statsCache.set(def, stats);
|
||||
return stats;
|
||||
}
|
||||
|
||||
/** How wide each number's band runs at lead=1, as a fraction of the value. */
|
||||
const FORECAST_SPREAD = {
|
||||
sustained: 0.30, gustPeak: 0.35, rain: 0.45, changeAt: 0.22, hailSeconds: 0.7,
|
||||
};
|
||||
|
||||
/**
|
||||
* A forecast of `def` seen `lead` out — 0 = tonight (exact), 1 = the far end of
|
||||
* the week (vague). Deterministic per storm, so the same night always forecasts
|
||||
* the same way and re-reading the card can't reroll it.
|
||||
*
|
||||
* The band ALWAYS contains the truth. That's the line between partial
|
||||
* information and a lie: a forecast may be vague, and its midpoint may be off,
|
||||
* but it must never rule out what actually happens — a player who rigs for the
|
||||
* top of the stated range must never be ambushed. Width and centre-wander both
|
||||
* shrink to nothing as lead → 0.
|
||||
*
|
||||
* @param {object} def parsed storm JSON
|
||||
* @param {number} lead 0..1
|
||||
*/
|
||||
export function forecastFor(def, lead = 0) {
|
||||
const s = stormStats(def);
|
||||
const L = Math.min(1, Math.max(0, lead));
|
||||
const r = mulberry32(((def.seed ?? 1) ^ 0xf0eca57) >>> 0);
|
||||
|
||||
const band = (v, rel) => {
|
||||
if (L <= 0 || !(v > 0)) return { lo: v, hi: v };
|
||||
const w = v * rel * L;
|
||||
const c = v + (r() * 2 - 1) * w * 0.6; // the centre wanders, seeded
|
||||
return { lo: Math.max(0, Math.min(v, c - w)), hi: Math.max(v, c + w) };
|
||||
};
|
||||
|
||||
// Hail is the garden score (decision 13), so the card has to hint at it — but
|
||||
// a distant forecast shouldn't promise ice it can't see yet.
|
||||
let chance = 'none';
|
||||
if (s.hailSeconds > 0) {
|
||||
if (L > 0.55) chance = 'possible';
|
||||
else chance = s.hailSeconds > 6 ? 'likely' : 'possible';
|
||||
}
|
||||
|
||||
return {
|
||||
lead: L,
|
||||
confidence: 1 - L,
|
||||
sustained: band(s.sustained, FORECAST_SPREAD.sustained),
|
||||
gustPeak: band(s.gustPeak, FORECAST_SPREAD.gustPeak),
|
||||
rain: band(s.rainPeak, FORECAST_SPREAD.rain),
|
||||
rainMmPerHour: band(s.rainPeakMmPerHour, FORECAST_SPREAD.rain),
|
||||
changeAt: s.changeAt == null ? null : band(s.changeAt, FORECAST_SPREAD.changeAt),
|
||||
hail: { chance, seconds: band(s.hailSeconds, FORECAST_SPREAD.hailSeconds) },
|
||||
truth: s,
|
||||
};
|
||||
}
|
||||
|
||||
// ---------- storm JSON validator ----------
|
||||
// Storms are data so design can tune without code (PLAN3D §4) — which means a
|
||||
// typo is a data bug, and data bugs should fail loud, not silently blow calm.
|
||||
|
||||
@ -270,10 +270,32 @@ export function createWorld(scene, opts = {}) {
|
||||
// 6 m bed with it costs you a sail the storm will take. Full shade is meant to
|
||||
// be the expensive answer; the small quads buy survival and pay in patchy
|
||||
// shade. That IS the design (DESIGN.md, "big flat low vs small twisted steep").
|
||||
// SPRINT6 gate 1: p4 is the ONE close anchor the balance pass allows, and its
|
||||
// position is measured rather than guessed.
|
||||
//
|
||||
// The wild night had no winnable line because every anchor near the bed —
|
||||
// p1/p2/p3 — is SOUTH of it, and nothing stands north short of the house 10 m
|
||||
// away. So covering rigs had to span the yard and died, while rigs small
|
||||
// enough to survive sat beside the bed instead of over it.
|
||||
//
|
||||
// p4 supplies the missing north-west corner. Swept its position against the
|
||||
// smallest quad that covers 90% of the bed:
|
||||
// (-2.2, -1.2) → 44.4 m² ← breaks the tradeoff (see below)
|
||||
// (-3.2, -1.2) → 48.6 m² ← here
|
||||
// (-3.2, -2.0) → 51.7 m²
|
||||
// (-4.2, -3.0) → 60.0 m²
|
||||
// beyond ~z=-4 → 63.5 m², i.e. too far away to matter at all
|
||||
// Full coverage costs 63.5 m² without it. At (-3.2,-1.2) that drops to 48.6 —
|
||||
// a real new option, 23% cheaper — while still costing you a bigger sail than
|
||||
// the 23-38 m² rigs that survive on their own. Pulling it in to (-2.2,-1.2)
|
||||
// would put full coverage at 44.4 m², INSIDE the survivable band, which
|
||||
// collapses DESIGN.md's central tension: covering the bed has to cost risk.
|
||||
// a.test.js asserts that >45 m² floor, so moving this post inward goes red.
|
||||
const postSpecs = [
|
||||
{ id: 'p1', x: -4.5, z: 5.5, h: 4.0 },
|
||||
{ id: 'p2', x: 4.0, z: 6.0, h: 4.0 },
|
||||
{ id: 'p3', x: 0, z: 7.0, h: 4.0 },
|
||||
{ id: 'p4', x: -3.2, z: -1.2, h: 4.0 },
|
||||
];
|
||||
const RAKE = (8 * Math.PI) / 180;
|
||||
for (const spec of postSpecs) {
|
||||
@ -448,6 +470,10 @@ export function createWorld(scene, opts = {}) {
|
||||
const gltf = await loader.loadAsync(new URL(`../models/${name}.glb`, import.meta.url).href);
|
||||
gltf.scene.traverse((o) => {
|
||||
if (o.isMesh) { o.castShadow = true; o.receiveShadow = true; }
|
||||
// Lane E's optional-node flag: glTF has no visibility bit and Blender's
|
||||
// hide_render does NOT survive export (THREADS [E] 2026-07-17 — the
|
||||
// garden bed drew all three wilt states superimposed for five sprints).
|
||||
if (o.userData?.hidden_by_default) o.visible = false;
|
||||
});
|
||||
return gltf.scene;
|
||||
} catch (err) {
|
||||
|
||||
Binary file not shown.
Binary file not shown.
BIN
web/world/models/textures/card_gameover.jpg
Normal file
BIN
web/world/models/textures/card_gameover.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
BIN
web/world/models/textures/card_win.jpg
Normal file
BIN
web/world/models/textures/card_win.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 41 KiB |
BIN
web/world/models/textures/moon.png
Normal file
BIN
web/world/models/textures/moon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
Loading…
Reference in New Issue
Block a user