Repository navigation
BDSP AutoStory: run Starter RNG in 00.02 (option, off by default) - #439
Conversation
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.
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.
…ostory-starter-rng-handoff
…-rng-callable' into bdsp/autostory-starter-rng
dayfine
left a comment
There was a problem hiding this comment.
Reviewed SHA: b6ec3bc
Verdict
NEEDS_REWORK (changes_needed)
Stack. Base is bdsp/starter-rng-callable (#438). The head also merges bdsp/autostory-starter-rng-handoff (#437), so the PR's diff (35 files) contains all of #437 and #438's content until they merge. I reviewed only what this branch adds on top of #437 and #438: the Lake events, AutoStory.{h,cpp}, StoryTable and its tests.
Off by default leaves the story unchanged. With both options false, plan_story_run() copies the rows unchanged, story.run_starter_rng is unset, and the program path is the same as #437's. Two side effects remain. NOTIFICATION_SHINY is added to NOTIFICATIONS unconditionally, which changes the user's notification settings and saved config even with the option off. STARTER_RNG_FILTERS.make_snapshot() runs on every run. Register the notification and take the snapshot only when RUN_STARTER_RNG is on, or note it in the description.
Blocking
- (high)
STARTER_RNG_FILTERShas no default row. The standalone program seeds a "Shiny" row in its constructor; here the table is empty.BdspRngFilterSnapshot::get_actionreturnsDiscardfor an empty table, sostarter_wantednever matches,select_targetfinds nothing, every attempt is Abandoned, and withSTARTER_RNG_MAX_RESETS = 0(the default, "no limit") the program resets forever. Seed the same default row as the standalone, and refuse an empty table with aUserSetupError. - (high) The shiny path leaves the game in the wrong place.
finish_battle_on_shinyends at "the start of the post-battle Lake Verity cutscene ... ready for AutoStory'safter_starlystep" (the header comment in #438'sStarterRngAttempts.h). Butwith_starter_rng_stepreplaces all of 00.02's steps, includingafter_starly, with onestarter_rngstep whosepose_afteris declared as Lakefront (17, 14..15). On a shiny hit, 00.03 therefore starts mid-cutscene, with a pose the story believes is already on the overworld. The non-shiny hit goes throughopen_menuandclose_starter_summary, so it passes. Run the cutscene (keepafter_starly) after a shiny, or make the shiny path wait for the overworld the way the non-shiny path does. A sim test covering the shiny path is also missing:Simulationonly runs thestarter_rngevent as a stub. - (high)
settings.player_model = 1is hard-coded. The standalone program has aPLAYER_MODELoption, and the lake and bedroom eye templates are chosen by model (lake_templates/model<N>.png). If the story's character is any other model, the blink watcher never finds the player and every attempt abandons at "never reached the lake blink position". Take the model from the story's character (or from an option), and say which model the new-game intro creates.
Other findings
4. (medium) The option interaction is undocumented. run_starter_rng silently overrides STOP_FOR_STARTER_RNG (&& !handoffs.run_starter_rng). Say so in both option labels, or reject setting both.
5. (medium) A failed Starter RNG returns outcome_failed("starter_rng_failed") from a 00.02 step. 00.02 is reload_and_retry, so the story's retry loop reloads the 00.02 save and reruns the whole Starter RNG up to the attempt limit, on top of the inner reset loop. starter_rng_aim (calibration) is kept across those retries, which is good, but resets_logged restarts at 1 on each. State this in the description or make the step fatal.
6. (medium) The AutoStory loop differs from the standalone program's: it passes ConsoleSettings::TOLERATE_SYSTEM_UPDATE_MENU_FAST through run_starter_rng_attempts's reset, while the story's own reload uses reset_game_from_home(..., true, 1000ms). Use one reset.
7. (low) BDSPAutoStory::program is 90 lines and the constructor 68 (limit 50, Code Health blocking). Move the run_starter_rng lambda into a named function (for example make_starter_rng_hook(...)) that returns the std::function. bdsp_starter_for_choice has an unreachable return after an exhaustive switch.
8. (low) starter_rng in Events_Lake.cpp takes the output parameter StoryExecutor& first (Code Health advisory); that is the signature all events share, so ignore this.
9. (low) StoryTable.h now has 9 namespace-scope symbols (limit 8) and two undocumented ones. Move the new row/action constants into the .cpp or a StoryHandoff.h.
10. (nit) Tests build messages with + instead of std::format.
No Qt, std::thread, mutex or std::filesystem in the new code; the listener is removed in the destructor.
Not verified: the console behaviour of close_starter_summary and the Starly battle after an RNG starter. A console run (hit and shiny) is needed before this merges.
…ity Lakefront card
…doff text; no handoff in verify mode
…bdsp/autostory-starter-rng
…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
|
Review fixes pushed: default shiny row seeded in the story options; player model comes from a story option; shiny notification only when its option is on; Run option takes precedence over Stop option explicitly (Stop is disabled while Run is on); Starter RNG failure is fatal for 00.02 (no row reload-retry on top of the reset loop); a failed post-shiny settle now stops instead of being swallowed; program()/constructor split; #437 and #438 merged in. Not changed: single reset path, shiny notification registration caveat. Red-first runs were not executed; tests added for each fix. |
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
Moved unchanged from bdsp/autostory-starter-rng (7a46b79), so that BDSP and FRLG both build on it from the shared base. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
FRLG's loop also ends where the user takes over (target hit but not shiny, attempts spent); that is a stop with a message, not an error. A shiny is a continuation whose rows the game builds, so the seam carries no rows. 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
Base:
bdsp/starter-rng-callable(#438) (also mergesbdsp/autostory-starter-rng-handoff#437)Integrates the BDSP Starter RNG attempt loop (
run_starter_rng_attempts()from #438, ported fromPokemonAutomation/Arduino-Source#1366) directly into BDSP AutoStory checkpoint00.02(Lake Verity) as an opt-in option (RUN_STARTER_RNG, off by default).How it fits into
00.02(Lake Verity)00.02starts atVerityLakefront (17, 14)facing north and saves at its start (saves_in = true,SAVE_AT_START).RUN_STARTER_RNGis enabled on a run covering00.02:plan_story_run()replaces00.02's post-save steps (enter_lake_verity,starly_ambush,pick_starter,starly_battle,after_starly,leave_lake_verity) with a singlestarter_rnggame action while keeping00.02's start save atVerityLakefront (17, 14)intact.STOP_FOR_STARTER_RNGis also checked,RUN_STARTER_RNGtakes precedence and continues past00.01into00.02.starter_rnginvokesrun_starter_rng_attempts()with:start_point = StartPoint::LAKEFRONTstarter = bdsp_starter_for_choice(STARTER.current_value())(Turtwig/Chimchar/Piplup)player_model = 1(matching00.00's default cursor selection inplay_new_game_intro())finish_battle_on_shiny = trueandclose_summary_after_read = trueHIT(afterread_observed_pokemon()+close_starter_summary()) or aSHINYin battle (afterclear_starter_battle()+open_menu()+ closing the X menu), the player is left on theVerityLakefront (17, 14..15)overworld with the menu closed—matching the end of00.02so00.03(Lake -> Sandgem -> Mom) continues seamlessly.Changes
PokemonBDSP_AutoStory.{h,cpp}:RUN_STARTER_RNG(defaultfalse),STARTER_RNG_MAX_RESETS(default20),STARTER_RNG_FILTERS(BdspRngFilterTable),NOTIFICATION_SHINY, andbdsp_starter_for_choice(StarterChoice).PokemonBDSP_AutoStory_StoryTable.{h,cpp}:STARTER_RNG_CHECKPOINT_ROW = "00.02",STARTER_RNG_ACTION = "starter_rng", andStoryHandoffs::run_starter_rnghandling inplan_story_run().PokemonBDSP_AutoStory_StoryExecutor.h&PokemonBDSP_AutoStory_Events_Lake.cpp:StoryEnv::run_starter_rngcallback and registered the"starter_rng"game action.PokemonBDSP_StarterRngAttempts.cpp:finish_battle_on_shiny && close_summary_after_read, advances through theafter_starlyLake Verity cutscene viaopen_menu()and closes the menu so shiny hits also end onVerityLakefront (17, 14..15).PokemonBDSP_AutoStory_StoryTable_Tests.cpp&PokemonBDSP_AutoStory_StorySimulation_Tests.cpp:run_starter_rngstep replacement, precedence overstop_for_starter_rng, and end-to-end simulation across00.01 -> 00.03.Tests
PokemonBDSP::StarterRng - aim offset and calibration biasPokemonBDSP::StarterRng - bedroom skip buffer and landing mathPokemonBDSP::StarterRng - per-starter tables and timingsPokemonBDSP::StarterRng - attempt loop outcome resolutionPokemonBDSP::AutoStory - Story table: rows lint, variants knownPokemonBDSP::AutoStory - Story table: each row starts where the last one endsPokemonBDSP::AutoStory - Starter RNG handoff: stops after 00.01 saved at the Verity LakefrontPokemonBDSP::AutoStory - Simulation: start and end checkpoints