Pokemon: Random Number Abuse in Gen 8

I've spent plenty of time digging into RNG manipulation in the previous Pokemon games, but the more recent Switch titles had been fairly well secured with CryptoSecure, which made predicting the outputs of the random number generation impossible in all but a few select cases. Strangely, the newer titles, Brilliant Diamond and Shining Pearl, abandoned CryptoSecure, but until just recently there hadn't been a clean way to discover the RNG seed without running custom firmware (CFW) on your Switch, which, among other hassles, makes online play risky, as modified Switches have been irreversibly banned from online play before.

Just a few days ago, on the /r/Pokemon_rng/ subreddit, I saw someone post that they'd successfully generated a shiny starter without needing CFW. I followed the references and came across a YouTube video by Papa Jefe outlining the process. The general gist was - blinking characters, both Pokemon and NPCs, insert intervals between blinks, the lengths of which are determined by RNG. Observe enough blinks, and one can determine both the RNG seed, as well as the current RNG frame. The cleanest and easiest way to do this would be with a HDMI capture card, but as luck would have it, I only had a Switch Lite handy, which cannot output video. I did however have a webcam handy, which can work almost as well!

I had honestly planned to write out all the steps in excruciating detail, but honestly the follow-up video Papa Jefe posted covers everything from the initial install forward. Instead  I'll briefly describe a couple of the snags I hit along the way with my setup.

Issue 1: Window capture is Windows only, and even then wouldn't work on certain windows. I ended up getting around this by using an old USB webcam (Logitech B910HD) and pointing the script directly at it. 

Issue 2: The "eye" it's looking for is based on the un-scaled video feed, if you screenshot the eye with a scaled video feed, you need to un-scale it using the inverse ratio (e.g. 75 in the Display Percent box, scale your captured image by 1.33x).

Issue 3: Every time my webcam is initialized, it tries to autofocus, leading to a ton of false blinks getting detected. This was solved by hunting down the old Logitech Webcam Software, entering "Quick Capture", popping out the Controls, the Webcam Options, and finally disabling Auto-focus. I found the eye detection worked best when I manually placed the focus one step away from sharp focus, so the pixel grid wasn't being resolved.

Leave a Reply