Skip to content

BDSP AutoStory: settle and Center visit on the shared seam-5 code - #549

Draft
dayfine wants to merge 78 commits into
bdsp/seam4-adoptfrom
bdsp/seam5-adopt
Draft

dayfine wants to merge 78 commits into
bdsp/seam4-adoptfrom
bdsp/seam5-adopt

Conversation

@dayfine

@dayfine dayfine commented Nov 15, 2026

Copy link
Copy Markdown
Owner

Depends on #523, #546. Base bdsp/seam4-adopt; #546 (autostory/center-settle) is merged in, so until #523's base has nav/shared's commits the diff also shows #546 and its parents. This PR's own change is commit 4d9881a.

BDSP AutoStory moves onto seam 5's shared settle loop and Center visit (#546's adoption list, step-5 design note decisions 1-6).

  • talk_over() is a SettleIO over the console (observer, B/next presses, wild-battle flee) and calls run_settle; TalkOverSpec::rule becomes settle (a SettleRule). StoryStepIO::settle passes settle_rule(kind). BDSP's SettleKind and TalkOverRule::door are gone: the merge took AutoStory: shared settle loop and Pokemon Center visit #546's SceneJudges/ScreenEvents, and the door timings (1 s / 2.5 s, 200 ms looks) are now the shared table's.
  • run_into_center/CenterEntry give way to BdspCenterVisit : CenterVisitIO (runs north in and south out on the StoryStepIO, its settle). ConsoleStory::heal runs run_center_visit with a console subclass: route turn before each run, enter_lit_door lineup, talk_to_nurse + B through her last line, place() = pokemon_center_inside or indoors() (the old exit check's room read). A failed check now returns heal_enter/heal_exit instead of throwing.
  • The sim: play_scene runs run_settle on a scripted clock; SimExecutor::heal runs the same visit (SimCenterVisit), the nurse not played; SimCenterDoors knobs per heal step (slow fade-in played through the door settle, late fades, a run out that stays inside).

Testing

  • New Console failure on the sim cases: 00.04b with a 4 s Center fade-in, with late fades at both doors, and with the run out stopping inside (r143a, must fail heal_exit; red before, as the sim never walked out).
  • Fault sweep: new late fades at a Pokemon Center's doors class per row; slow fade-in after every warp now also plays a 4 s Center fade-in on every heal step. Known-failing lists unchanged.
  • Touched files compile locally (clang, no warnings); code health 0 failures. Fork Draft CI runs the suites. No console run.

dayfine and others added 30 commits November 12, 2026 22:51
…tion, engine)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…kpoints (set_pause_points)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
# Conflicts:
#	SerialPrograms/Source/Pokemon/AutoStory/Engine/Pokemon_StoryEngineRuns_Tests.cpp
Moved from the FRLG stack, where 0ac33f9 added it inside a game PR (FRLG
names its route screenshots by the step under way).

(cherry picked from commit 0ac33f9, Pokemon_StoryBreakpoints.h only)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
TEXT_BOX -> DIALOG_BOX, BATTLE -> BATTLE_STARTED, CAN_MOVE ->
PLAYER_CAN_MOVE, STILL -> SCREEN_STILL; Pokemon:: screen event names
are now in PokemonAutomation (CommonTools/ScreenEvents).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Adds Pokemon_StoryFailureClasses: 27 classes as data rows (id, meaning,
how a run sees it, the sim faults that inject it, the engine Outcome
names it covers, a retry hint), the maps from every sim FaultClass and
every engine failure name to a class, and a "class=<id>" tag that log
lines and run records can carry and read back. No game uses it yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
FRLG's fault sweep injects it (11.01, console B, 2026-11-12); the
story failure class mount_lost now lists it as its sim fault.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Code Health's test-case rule wants each UnitTest built from one case
struct of name, input and expectation, with the name outside the input.
Move every case's name from its Input to the case itself, nest the
RngHandoff input and expectation structs, and give the first-save,
captured-transition and move-mechanics cases explicit names (the same
test names as before). Assertions and test bodies are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
An Outcome may carry its StoryFailureClass (outcome_failed's third
argument, for a game's own failure names); failure_class_of() falls back
to the shared list's class for the name. The engine's failure lines
([Event], [Checkpoint], [Step], [Segment], [Verify]) end with
"(class=<id>)" when the class is known, and an OperationFailedException
that leaves an event is logged as class=operation_failed.

Pokemon_StoryFaultSweep: a game gives its sweep as data (rows, an
injector per sim fault, the known-failing list); the engine makes one
test per class and row, named "<row>, <class id>", judges it, and checks
the known-failing list names only its tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…/fault-classes

# Conflicts:
#	SerialPrograms/Source/Pokemon/AutoStory/Engine/Pokemon_StoryEngine_Tests.cpp
… run

The shared wire cases at PokemonSimulation 866613f (and its main) still use
the old pose (certainty/where) and per-kind step fields; since the #312
review the native reader reads steps as an action plus typed args, so every
kind case without args failed. The Python reader still checks those cases;
the native codec is covered by its own CTest cases.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…onformance run

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
… on #312, ScreenEvents case names

Conflicts: ScreenEvents_Tests.cpp takes #313's case struct (name outside the input); the story-data README keeps this branch's reader-only text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…known (#312 review)

checkpoint_end_pose() stopped looking back only at LEGS, so a STEP after a route kept the route's target as the end and the tile check failed a run that worked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
AutoStory: story step types and engine (split from #122, layer 1 of 3).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
dayfine and others added 20 commits November 14, 2026 14:43
story_failure_class_info() throws for a class with no row in its place,
and a test checks every class has one.
Covers the first frame's rises, rose/fell edges, the capacity drop and
describe().
AutoStory: review fixes on the shared engine (#312, #313, #332, #474, #479)
…again

StoryDataTests takes the path of a pokesim-story-wire-cases/2 file, reads
each case with the native pose, step and checkpoint readers and checks the
accept/reject and the record read. The workflow pins PokemonSimulation
4e023f3 (#104, cases in the action-plus-args form) and runs it on all three
platforms.
Answers the #312 review: the Switch FireRed/LeafGreen are the GBA releases
reissued, one version per language with no in-game option, so all six
languages stay (as in upstream's FRLG programs). Gen 8-9 games have one
Spanish, so one "es". Code that reads text takes the language option.
…e fails loudly

The standalone main moves to devtools/story-data-tests/StoryDataMain.cpp so program source no longer includes a devtools header; other argument counts print usage and exit 2. The wire-case reader reads a case's own fields outside the try, so a malformed case file throws instead of reading as a rejection. Also plain statements for the verified fields and explicit includes.
Fix shared AutoStory engine review nits
Story data codec: run the shared wire cases natively again
A watch that ends in wall time reads a window full of dropped frames as
"not seen". FrameCoverage records the capture times of the frames a
watcher was handed and finds the largest gap in the window; judge_watch()
returns SEEN, NOT_SEEN (frames cover the window) or UNKNOWN (a gap longer
than max_gap). CoveredWatcher wraps any VisualInferenceCallback and can
stop on the first frame captured at a deadline; run_watched() and
watch_for() end a window in frame time, bounded by a wall-clock cap.
Game languages: FRLG keeps six languages, one Spanish (#312 review)
Review of #114 (dropped frames):
- A hold watcher fires a hold after the screen shows, so a screen that
  shows in the window's last hold fired only after the watch stopped.
  CoveredWatcher now keeps watching until a frame captured `tail` after
  the window's end, still bounded by the wall-clock cap.
- largest_gap rounds up to whole ms, so a gap a fraction over max_gap is
  UNKNOWN, not NOT_SEEN.
- Frames captured before the window opened are not handed to the wrapped
  watcher, so a fire on one is not SEEN.
- The window's end is a constructor argument (watch_for) or set by
  end_at() between sessions (run_watched), documented as such.
- WatchLimits carries max_gap, tail, cap and the poll period; run_watched
  checks only fired(); <cstddef> for size_t.
StoryCheckpoint::postconditions gets = {} so designated initializers that
leave it out build on Windows Clang (-Wmissing-designated-field-initializers).
The eight AutoStory test tables now hold each case's name next to its input
and expectation, as code health's test-case rule asks; the step JSON tests
pass the name to the readers as the parse source.
Windows Clang errors on designated initializers that skip a field
(-Wmissing-designated-field-initializers). A syntax check of every .cpp
nav/shared touches, with the Compiler.h pragma disabled, found only these.
run_settle() is one settle loop over TalkOver for every game, with the
rule for each SettleKind (talk, after a warp, door) in one table. The
door rule (1 s of the player still, 2.5 s calm, a look every 200 ms)
comes from the BDSP tree as TalkOverRule's quiet and still fields and
the PLAYER_STILL screen event.

run_center_visit() is the shared order of a Center visit: in, settle,
check inside, heal, out, settle (door or after warp), check outside.
Games give the walks, reads and nurse through CenterVisitIO.
Door times private to the settle table, SettleEnd::Result nested, the
IO last in run_settle() and the visit functions.
…sp/seam5-adopt

# Conflicts:
#	SerialPrograms/Source/CommonTools/ScreenEvents/ScreenEventTypes.h
#	SerialPrograms/Source/CommonTools/ScreenEvents/ScreenEvents.cpp
#	SerialPrograms/Source/Pokemon/AutoStory/Pokemon_SceneJudges.cpp
#	SerialPrograms/Source/Pokemon/AutoStory/Pokemon_SceneJudges.h
talk_over() and StoryStepIO::settle run Pokemon::run_settle with
settle_rule(kind); BDSP's SettleKind and TalkOverRule::door give way to
the shared ones. ConsoleStory::heal and the sim's heal run
Pokemon::run_center_visit through BdspCenterVisit (enter_lit_door,
talk_to_nurse, run_into_door; pokemon_center_inside or indoors() as
place()). The sim's play_scene runs the same loop. New sim cases for a
slow Center fade-in, late fades and a run out that stays inside
(heal_exit); fault sweep LATE_FADE and SLOW_FADE_IN on Center visits.
…the policy asks

BDSP's title plays an attract movie, a town with people walking, that
reads as the overworld; on console B (2026-11-15 03:42) the launch
settled on it before the title took a press. A policy with
overworld_after_load answers such a look with the title press and counts
the overworld only after a title press and then the load's black.
Console B, 2026-11-15 04:21 (BDSP, Japanese): ZL on the title's attract
movie went back to the title through a black, and that black counted as
the load; the title, read as the overworld, then settled. With
overworld_after_load, a press on an overworld look no longer arms the
load, and a title showing again clears a black seen before it.
Console B, 2026-11-15 04:21, the game in Japanese: the launch never read
the title (its check, a quiet screen, never held: the title shows
PLAYER_CAN_MOVE) and settled on it. title_screen_shown() reads the red
line under the logo and the starfield's dark bottom corners, which every
language shares; the launch look carries it as TITLE_READING, and the
policy turns on overworld_after_load so the boot's logos and the attract
movie take ZL without counting as the overworld.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant