Skip to main content

How Zelda: Ocarina of Time speedrunners break the N64 in incredible new ways

ReSpec is normally a column about the wonderful, technical world of PC gaming, but occasionally there are topics that are too good to pass up. The Legend of Zelda: Ocarina of Time is universally acclaimed as one the best Nintendo 64 games ever made, and while it’s not a PC title, the highest-level, most technical speedruns of the game expose how games work on a fundamental level. More importantly, these incredible feats are only possible with a lot of community effort.

Ocarina of Time is a game that would take a normal player around 30 hours to beat; the most skilled speedrunners, who aim to play the game as fast as possible, can beat it in around three hours and 40 minutes without glitches. But the Any% category of the game, which tasks players with completing the game regardless of the methods used, is down to three minutes, 54 seconds, and 566 milliseconds. And yes, those milliseconds matter. The second-place record holder is less than a full second behind the world record.

Related Videos
Ocarina of Time game for the Nintendo 64.

Even with being such a remarkable feat, that’s not all Ocarina of Time speedruns bring to the table. At Summer Games Done Quick 2022, a semiannual speedrunning marathon for charity, there was a showcase that highlighted a group of speedrunners reprogramming the game on the fly to display new graphics, play new music, and even run a Twitch chat overlay. And all of that was done on a stock copy of the game with no preprogramming.

The Ocarina of Time speedrunning community has continued to break the game in seemingly impossible ways. I reached out to two of the leading minds in the community to find out what makes the classic Nintendo 64 game tick, and it all comes down to one exploit: Arbitrary Code Execution.

Far from arbitrary

Nintendo 64 console and games.
Rob Tek/Shutterstock

Arbitrary Code Execution, or ACE, sounds a lot more intimidating than it actually is. It’s a term thrown around in cybersecurity that basically means running code (or a program) that shouldn’t be run. That’s how dannyb, a speedrunner for Ocarina of Time who holds the second-place record in the Any% category, described ACE in Ocarina of Time: “Arbitrary Code Execution in OoT is an exploit whereby a player can use in-game actions to arrange a bunch of data in memory to mimic game code, and then manipulate the location where the game is looking to run code to be the place where we just did that arranging.”

With the right actions, dannyb says players are able to “essentially run any code we like from within the game, and cause the game to do things it was not programmed to do.” These actions include things as seemingly useless as the name you enter when you start the game. That’s exactly the action that has allowed Ocarina of Time to be beaten so quickly.

In a game like Ocarina of Time, the game checks its memory for a certain requirement to be met in order to beat the game. The goal in an Any% speedrun is to rearrange the memory to look at your character’s name instead of where it would typically look. This is called Stale Reference Manipulation, or SRM, and dannyb says the exploit is what cracked Ocarina of Time speedruns open in a major way.

[Former World Record] OoT Any% Speedrun in 3:55.300!

“ACE in any video game always needs those two things: fine-tuned control over some region of memory such that the player can make the data there mimic code, and the ability to change location of code execution to be the place where the custom code lies. In 2019, a glitch called Stale Reference Manipulation was discovered in OoT, which opened up the second requirement in a big way,” dannyb said.

In the case of a normal Ocarina of Time run, seemingly random actions add up to trick the game into checking areas (such as your character’s name) for completion requirements when they shouldn’t. It’s a two-part process. Create a data payload, such as your character’s name, and manipulate memory with SRM to point toward that payload.

Hacking on the fly

OoT Triforce Percent ACE Showcase: TASBot brings us Here Together at SGDQ 2022! (Beta + new content)

That’s how speedrunners beat Ocarina of Time in just a few minutes, but it doesn’t fully explain how the lovingly named Triforce% showcase was able to add new texture, models, music, code, and even a Twitch overlay to the game without any modification to the cartridge. Savestate, one of the minds behind this yearslong project, explained that it’s all about priming the Nintendo 64 console to understand controller data as game data.

It’s a showcase that’s only possible due to TASBot, which is able to execute inputs at inhuman speeds. As Savestate explains, “We modify an instruction in memory to start reading controller data as N64 instructions. Normally, this would crash, but thanks to TASBot, he is able to simulate controllers and manipulate them at inhuman speeds to look like N64 instructions so that the game executes the controller data as a set of predetermined instructions.”

The runners are able to add any code they want to the game just through controller inputs.

In short, the Triforce% showcase is using ACE and SRM like a normal Ocarina of Time speedrun, but it’s specifically changing how the Nintendo 64 console understands instructions. With that setup, the runners are able to add any code they want to the game just through controller inputs. Savestate continued: “There is no modification of the game cartridge. To get custom data into memory, we use a glitch that allows us to start adding and modifying stuff in memory with the help of TASBot while only interfacing with the N64 console through its controller ports.”

Controller port on the Nintendo 64.

These exploits aren’t just randomly discovered, either. Savestate explained that the Ocarina of Time community has developed tools to look at how memory is arranged in the game, as well as programs to simulate different memory arrangements. Emulators like Project64 help a lot, allowing runners and tool developers to go through how the game executes code step-by-step.

Ocarina of Time is one of the most iconic games ever made, and the robust, dedicated speedrunning community has allowed the game to thrive with new developments for decades after it was originally released. Exploits like the one that powers the fastest Ocarina of Time speedruns trivialize the challenge normally associated with beating a game as fast as possible, but they also highlight the incredible technical expertise and community effort that goes into dissecting and analyzing beloved games.

The community is aware of this balance, too, according to dannyb: “OoT’s Any% speedrun category is the only one on our main leaderboards which allows ACE as a valid way to complete the goal. For everything else, we ban ACE in order to preserve the uniqueness which brought those categories to life in the first place.”

This article is part of ReSpec – an ongoing biweekly column that includes discussions, advice, and in-depth reporting on the tech behind PC gaming.

Editors' Recommendations

The Legend of Zelda: Tears of the Kingdom: release date, trailers, rating, and more
Link on island in the sky in The Legend of Zelda: Tears of the Kingdom.

When Nintendo released the teaser trailer for Breath of the Wild 2 several years ago, it unleashed a whirlwind of rumors and speculation about a sequel to one of the best Zelda games. Thankfully, Nintendo has given us a few new glimpses into what we now know will be called The Legend of Zelda: Tears of the Kingdom, which is finally nearing its release in 2023. As anticipation reaches a new high, we've dug up all the information there is about our next adventure in Hyrule.

Further reading

Read more
AI is coming for your PC games, but you should be excited, not worried
how ai can change destory pc gaming games respec featured

The tech community has been oversaturated with AI this past week, from ChatGPT to Google Bard, but not without reason. We see fads like NFTs and web3 come and go, but AI is here to stay -- even in your PC games.

It's not all doom and gloom, though. AI and machine learning has already proven itself wildly useful in PC gaming, and it has far-reaching implications for how games are made and experienced. I'm not trying to fit a square peg into a round hole here -- and if you stick with me, you'll see why.
How it's being used now

Read more
Don’t expect Zelda’s $70 price to become the new Switch standard, says Nintendo
Link looks at his hand in The Legend of Zelda: Tears of the Kingdom.

The Legend of Zelda: Tears of the Kingdom will be Nintendo's first Switch game to be priced at $70. News that Tears of the Kingdom, a sequel to one of the bestselling and most critically acclaimed titles on the system, will have an increased price compared to its predecessor came as a surprise over three-and-a-half years after its announcement. It also raised questions about what the future of pricing for Nintendo games will be, especially as Sony, Microsoft, and third-party publishers all upped the cost of their new games in recent years. 
While Nintendo will release Tears of Kingdom at $70, a spokesperson for the company tells Digital Trends that this will not always be the case for its first-party games going forward. 
"No," the spokesperson said when Digital Trends asked if this is a new standard. "We determine the suggested retail price for any Nintendo product on a case-by-case basis." 
The Legend of Zelda: Tears of the Kingdom – Official Trailer #2
To get more insight into the price shift, I spoke to Omdia Principal Analyst George Jijiashvili, who explains what has caused the price of games to go up in recent years and how Tears of the Kingdom demonstrates that Nintendo will "remain flexible about first-party title pricing." Ultimately, Nintendo fans are finally starting to feel the impact of inflation that's been sweeping across the game industry, even if it's only "on a case-by-case basis" for now.
The price is right
Nintendo claims that not every one of its significant first-party game will be $70, and we can actually already see that in action. Preorders just went live for Pikmin 4, which launches on July 21, after Tears of the Kingdom, and it only costs $60. Still, Zelda's price tag indicates that going forward, Nintendo will at least consider raising the price of its most anticipated games to $70. But why start with Tears of the Kingdom?  
When asked why it chose Tears of the Kingdom as its first $70 Nintendo Switch game, a Nintendo spokesperson simply reiterated that the company will "determine the suggested retail price for any Nintendo product on a case-by-case basis." Still, it's a surprising choice for Nintendo to make that pricing change to just one exclusive game almost six years into the Switch's life span. Jijiashvili thinks the choice to do this with Tears of the Kingdom was a pretty apparent one for Nintendo, although it won't apply to everything going forward.
"If you are going to make a game $70, it's going to be the follow-up to one of your most critically acclaimed and bestselling games ever," Jijiashvili tells Digital Trends. "I don’t think that this means that $70 will become the standard price for all major Nintendo releases. It's worth noting that Metroid Prime Remastered is priced at $40. It's clear that Nintendo will remain flexible about first-party title pricing."

It makes basic financial sense for Nintendo to ask for a little bit more for a game it knows will be one of the biggest releases of 2023. But what factors in the game industry and world's economy at large caused Nintendo to make this decision? 
Priced Out
For more than a decade, people got comfortable with AAA video games being priced at $60. Of course, there were occasional exceptions to this rule, but it was seen as an industry standard until the dawn of the PlayStation 5 and Xbox Series X. Publisher 2K was one of the first to announce a price increase, and companies like EA, Sony, and Microsoft have all followed suit. Jijiashvili chalks this up to inflation-related pressure on game publishers.
"The games industry has already been experiencing a lot of inflationary pressure," he explains. "AAA games are much more expensive to make now than they used to be, but prices have actually been declining in inflation-adjusted terms -- if prices had risen with inflation since 1990, they would now be over $90. On top of that, we’ve had a big burst of general inflation, meaning that publishers are looking at big increases in everything from salaries to tools. It’s going to be really hard for most publishers to avoid passing on all those extra costs at some point."
Jijiashvili provided us with a graphic created by Omdia that "shows what the typical price points for each generation would look like if you adjusted for inflation." As you can see, the inflation-adjusted prices are only exponentially growing, and the big game pricing shifts the graph highlights were all technically not even enough to keep up with inflation when they happened. 

Read more