Skip to content

FRLG walker: catch open legs that ended short; one late-battle delay - #205

Closed
dayfine wants to merge 21 commits into
frlg/overworld-simfrom
frlg/short-leg-late-battle
Closed

dayfine wants to merge 21 commits into
frlg/overworld-simfrom
frlg/short-leg-late-battle

Conversation

@dayfine

@dayfine dayfine commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

Depends on #202 (base frlg/overworld-sim; the diff shows only this change).

Two walker gaps the overworld sim audit found. An open leg that ended short with nothing on screen was taken as walked (r16, Viridian Forest): now, before a hold to a wall that wouldn't end on its tile from the leg's last 3 tiles, run_route() finds the player at walls with the existing re-anchor, when that walks at most twice the leg (RoutePlanning::open_leg_check turns it off). And StoryWildBattle placed a late-seen battle with 2000 ms while the walker uses the 3700 ms measured on Route 1; both now use OverworldWalkSteps::LATE_WILD_BATTLE_DELAY. The sim walker now takes the caller's interrupt set (test support in the #202 files) so the story's interrupts run on the sim.

A third gap, from the console (2026-11-03, Mt. Moon 1F, row 00.13): a wild battle whose flashes were missed started on "south 3 (warp)" to the ladder, its wipe passed for the ladder's fade, and the walker stopped as off the route. walk_overworld_route_with_recovery() now runs from it and reports the leg stopped before its warp (walked_before_warp()), so run_route() finds the player on the leg and walks back through the warp; it still stops if that warp's fade never comes. The sim takes the battle screen for the fade when no warp came, as the console's watcher does, and has the rule as SimWalkerRules::find_player_after_warp_battle; its test (Viridian Forest's north gate, battle on the leg's first or second step) was red with the console's exact error, and also checks the switch off and a walk back that ends short of the warp. The Mt. Moon case itself is tested in #210.

Each test was red before its fix: the r16 sim case and a new one-tile-short case (claimed done on (8, 33)), and a Route 1 "south 20" story test (placed on tiles 5-7, actual 1). Built locally and ran the OverworldSim, OverworldRecovery, OverworldReanchor, OverworldRoute, OverworldWalk, OverworldMaps and AutoStory* suites (142 tests, all pass) with an out-of-tree runner; nothing ran on the console.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E

dayfine and others added 3 commits November 2, 2026 23:48
Test support for the story's late-battle test: OverworldSimWalker places
stops with the detection delays of the interrupt set it is given, the
walker's own by default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
StoryWildBattle placed a late-seen battle's stop with 2000 ms while the
walker uses the 3700 ms measured on Route 1, so the story put the player
about 6 tiles past where the battle stopped them. Both now use
OverworldWalkSteps::LATE_WILD_BATTLE_DELAY. Test: Route 1 "south 20" on
the sim with story_interrupts(), red before (placed on 5-7, actual 1).

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

An open leg that ended short with nothing on screen was taken as walked
(r16, Viridian Forest). Before a hold to a wall that wouldn't end on its
tile from the leg's last OPEN_LEG_SHORTFALL + 1 tiles, run_route() now
re-anchors on those tiles (plan_reanchor()) when the holds and the way back
walk at most twice the leg. RoutePlanning::open_leg_check turns it off.
Sim tests: the r16 case now arrives, and a new one-tile-short case that was
claimed done on (8, 33).

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:25
…fore the warp

Console B, 2026-11-03, Mt. Moon 1F (row 00.13): a wild battle whose
flashes were missed started on "south 3 (warp)" to the ladder; its wipe
passed for the ladder's fade, and the walker stopped as off the route.
walk_overworld_route_with_recovery() now runs from it and reports the
leg stopped somewhere before its warp (walked_before_warp()), so
run_route() finds the player again on the leg and walks back through
the warp. If that warp's fade never comes it still stops on no fade.

The sim takes the battle screen for wait_out_warp()'s fade when no warp
came, as the console's watcher does, and has the rule as a switch.

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 01:41
…ts way

In Mt. Moon (console B, 2026-11-03, row 00.13) a wild battle started on
"south 15 (to wall)" with its flashes missed. Its HP boxes, which the late
battle watcher needs, came over 5 s after the step, after the leg's watch had
ended on the battle's empty text box; the leg was taken as walked to its wall
and the next leg walked into the battle, 5 tiles short of where it was planned
from.

After a wild leg's watch sees nothing, the walker now checks the screen once:
the battle's text box by its frame (BattleTextBoxDetector, new: blue inside a
white line and a gold band, which black below a small room doesn't have), or
black. Either is watched on for up to 5 s with the leg's interrupts, and the
leg counts as stopped part-way, so the route's recovery walks a leg to a wall
again and finds the player after an open one. The sim models the battle's
opening and the rule as a switch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
dayfine and others added 12 commits November 3, 2026 02:45
… in a dark cave) into frlg/short-leg-late-battle
…attle on its way

On Mt. Moon B2F "east 7 (to wall)" crossed tiles closed on one side, which the
maps don't mark as wild, so the leg and its watch looked only for messages and
clear_unseen_battle() skipped it. A battle on its first step left the screen
black after the leg; the leg was taken as walked and "south 14" was held from
where the battle left the player (console B, 2026-11-03, row 00.13).

clear_unseen_battle() now checks after any walk not onto a warp and watches on
with the wild interrupts. Before each step the walker checks the same screen:
a battle set off before the step makes it BATTLE_BEFORE, and run_route() finds
the player on the step walked before it, never on the new step's line. The sim
models a battle's wipe and maps whose every tile is wild, with both checks as
rules.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
…mpts out of step) into frlg/short-leg-late-battle

# Conflicts:
#	SerialPrograms/Source/VideoGames/PokemonFRLG/Programs/AutoStory/PokemonFRLG_AutoStoryItems_Tests.cpp
…to frlg/short-leg-late-battle

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
…ps a TM not in the case) into frlg/short-leg-late-battle

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
…e) into frlg/short-leg-late-battle

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 #215 (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