Skip to content

FRLG AutoStory: plan Starter RNG attempts from SID Helper's candidates - #182

Closed
dayfine wants to merge 40 commits into
frlg/rng-plan-basefrom
frlg/autostory-rng-plan
Closed

dayfine wants to merge 40 commits into
frlg/rng-plan-basefrom
frlg/autostory-rng-plan

Conversation

@dayfine

@dayfine dayfine commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner

Depends on #179, #181, #185, #186, #187 and #188. Base frlg/rng-plan-base: frlg/autostory-starter-rng (#179) with #181, #185 (frlg/trainer-card) and #188 (frlg/rng-plan-log, which carries #187 and #186) merged in, so the diff shows only the AutoStory glue.

The Starter RNG stop told the user to run Starter RNG but not with which seed, and with the SID only narrowed to SID Helper's candidates there was no plan for finding a shiny. Now the stop reads the TID off the Trainer Card and lists the attempts to make, in order.

Testing: the plan's suites (PokemonFRLG::RngPlan, RngPlanTracker, RngPlanInputs, RngPlanLog, RngTargetSearch) now live in the split PRs and passed before the split in a harness linked against the lab build. This PR's files were syntax-checked only, not built; CI is dispatched. Nothing ran on a console, so the card read at the stop is unverified.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E

dayfine and others added 5 commits November 2, 2026 15:16
…g/autostory-rng-plan

# Conflicts:
#	SerialPrograms/Source/VideoGames/PokemonFRLG/PokemonFRLG_Tests.cpp
…dates

With "Stop for Starter RNG" on, AutoStory now searches Starter RNG targets
(#181's search_rng_targets) for the TID and SID Helper's candidate SIDs,
orders them so each attempt covers the likeliest SIDs not yet ruled out,
and lists them in the stop message and log. RngPlanTracker holds the
decision after each attempt (shiny, hit but not shiny, missed), for the
in-process follow-up.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
The options and the plan they build go in StarterRngPlanOptions, which
keeps AutoStory's constructor and program() short; the long tests take
their cases from functions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
SID Helper's navigate_to_trainer_card() and TID read move to a shared
PokemonFRLG_TrainerCard.h; SID Helper calls them as before. TrainerIdReader
gains try_read_tid(), which says when the digits can't be read.

At the Starter RNG stop AutoStory reads the TID from the card unless the
RNG plan's TID (now text, empty by default) overrides it, and stops with
an error when it can't. The plan logs grep-able "RngPlan:" lines (TID,
SID Helper's candidates, attempts, the confirmed SID's place among the
candidates) so the candidate odds can be rebuilt from logs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Keeps program() under the code-health limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine added a commit that referenced this pull request Nov 2, 2026
Replaces "AutoStory never picks seeds": the Starter RNG stop reads the TID,
plans attempts over SID Helper's candidates (fork #182), and the user still
runs Starter RNG per attempt for now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine and others added 2 commits November 2, 2026 15:41
The TID read and the plan run just before 00.04's save, so an unreadable
TID or a plan with no target ends the run with 00.03's save kept, and
00.04 can be run again once the RNG plan is fixed. A typed-in TID still
skips the card.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine and others added 2 commits November 2, 2026 16:50
…he next step

rng_log_result() takes an RngResultLog: the try, Starter RNG's own
outcome, the nature, IVs and PID when known, and what comes next
(rng_plan_next()). Outcomes are lower case. RngPlanTracker gains
attempt_count(). The header lists every RngPlan: line in the order a run
logs them, including the loop's state line.

Moved here from #184, which uses it, so that each PR owns its files.

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

A shiny that isn't the planned target (another advance) says nothing
about the SID, but RngPlanTracker narrowed the SIDs to the target's for
any shiny, which could confirm a wrong SID. A new outcome,
SHINY_OFF_TARGET, ends the plan as GOT_SHINY_OFF_TARGET with the SIDs as
they were and none confirmed; classify_attempt() returns it for a shiny
without the target's nature and IVs. The result line names it
shiny_off_target, with next=stop.

An attempt missed more often than the retries allow now moves on to the
next attempt still shiny for a SID left, since a miss rules nothing out.
The plan stops only when there is none: MISSED_EVERY_ATTEMPT_LEFT
replaces OUT_OF_RETRIES.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine added a commit that referenced this pull request Nov 3, 2026
…move on

Starter RNG's attempts now tell whether a shiny was the target
(identify_shiny, #183). Only a shiny on the target narrows the SIDs; one
off it, or not known to be on it, ends the loop as SHINY_OFF_TARGET with
no SID confirmed and no "RngPlan: confirmed" line. Its result line says
outcome=shiny_off_target next=stop. Either shiny goes on with the story.

The result line names a try that ran past its deadline attempt_deadline,
apart from out_of_resets, no_matches and wild_shiny; all still count as a
miss. An attempt missed more often than the retries allow moves on to the
next one still shiny for a SID left (#182), and the run stops only when
none is left (MISSED_EVERY_ATTEMPT_LEFT). A shiny for none of the SIDs
left no longer says "one of" an empty list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine and others added 3 commits November 2, 2026 17:07
… screen

Starter RNG waits on the title screen for the seed list's delay less
845 ms plus its calibration, and refuses a wait under 29,650 ms. The plan
listed seeds whose wait came out just under that: on console B, TID
55740's first attempt was seed 11A3 (30,473 ms in the table, a 29,628 ms
wait), and Starter RNG stopped with "The title screen delay cannot be
less than 30s". 405C (30,488 ms) fails the same way.

plan_starter_rng() now drops seeds whose wait, as prepare_timings()
makes it, is under 29,650 ms plus a 1 s margin for the seed calibration
(starter_rng_can_wait_for()). Tested on both seeds and on TID 55740's plan.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
A new outcome, UNUSABLE, is for an attempt Starter RNG refuses to run
(its timings): it rules nothing out, and the tracker moves on to the next
attempt still shiny for a SID left, or ends as MISSED_EVERY_ATTEMPT_LEFT
when there is none. The result line names it "unusable".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
More data from console B on the plan's targets:
- The title screen: Starter RNG's docs warn that waits near 30,500 ms
  can miss the title press, so the plan now needs a 31,500 ms wait
  (STARTER_RNG_MIN_SEED_WAIT_MS), not 29,650 ms plus 1 s.
- In game: Starter RNG needs at least 7,500 ms, which its 940-advance
  minimum just makes, and the in-game calibration moves it. Seed B579 at
  967 advances (7,725 ms) went to a -720 calibration after one miss and
  1,725 ms. Targets now start 720 advances past the minimum
  (STARTER_RNG_INGAME_MARGIN_ADVANCES, to tune from the logs).

The order is unchanged: rank_rng_targets() over the targets that pass.
Each "RngPlan: attempt=" line now gives Starter RNG's two waits before
calibration (seed_wait_ms, ingame_ms).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine added a commit that referenced this pull request Nov 3, 2026
Starter RNG refuses timings it can't press (a title screen or in-game
wait too short, a negative delay) with a UserSetupError, or a failure
that sends no error report (check_timings()). That ended the whole run;
on console B it did for seed 11A3, whose title screen wait was under
30 s. The console steps now turn such a refusal into a UserSetupError,
and the loop logs it ("RngPlan: attempt <i> can't run: ...") and records
the attempt as unusable (#182): the result line says
outcome=unusable starter_rng=setup_error, and the next attempt still
shiny for a SID left runs. A game failure (one that sends an error
report) still ends the run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine and others added 2 commits November 2, 2026 18:09
The plan doesn't know about the story, so it moves out of AutoStory into
four RngManipulation modules, each with its own test suite:
RngPlanInputs (TID/IV/nature text), RngPlan (SID Helper's candidates, the
attempt order and Starter RNG's timing limits), RngPlanTracker (outcomes,
the step after each, rng_plan_next) and RngPlanLog (the attempt and
"RngPlan:" lines). The tests' made-up targets move to RngPlanTestTargets.
Code is moved unchanged; AutoStory keeps the options group.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine and others added 4 commits November 2, 2026 20:14
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
The RNG plan gets an "RNG Calibration (this console)" group with the seed
and Continue Screen Frames offsets, in Starter RNG's units, for AutoStory's
RNG stops to start from and save back to. Each stop keeps its own in-game
advances offset, added with the stop.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine added a commit that referenced this pull request Nov 3, 2026
* Design: FRLG AutoStory events after Brock (moved from fork #126)

Moved from the program folder on #120 to docs/design, renumbered for the
00.07/00.08 forest split (Brock is 00.09), and pointed at the planned run modes.

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

* Design: full FRLG AutoStory checkpoint list from the 52poke flow

Rewrites the post-Brock outline into segments 00-17 (the English
walkthrough's 20 parts, segment 00 = Parts 1-3 + Running Shoes), 95
checkpoints with start, steps, end save and the 52poke lines each covers.
Italic 52poke lines become named options, off by default; the postgame
after the first Hall of Fame is its own section. A coverage table maps
every 52poke line to a checkpoint.

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

* Design: FRLG RNG handoffs, RNG plan setting, speedrun notes

Adds an RNG handoff per target the upstream FRLG RNG programs support
(Gift, Static, Roaming; Wild and Egg hooks noted), each a default-off
split that saves at the program's start state and stops, and an RNG plan
setting with its pre-run checks. Reserves an ACE setup option. Copies
the WR speedrun notes next to the list and links them where used.

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

* Design: FRLG item duplication, team plan and money plan

Replaces the reserved ACE row with an item_dupe option (the Knock Off +
Recycle mail glitch, new checkpoint 06.07, Tower rows renumbered), adds a
team plan (HM users, in-game trades, level targets per fight, GRIND
steps) and a money plan worked backwards from the purchases, with a
decomp-sourced ledger and the Vs. Seeker loop count behind a
nugget_bridge_loop option.

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

* Design: FRLG options reference and per-starter team plan

Collect every option into one reference grouped as run control, story
choices, optional story, team, legendaries, economy, glitches and RNG, each
with values, default, rows, dependencies and user data, plus one table of
run-start checks. Make the team plan per starter and version: matchups by
fight, HM users, supporters (LeafGreen Starmie via the Super Rod, FireRed
Lapras), the catches they add to rows, second-carrier levels and their
money.

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

* Design: AutoStory plans the Starter RNG attempts over SID candidates

Replaces "AutoStory never picks seeds": the Starter RNG stop reads the TID,
plans attempts over SID Helper's candidates (fork #182), and the user still
runs Starter RNG per attempt for now.

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>
dayfine and others added 16 commits November 2, 2026 21:29
# Conflicts:
#	SerialPrograms/cmake/SourceFiles.cmake
…-rng-plan

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
# Conflicts:
#	SerialPrograms/cmake/SourceFiles.cmake
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
… in a dark cave) into frlg/autostory-rng-plan
…mpts out of step) into frlg/autostory-rng-plan
…utostory-rng-plan

# Conflicts:
#	SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStory.cpp
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
…utostory-rng-plan

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
…e) into frlg/autostory-rng-plan

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

dayfine commented Nov 3, 2026

Copy link
Copy Markdown
Owner Author

Superseded by #214 (FRLG stack consolidated into stage PRs; will be resplit for upstream).

@dayfine dayfine closed this Nov 3, 2026
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