Skip to content

PokemonLZA AutoStory: catches in Wild Zone 1 and the objective marker walks - #564

Draft
dayfine wants to merge 8 commits into
plza/upstream/p3-01from
plza/upstream/p3-02
Draft

dayfine wants to merge 8 commits into
plza/upstream/p3-01from
plza/upstream/p3-02

Conversation

@dayfine

@dayfine dayfine commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Depends on #563

Adds the catches of Main Mission 03: the catch tutorial, a battle then a catch, catching new species in Wild Zone 1 until the Pokedex has five, and the walks by the objective marker into and out of the zone. PokemonLZA_AutoStoryCatches.cpp alone is over the size the rest of the chain keeps to; it is one routine with its retries. The story game in #568 wires these into steps of 03.07 and 03.08. They run only on a console; their decisions are tested in #563.

@dayfine

dayfine commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

API review (claude-sonnet-5-5) at 2ca4fa4: changes_requested

One correctness bug: walk_from_objective() has the misread filter that walk_to_objective() was fixed to avoid. The rest is style: duplicated camera-steering code, misplaced comments, PR/lab-run references in comments, a stub function, and marker walks split across two files with circular includes.

  • [bug] SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryMarkerWalks.cpp:57 The misread filter keeps last and drops any read more than 12 from it, with no recovery. If the first read is a misread (the 36 as "3" or "1110" cases DistanceReads documents), every later true read is rejected until the limit. A wrong high first read can also satisfy *last >= stop_at and end the walk early. walk_to_objective() was fixed for exactly this with DistanceReads (three agreeing far reads replace the last). The header says 'as in walk_to_objective()', which is no longer true. walk_back_to_zone_road() then times out after 30 s and throws. Fix: Move DistanceReads into MarkerWalks.h/.cpp (or a small header) and use reads.accept(marker->distance) here instead of the inline std::abs(...) <= 12 check, so both walks share one misread policy.
  • [style] SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryCatches.cpp:333 The stick-from-offset formula Milliseconds((int)(std::min(1.0, std::abs(off) * 4) * 400)) + 80ms with the 0.4 stick and 0.06 deadzone is copy-pasted here and in steer_and_step() (line 572). It uses a C-style cast and unexplained magic numbers. walk_from_objective() already uses camera_turn_toward() for the same job, so there are now three spellings of 'turn toward the marker'. Fix: Use camera_turn_toward(marker->x) and turn_camera() (or one shared steer_toward(context, x) helper) in face_objective() and steer_and_step(). If the numbers must differ, name them as constants with a why-comment.
  • [style] SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryCatches.cpp:779 The doc comment for patrol_and_catch() (the 10-minute patrol, the stops, the turn-back) sits directly above struct Patrol, so it describes the wrong thing. patrol_and_catch() itself has no comment, and read_party_slots() is wedged between the struct and the function. Fix: Give struct Patrol its own short comment. Move the patrol description to directly above patrol_and_catch(), after read_party_slots().
  • [style] SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryCatches.cpp:740 walk_to_objective(), walk_to_marker() and walk_back_to_zone_road() are marker walks, but they live in Catches.cpp (already far over the chain's size) while MarkerWalks.h/.cpp exist for 'walks by the objective marker'. This also creates a circular include: MarkerWalks.cpp includes Catches.h to get walk_to_objective(), and Catches.cpp includes MarkerWalks.h. ObjectiveWalk, StuckWatch, DistanceReads and steer_and_step() move with them. Fix: Move walk_to_objective(), ObjectiveWalk, StuckWatch, DistanceReads, steer_and_step(), walk_to_marker() and walk_back_to_zone_road() into MarkerWalks.h/.cpp. That shrinks Catches.cpp, and MarkerWalks.cpp no longer needs Catches.h.
  • [style] SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryCatches.cpp:414 Comments refer to who or what observed things instead of describing the game: 'the user's catches', 'the user' (line 220), 'the console', '(03.08)', 'three runs saw the dialog only at ... the fourth missed it' (line 914), 'NEEDS CONSOLE'. The MarkerWalks files do the same ('the fault sweep's lost tap', 'the walk from 60 to 100 bent off'). That is run history, not code explanation. Fix: Rewrite as what the game does (for example 'the catch spots are in the grass right of the road'). Put run history in the PR description. Keep the TODO but drop 'the user' and lab-run wording.
  • [style] SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryCatches.cpp:864 read_dex_species_count() only logs and returns nullopt. It is a stub, yet catch_in_zone() branches on read_dex_count(goal.checks, tally) to call it, so that branch can never produce a value. Fix: Remove the stub and the dead branch until a Pokedex reader exists, or make the 'not read' case explicit at the call site with a TODO. Leave dex_count as patrol.party_slots.
  • [nit] SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryCatches.cpp:881 Unexplained magic numbers: start->distance >= 115 with a 1000 ms step right (there is a comment about the rocks, but not why 115 or 1 s). The same applies to brackets_show(..., 3000ms), the 4-flick and 12-try limits, and the 0.5 stick in catch_at_stop(). Fix: Name them (for example ROCKS_DISTANCE, ROCK_SIDESTEP) with a one-line why-comment.
  • [nit] SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryCatches.cpp:916 MARKER_SCENE_WAIT is typed std::chrono::milliseconds while the rest of the file uses Milliseconds. Fix: Use constexpr Milliseconds MARKER_SCENE_WAIT = 15000ms;.
  • [nit] SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryCatches.h:5 The file header comment is broken: it ends 'from' followed by a line containing only ' * .', so the source is missing. Fix: Finish the sentence or delete the dangling fragment.
  • [nit] SerialPrograms/Source/VideoGames/PokemonLZA/Programs/AutoStory/Actions/PokemonLZA_AutoStoryMarkerWalks.cpp:28 The comment above the pitch constants starts mid-sentence in lower case ('the right stick down held 1500 ms pins the pitch...'), with no subject and no mention that these are the level_camera() holds. Fix: Start with 'level_camera() holds the right stick down 1500 ms to pin the pitch at its lowest, then up 600 ms for the walking pitch (400 ms is still too low, 1000 ms looks at the sky).'

…nceReads

walk_from_objective() kept the first read and dropped any read more than
12 from it, so a misread first read (36 as "3", 110 as "1110") rejected
every true read after it, and a high one could end the walk early.
DistanceReads moves from Catches.cpp to MarkerWalks.h and both walks use
it. Also: Catches.h's header sentence is finished, MARKER_SCENE_WAIT is
Milliseconds, and the camera-pitch comment names level_camera().
…tra wait

Callers only tested for a seen banner; it now returns that bool.
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