Pre-Flight — WP-143 — 2026-12-03
Filled-in copy of docs/reference/pre-flight for WP-143. Verdict at the bottom.
Written by the session that drafted WP-143 and ran WP-141, on Jeff’s “Yes, run it here” (2026-12-03). Checked at claim time: no
wp-143branch in the fork; WP-143’s only open PR is its draft, #375; the number is this packet’s (the TV tiles draft that also took it, #376, was renumbered WP-145 in #378). Both claim branches were pushed before anything else.
Header
- WP:
WP-143 - Title: A “your turn” cue and forgiving timing in the Wizard’s Rule Room (Gen 1)
- Pre-flight date:
2026-12-03 - Targets generation(s): 1
- Targets disc(s): Phantom
Dependency check
| Prereq | Status | Notes |
|---|---|---|
| WP-094 | ✅ Done | The rhythm game: the clock, the window, the table. |
| WP-133 | ✅ Done | The play self-test lines, through the event path. |
| WP-141 | ✅ Done in its docs PR #374, open | The finding this packet acts on. |
| Fork PR #69 | Open | The wfr: a click on … line. The packet asks for it merged first; it isn’t, so this branch is cut from #69’s branch and its PR stacks on #69. Once #69 merges, the WP-143 PR shows only its own commits. |
| D1–D4 | Decided, 2026-12-03 | All four recommendations (§Decisions). |
Repo + disc state
- Docs repo: branch
docs/wp-143-executioncut fromdocs/wp-143-wfr-turn-cue(#375) @2c288f6, pushed at once; worktreeC:\claude-worktrees\terraglyph-wp-143-exec. - Fork worktree, the claim:
tools/New-ForkWorktree.ps1 -Branch wp-143-wfr-turn-cue-timing -Base wp-141-wfr-bottles-live-clicks→C:\claude-worktrees\scummvm-wp-143-wfr-turn-cue-timing, frome5cbe578a3(#69’s tip), pushed at once. - Build: MSYS2 UCRT64,
../configure --disable-all-engines --enable-engine=terraglyphthenmake, out of tree inbuild-tg/. - Game files:
C:\dev\scooby-engine\tools\exes\phantom(local, gitignored). - Logs and configs:
C:\pcloud\scooby-engine\verification\wp-143-2026-12-03\. - Baseline: WP-141’s
seeded-wp141.log(random_seed=140), run one5cbe578a3, this branch’s base.
Source read
On e5cbe578a3, wfr_rooms.cpp:
tick(): a click is read once, on the tick after it. In the late part of a beat (beatf − beat ≥ 0.49) the tick darkens the bottles and returns: the click is lost. On a beat already done (_handled) it’s lost. On the player’s beat, a gap is done with and the click lost; the wrong bottle is lost and the beat stays open; the beat’s bottle counts (lit 12 ticks,WFR.Potion_<n>, the colour called).- On the player’s beats (8–13 of a phrase, the dance beats) the wizard
dance()s; on the wizard’s (0–5) ScoobyturnWatch()es. Each bar’s first beat idles both first, so the turn happens on beats 0, 4, 8 and 12. Beats 6–7 and 14–15 idle a dancer whose anim is over. setMode()builds the anim from the dancer’s name, so modes 2 and 4 of the wizard areANIM_WFR_WIZARDTURN_WATCHandANIM_WFR_WIZARDWATCHwith no new code._lightTimeris one timer for the room’s own light; on 0 it darkens every bottle.
The change (written before the first build)
All in wfr_rooms.{h,cpp}, each marked in a comment as not the original’s, with the WP number:
- D1, the cue. On the player’s dance beats the wizard
turnWatch()es instead ofdance(). With the bar’s idle on beats 8 and 12, he turns to watch on beat 8, and again on 12, as Scooby does on 0 and 4. - D2, the early window (
kEarlyWindow = 0.25). In the late part of a beat, a click atbeatf − beat ≥ 0.75is held when the next beat is a player’s beat with a bottle. On that beat’s first tick in its window the held click is taken as the tick’s click, unless a click landed that tick. The window[0.49, 0.75)still loses a click, so a late click can’t count for the next beat. The late end stays 0.49. - D3, a lost click (
answerLostClick). Every exit that loses a click lights its bottle for 4 ticks (kLostLightTicks) and playsSign_In.Click. Its own timer runs beside_lightTimer, and on expiry it darkens only that bottle, and not when the room itself lit that bottle and its light still runs (_roomLit). No colour is called. - The diagnostic line gets two forms:
…: early, held for beat <n>when a click is held, andwfr: a click on the <COLOUR> bottle at beat <b.ff> (<ms> ms), taken on beat <n>: <verdict>when it’s taken.
D4: always on, no option.
Expected self-test lines (committed before the first run)
From the source above, with the checks’ fixed random (drawRandom() 1, so the snack line is Correct2). Two ticks a beat in the checks, at 0.2 and 0.7 of it.
Lines that change on purpose:
| Line | Baseline | Expected |
|---|---|---|
clean, play clean |
… RED (ANIM_WFR_WIZARDTURN_DANCE ANIM_WFR_SCOOBYTURN_DANCE) … at beat 8 |
… RED (ANIM_WFR_WIZARDTURN_WATCH ANIM_WFR_SCOOBYTURN_DANCE) …; the rest the same |
play wrong bottle |
beat 8 lit -; …; heard from beat 8 Knights.Glass_Breaks.1 … |
beat 8 lit GREEN; …; heard from beat 8 Sign_In.Click Knights.Glass_Breaks.1 …; the rest the same |
play late press |
beat 8 lit -; …; heard from beat 8 Knights.Glass_Breaks.1 … |
beat 8 lit - (the press is after the read); heard from beat 8 Sign_In.Click Knights.Glass_Breaks.1 …; the rest the same |
play not the player's |
beats 0-2 lit RED GREEN BLUE; heard -; gap 11 pressed lit -, snacks 1, missed 0 |
beats 0-2 lit RED RED+GREEN BLUE; heard Sign_In.Click; gap 11 pressed lit RED, snacks 1, missed 0 |
Every other wizard's rule room check line (entry, missed, lives, song over, hover, first dance, claim, clips, lines, sounds) stays the same. The missed line has no click on a lost exit, so it stays the same too.
New lines:
wizard's rule room check play cue: beats 0-5 the wizard dancing 6 watching 0, Scooby dancing 0 watching 6; beats 8-13 the wizard dancing 0 watching 6, Scooby dancing 6 watching 0
wizard's rule room check play early press: 7.85 RED: at the press lit -, heard -; beat 8 lit RED, heard WFR.Potion_1 Wizards_Rule.Red; snacks 1, missed 0 | 7.70 RED: at the press lit RED, heard Sign_In.Click; beat 8 lit -, heard -; snacks 0, missed 1 | 10.85 RED: at the press lit RED, heard Sign_In.Click; beat 11 lit -, heard Wizards_Rule.Correct2_1_NARRATOR; snacks 1, missed 0 | 15.85 RED: at the press lit RED, heard Sign_In.Click; beat 16 lit PINK, heard -; snacks 1, missed 0
wizard's rule room check play lost click: RED pressed, lit tick by tick RED+GREEN RED+GREEN RED+GREEN RED+GREEN GREEN, heard Sign_In.Click; GREEN pressed, lit tick by tick GREEN GREEN GREEN GREEN GREEN, heard Sign_In.Click; Sign_In.Click found 1
On the original’s rules the play cue line would read the wizard dancing 6 watching 0 on 8–13, and the 7.85 press would be lost.
The diagnostic line’s counts change with the new presses and the new lines. Only the early, held for beat 8 and taken on beat 8: counted forms are new text.
Scope lock
fork: engines/terraglyph/wfr_rooms.cpp
engines/terraglyph/wfr_rooms.h
engines/terraglyph/wfr_check.cpp
docs: docs/reference/pre-flight-WP-143-2026-12-03.md
docs/work-packets/WP-143-wfr-turn-cue-timing.md
docs/work-packets/WORK_INDEX.md
docs/formats/scooby-exe.md (the "Departs from the original" note)
Staged by name; git diff --cached --name-only checked against this list before each commit. Forbidden: game data, logs or captures in any repo; the beat rate, the late end of the window, the phrase table or the lives; the miss called on the next beat (out of scope).
Risk review
| Risk | Likelihood | Impact | Mitigation |
|---|---|---|---|
| The lost light cuts the room’s own light short, or the other way round. | med | med | A timer of its own; it won’t darken a bottle the room lit while that light runs. The play lost click line checks the bottle the wizard lit, tick by tick. |
| A held click counts for the wrong beat. | low | high | It’s held only for the next beat, only if that’s a player’s beat with a bottle, and is dropped on that beat’s first in-window tick if not taken. play early press covers a gap and the wizard’s beat next. |
| The cue comes too late to help on beat 8. | med | med | D1 turns the wizard on beat 8, the player’s first beat, the same moment Scooby turns to dance. It marks the turn rather than announcing it. If Jeff’s live check finds it late, turning him on beat 7 is a one-line change and a new decision, not a silent one. |
| The self-test passing while the live game fails. | med | high | Exit criterion 3 is Jeff’s own play, at --debuglevel=2, read against the diagnostic line. |
Self-test result
Run on fork 5fc9c15e0f (seeded-wp143.log, and seeded-wp143-run2.log as a second sample), against seeded-wp141.log:
- The three new lines match the block above character for character.
- The five lines named as changing on purpose read as the table above says.
- The other 11 check lines are unchanged.
- One clue line differs, from the new checks. The debug-tools check’s clue (
EWAN_KforEWAN_BELLOWS) moves because the new checks draw on the engine’s random stream. A control build with the new blocks skipped (seeded-control-no-new-checks.log) gives the baseline’s clues back. - One real-clock line differs.
wfr: beat 0 at 12–13 msin a room-walk visit is the mixer’s position, read before any changed code. - The rest is WP-140’s noise floor.
Full table in WP-143 §Result.
Verdict
- READY, executed: fork PR barefootbetters/scummvm#70, stacked on #69. The live check is Jeff’s.
Prepared by: Claude (WP-143 execution session) Date: 2026-12-03
Second pass: D5 (2026-12-03)
Jeff’s first live check failed: he clicked the bottles in the right order,
each 0.3–0.9 of a beat late. He chose to judge the turn by order (WP-143
D5), which replaces D2. Fork 31a4c93fcd, same scope lock. The changed
self-test lines were read against the change after the run, not written
down before it. Each is accounted for in
WP-143 §D5.
A second run is in seeded-wp143-order-run2.log. Verdict stays READY;
the live check is Jeff’s.
Third pass: D6 (2026-12-03)
Jeff’s live check 2 passed. He then chose to hold a click from late in
beat 7 for the turn (WP-143 D6). Fork 495a4a35de, same scope lock. This
time the changed play order line was written to expected-d6.txt before
the build, and the run matches it. See
WP-143 §D6.
Lessons learned
- A check that enters a room moves the random stream. Every
begin()and tick draws on the engine’s random, so new checks change a later, unrelated clue line even when they’re seeded. A control build with the new blocks skipped settles it in one run. Plan for that control when a packet adds checks ahead of the debug-tools check. - Copy-Item keeps the source file’s timestamp. Restoring a file with it
leaves
makethinking the old object is current, so it doesn’t rebuild. Touch the file after a restore.