Skip to content

BDSP AutoStory: Starter RNG on the story engine - #526

Draft
dayfine wants to merge 50 commits into
bdsp/story-enginefrom
bdsp/starter-rng-adopt
Draft

dayfine wants to merge 50 commits into
bdsp/story-enginefrom
bdsp/starter-rng-adopt

Conversation

@dayfine

@dayfine dayfine commented Nov 15, 2026

Copy link
Copy Markdown
Owner

Depends on #353

Starter RNG (#438) and the option to run it at 00.02's starter pick (#439) were built on bdsp/autostory-v4, so they could not run on the story-engine stack. This merges bdsp/starter-rng-callable into bdsp/story-engine and ports the hook onto the engine: StoryEnv gets run_starter_rng, the starter_rng event takes StoryEnv, the program runs ConsoleStory over plan_story_run()'s rows, and the Stop for Starter RNG save puts its card map in the saves_in arg. Since the RNG branch sits on autostory-v4, the merge also brings that stack's view-shift walk check and the MenuDetector cursor-glow fix. The changed files compile (syntax-checked locally); the BDSP AutoStory and StarterRng suites run on Fork Draft CI.

dayfine and others added 30 commits November 2, 2026 07:27
The tap counters read any screen change as our own step, so cloud
shadows (r83, r84), TVs and conveyors counted as tiles walked. Outside,
the camera follows the player: walk_view_shift() finds the scroll that
lines up two frames around the player, and tap_moved() counts a tap only
if a scroll lines up at least twice as well as none. Inside, the camera
can stay put while the player crosses a room, so the old screen-change
line still decides there. WalkUntil's tap walks and dpad_tiles() use it.

Measured offline on r83/r84's Floaroma video: standing frames with screen
changes up to 57 never read as scrolled; walking read a scroll 2 to 6
times better than none.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Walk_Tests.cpp: keep both Test_ViewShift and Test_PokemonCenterOnScreen,
their registrations, and both new includes.

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_013VUubhHeYSMGSSDXZkKZss
…w-shift

# Conflicts:
#	SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Utils/PokemonBDSP_AutoStory_Walk.cpp
The merge of bdsp/autostory-v4 brought back a call to still_chunk(), which
this branch replaced with tap_moved(); use tap_moved() there too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Walk.h is split upstream of here: the view-shift check (ViewShift,
walk_view_shift(), tap_moved()) moves, unchanged, into WalkScreen.h
next to the other screen-change measures. Its users include it.

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_01AKYzhrMnPK61XHWEch4a6E
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_01AKYzhrMnPK61XHWEch4a6E
The selected menu icon glows about 0.008 past its left edge. With the
cursor on the first icon of a row (TOWN MAP on the second row), the
first 0.015-wide column took the glow's edge and its stddev rose to
about 12, over the white test's 10, so overworld_to_menu() timed out
with the menu on screen. Columns of 0.010 end just short of the glow.

New image test: a French menu with the cursor on the map and a NEW tag
on the Trainer Card (both column modes).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Adds a "Stop for Starter RNG" option (off by default) to BDSPAutoStory. When on, plan_story_run() stops after 00.01 saves at the Verity Lakefront (17, 14) facing north, where 00.02 and Starter RNG (PokemonAutomation#1366, Start point: Verity Lakefront) start. With it off, the table and run are unchanged.
Port the remaining Starter RNG files from PokemonAutomation#1366 (by theastrogoth) onto the merged BDSP RNG infrastructure:
- BdspRngFilterRow / BdspRngFilterTable / BdspRngFilterSnapshot
- RngAim, RngCalibration, RngExecution, RngTargets, RngTimeline, TargetSelection
- StarterNavigation, SummaryNavigation, StarterRng

Adapt to the upstreamed BlinkRecovery, BlinkScenes, AdvanceClock, and SingleSwitchProgramDescriptor APIs, and register StarterRng in PokemonBDSP_Panels.
Extract the Starter RNG attempt and reset loop out of StarterRng::program() into PokemonBDSP_StarterRngAttempts (run_starter_rng_attempts / run_starter_rng_attempt / resolve_starter_rng_step), parameterized by StarterRngSettings and StarterRngAttemptIO and returning StarterRngRunResult. Add finish_battle_on_shiny and close_summary_after_read options (with close_starter_summary in SummaryNavigation) so AutoStory can continue directly from Lake Verity or Verity Lakefront, and add unit tests for per-starter tables, bedroom skip buffer/landing math, aim calibration, and attempt loop outcome transitions.
Adds "Run Starter RNG in AutoStory" (off by default), "Starter RNG Maximum Resets", and "Starter RNG Stop Conditions" to BDSPAutoStory. When enabled, plan_story_run() replaces 00.02's Lake Verity steps (after 00.02's Verity Lakefront start save) with the starter_rng game action, which runs run_starter_rng_attempts() from VerityLakefront (17, 14) through the Starly battle and Rowan's scene, closes the menu on VerityLakefront (17, 14..15), and continues into 00.03.
…-rng-callable' into bdsp/autostory-starter-rng
dayfine and others added 18 commits November 12, 2026 17:44
…n failure, unsettled shiny stops, program split
…and shiny settle, constants in StoryTable.cpp)

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
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Pokemon_StoryRngHandoff.h holds what every game's RNG handoff shares: the
OFF/STOP/RUN mode, the result an RNG program's call ends in, and
run_rng_handoff(), which logs a success and throws on a failure so no row
retry reruns the reset loop. BDSP's Starter RNG hook now runs through it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Folded leaf PR #439; tree equals the leaf tip.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Folded leaf PR #430; tree equals the leaf tip.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Folded leaf PR #168; tree equals the leaf tip.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…de; its stop reports through the shared report

StoryHandoffs held two bools whose combination the plan decoded;
it holds the mode of the options now, as FRLG's program derives it.
The stop's log line, overlay line and notification text come from
Pokemon::report_rng_handoff_stop.

Co-Authored-By: Claude Sonnet 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_01AKYzhrMnPK61XHWEch4a6E
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Brings Starter RNG (#438) and Run Starter RNG in 00.02 (#439) onto the
story engine. The story-engine structure wins: StoryEnv (StoryCheckpoint.h)
gains run_starter_rng, the starter_rng event takes StoryEnv&, the program
runs ConsoleStory over plan_story_run()'s rows, and the Stop for Starter
RNG handoff save carries its card map in SAVES_IN_ARG. The old
StoryExecutor.h stays deleted.
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