Skip to content

A few fixes for FRLG RNG programs#1282

Merged
Mysticial merged 10 commits into
PokemonAutomation:mainfrom
theastrogoth:frlg-color-fixes
Jun 9, 2026
Merged

A few fixes for FRLG RNG programs#1282
Mysticial merged 10 commits into
PokemonAutomation:mainfrom
theastrogoth:frlg-color-fixes

Conversation

@theastrogoth

@theastrogoth theastrogoth commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

This fixes:

  • **Review requested:**✅ Fixed detection issue with BattlePokemonDetector. This previously used is_solid(), but needed relatively narrow tolerance to avoid also being triggered by the background after fainting (solid white, or close to it). This was a bad idea, so I've switched to is_grey() to allow it to be used with more generous tolerances, as well as added negative locations for detecting backgrounds that would indicate fainting. Bug reported by... Leon, if I recall correctly? They changed their Discord name to "Feel free to ping me in reply" lol.
    • also added solid-color detection for background behind HP bar area
  • **Review requested:**✅ Fixed issue with summary reading with a bright capture card in the FRLG StatsReader. I don't understand all of the choices in the FRLG OCR pipeline (not written by me), so I tried to leave it mostly intact. My solution was to filter/preprocess the lilac background based on its lower green value to make sure it's distinguished from the white text as well as add multi-filtering for name OCR. Bug reported by rageflapjack
  • Fixed a bug preventing the RNG calibration from making use of resets with multiple remaining results if a program is run with 0 rare candies.
  • Added update for calibration history when a recoverable error happens

if (is_grey(left_image, 680, 770, 20)
&& is_grey(right_image, 220, 320, 20)
&& is_grey(top_image, 680, 770, 20)
&& is_grey(bottom_image, 220, 320, 20)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you mention struggling here, can you just add more detection locations?

@theastrogoth theastrogoth Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't think of any good ones, unless we want to detect the sprites. Battle backgrounds change by location, so we're stuck with the Name/Level/HP bar area, I think

@Mysticial Mysticial Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you tried negative locations? Since you know what the common false positives are, add boxes that will detect those false positives and require that they don't pass for this detection.

The Home screen detector as well as the BDSP dialog detector uses some negative detections to filter out some backgrounds.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added! I was a little hesitant to do this in case there were many background colors to handle depending on in-game location, but as far as I can tell, there are only two (brown in caves, white elsewhere)

@Mysticial Mysticial merged commit eef0871 into PokemonAutomation:main Jun 9, 2026
7 checks passed
@theastrogoth theastrogoth deleted the frlg-color-fixes branch June 9, 2026 11:06
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.

2 participants