banner

Blog

May 18, 2024

Gotta Catch ‘Em All the Time

Pokémon games, enjoyed by people of all ages, have captured the hearts of millions around the world since their release. The games are all about catching and collecting various creatures known as Pokémon. While players encounter a variety of these fantastical beings throughout their journey, the real excitement comes from finding rare Pokemon. These elusive creatures, with their unique abilities and captivating designs, provide a challenge that tests a trainer's skills, patience, and determination.

Rare Pokémon are not simply handed to players; they frequently must be sought out in specific locations or during special events. In their quest to catch rare Pokémon, trainers may need to employ various tactics, such as using special Poke Balls, weakening the target Pokémon without knocking it out, and exploiting its weaknesses. Some rare Pokémon may even require intricate quests or puzzles to be completed before they reveal themselves, adding layers of complexity to the challenge.

Many people believe that the challenge has become too great in some of the more recent games, however, with some Pokémon taking weeks of play to capture. YouTuber Dinones is a big fan of the game Pokémon Brilliant Diamond for the Nintendo Switch, but he definitely feels that the rarest Pokémon, especially the shiny Pokémon, are too hard to catch. Nintendo apparently had a 12-bit random number generator that they were just dying to use in this game, giving a 1 in 4,096 chance of a shiny Pokémon appearing in any given battle.

Dinones did a few back-of-the-envelope calculations and realized it could easily take over 40 hours of gameplay to find a single shiny Pokémon. As the famous saying (that I am coining just now) goes, when the going gets tough, the tough get automating. Dinones built a system that automatically plays the game, detects if a rare shiny Pokémon is present in a battle, and if so, captures it. This setup was configured to run in a loop, so it can play for hours on end until the goal has been achieved. While some people may consider this move to be controversial, Dinones just sees it as a practical response to unreasonable odds.

There are a number of moving pieces to make this trick work. First, an HDMI to USB capture device acquires image frames from the Nintendo Switch as the game is being played. Next, with the help of a tool he created, Dinones found the colors present in shiny Pokémon that are not present in their normal counterparts. This provides a signature that can be detected during a battle using OpenCV.

To control the game, an application called NXBT was leveraged. This allows commands to programmatically be sent to a Switch via Bluetooth, as if they were coming from a Joy-Con. Finally, using these pieces, logic was encoded into a Python script that will start the game, enter a battle, and assess whether or not a shiny Pokémon is present. If not, a soft reset is issued, and the process starts again. If an elusive shiny Pokémon is found, it is immediately captured by a special Master Ball that cannot fail, then the game is paused. The entire system runs on a Raspberry Pi so that Dinones does not need to listen to the whirr of the fan on his primary computer during the long hours of automated Pokémon hunting.

If you need to step away from your Switch because you have to grab a bite to eat, or perhaps go to your job so that you can continue to eat in the future, but you still want to catch an elusive shiny Pokémon, then Dinones’ work may be of interest to you. Fortunately, he has released the source code on GitHub for anyone that would like to replicate the project.

SHARE