Skip to content

BDSP AutoStory: grid simulation of walks and scenes for unit tests - #167

Draft
dayfine wants to merge 15 commits into
bdsp/autostory-v4from
bdsp/sim
Draft

dayfine wants to merge 15 commits into
bdsp/autostory-v4from
bdsp/sim

Conversation

@dayfine

@dayfine dayfine commented Nov 2, 2026 •

Copy link
Copy Markdown
Owner

Depends on #128 (base bdsp/autostory-v4); the diff shows only this PR's change.

A grid simulation of the player so walking and scene bugs in BDSP AutoStory show up in unit tests, not only on the Switch.

  • GridSim moves like the console measured: 40–80 ms D-pad taps only turn, 160 ms steps a tile, holds walk to the wall, a 100 ms stick tap moves about 0.6 tile and later D-pad moves keep that offset, doors warp only from their exact column, people block, and trainers' sight lines and coord events stop the walk. The route walker runs on it through GridSimRouteIO.
  • The executor's walking steps (ROUTE, LEGS, STEP, TALK, MASH) move into StoryWalkSteps on a StoryStepIO, so the whole table, 00.00 to 01.11, runs with the program's own steps on the sim, in one run and row by row. Events, battles and shops are stubbed and end where the table says; each row must start where the one before left the player.
  • Scenes start from the maps' coord_events, now BDSP AutoStory maps: the story maps as generated JSON, read through MapData #134's generator output (decomp triggers plus Mom's call), read by story_coord_events(); nothing is hand-added to the JSON here.
  • Detector-miss test (AutoStory simulation: inject timing and placement variance #162): for each door fade and map banner the run looks for (20 fades, 8 banners), reruns its row and the next with it missed; every miss must stop the run in its own step or be got over, never fail later.
  • Exit tests for r75 and r81: a hold that misses the fade goes on past the door, and a banner reads a few tiles into its map. The old walk west out of the Oreburgh Gate ends in Route 203's pond pocket and the old timed walk out of the Ravaged Path on Route 204's cliff, both caught by the end-tile check; the table's tap-to-banner never ends there.

Testing

  • Suites: GridSim and StorySim pass locally, as do the existing AutoStory suites. Reverting earlier fixes fails the new tests: turning with a 100 ms stick tap (r49) misses the Sandgem Center and Jubilife School doors and most of the table's routes, and a talk that does not first turn to the pose's facing (r40) finds nobody beside Mom or the TV station clown.
  • Console: not run; the sim's moves are the ones measured on console B.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E

dayfine and others added 7 commits November 2, 2026 02:03
…n it

GridSim moves a player on the story maps as measured on the console: short
D-pad taps only turn, 160 ms steps a tile, holds walk to the wall, a stick
tap moves part of a tile and the D-pad keeps that offset, doors warp only
from their column, people block and trainers' sight lines stop the walk.
GridSimRouteIO runs the route walker on it.

The executor's walking steps (ROUTE, LEGS, STEP, TALK, MASH) move into
StoryWalkSteps on a StoryStepIO, so the story sim tests run rows 00.04 to
00.05c with the program's own steps on the simulation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
The story maps list their coord events ("coord_events": the decomp's
zone_event triggers, from pret/pokeplatinum's events files, and Mom's call
as measured on the console). story_coord_events() reads them, and the
story sim arms each while its story variable holds, so a step onto a
trigger tile starts its scene in the simulation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
v4's change to settle() (15 s of calm overworld when the screen keeps
moving) goes into StoryStepIO.cpp, where #167 moved settle(). v4's battle,
save (saves_in) and make_story_segment changes stay in the executor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
PlayerHouse1F.json: take autostory-v4's decomp tiles and "patches",
keep sim's "coord_events".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
The story sim's StoryStepIO can now miss the Nth door fade (run_into_door
reports no fade though the player warped; the settle after it sees none
either, as on the console once the fade is over) or the Nth map banner
(run_until_map). A new test runs 00.04 to 00.05c once per fade and banner
the clean run makes, and requires each miss to be got over or to stop the
run in the step that missed: a later failure means the miss went unseen.

Today all four (3 fades, 1 banner) stop in their own step. A missed fade
costs settle()'s 120 s and a failed attempt.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
# Conflicts:
#	SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/JubilifeCity.json
#	SerialPrograms/Source/PokemonBDSP/Programs/AutoStory/Maps/SandgemTown.json
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 3, 2026 00:06
#128 now has seg01's planned 01.05 to 01.10 (#175) and the shared steps
(#173). Their executor changes go where this branch moved the walking
steps: per-world trainers, the Twins as a pair (ConsoleStoryStepIO::fight),
the "to_banner" tap (StoryStepIO::tap_to_banner), and the 8 s wait for an
answer to a talk (StoryWalkSteps::talk). The story sim taps to the banner
too, and walks a route on the joined world it plans on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
The story sim ran only 00.04 to 00.05c. It now runs 00.00 to 01.11, the
whole table and each row alone, with the program's own walking steps;
scenes, events, battles and shops end where the table says. Each row must
start where the row before left the player, and every walking step with a
declared or worked-out end is checked against it in world tiles (a leg out
of Twinleaf ends on Route 201's tiles).

What it needed: the story variables of the coord events the table walks
onto (00.01 to 00.03, 01.01 to 01.07), the houses' stairs as doors, Barry
in Oreburgh's Center door until his lines (01.03), and B running only once
the shoes' scene has given them (Route 201 timed a walk as a run).

A tap or hold through a door or cave mouth that misses the fade now goes
on onto the step's far side, and a banner reads three tiles into its map
("a tile or a few past the border"). The exit tests run r75's and r81's
old open-ended walks that way: they end in Route 203's pond pocket (52, 9)
and on Route 204's cliff (20, 30), and the end-tile check fails them;
the table's taps to the banner never end there, whatever is missed. The
detector-miss test covers the whole table (20 fades, 8 banners), each miss
on its own row and the next.

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