Skip to content

BDSP AutoStory MVP v3: segments 00 and 01 as event tables, maps as JSON - #121

Closed
dayfine wants to merge 26 commits into
bdsp/segment00-planned-walksfrom
bdsp/mvp-v3
Closed

dayfine wants to merge 26 commits into
bdsp/segment00-planned-walksfrom
bdsp/mvp-v3

Conversation

@dayfine

@dayfine dayfine commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

Depends on #112, which depends on #111. Those two now hold the decomp grids as committed JSON files built in by CMake, and #112's 00.01–00.03 lines on them, so this PR is v3's own work only.

Each checkpoint from 00.00 to 01.11 is a row of a segment table on the shared engine. Its events are the step functions it already called, and each row saves at its start; 00.04 is four rows (00.04, 00.04b–d), so a failure after training no longer repeats it. The fixes from the console runs r252–r261 are here too: the indoors check under the evening tint, the door exit stopping outside, taps to Sandgem's Center door, the blackout check after training, and Potions from the Poke Mart lady with the clerk as a fallback. Fork CI on Mac, Windows clang and Ubuntu passes the story-table, indoors, door-fade and Mart-lady-walk tests and every route test; only the two PokemonAutomation#1717 screenshot tests fail, as they do on #111.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E

dayfine and others added 17 commits November 1, 2026 01:18
The shared engine replaces this branch's copies of the grid types, leg
planner and story events. LegWalker goes: nothing in BDSP uses it, and
FRLG brings its own on nav/shared. SandgemCenterEvents moves to the
shared Pose (a Position) and returns learned poses in its Outcome.

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
#111's decomp grids win: Segment00Lines drops its Route 201 stand-in
for Route201::grid() (7 rows shorter at the top) and SandgemTown::grid()
is now its whole cell (4 rows taller). The 00.01-00.03 lines, triggers,
named tiles and route records move by those offsets; their world tiles
are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Each checkpoint 00.00 to 01.11 is a row of a Pokemon::Segment table
(make_segment_00, make_segment_01) whose events are the step functions
it called, in the same order; run_segment runs them. The
checkpoint_reattempt_loop wrappers go: a row saves first (skipped on a
retry), and a failed step takes the loop's screenshot, counts a reset
and is retried from a reset to that save, up to the same 20 attempts.
00.04 is two rows, 00.04 and 00.04b, for its two saves. 00.00 neither
saves nor retries, as before. The program's options are unchanged: each
checkpoint and segment runs its rows through run_story_table().

Test_StoryTables builds both tables with a describe-only runner, checks
their rows and first events, lints and describe()s every checkpoint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
devtools/maps/bdsp_maps.py writes the 16 C++ tile tables as
PokemonBDSP/Maps/<name>.json in Pokemon_MapData's schema ('"' as '~', a
standing 'N' as an npc object on open ground). The program loads them
through parse_map() when it starts, checks each against its table cell
for cell, and StoryMaps plans on the loaded grids (story_grid()); the
offline tests, which have no resources, plan on the tables as before.
The tables stay until the files are the source.

Tests: the glyph mapping (CI), and the files equal to the tables when
the resources have them (skipped in CI, which has none).

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

make_segment_00 and make_segment_01 build their tables from two row
lists each through story_segment(), which keeps every function under 50
lines and four levels of braces; program() loads the maps through one
helper call, so it does not grow.

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

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

r252 (v3, 2026-11-01) failed in 00.04's heal: from the catch grass the
route costs found no plan within the cap, and the default costs' plan went
round the houses south of the Mart (stopped early among the wandering
townspeople), then walked west 9 along the doors' row and ended about two
tiles short, near (22, 11), halfway between the Center's door (17, 10) and
the Mart's (27, 10); lining up by sight then flipped between the two
doors. The grid is right: door, sign and Mart are where the screen shows
them, as on the grid run 2 passed with.

The walk is now two: down the road with the default costs to where it
stops above the Mart (SandgemTown::ROUTE_202_ENTRY_STOP, (29, 5)), then
the Sandgem Center events' town plan, which ends walking north into the
Center's sign (west 9, east 1, south 7, west 1, north 2; tested leg by
leg). The tile grid plans test checks the first walk in place of the
one-walk plan.

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

r253 (v3, 2026-11-01) failed 00.04's training: the walk to the catch grass
planned west 10 along row 29 onto (20, 29), stopped a tile short beside
trees, and walked up and down the path for three minutes without a
battle. The decomp has the patch at (15..20, 25..29); in BDSP its two
bottom rows are trees (the screenshot shows three grass rows above a tree
row, and the walk west stopped against them), as the image-traced grid
had it and as encounter_one_wild_pokemon() assumes ("three rows between
tree walls"). The grid marks (15..20, 28..29) as trees, and CATCH_SPOT
(19, 27) is the patch's bottom row.

Test_Route202CatchGrass: every patch column runs rows 25..27 between
trees, and the planned walk from the save spots ends in the grass.

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

The catch's save (00.04b's start) loads in the pocket east of the catch
patch behind the tree row, (21, 29) by the screen (the 202 sign 3 columns
right and 4 rows up, the grass's bottom row above-left), not on
CATCH_SPOT. Planning from {CATCH_SPOT, SAVE_SPOT} sent r253 and r254 the
wrong way: r254's first leg south was blocked at once, then "too many
plans". The pocket is on the grid and reachable from the grass up the
lawn column 21.

- story_catch_save_area(): the patch (15..20, 25..27) and column 21 from
  row 25 down to the pocket; the training walk starts there (a save on
  SAVE_SPOT has Potions and resumes past training), and its goal is a
  tall-grass tile of the training column: north to the trees, east to the
  sign, taps west.
- Route 202 grid: a tree at (21, 30), south of the pocket (r254).
- Test_Route202CatchGrass plans to the grass from the whole area and from
  the pocket alone, with the route costs and else the default costs, as
  walk_route() does, and checks every end tile is grass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
The catch patch's two bottom rows are trees now, and plan_robust_route()
refuses starts on them (tile grid plans: "Route starts must be standable").

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

r255 (v3, 2026-11-01) walked the town plan exactly: west 9 to the wall
at (20, 5), east 1, south 7, west 1, north 2 into the Center's sign at
(20, 11), the tile the plan ends on. Lining up by sight from there then
read the Mart's sign, 5 tiles east and a row up, as a lit doorway
("doorway 4.6 tiles across", the same reading as r252's), stepped to it,
walked into it, and went back and forth between the two signs' white
panels for 12 tries. The grid matches the screen (Center door (17, 10),
its sign (20, 10), the Mart's sign (25, 10) and door (27, 10)).

From below the sign, three D-pad taps west put us below the door, where
the door is straight ahead and the lining up starts at 0.
Test_SandgemCenterApproach checks the taps' row and where they end.

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

r256 (v3, 2026-11-01) arrived below the Center's sign at (20, 11) facing
north, and its three taps west moved two: the first only turned. Its
screenshot has the player at (18, 11), one tile right of the door's
middle and two left of the sign, so the door stays (17, 10), as the
decomp has it; (17, 11) is open. Turn west first, then tap; two tiles
moved is accepted, since the lining up by sight takes a door one tile off
and dead ahead.

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

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

r257 (v3, 2026-11-01) healed in Sandgem's Center, walked out, and walked
on south past the road into a house: indoors() counted warm pixels only,
and the evening tint (console clock ~5:20 pm) makes the outside 50..72%
warm, over its 25% line; Oreburgh's ground by day is 58..69%. A room
floats in black, which shows along an edge, so indoors() now also needs a
near-black share of 15% in a strip 12% deep along one edge. Checked on
the 1412 lab screenshots: the 54 the old rule called inside and the new
one outside are all outside (Sandgem in the evening, Oreburgh by day,
Jubilife at night); the Centers, the School and Barry's house stay inside.

leave_door_south() takes the fade it stopped on as the door, rather than
looking again and walking on.

Test_IndoorsAnyLight: synthetic screens (the evening outside, a room with
black below its floor, a fade, a thin shadow, grass).

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

r258 (v3, 2026-11-01) lost its third training battle in Route 202's
grass: Piplup used Tackle four times, nothing came for 16 s, the
end-of-battle check fired on the blackout, and the player woke at home in
Twinleaf. "Into Sandgem Town" then walked its plan there: out of the
house's door, south (the 1850 ms of big screen changes), east 8 into the
trees east of the town, and south into the trees above the pond, which is
the r258 screenshot (the house with the mailbox, the pond at (12..19,
27..31), trees east and south). Route 202's grid is not involved; the
step screenshots of the walk to the grass match it tile for tile
((30, 24) under the ledge, (22, 24) by the trees, the patch's corner at
(20, 25)).

fail_if_blacked_out() after each training battle: a room within 10 s
means a blackout, and the step fails with a screenshot, so the checkpoint
resets to its save before training instead of walking on from home.

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 1, 2026
LegPlanner's wild-step weighting moved from #119 to #114 (7008f8c) and merged down #117 → #118 → #119 → #120; #120's diff is PokemonFRLG only. Adds #119, #120, #121 to the tree and a file-ownership table.
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 1, 2026
…d stop is named

Moved here from #121 (bdsp/mvp-v3), where console runs r253..r258 found
them; this PR owns the decomp grids.

- Route 202: trees, not grass, at (15..20, 28..29): the console's catch
  patch is three rows between tree rows, as the image-traced grid had it
  (r253: west along row 29 stopped at column 21); a tree at (21, 30),
  south of the pocket at (21, 29) where the catch's save loads (r254).
  CATCH_SPOT (19, 27) is the patch's bottom row.
- story_after_training_area() keeps only standable tiles (the planner
  refuses starts on trees); story_catch_save_area() is where the catch's
  save may stand: the patch and the lawn column east of it to the pocket.
- Sandgem: ROUTE_202_ENTRY_STOP (29, 5), where the walk south from Route
  202 stops above the Mart; sandgem_entry_stop() uses it.

Tests (PokemonBDSP_AutoStory_MapGrid_Tests.cpp): the patch's columns run
rows 25..27 between trees, and plans from the save area and the pocket
end in the grass; Sandgem's Center door (17, 10), its sign (20, 10) and
the open row below them; plans into Sandgem from every tile of the
training area.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
…08f8c) into bdsp/mvp-v3

#111 now holds the grid fixes and #112 the 00.01-00.03 lines on them,
both first made here; their content matches this branch's, so only
nav/shared's newer LegPlanner (an opt-in wild-stop weight, 0 by default)
and #111's map grid tests arrive.

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 1, 2026
#111's decomp grids win: Segment00Lines drops its Route 201 stand-in
for Route201::grid() (7 rows shorter at the top) and SandgemTown::grid()
is now its whole cell (4 rows taller). The 00.01-00.03 lines, triggers,
named tiles and route records move by those offsets; their world tiles
are unchanged. Done first on #121 (64afa5f); this PR owns the lines.
This PR now builds on #111.

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

Test_Route202CatchGrass, Test_SandgemCenterApproach and
Test_TrainingToSandgem moved to #111 (PokemonBDSP_AutoStory_MapGrid_Tests,
merged in), so Segment00_Tests.cpp is #112's again; Test_IndoorsAnyLight,
v3's own, moves to PokemonBDSP_AutoStory_Indoors_Tests.cpp. No program
code changes.

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/maps-rederive to bdsp/segment00-planned-walks November 1, 2026 17:26
dayfine and others added 5 commits November 1, 2026 09:34
…sp/mvp-v3

#111 and #112 now hold the maps as JSON, the built-in test copy, the
generator and the JSON-to-grid loader (MapGrids), which were this
branch's; the C++ tables are gone. What stays here: the program loads
Packages' files at start, checks each against the built-in copy, and
installs them for story_grid() (MapFiles); StoryMaps goes back to the
X::grid() accessors. The glyph test moved to #111 with the loader.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
r259 (50edfb0) healed in Sandgem's Center, turned round to walk out,
and at 800 ms one look read "not a room" (the lit Center missed its
black edge) with a big screen change: leave_door_south() took that for
the fade, and "To the Poke Mart" walked east inside the Center.

Out is now a dark look (brightness under 120: the fade) followed by a
bright one (200 and up) that is not a room; or, after a walk, three
standing looks half a second apart, none a room. A big screen change no
longer counts. Each look is logged with its brightness, the indoors()
reading and whether the fade was seen. Test_DoorFade: r259's looks, the
fade then the town, the fade then the room again, a dim fade-in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
…he clerk as a fallback

Step 3 runs the Sandgem Center events' Mart lady checkpoint (the
diagnostic_sandgem_mart_lady() path: the Lab's sign, west along the path
to her grass, north to her row, her talk, Route 201's sign, east to the
trees east of the Mart, Route 202's save spot, and the save there, which
is step 4) for her 10 free Potions. She stands still: her object in the
Diamond decomp has no wander, and the user has seen her stand on the
console; the r113a..r120a misses were the walk, not her. After two
failed runs (each fails the step, and the row resets to its save), the
clerk's 5 and the old walk back and save are used instead. The Bag must
have Potions after step 3 (bag_has_item() checks presence, not a count).

Test_MartLadyWalk follows her walk's legs to their walls on the story
maps, from below the Center's door to the front row's east end.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
…uilt in by CMake) into bdsp/mvp-v3

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
…s are the only copy

The user's decision (2026-11-01): the maps stay files in this repository
(#111, #112), built into the program; story_grid() reads only those.
The start-up load of Packages' PokemonBDSP/Maps and its "differs from
this build's copy" check go, with their test; the lab deploy no longer
copies map files.

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 1, 2026
… the Center

On the decomp grids, with the catch patch three rows, the one walk from
the training area to below the Center's sign finds no plan (tile grid
plans: "After training to the Pokemon Center: no robust route found"),
and on r252 its default-costs plan went round the houses south of the
Mart and ended two tiles short. Two walks instead: down the road with
the default costs to where it stops above the Mart (ROUTE_202_ENTRY_STOP),
then the Sandgem Center events' town plan, which ends walking north into
the Center's sign. Made first on #121 (cd3d0b3); it goes with the grids.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
…approach) into bdsp/mvp-v3

#111 now has the two walks into Sandgem; this branch's version of the
heal (the same two walks, then the taps west below the door) is kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
…xit stops outside; onto the doors' row

The user's rule: define checkpoints as you go and save as each completes.
00.04b ran six steps on one save, so every failure after training cost
the training again. Now three rows, each saving at its start, which is
the end of the one before:
- 00.04b (from the catch's save): train in the catch grass, heal in
  Sandgem's Center.
- 00.04c (from the save just out of the Center): Potions from the Mart
  lady (her checkpoint without its own save; the clerk after two
  misses), on to Route 202's save spot; the Bag must have Potions.
- 00.04d (from the save on the save spot): north past Route 202's
  trainers into Jubilife and Dawn's scene.
The resume-with-Potions branch and its Sandgem anchor go: no row starts
from a save another row made mid-way any more. Checkpoint 00.04 and the
post-catch diagnostic run 00.04b..00.04d.

r261: out of the Center the walk saw no dark fade and held south for
2 s, three rows past the door, and the Mart lady's walk west ran into
the trees. leave_door_south() now also stops at the first look that is
not a room, then confirms with three standing looks (five tries); and
00.04c first turns east, taps under the Center's wall and walks north to
its front, so the walk west starts on the doors' row whichever row the
exit left us on.

Tests: Test_StoryTables has the new rows; Test_MartLadyWalk starts one,
two and three rows below the door.

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

dayfine commented Nov 1, 2026

Copy link
Copy Markdown
Owner Author

Superseded by the BDSP v4 stack, ending in #128 (new game to Floaroma as one story table on the shared steps).

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