Repository navigation
PokemonBDSP AutoStory: plan robust routes with the shared robust leg planner - #413
Conversation
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
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss
dayfine
left a comment
There was a problem hiding this comment.
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)
- (Low, data over types)
RobustPlanCostsandPokemon::RobustLegCostsare 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 aPokemon::RobustLegCosts(plus theTilePlanCostsparts the tile planner needs) and deletingrobust_leg_costs(). That can be its own small follow-up; it does not change plans. - (Low)
RobustWorldModelandStoryWorldModelrepeat 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 onbdsp/autostory-v4), so the golden has run only locally.
…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
|
Review addressed at 1ef39dc (fix: 96f8ad7, plus #411 and #412 merged in).
Local headless run (Pokemon::, PokemonBDSP::AutoStory, PokemonBDSP::StoryData): 464 passed, 0 failed, including "plans match the golden". Code health: 0. |
dayfine
left a comment
There was a problem hiding this comment.
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, andper_wander_tilecomes from BDSP's own costs, not the shared default. Both conversion sites (plan_robust_legsandrobust_legs_cost) go throughrobust_leg_costs().RobustWorldModelchargesm_costs.per_wander_tilefor each wander tile entered. - Wander cost 15: this branch does not have it. Here
town_plan_costs()(PokemonBDSP_AutoStory_PlanCosts.cpp) never setsper_wander_tile, so BDSP usesTilePlanCosts' default of 3. The same was true at 057a7ee and onbdsp/connected-maps. The value 15 was added in c567cbb, which is only onbdsp/start-certaintyandlab/dev-bdsp. This PR does carry it over:PlanCosts.cppmerges cleanly withbdsp/start-certainty, and the copy passes BDSP'sper_wander_tilethrough unchanged. - Merge note (not this PR's defect):
git merge-treeof this tip withorigin/bdsp/start-certaintyconflicts inPokemonBDSP_AutoStory_RoutePlanner.cpp, in three hunks, and inSourceFiles.cmake. start-certainty still edits the localstep_tiles/step_prefixes/along_wanderplanner, which this PR replaces withPokemon::plan_robust_legs. Whoever merges must port those edits toRobustWorldModelrather than keep both versions. They include the held-up wall-leg replan and the zone-avoidingplan_fastest_routecheck. After that merge, check that start-certainty's sim tests for the boy on row 34 pass.
Style (nits, optional):
- 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". - "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.
…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
Base
bdsp/connected-maps(#411), withnav/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()androbust_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 ofRobustPlanCostsinto the shared costs.Testing
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::RobustLegPlannerpass; the only failures are the BDSP MenuDetector / ShortDialogDetector image tests (FileException, no CommandLineTests checkout).🤖 Generated with Claude Code
https://claude.ai/code/session_013VUubhHeYSMGSSDXZkKZss