Skip to content

BDSP AutoStory: run story steps on the shared story engine - #353

Draft
dayfine wants to merge 228 commits into
bdsp/center-run-settlefrom
bdsp/story-engine
Draft

dayfine wants to merge 228 commits into
bdsp/center-run-settlefrom
bdsp/story-engine

Conversation

@dayfine

@dayfine dayfine commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

Depends on #375 (base bdsp/center-run-settle).
Also depends on #474 (merged in: the shared story files and the autostory/engine changes under it, which show in this diff until they reach the base).

BDSP ran its story steps through its own StoryExecutor (an action table run by TableExecutor). This deletes it: the story's actions become the engine's StoryGame<GridPose> from #332, dispatched by the engine's StoryActionRegistry and StoryStepRunner, and the console (ConsoleStory) and the simulation (SimExecutor) bind the same game. Steps, actions, plans and the run loop are unchanged; two gaps in the engine are bridged on the BDSP side: it has no step guard or between-step interrupts yet, so steps still run inside TableExecutor's guard, and its backend inputs are unused because BDSP's actions play through StoryStepIO. A row's start save now names its map in a saves_in arg instead of the step's action, so the engine can find the SAVE action by name. Tested with the headless runner, --filter "PokemonBDSP::AutoStory": 296 passed, 4 failed, 8 skipped, the same four failures as #375 without this change; the app builds.

With #474 merged in, load_bdsp_story() reads the checkpoints through Pokemon::load_story_data, so a BDSP run takes dev checkpoint files from <user files>/AutoStoryDev/bdsp/ (read at the run's start, each logged) and the shared save / reload_when_chained / dev_only keys; dev_only rows are listed only in Developer Mode, and the rows stay in id order. The merge also moves BDSP to the engine's CommonTools/ScreenEvents and FastCodeEntry::type_on_system_keyboard. New PokemonBDSP::StoryData - Dev file cases cover the override, the order, dev_only and the refused files.

The console actions (from StoryExecutor.cpp into ConsoleStory.cpp) and the row types and make_story_segment() (into StoryCheckpoint.h/.cpp) moved unchanged: git diff --color-moved origin/bdsp/center-run-settle...bdsp/story-engine.

🤖 Generated with Claude Code

https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss

dayfine and others added 12 commits October 29, 2026 13:56
Games open the Switch's own keyboard for names (e.g. BDSP's player name).
keyboard_enter_code() types on it blind from an assumed starting key, so it
can't recover from a press the keyboard ignored while sliding in, or start
from wherever the keyboard left its cursor.

SystemKeyboardDetector recognizes the keyboard (OK blue, or grey while the
field is empty), find_system_keyboard_cursor() reads the key under the cursor,
and system_keyboard_field_has_text() says whether the field is empty. Unit
tests cover all three on six reference screenshots (CommandLineTests,
NintendoSwitch/SystemKeyboardDetector).

type_on_system_keyboard() in FastCodeEntry reads the cursor before each key
and moves it with keyboard_get_path(), now declared in the header, over
KEYBOARD_POSITIONS, so it shares the key grid and the wrap-around moves with
blind code entry and also supports AZERTY.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
@dayfine
dayfine changed the base branch from bdsp/autostory-mine-floaroma-wip to bdsp/engine-base November 11, 2026 01:53
dayfine and others added 4 commits November 11, 2026 07:01
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Move the game-agnostic part of SV's checkpoint_reattempt_loop and
checkpoint_save into Pokemon/AutoStory/Pokemon_CheckpointRetry: the retry
policy, reset counter and StoryLog lines, with the game's run, report,
reset and give-up as callables. SV keeps its saves and messages and its
historical counts (102 attempts, report on the 11th failure).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
The tutorial and main story checkpoint dropdowns are now the shared
StoryRangeOptions, added under the same keys (START_CHECKPOINT_TUTORIAL,
END_CHECKPOINT_TUTORIAL, START_CHECKPOINT_MAINSTORY, END_CHECKPOINT_MAINSTORY)
over the same databases, so saved settings load unchanged; the end stays
unlocked while running. The start-before-end check is the range's. The
checkpoint loops log the shared attempt and reset lines, and the run logs
the shared checkpoint start line.

Rebased onto autostory/story-range-options (#325) and squashed: it
uses only the shared range options (#325) and log lines (#45), not #312.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
@dayfine
dayfine changed the base branch from bdsp/engine-base to bdsp/autostory-mine-floaroma-wip November 12, 2026 05:38
@dayfine
dayfine changed the base branch from bdsp/autostory-mine-floaroma-wip to bdsp/engine-base November 12, 2026 05:47
BDSP's own StoryExecutor (an action table run by TableExecutor) is gone.
The story's actions are now the engine's StoryGame<GridPose>, dispatched by
the engine's StoryActionRegistry and StoryStepRunner (story_game(),
StoryEngineSteps); the console (ConsoleStory) and the simulation
(SimExecutor) bind the same game.

Kept as before: the walking steps on StoryWalkSteps, the console actions
(moved unchanged into ConsoleStory), each event found by name for a step of
any kind, the step guard's log lines and failure screenshot, the interrupts
cleared between steps (still TableExecutor's: the engine has neither yet),
and the program's run loop (StoryRun's run_segment, start saves).
The story row types and make_story_segment() move unchanged into
StoryCheckpoint.h; a row's start save names its map in the "saves_in" arg
instead of the step's action, so the engine finds the SAVE action by name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
@dayfine dayfine changed the title BDSP AutoStory: run on shared story engine, delete custom executor BDSP AutoStory: run story steps on the shared story engine Nov 12, 2026
@dayfine
dayfine changed the base branch from bdsp/engine-base to bdsp/center-run-settle November 12, 2026 07:11
dayfine and others added 3 commits November 12, 2026 00:36
Shared plumbing for seam 3's sim goldens: a golden's path beside its
test, its text, the first differing line, and a check that rewrites the
file when PA_UPDATE_SIM_GOLDENS is set.

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
dayfine and others added 13 commits November 14, 2026 00:18
The fault sweep failed on 24 of 51 story routes without the fault: since
18b4254 the simulator timed every wall walk paced to run at a run, while
the sweep's walker (no running shoes, MoveSpeed::WALK) counts the tiles at a
walk. A run-paced walk of 13 tiles read as about 6, so wall legs "stopped
early" and replanned until "no plan" or "too many plans" (01.10 line_6). On
the console B does nothing before the shoes, so SimulatedRouteIO now takes
the player's top speed and paces a run at it. Not from the autostory/engine
merge: the same 24 rows fail on bdsp/center-run-settle (fc3fec6).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
# Conflicts:
#	SerialPrograms/Source/ComputerPrograms/ComputerPrograms_UnitTestRunner.cpp
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
One driver for every game: a per-game StoryLaunchPolicy (HOME tile check,
title, backup-save presses, prompts such as the license check, the
overworld judge) and launch_story_game(), which looks, does one thing,
counts each screen's presses and ends only on a settled overworld. It
never starts a new game. No game uses it yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
dayfine and others added 11 commits November 14, 2026 01:46
…after the launch

The update prompt needs the cursor moved before A, and PLZA's title and
dialog checks are loose enough to match the game in play, where a press
would answer the story. StoryLaunchPrompt::before presses before the
prompt's press; StoryLaunchPrompt::after_launch and
StoryLaunchPolicy::title_after_launch read those screens only once the
launch closed or launched the game.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
NintendoSwitch_HomeTileReader finds HOME's cyan frame on the game row and
reads the game name HOME writes above the row. switch_home_tile_named()
turns it into a launch policy's tile check, so a game names its tile
instead of trusting whatever tile is selected (console B, 2026-11-14: a
blind launch opened FireRed after the HOME order changed).

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

StoryFileReader gains in_story_order(id). When a game sets it,
load_story_data() throws ParseException naming the file (the dev file's
path for an override) and the id of any checkpoint the game's story order
does not list, instead of skipping it or sorting it to the end. Games that
keep no list leave it unset and load as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Pokemon_StorySwitchPrompts.{h,cpp} come unchanged from plza/story-engine
(723921b). The Close software dialog, the user select and the update
prompt are the same in every game, so the shared launch owns them and
FRLG, BDSP and PLZA use this one copy.

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

TalkOverRule gains `calm`, how long the overworld with no box ends a talk,
still or not. It defaults to TALK_OVER_CALM (15 s), so FRLG and BDSP keep
their behaviour; PLZA (#335) sets it to 1 s, its party bar held. The field
is last, so positional initializers are unaffected.

TALK_OVER_QUIET and TALK_OVER_CALM move above the rule, which now names
TALK_OVER_CALM, and become inline constexpr. Two test_talk_over rows pin a
shorter calm: it ends the talk sooner, and a box restarts its clock.

Moved here from #335's 3175afd, since this PR owns the shared judge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
On console B (FRLG, 2026-11-14 02:41) HOME showed for about 1.5 s after
the launch's A on the tile, and each look there pressed A again until
the launch failed as stuck on HOME, while the game was booting. After
that A, HOME now waits for up to the policy's launch_wait (30 s, as the
FRLG RNG reset's wait for the boot) before another A, and moves no
cursor in that time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
The story's load_save hook used reset_game_from_home(): close and reopen,
then a ZL mash on fixed waits. It now runs launch_bdsp_save(), the shared
launch (Pokemon::launch_story_game) with a BDSP StoryLaunchPolicy: the
"Brilliant Diamond" or "Shining Pearl" HOME tile, the Switch's prompts, ZL
on any quiet screen after the launch (logos, title), done once the
overworld has settled. Launch-driver tests with scripted looks cover
HOME -> title -> load -> overworld.

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

dayfine commented Nov 14, 2026

Copy link
Copy Markdown
Owner Author

Merged autostory/launch-from-home (#477) at bb240f6 (merge 7fa1338) and moved BDSP's load_save from reset_game_from_home() to the shared launch (feded50, PokemonBDSP_AutoStory_Launch.{h,cpp}, tests PokemonBDSP::AutoStory - Launch: *). Note: the shared RELOAD_AT_START option (Pokemon_StoryRunOptions) is not on this branch yet (it lives on plza/story-engine), so BDSP still always reloads at start; wire it when that lands here. The new-game intro restart (AutoStory_NewGame.cpp) still uses from_home_close_and_reopen_game(), as a launch never starts a new game. HOME tile names "Pokémon Brilliant Diamond" / "Pokémon Shining Pearl" are not yet checked on console B.

🤖 Generated with Claude Code

https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss

The old pin 7d108a25 lacked upstream FRLG FrontSprites, FrontSpritesShiny
and PokeballSprites, so 72 FRLG sprite-reader tests failed with
"Unable to open file". b4d7d425 merges PokemonAutomation/Packages master
into the BDSP option-template branch.
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.

4 participants