Skip to content

FRLG AutoStory: plan around a trainer who walked up - #599

Closed
dayfine wants to merge 18 commits into
frlg/fly-to-centerfrom
frlg/moved-trainers
Closed

dayfine wants to merge 18 commits into
frlg/fly-to-centerfrom
frlg/moved-trainers

Conversation

@dayfine

@dayfine dayfine commented Nov 16, 2026

Copy link
Copy Markdown
Owner

Depends on #586

On console B (2026-11-15, 17.03) Takashi walked from (10, 2) to (10, 4) when he saw the player on (10, 5), and stayed there after the battle; below_giovanni still planned north through him, and the walker took the bumped "north 2 (open)" as walked, so the checkpoint failed a leg later on "moved nothing twice".

  • After any trainer_line / trainer_wait step, the trainer who saw the player is recorded where he stops (beside the player, toward his map tile, from the pokefirered object's sight and facing) as a trainer_at: run flag, so every later route and re-plan in the run plans around his new tile and over the one he left. The program, the row sim and the plan-golden walk share one function (PokemonFRLG_AutoStoryLineTrainer). A wanderer or two trainers seeing the tile leave the maps unchanged.
  • The walker kept the hold's movement only when no trainer watch followed it; across a trainer's sight a hold that moved nothing was taken as walked. It now keeps the movement, so a blocked leg is caught on that leg.

Testing: new OverworldRecovery case (a hold in a trainer's sight that moved nothing) and a 17.03 row on the overworld sim (Viridian suite); 17.03's clean-run fault sweep comes off KNOWN_FAILING. The row sim and the fault sweep now carry run flags from step to step as the program does.

…line, shared by the program, the row sim and the plan walk
…rs go home on a map change

17.03 is scripted: legs back the way 17.02 came to below the up arrow
(19, 14), the arrows slide the player to (11, 2) beside Takashi (10, 2),
a talk and his battle (he stays on (10, 2)), the arrows down to (18, 14),
a planned walk round to (10, 7), and the old legs up column 10 to below
Giovanni. Warren's walk-up to (14, 7) is a 17.02 flags_after and a 17.03
start flag.

A trainer who walked up stands on their own tile again, beaten, once the
player leaves the map (the game respawns a map's objects from their
templates): Jeff on Route 6 no longer blocks 06.03's leg onto (11, 33).
The sims, the plan walk and the trainer-line lint take a talk battle's
trainer_beaten flags_after. Golden: 06.02 below_gym_tree (Tucker on
(6, 8)) and 17.03. 06.02's clean sweep passes now: off KNOWN_FAILING.
…e lifts' rooms; stage sims; 17.03 planned routes; legs lint
…shi replay (red)

The sim walker no longer waits out a slide on its own: the console's
walk_hold_step() has no such wait, and its next press was lost in the
slide up Viridian Gym's column 19 (console B, 2026-11-15 21:12).
… doesn't end

run_route() calls RouteCalls::wait_out_slide() after a leg onto a spinner:
the console compares game-screen shots 200ms apart until two match, for
up to twice the slide's time, and fails the route with the reason if the
screen still moves. walk_hold_step() had no wait, so 17.03's second
"north 1" was pressed during the slide up Viridian Gym's column 19 and
lost (console B, 2026-11-15 21:12). The sim walker waits the same way
through the shared call, and a hold during a slide reads as moved.
A clean walk of below_giovanni planned again from an unknown tile twice
(console B, 2026-11-15 21:39): after "west 3 (open)" to (7, 3) and after
"north 3 (open)" up to Giovanni, each of which had arrived. The sim walk
must arrive with no position check and no leg walking back.
dayfine and others added 4 commits November 15, 2026 22:46
… place; a hold that moves nothing places them

below_giovanni re-planned from an unknown tile twice on a clean walk
(console B, 2026-11-15 21:39): "north 3" up to Giovanni counted as an
open leg (a person never counted as a wall), and "west 3 (open)" to
(7, 3) before "south 3 (to wall)" was checked though that hold moves
from no tile short of (7, 3).

- stops_at(): a person with no wander box stops a hold as a wall, in
  the planner and the walker (hold_to_wall()).
- run_route()'s open-leg check: a hold after an open leg that ends on its
  tile from the leg's end and moves nothing from the tiles short of it
  places the player itself; when it moves nothing, the player is found
  from those tiles.
- The leg planner weighs RouteCost::OPEN_CHECK (10) for an open leg of 2+
  tiles the walk would check at walls (open_check_risk()): one that ends
  the walk, or before a hold that doesn't place the player, or before a
  spinner.
…est allows a one-tile step off a wall

A hold to an unbeaten trainer walks up their line: right_of_takashi went
up column 10 into Takashi's. below_giovanni now plans "west 6 (to wall)",
"east 1", "north 3 (to wall)" to Giovanni: the one-tile step off the
wall is the planned funnel; the test fails a leg that walks 2+ tiles back.
Plan goldens regenerated.
…nts, no new concept)

trainer_crossing() and the functions beside it move unchanged from
PokemonFRLG_OverworldRecovery.cpp to PokemonFRLG_OverworldTrainerCrossing.cpp,
which their header already names.
dayfine added a commit that referenced this pull request Nov 16, 2026
The story planner weighed no trainer's sight (SIGHT_TILE 0), so routes
kept out of lines only by chance; #599's open-leg cost moved several
into them. 05.06's below_franklin_line went "north 6 (to wall)" up
Route 25's column 12, through (12, 4) in Franklin's line (sight 4 east
from (11, 4)), and the sim fought him before franklin_line ("no trainer
saw the player"). 10.01 fought the beauty, 18.01 met a trainer, and the
Route 3 lines test failed on the same walk.

story_route_costs() now weighs SIGHT_TILE 100 and SIGHT_OVERSHOOT 10 (the
values the Rocket Hideout B2F drawn-route test plans with). The costs
count only trainers who stand and look one way: one who wanders or looks
around can't be planned round, and the walk watches for them (the
lines test's rule: a leg across their sight ends on a wall). Battles the
story wants have their own step into the line (03.02's liam_line), so
the old reason to leave the costs off is gone. Default costs keep them
at 0, so the plan goldens don't change.
@dayfine

dayfine commented Nov 18, 2026

Copy link
Copy Markdown
Owner Author

Superseded by #652: this PR's work is in it; the lead-faint stop merged in from #554 was dropped (it conflicts with the League's faint sends).

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