Skip to content

PokemonBDSP AutoStory: plan robust routes with the shared robust leg planner - #413

Merged
dayfine merged 15 commits into
bdsp/connected-mapsfrom
bdsp/robust-leg-planner
Nov 12, 2026
Merged

dayfine merged 15 commits into
bdsp/connected-mapsfrom
bdsp/robust-leg-planner

Conversation

@dayfine

@dayfine dayfine commented Nov 12, 2026

Copy link
Copy Markdown
Owner

Base bdsp/connected-maps (#411), with nav/robust-leg-planner (#412) merged in; the diff shows #412's files too until it merges into #408 and #408 into #411.

BDSP plans its robust routes with the shared Pokemon::plan_robust_legs() from #412.

  • plan_robust_route() and robust_route_cost() keep their signatures; their set search moves out, and what stays is the story world as the planner's step model (step, ledge hop as 2 tiles, at_wall, tall grass, wander zones) plus a copy of RobustPlanCosts into the shared costs.
  • BDSP still plans one story world at a time; planning on connected maps comes with FRLG's switch.

Testing

  • Headless runner (SerialProgramsTests): PokemonBDSP::AutoStory (63 cases, incl. "plans match the golden", unchanged from BDSP AutoStory: golden test for planned story routes #392), PokemonBDSP::StoryData, Pokemon::LegPlanner, Pokemon::RobustLegPlanner pass; the only failures are the BDSP MenuDetector / ShortDialogDetector image tests (FileException, no CommandLineTests checkout).

🤖 Generated with Claude Code

https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss

dayfine and others added 7 commits November 11, 2026 20:48
BDSP's search over the sets of tiles a player may stand on after an
uncertain open leg, lifted as a template over a step model so it can plan
on any state (a world tile, or a map and a tile).

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

plan_robust_route() and robust_route_cost() keep their signatures and plans;
the set search moves to Pokemon::plan_robust_legs(), with the story world's
step rules as its model.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…put and expectation cases

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

@dayfine dayfine left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed SHA: 057a7ee

Reviewed against bdsp/connected-maps. The Pokemon_RobustLegPlanner* files in the diff are #412's, merged in (byte-identical to #412's head), and are reviewed there.

Verdict

APPROVED (LGTM to merge, after #412)

Correctness: RobustWorldModel wires exactly the calls the removed code made: step(), distance() for the tile count (ledge hop = 2), at_wall() for held, tall_grass() for wild, wandering_hazard() for wander, and the same y-then-x order for spreads. robust_leg_costs() copies all twelve fields (per_grass_tile -> per_wild_tile). Results convert back to PlannedLeg with the same direction, tiles, wall flag and after. With #412's search being the moved BDSP search, plans cannot change, and the diff touches no golden data; "plans match the golden" is unchanged (#392), as the description says. Code Health: 0 failures.

The lab's wander cost (Jubilife Mart clown fix)

lab/dev-bdsp sets costs.per_wander_tile = 15; in town_plan_costs() in PokemonBDSP_AutoStory_PlanCosts.cpp, on BDSP's own RobustPlanCosts. This PR does not touch PlanCosts.cpp, and robust_leg_costs() copies per_wander_tile into the shared costs, so the 15 must carry over and it will: when this stack meets the lab line, the lab's one line merges cleanly and reaches the shared planner. #412's default of 3 never applies to BDSP. Keep that line when the stack and the lab line meet, and expect the lab's golden, not this stack's, to carry any town plans the 15 changes. If a later cleanup replaces RobustPlanCosts with Pokemon::RobustLegCosts (finding 1), it stays a one-line change, since the field name is the same.

Findings (non-blocking)

  1. (Low, data over types) RobustPlanCosts and Pokemon::RobustLegCosts are now parallel structs with a field-by-field copy. When #412 grows a field (FRLG will add some), BDSP silently gets the shared default because nobody adds it to the copy. Prefer making BDSP's robust costs a Pokemon::RobustLegCosts (plus the TilePlanCosts parts the tile planner needs) and deleting robust_leg_costs(). That can be its own small follow-up; it does not change plans.
  2. (Low) RobustWorldModel and StoryWorldModel repeat the same world rules (step, at_wall, tall_grass, wandering_hazard) for the two planner concepts; this follows from #412 finding 4 and goes away if the concepts are aligned.

Notes

  • Fork Draft CI is red from the base (Duplicate Test Name: PokemonBDSP::ShortDialogDetector … aborts the run at registration, same on bdsp/autostory-v4), so the golden has run only locally.

dayfine and others added 8 commits November 12, 2026 00:15
…0; capped slide (#412 review)

Each row now holds the map, starts, goal and costs, and the expected plan
as text; one runner compares describe() output. New rows cover a ledge hop,
tall grass, max_spread, max_searched, joined open legs and a walk that
never stops. open_error_per 0 adds no growth instead of dividing by zero,
and slide_to_wall() gives up as not held after 1024 steps. The header says
how this step model relates to LegPlanner's and that warps are the
caller's job.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
…t costs (#413 review)

robust_leg_costs() copies BDSP's costs field by field; a static_assert that
names every field of Pokemon::RobustLegCosts now stops the build when the
shared struct grows, so a new field can't silently take the shared
default. per_wander_tile stays BDSP's own, so the lab's town cost carries
over.

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

dayfine commented Nov 12, 2026

Copy link
Copy Markdown
Owner Author

Review addressed at 1ef39dc (fix: 96f8ad7, plus #411 and #412 merged in).

  • Finding 1: the copy now has a field-count guard. robust_leg_costs_fields_copied() structured-binds every field of Pokemon::RobustLegCosts, and a static_assert calls it, so the build breaks when the shared struct gains or loses a field. A new field can't silently take the shared default. I kept the parallel structs rather than folding RobustPlanCosts into the shared one, so the lab's costs.per_wander_tile = 15; in town_plan_costs() still merges as one line. It flows through the copy, which now says that per_wander_tile is BDSP's own.
  • Finding 2: left as is; it follows Pokemon Navigation: robust leg planner shared by the tile games #412's two step-model interfaces, which the Pokemon Navigation: robust leg planner shared by the tile games #412 description notes.

Local headless run (Pokemon::, PokemonBDSP::AutoStory, PokemonBDSP::StoryData): 464 passed, 0 failed, including "plans match the golden". Code health: 0.

@dayfine dayfine left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed SHA: 1ef39dc

Delta since 057a7ee: the fix 96f8ad7, plus merges of #411 (nav/bdsp connected-maps) and #412 (nav/robust-leg-planner). I compared the PR's own diff at the two SHAs. Apart from 96f8ad7, every change came in through those merges and was reviewed on #411 and #412. The BDSP-side code changed only in PokemonBDSP_AutoStory_RoutePlanner.cpp (the field-count guard and the comment on robust_leg_costs()).

Verdict

APPROVED

Findings

Correctness: none blocking.

  • The guard works: a structured binding of Pokemon::RobustLegCosts{} with 12 names fails to compile when the shared struct gains or loses a field. robust_leg_costs() copies all 12 fields today, and per_wander_tile comes from BDSP's own costs, not the shared default. Both conversion sites (plan_robust_legs and robust_legs_cost) go through robust_leg_costs(). RobustWorldModel charges m_costs.per_wander_tile for each wander tile entered.
  • Wander cost 15: this branch does not have it. Here town_plan_costs() (PokemonBDSP_AutoStory_PlanCosts.cpp) never sets per_wander_tile, so BDSP uses TilePlanCosts' default of 3. The same was true at 057a7ee and on bdsp/connected-maps. The value 15 was added in c567cbb, which is only on bdsp/start-certainty and lab/dev-bdsp. This PR does carry it over: PlanCosts.cpp merges cleanly with bdsp/start-certainty, and the copy passes BDSP's per_wander_tile through unchanged.
  • Merge note (not this PR's defect): git merge-tree of this tip with origin/bdsp/start-certainty conflicts in PokemonBDSP_AutoStory_RoutePlanner.cpp, in three hunks, and in SourceFiles.cmake. start-certainty still edits the local step_tiles / step_prefixes / along_wander planner, which this PR replaces with Pokemon::plan_robust_legs. Whoever merges must port those edits to RobustWorldModel rather than keep both versions. They include the held-up wall-leg replan and the zone-avoiding plan_fastest_route check. After that merge, check that start-certainty's sim tests for the boy on row 34 pass.

Style (nits, optional):

  1. The comment on robust_leg_costs_fields_copied() says it "Names every field ... in order". The binding checks only the field count. A rename, a reorder, or a swap of one field for another passes silently. Suggested wording: "Binds as many names as Pokemon::RobustLegCosts has fields, so it stops compiling when the shared costs gain or lose one".
  2. "town_plan_costs() may raise it" describes a change that is not on this branch yet. That is fine once start-certainty lands; until then the comment reads as wrong to a reader of this branch.

CI at this SHA: Fork Draft ubuntu / build (build + unit tests), code-health and no-tabs pass. native-schema fails on all three OSes; that is the known pre-existing failure ("native-schema Runtime map reader" link), not this PR's. One ubuntu / build run was cancelled; a later run passed. As a draft, the PR was not built on MSVC or clang-cl. The [[maybe_unused]] const auto& [...] = T{} form inside a constexpr function is valid C++20, and GCC accepts it under the strict flags. Windows is the remaining risk if this goes ready.

@dayfine
dayfine merged commit 31df61e into bdsp/connected-maps Nov 12, 2026
26 of 34 checks passed
dayfine added a commit that referenced this pull request Nov 12, 2026
…er) into bdsp/start-certainty

BDSP's robust routes now plan on Pokemon::plan_robust_legs. The held open
legs this line added to BDSP's own planner (#375: hold_open_legs,
per_open_grass_tile, open_hold_error(), TileLeg::held) move into the shared
planner as RobustLegCosts::hold_open_legs / per_open_wild_tile and
RobustLeg::held, off by default, so BDSP plans the same legs as before.
SourceFiles.cmake keeps both sides' new files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
@dayfine
dayfine deleted the bdsp/robust-leg-planner branch November 13, 2026 03:26
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