Skip to content

BBQ: fly to a Terarium fly point from anywhere, checking its name - #20

Closed
dayfine wants to merge 2 commits into
mainfrom
bbq/fly-from-anywhere
Closed

dayfine wants to merge 2 commits into
mainfrom
bbq/fly-from-anywhere

Conversation

@dayfine

@dayfine dayfine commented Oct 22, 2026

Copy link
Copy Markdown
Owner

Depends on: nothing. Base: main. The diff shows only this change. Draft on the fork until the R6 live check passes; then it moves upstream.

Roadmap milestone N1. Also covers PokemonAutomation#263 item 7 (check the fly point before flying).

Problem

central_to_*() push the map cursor a fixed amount from where the map opens, so they only work when the player stands at Central Plaza. Doing two quests in the same area (area batching) needs to fly from anywhere, and to know it reached the right fly point.

Change

  • fly_to_terarium_point(info, stream, context, language, TerariumFlyPoint) (new, nothing calls it yet):
    1. Open the map and anchor the cursor the way return_to_plaza() does: top-left corner one zoom level out, then back toward the center (2000 ms, 2400 ms after a failure).
    2. Snap the cursor onto the Central Plaza icon one zoom level in (detect_closest_flypoint_and_move_map_cursor_there()), then zoom back out.
    3. Apply the same offset central_to_*() uses, then zoom out as map_move_cursor_fly() does.
    4. OCR the fly point's name label shown above the cursor (MapFlyPointLabelReader, new). A missing or wrong name closes the map and retries. After 3 failed attempts it returns false, back in the overworld. It doesn't throw.
  • Names: the label must contain the listed words after normalization (lowercase, no spaces or punctuation). English is listed for all 10 points. Chinese (Traditional) is listed for the 5 plazas (中心廣場 and 草原廣場 were read off the lab map; 海岸, 峽谷 and 極地 come from the quest texts). Other points and languages fly without the check, and the log says so. If the language has no OCR data, nothing is checked.
  • central_to_*() behavior is unchanged. They now read their offsets from the same table, with the same values. A test pins each value to the old literal.
  • The retry loop runs against an injectable TerariumFlyActions, with a console implementation and a scripted fake in the tests.

How to review

Read in this order:

  1. Programs/PokemonSV_TerariumFlyPoints.h/.cpp (new): the table, name matching, and the loop.
  2. Programs/PokemonSV_Terarium.cpp: TerariumFlyActionsConsole (the game steps) and the routing of central_to_*() through the table.
  3. Inference/Map/PokemonSV_MapFlyPointLabelReader.cpp (new): the OCR box.
  4. The tests in PokemonSV_Tests.cpp.

The only moved code is the nine central_to_*() offset literals, now in the table. They moved with renames (each argument became a named field), so --color-moved doesn't mark them. Compare them by eye, or rely on TerariumFlyPointMove, which checks every value. Command:

git diff --color-moved=dimmed-zebra --color-moved-ws=allow-indentation-change main...bbq/fly-from-anywhere

Tests

Native, in PokemonSV_Tests.cpp: 30 cases, all passing locally.

  • TerariumFlyPointMove (10): the table matches the old central_to_*() literals.
  • FlyPointLabelMatch (13): match, mismatch, no label and not checked, in English and Chinese, including OCR spacing and noise.
  • TerariumFly (7): the loop against a scripted fake, covering first-try success, a wrong name then the right one, giving up after 3 attempts, Central Plaza not found, no fly menu, an unknown language, and Central Plaza as the destination.

Not yet verified on a Switch (R6):

  • The anchor-and-snap sequence.
  • The label OCR box {0.250, 0.348, 0.500, 0.054}. It was measured from one lab screenshot of the 中心廣場 label at the zoom the map opens with.
  • The guessed English words.
  • Whether the offsets from a snapped cursor match the ones measured from the player's position.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E

central_to_*() only work when the player stands at Central Plaza, since
they push the map cursor a fixed amount from where it opens.

fly_to_terarium_point() anchors the cursor first, the way
return_to_plaza() does (top-left corner, back toward the center), snaps
it onto the Central Plaza icon, then applies the same central_to_*()
offset. Before flying, it OCRs the fly point's name label on the map;
a missing or wrong name closes the map and retries, up to 3 times, then
returns false with the map closed. Names are known for English and the
Chinese (Traditional) plazas; other names are not checked yet.

The offsets now live in one table that central_to_*() also reads, with
the same values as before. The retry loop runs against an injectable
TerariumFlyActions, so it is unit tested with a scripted fake.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AKYzhrMnPK61XHWEch4a6E
Give TerariumFlyScenario's `central_plaza_found`, `labels`, `fly_point_under_cursor`, `expected_log` a default member initializer (= {}), so
test cases that leave them out of a designated initializer compile on
the Windows Clang CI job.

That job builds with clang-cl /W4 /WX, which turns on
-Wmissing-designated-field-initializers: a designated initializer that
omits a field without a default member initializer is an error. Apple
clang's -Wextra does not enable that warning, so macOS builds miss it.

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

dayfine commented Oct 27, 2026

Copy link
Copy Markdown
Owner Author

Closing: the lab went with checked plaza returns plus a landing-banner arrival check and closest-fly-point snapping instead of reading fly-point names from anywhere; this branch also conflicts with #24/#30 in Terarium.cpp. Tracked in the PR plan's navigation chain.

@dayfine dayfine closed this Oct 27, 2026
@dayfine
dayfine deleted the bbq/fly-from-anywhere branch November 3, 2026 05:46
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