Skip to content

PokemonLZA AutoStory: screen detectors for the story's scenes - #556

Draft
dayfine wants to merge 6 commits into
plza/upstream/p1-01from
plza/upstream/p1-02
Draft

dayfine wants to merge 6 commits into
plza/upstream/p1-01from
plza/upstream/p1-02

Conversation

@dayfine

@dayfine dayfine commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Depends on #555

Adds the AutoStory detectors that tell where a story scene is: the arrival platform, the skip prompt, the autosave badge, the controls hint, the advance arrow, the main mission banner and its complete card, the minimap's wild zone, and the caught mark on a Pokemon's plate, with the pixel-share helpers they share. The platform detector compares against reference cells in ReferenceData/plza-platform.json, which cmake/EmbedTextFiles.cmake builds into the program, so no resource file is added. The program reads them through its backend in #559. PokemonLZA::AutoStoryDetectors runs all of them together on synthetic frames and on the console frames in CommandLineTests/PokemonLZA/AutoStoryDetectors/, checking that each frame fires exactly the detectors it should; this is why they come as one PR, over the size the rest of the chain keeps to.

@dayfine

dayfine commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

API review (claude-sonnet-5-5) at 49a1288: LGTM_with_nits

No bugs or hard-rule violations found. The Qt, filesystem and concurrency rules are respected, control-flow formatting is right, and the test shape follows the linter's mandated form. The remaining issues are comment content that talks about development history instead of the code, a possible off-by-one in the plate-bar bounds, a stale header comment, and some small hygiene items.

  • [style] SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryAutosaveDetector.cpp:73 The detect() comment records tuning history: "02.04's check-in, frame 0075 of a run in Japanese", "of the 3569 PLZA captures on the console it finds 11 more badges". That is lab-run and commit-message content, not a description of what the code does. Fix: Keep only the lasting facts: the glow is dim (about 28, 70, 85) over dark or lamp-lit scenes, so dim_cyan_share() is used instead of cyan_share(). Move the capture counts and run references to the PR description.
  • [style] SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryCaughtMarkReader.cpp:28 Comments refer to dev-run labels and history: "(03.08)", "so the bar was no longer flat and the lock-on was missed", "Tuned on Mareep... on the console", "(Scatterbug)". The same appears in the header and in the tests ("03.08's start", "03.07's last catches", "02.04's check-in... which the badge detector missed"). These are meaningless to a future reader. Fix: Describe what the game shows: the plate bar's color and size, and that bright grass near the plate is close to the bar's green. Drop run numbers and "missed" or "was no longer" narration, and put the history in the PR description.
  • [nit] SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryCaughtMarkReader.cpp:41 find_plate_bar() uses object.width() + 1, object.height() + 1 and max_x + 1. AdvanceArrowDetector.cpp loops x < blob.max_x, treating WaterfillObject's max as exclusive, so the two files disagree. If max is exclusive here too, the bar is one pixel too wide and tall, which skews w >= 80*scale, w >= 4*h, the area-fill check and the returned box. Fix: Check the WaterfillObject bounds convention. If max_x and max_y are exclusive, use width() and height() directly and ImagePixelBox(min_x, min_y, max_x, max_y), then re-check the thresholds against the console frames. If they are inclusive, fix the loops in v_match() and stray_share() instead.
  • [nit] SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryCaughtMarkReader.cpp:40 find_next(object, false) here and find_next(blob, true) in AdvanceArrowDetector.cpp pass a bare bool to an existing API, and the two call sites differ with no hint why (keep the object's pixels or not). Fix: Add a call-site comment such as find_next(blob, /*keep_object=*/true), matching the real parameter name.
  • [nit] SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryCaughtMarkReader.cpp:7 The file uses std::unique_ptr, std::min and std::max without including or , and relies on transitive includes. Under /W4 /WX with other toolchains this is fragile. Fix: Add #include , #include and #include .
  • [nit] SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryMinimapZoneDetector.h:28 The class comment says the detector reads "a circle of radius 140 around (180, 180)", but the code reads only a 60x60 box at x 150-210, y 150-210. Fix: Describe the actual 60x60 middle box, or say the minimap is a circle of radius 140 and only its middle box is read.
  • [nit] SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryPlatformArrivalDetector.cpp:2 The file header title says "Opening detectors", but the file is the platform arrival detector. Fix: Retitle it "PokemonLZA AutoStory - Platform arrival detector".
  • [nit] SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryPixelShares.cpp:24 The doc comments for white_share, sky_blue_share, banner_yellow_share and complete_green_share are duplicated verbatim in the .h and the .cpp, so the two copies will drift. Fix: Keep the comments in the header only.
  • [nit] SerialPrograms/cmake/EmbedTextFiles.cmake:22 The variable MAP_DIRECTORY is a leftover name from another helper. It actually holds the resolved JSON folder. Fix: Rename it to something like EMBED_DIRECTORY or RESOLVED_FOLDER.
  • [nit] SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Detectors/PokemonLZA_AutoStoryPlatformArrivalDetector.h:74 detect() writes m_last while last_distances() returns a reference to it. A caller on another thread (UI or logging) reading while a detect() runs gets a data race. Fix: Return PlatformDistances by value and document that it is for the same thread that calls detect(), or drop the cache and let callers call platform_distances() directly.

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