Skip to content

BBQ Farmer: run unattended for hours (status and PR plan) #263

Open

Description

@dayfine

What this is. On main, BBQ Farmer can stall for hours on some quest boards and spends much of its time on quests it can't finish. I've been fixing that on a Switch 1 (Traditional Chinese): run the farmer for 2 hours, look at what failed, fix it, repeat. My test build now runs 2-hour sessions without stalls at about 550 net BP per hour, where main made about 400 and then stalled.

What changes, in plain terms

  • It doesn't get stuck. A quest that keeps failing is rerolled once its retries run out, instead of being retried every round forever. Quests the farmer can't do are rerolled as soon as they appear.
  • It checks where it landed. After each flight it reads the place name and flies again if it's in the wrong spot.
  • It finds its target. For catches it locks on to a nearby Pokémon (ZL) instead of throwing blind, and for photos it turns the camera toward the target first.
  • It picks better quests. Quests are ordered and rerolled by their measured BP per minute.
  • Auto Battle quests are shorter. It stops at the kill target and heals only when HP is low.

How it will arrive. About 60 small PRs, each one change with unit tests, in this order:

  1. Small, independent pieces: a crash fix in error reporting, splitting the test file, new detectors with their test images in CommandLineTests.
  2. Shared routines other programs can use: lock-on, leaving a battle, Terarium flights. These get extra testing because other programs call them.
  3. The farmer's own logic: quest choice, retries, Auto Battle. Most of these are already written as PRs on my fork.
  4. Routes for individual quests, each tested on the Switch.
  5. The program's docs page, listing the known gaps below.

I keep at most two PRs open here and open the next one when one merges. Behavior changes get their own PR and say so in the title. The full plan, with sizes and the risk of each PR, is here.

Where your input helps most

  • Where shared routines should live, for example a new PokemonSV_OverworldControls file for lock-on and riding.
  • Whether a species → type table belongs in Resources, like Max Lair's rental_pokemon.json.

Known gaps: photographing flying Pokémon is unreliable; rain shortens glides; lock-on takes the nearest Pokémon even when it's the wrong species.

Earlier status (2026-10-22) and original report (2026-10-20)

Update (2026-10-22): with fixes for most items below, lab runs on Switch 1 now sustain ~600 net BP/hour with no stalls (604 BP/h over a 2-hour run, 34 quests), up from ~400 BP/hour with multi-hour stalls on main; simulations project ~715 BP/hour once the remaining items land.

Status by item (2026-10-22)

# Item Fix Live result
1 tera-self-defeat depends on one Kleavor open: look around / fight any nearby wild Pokémon glide always lands on the right spot; Kleavor absent in 9 of 22 attempts
2 Retry limit resets every round failed-quest memory + out-of-retries action (Reroll/Stop), was PokemonAutomation/Arduino-Source#1642/PokemonAutomation/Arduino-Source#1645 failing quests are rerolled after NUM_RETRIES + 1 attempts
3 Unsupported quests block slots exclusions can reroll them (was PokemonAutomation/Arduino-Source#1644); impossible quests rerolled on sight, red included one run lost ~60% throughput to two dead slots; rerolling them restored it (259 → 604 BP/h)
4 Unreadable 4th slot correction: slot 4 reads no matches when there is no red quest. A red quest sits in the top slot and pushes the three blue quests down, so a 4-entry board means a red is present no fix needed
5 No spawn wait / search open (same work as item 1)
6 Radar ball not found after landing not investigated; landings are verified independently (item 7)
7 Fly destinations not verified landing check reads the place-name banner after returning to Central Plaza and retries 73/73 landings confirmed, 0 false retries
8 Save/reset repeats without progress save only when milestones advance, was PokemonAutomation/Arduino-Source#1626
9 Tera handler runs without a battle; heal after a failed catch battle-entry guard (PokemonAutomation/Arduino-Source#1636); skip the heal when no battle started heal skip seen live
— Cost-aware selection measured per-route success and time drive the reroll list; a model of BP/hour per work item orders the queue Auto Battle 10: 337 → 230 s (heal only below 50% HP, stop at target); quest-panel reads 4.0 → 2.9 per completion

Also found: every 10th completion pays a +110 BP bonus, and red quests pay 100–150 BP but block the next red while unfinished.

Upstream PRs open for review: PokemonAutomation/Arduino-Source#1628, PokemonAutomation/Arduino-Source#1631, PokemonAutomation/Arduino-Source#1632, PokemonAutomation/Arduino-Source#1636, PokemonAutomation/Arduino-Source#1640. The rest wait on those and are tracked in the status comment below.


Original report

Game

  • Sword/Shield
  • Brilliant Diamond/Shining Pearl
  • Legend Arceus
  • Nintendo Switch Features
  • Scarlet/Violet

Type

  • New Program
  • Improvement to BBQ Farmer (PokemonSV:BBQSoloFarmer)

Description
BBQ Farmer can get stuck retrying quests that depend on a single wild spawn, while unsupported quests block board slots. In my run only one of three quest slots was productive.

Environment: Pokémon Automation v0.70.10 · Switch 1 · Game language: Traditional Chinese · Number of Retries = 1 · Arduino-Source main @ 889c1d5

Additional context

Observed
Board: sneak-up, pickup-10, tera-self-defeat, plus a 4th slot read as no matches. The program spent rounds retrying tera-self-defeat (~2 min per attempt) without ever finding Kleavor, while pickup-10 can't be done at all.

Log excerpt:

Quest: Tera-self and defeat any wild.
Attempting to fly to Canyon Plaza.
Unable to locate the overworld radar ball, falling back on hard coded location.
Did not enter battle. Did Kleavor spawn?
Turn 1: Tera.
Attempting to return to Central Plaza.
...
String Match Result: ... (sneak-up)
String Match Result: ... (pickup-10)
String Match Result: ... (tera-self-defeat)
String Match Result: no matches
Current quest exists on list. Quest did not complete.
Quest: Tera-self and defeat any wild.

When I stopped the program at the target spot, wild Pokémon appeared within seconds, which suggests the program arrives and gives up before spawns load on Switch 1.

Bugs / reliability

  1. tera-self-defeat depends on one Kleavor spawn. The quest accepts any wild Pokémon, but quest_tera_self_defeat() does a long blind glide (Switch 1: 8000 ms + 13200 ms) to drop on Kleavor. On my Switch 1 it never succeeds. Suggest: battle the nearest wild Pokémon near the plaza (the code itself notes "plenty of Scyther in the area").

  2. Retry limit resets every round. quest_attempts is local to process_and_do_quest(), and BBQSoloFarmer::program() re-reads the board each round, so a failing quest gets NUM_RETRIES + 1 attempts per round, forever. Board order also puts it first each time. Suggest: track failures per quest across rounds; after the limit, apply a configurable fallback (Reroll or Skip).

  3. Unsupported quests block slots, and the reroll-all fallback never fires. not_possible_quests (pickup_10, photo_flying, catch_flying, UnableToDetect) is checked before the exclusions table:

    • pickup_10 isn't in the dropdown at all.
    • catch_flying and photo_flying are in the dropdown, but any action set for them is ignored without warning.
    • "Reroll all when nothing is possible" only triggers when zero quests are doable, so a board with one doable quest keeps the dead slots forever.

    Suggest: show these quests in the UI as unsupported, and let Reroll apply to them.

  4. An unreadable slot is silently treated as impossible. The 4th slot OCRs as no matches → UnableToDetect → skipped. If this is the bonus (red) quest, bonus progress is blocked with no warning. Suggest: log a warning, and retry the OCR or reroll.

  5. Catch and photo routes have no spawn-loading wait and no search. Each quest type has one fixed location reached by fixed-timing glides; the program locks on and throws immediately on landing. Suggest: wait a few seconds after landing (configurable, longer on Switch 1), then rotate the camera and try lock-on a few times before declaring failure.

  6. Radar ball detection fails after every landing. Unable to locate the overworld radar ball, falling back on hard coded location. appears after every fly (Switch 1, Traditional Chinese). This may affect orientation for subsequent glides.

  7. Fly destinations aren't verified. map_move_cursor_fly() moves the cursor by fixed joystick timing; the location name is only logged. "Fly successful" means the character landed, not that it landed at the intended spot. Suggest: OCR the selected fly point's name before confirming.

  8. Save/reset can repeat on rounds with no progress. num_completed_quests % SAVE_NUM_QUESTS == 0 is checked every round, so once the count hits a multiple of N, each round that completes nothing saves and resets again. Suggest: only save when the count has increased.

  9. Minor: wild_battle_tera() runs even when no battle started (Did not enter battle → Turn 1: Tera.). Also, after a failed catch, the program heals at Central Plaza and then flies to Central Plaza again.

Feature: cost-aware quest selection

  • Track per-quest-type attempt time t_q and success rate p_q; expected completion time is T_q = t_q / p_q.
  • Run the fastest quests first.
  • Reroll when T_q − T̄ > C / λ, where C = reroll cost (10 or 50 BP), λ = observed BP per minute, and T̄ = average quest time.
  • Credit completions for progress toward the next bonus quest, since rerolls don't count toward it.

Items 2 + 3 alone would have restored about 2/3 of the lost throughput in my run.

Activity

  1. dayfine commented on Oct 20, 2026

    @dayfine
    Author

    Proposed incremental workplan

    Overnight logs show approximately 401 net BP/hour before 05:05, followed by 3.2 hours without another completion on photo-savanna / pickup-10 / sneak-up. Replacing those three blue quests costs 30 BP before menu time/replacement difficulty. This supports recovery fixes before sophisticated navigation. Earnings are inferred from board changes, not measured balance snapshots.

    Implement one milestone/behavior change per commit, validate it, then advance:

    1. Prevent stalls

    • M0: establish local Switch 1 baseline. Build/profile are prepared; startup/gameplay validation is pending.
    • M1: add quest/attempt IDs, phase timings, BP snapshots, reroll outcomes and failure screenshots.
    • M2: save/reset only on newly reached completion milestones.
    • M3: guard Tera/attack handling on confirmed battle entry.
    • M4: preserve outstanding-quest retry budgets across rounds.
    • M5: expose Pickup in configuration and honor reroll policy for unsupported quests; verify replacements.
    • M6: apply configured reroll/skip/stop after exhausted retries; bound unclear confirmations and insufficient-BP handling.
    • M7: add board-level no-progress recovery; retry uncertain OCR rather than blindly charging for an unreadable fourth slot.

    Gate: the observed stalled board recovers or stops clearly, with bounded spending. Keep navigation unchanged during this comparison.

    2. Re-measure velocity and prioritize

    The continuous pre-stall sample has TM 6/6 successful batches, 0.82 min/batch; in-flight photos 4/4, 1.14 min; Auto-10 9/9, 5.40 min; Sneak-up 4/26, 3.22 min. These include retries/failures, but exclude between-task overhead. Small samples and changing route conditions limit extrapolation. Blue completions also advance bonus quests, so direct reward alone is insufficient grounds to reroll Auto-10.

    • M8: refresh per-quest ROI and 10/30/60-minute net-return distributions after recovery fixes.
    • M9: trial one evidence-supported priority rule, accounting for reroll costs, bonus progress and starvation.

    3. Reduce overhead through separate experiments

    • M10: skip unnecessary healing on one verified path, starting with no battle entered.
    • M11: remove one duplicate flight while preserving the next route's position/camera anchor.
    • M12: test bounded Switch 1 spawn-loading waits on one failing route.
    • M13: test the Pride Rock photo camera-reset asymmetry against screenshots.

    Radar/fly-destination verification gets its own follow-up if incorrect orientation/arrival is reproduced.

    4. Improve target acquisition

    • M14: bounded local search/lock-on and verified engagement on one route.
    • M15: replace Tera-self's single-Kleavor dependency with an ordinary nearby wild target.
    • M16: migrate one additional typed-catch/Sneak-up route at a time, preserving requirements and shiny handling.

    Objective combinations and actual item collection follow as separate experiments. 400 BP/hour is a baseline, not a ceiling.

    For every milestone, record revision/settings, focused checks, gameplay evidence, elapsed time and BP costs/results. Advance after validation; assess sustained net BP/hour and zero-return windows. No gameplay fixes are included in this planning update.

  2. dayfine commented on Oct 22, 2026

    @dayfine
    Author

    Status update (2026-10-21): PRs, sizes and review order

    The work from this issue is now 16 PRs, each one change with native C++ unit tests. Only PRs with no unmerged parent are open upstream. The rest wait as PRs on my fork, stacked on their parents, and move upstream as their parents merge.

    Size: all lines added or removed in .cpp/.h, with tests counted separately.

    PRs Production code Tests
    Open upstream, ready for review 5 +628 −354 +531
    Waiting on the fork 11 +827 −105 +840
    Total 16 +1455 −459 +1371

    Most of the 354 lines removed in the upstream PRs are code that moved (for example, the quest list moving to its own module), not deleted behavior. PRs that move code have a "How to review" section saying what moved and what changed.

    Open upstream: ready for review, independent of each other

    PR What Code Tests Unblocks
    PokemonAutomation/Arduino-Source#1636 Run the Tera battle handler only after battle entry is confirmed (issue item 9, plan M3) +51 −16 +54 none
    PokemonAutomation/Arduino-Source#1628 Leave the "BP" suffix out of the balance OCR +68 −6 +74 detector tests
    PokemonAutomation/Arduino-Source#1631 Move the quest list and its names into their own Options module (prep) +180 −112 +31 logging (M1)
    PokemonAutomation/Arduino-Source#1632 Run the farmer's rounds through an injectable BBQGameActions, so round logic is testable (prep) +153 −63 +222 M2, M4, endless-reroll guard
    PokemonAutomation/Arduino-Source#1640 Separate the quest plan from the controller steps (prep) +176 −157 +150 verified reroll, M5

    Waiting on the fork: moves upstream when its parent merges

    Plan Change Parent Code Tests
    M1 Log quest boards and attempts (fork #2) #1631 +179 +76
    M1 Save screenshots of failed attempts locally (fork #3) fork #2 +91 +83
    M2 Save/reset only when a new completion milestone is reached; issue item 8 (fork #4) #1632 +15 −2 +19
    Stop instead of rerolling the quest panel forever (fork #5) #1632 +50 +61
    M4 Don't retry a failed quest every round while it stays on the panel; issue item 2 (fork #6) #1632 +45 −3 +69
    Test the quest detector on reference frames (fork #7) #1628 none +72
    M5 Check which quest a reroll pays for, and that it was replaced (fork #8) #1640 +187 −18 +216
    M5 Let the exclusions table reroll quests the farmer can't do, including Pickup; issue item 3 (fork #9) fork #8 +41 −13 +34
    M6 Out of Retries option: Skip (default, keeps today's behavior), Reroll or Stop (fork #10) fork #6 + #8 +89 −35 +27
    M7a Reuse a verified board after a reroll instead of reading it again (fork #12) fork #10 +111 −32 +111
    M7b Replan after rerolling an exhausted quest (fork #13) fork #12 +19 −2 +72

    The largest of these is +187 lines of production code, and most are under +100.

    Suggested review order

    1. The five open PRs, in any order. #1632 and #1640 unblock the most.
    2. When #1632 merges: M2, M4 and the endless-reroll guard come up, each +15 to +50 lines of code.
    3. When #1640 merges: the verified reroll comes up, then M5.
    4. M6 and M7 follow once both stacks are in.

    Verification

    • Tests: every PR's native tests pass locally. The integrated build, with all of these PRs, passes 55 test cases.
    • On a Switch: the M4–M6 stack ran together with #1636, #1639 and #1626 on a Switch, using a separate profile. M7a and M7b were observed live (M7a: a verified board reused, then read fresh again).
    • Notes: run records and BP ledgers are kept on the fork, not in these PRs.

    Next, after M7: estimated sizes (renumbered from the plan above)

    These are estimates, not measurements. They're based on the PRs so far: a quest area with no test seam yet needs a prep PR to add one first (+150 to +200 lines of code, +150 to +230 of tests, like #1632 and #1640), and a behavior change on an existing seam is +15 to +100 lines of code, with tests about the same size.

    Milestone What PRs Code Tests Confidence
    M8a Restore the party when hatching fails midway (seen live once: a timeout skipped the restore) 2 (seam + fix) +170 to +260 +200 to +300 Medium
    M11a Don't start rinsing after a failed scrub in the wash quest 2 (seam + fix) +130 to +200 +130 to +200 High for the fix itself
    M13 Bound the total time spent recovering navigation inside a quest (shared navigation code) 1–2 +80 to +150 +100 to +150 Medium
    M14 Show BP income, expense and net in the status 1 +60 to +120 +50 to +100 High
    M7 follow-ups Count completions that happen along the way; schedule the red quest sooner 1–2 +30 to +80 each +50 to +80 each High
    M8b Pick a box with eggs at startup 1–2 +100 to +200 +100 to +150 Medium
    M9a Auto Battle exit and heal policy 2–3 (diagnostics, seam, policy) +180 to +300 +150 to +250 Medium; sized after diagnostics
    M12a Target acquisition for Pride Rock, Catch Any and Sneak Up (66 of 128 minutes in one run went to these routes without success) 2–3 +200 to +400 +200 to +300 Low; sized after investigation
    M10a Pickup route 1–2 +150 to +300 +100 to +200 Low; sized after investigation
    M10b/c Flying-type catch and photo (the routes exist but are disabled) 1 each +30 to +100 each +50 each Low; sized after investigation

    Total for M8 onward: about 15–20 PRs, +1,100 to +2,100 lines of production code and +1,200 to +1,900 lines of tests, about the same again as M1–M7. The first five rows are next in line and the most predictable: about 7–10 PRs and +500 to +900 lines of code. The rows marked "sized after investigation" will be re-estimated once their live diagnostics are in.

    Each one is a single PR on the fork first, with a live run before it goes upstream.

  3. changed the title [-][REQ] - BBQ Farmer: single-spawn targets, per-round retries, and silently dropped quests cut throughput to ~1/3 on Switch 1[/-] [+][REQ] - BBQ Farmer: unsupported quests, single-spawn targets and per-round retries cut throughput (fixes now reach ~600 BP/h on Switch 1)[/+] on Oct 22, 2026
  4. changed the title [-][REQ] - BBQ Farmer: unsupported quests, single-spawn targets and per-round retries cut throughput (fixes now reach ~600 BP/h on Switch 1)[/-] [+][REQ] BBQ Farmer: run unattended for hours (status and PR plan)[/+] on Oct 27, 2026
  5. changed the title [-][REQ] BBQ Farmer: run unattended for hours (status and PR plan)[/-] [+]BBQ Farmer: run unattended for hours (status and PR plan)[/+] on Oct 27, 2026
  6. dayfine commented on Oct 27, 2026

    @dayfine
    Author

    Update: the first two stages of the plan were checked on a Switch today, each with a build of
    upstream main plus that stage's PRs.

    • Stage 0 (measure it): the BBQ Farmer stats now show BP earned, spent, net and BP/hour, and
      at the end of a run the program checks the balance change against the stats. 8 quests in 24
      minutes, and the check matched exactly. An error report with no screenshot no longer crashes
      the app.
    • Stage 1 (never stuck): two runs, 15 quests in 57 minutes, never more than 11 minutes
      without a completed quest. Every reroll hit the intended quest and was confirmed replaced;
      quests that failed their retry and quests the farmer can't do were rerolled; saves happened
      at each milestone. The BP check matched in every run.

    These were 30-minute smoke tests, so they show the code works on the real game rather than a
    BP/hour gain; that needs the 2-hour runs in the plan. Two setup problems turned up and will be
    handled at program start: the hatch-egg quest with no egg left in the boxes leaves the game in
    the box screen, and a Switch that has dimmed its screen after a few idle minutes isn't
    recognised as the overworld.

    Details: https://github.com/dayfine/Arduino-Source/blob/agents/pokemon_sv/STAGE_RUNS.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions