Link's Awakening Switch RNG Manipulation Primer

The nuts and bolts

Like most games, Link's Awakening comes equipped with a pseudorandom number generator, commonly abbreviated as RNG. (Speedrunners also use RNG to refer generically to randomness; this primer only uses the more exact definition.) This is called pseudorandom, rather than truly random, because an RNG with a known state will consistently produce the same number the next time it is called. This means that if the RNG begins the game in the same state every time it boots up, it will always produce the same sequence of numbers. The game generates solutions to the D4 tile puzzle and egg maze on file creation, before the RNG has been used for anything else; therefore, those patterns will always be the same.

To account for this, when the game initializes, it uses a system call to get a "truly" random number to initialize the RNG with. This in theory should make it impossible to predict the first few RNG outputs. Luckily, thanks to the power of Grezzo, this seed number is the number of seconds since the switch booted up. So all a runner has to do is restart their Switch before every run, and keep the time between system boot and starting the game consistent to within a second; this will give them a perfectly predictable D4 and egg!

In practice, it's possible to miss this window by a hair, and different Switch devices may have small discrepancies in loading times. This is a not a problem. Since runners pass the D4 solution at some point in the run before entering the egg, you can use that information to determine whether you hit your target second window, or missed by a little bit. If you missed, you simply follow the egg solution that pairs with the D4 you got. The primer leaves ample room for error by covering a full 5 second window of RNG seeds.

Performing the manip

Here, we'll follow the splits timing method used by Samura1man. note that the only important variable is the time between resetting the Switch, and selecting your user profile to load Link's Awakening. As long as that interval matches the example video, you can time the rest however you want. For example, you could start your splits at -50s to cut down on time waiting on the file select screen.

Example Video

  • Set your splits to begin at negative 1 minute.
  • From the home screen, hold down the power button for 3 seconds to bring up the power menu. Select Power Options.
  • Select Restart. As soon as the loading icon disappears and the screen goes dark, start your splits.
  • When the Switch reboots, select Link's Awakening and hover the cursor over your user profile.
  • Wait until your splits reach EXACTLY -0:35.5, or as close to that as you can get. (Don't worry too much, this primer covers ~2.5 seconds on either side.)
  • At the correct moment, select your user profile and start the game.
  • Set up a new run file. Any slot or filename should be fine. Don't return to the file select screen after filename input, just wait to confirm it.
  • When the splits timer reaches 0, confirm your filename and begin the run.

Confirming Your RNG Seed and Determining Your Egg Path

At this point, your D4 and egg solutions have been locked in, but you can't be entirely certain that you got the seed you were aiming for. The D4 tile solution room (right below the flippers) is your chance to confirm that. The same seed will always have the same D4 and egg, so this room will inform you as to what egg path to use at the end of the run.

The seed value described here is the actual internal integer that was used to seed the RNG, which is close to (but not exactly) the time spent between restart and starting the game. This number is useful for discussing your run with others, but isn't necessary for anything within the run.

If you find that you're consistently missing the center seed (24) across multiple runs, you can adjust your game selection point to compensate; for example, if you consistently hit seed 25, try selecting your user profile at -0:34.5 instead of -0:35.5.

The tile names used below are defined here.

D4 tiles -> Egg path

As you pass the tile solution room on your way to get the Nightmare Key, glance at the blinking tile denoting the first step of the solution.

First tile is UR

You have seed 24. Congratulations, this is the seed you were targeting, right in the middle of the 5 second window. You can skip checking the rest of the tile solution, since this is the only one in the range that begins with UR.

Your D4 tile solution: UR UL DR DL M
Your egg path: RRRRULLU

First tile is DR

You missed the target seed by a bit, but that's not a big deal. Jump on the highlighted tiles to find the rest of the solution, and check below.

D4 solution: DR UL DL UR M

You have seed 25.

Your egg path: LLLURRUU

D4 solution: DR UL M DL UR

You have seed 26.

Your egg path: LLUUUURU

D4 solution: DR UR UL M DL

This is a bit awkward; seeds 22 and 23 happen to have the same D4, but different eggs. No problem though, you can just try both egg solutions when you get there. If the first one fails, you can move directly into the second one; no need to reset the egg or anything.

Egg path #1: RULLURRU (You have seed 23)

Egg path #2: LLURURUU (You have seed 22)

D4 pattern isn't listed here, or listed egg path didn't work

You didn't correctly restart your Switch, or your timing was off by enough to miss the 5 second window, or you somehow caused the RNG to spin before creating your file. Share a video of your run attempt in #remake-programming on the LA discord and we'll see what's up.

Additional Resources

Xander's compact image instructions

Full list of computed egg paths by seed

Spreadsheet of runs with RNG manip

Edit
Pub: 02 Oct 2019 15:27 UTC
Edit: 07 Oct 2019 13:48 UTC
Views: 7369