How a Robot Programmed Super Mario 64 and Portal onto a 30-Year-Old Super Nintendo

SethBling's robot in front of a CRT TV running Super Mario 64 on an SNES

In 2020, a talented programmer and content creator by the name of SethBling achieved what many would consider impossible: he successfully programmed full ports of the classic 3D games Super Mario 64 and Portal onto an unmodified Super Nintendo Entertainment System (SNES) from 1990. Even more amazingly, he did it using a robot to manually input the game data byte-by-byte over hundreds of hours.

As a full-stack developer and professional coder, I was blown away when I heard about this project. The technical challenges involved in cramming these complex 3D games onto the limited hardware of the 16-bit SNES are immense. In this post, I‘ll break down how SethBling pulled off this remarkable feat and what it means for the world of gaming, programming, and digital preservation.

The Limitations of the Super Nintendo Hardware

To understand why porting SM64 and Portal to the SNES is so impressive, we need to look at the console‘s technical specifications. The SNES, released in 1990 in Japan and 1991 in North America, was the pinnacle of the 16-bit console generation. But compared to modern gaming systems or even the N64 that originally ran SM64, its hardware is extremely limited.

Spec Super Nintendo Nintendo 64
CPU 3.58 MHz 93.75 MHz
Main RAM 128 KB 4 MB
Video RAM 64 KB 4 MB
3D Rendering None Reality Coprocessor

As you can see, the N64‘s CPU runs nearly 30 times faster than the SNES‘s processor. It also has 32 times as much main RAM and a whopping 62.5 times more video memory. Most critically, the N64 has the Reality Coprocessor chip to handle 3D rendering, a feature the SNES lacks entirely.

Squeezing a game like Super Mario 64, which was designed to take full advantage of the N64‘s advanced capabilities, onto the far more limited SNES is a truly herculean effort. But thanks to SethBling‘s ingenuity and some clever hacking, that‘s exactly what he achieved.

The Man Behind the Mods

If you‘re not familiar with SethBling, he‘s a popular YouTube content creator known for incredible feats of gaming and programming. With a computer science background, he specializes in game mods, tool-assisted speedruns, and pushing games to their absolute limit.

SethBling‘s channel has amassed over 600,000 subscribers who tune in to see him pull off stunts like:

  • Beating Super Mario World in under a minute using glitches and exploits
  • Coding Flappy Bird in Super Mario World using in-game elements
  • Building a bot to automatically beat dozens of difficult NES games
  • Playing Minecraft in virtual reality using a motion-tracking robot

With a track record like that, it‘s no surprise that SethBling was the one to finally crack the code on porting SM64 and Portal to the SNES over two decades after those games‘ original release.

Building the SNES Cartridge Interface

The heart of SethBling‘s setup is a custom SNES cartridge he designed to interface with a Raspberry Pi single-board computer. Housed inside an original SNES cartridge shell is a Pi connected to the console via a custom PCB. The Pi features a USB port for receiving controller input data and a switch to enable the setup and sync communication with the SNES.

The custom SNES cartridge with Raspberry Pi

With the cartridge in place, an Arduino-powered robot arm is positioned in front of the SNES. The robot connects to the Pi via USB and receives pre-recorded controller input sequences. These inputs are then streamed from the Pi to the robot, which physically presses the buttons on an SNES controller.

Through this setup, the robot essentially acts as a programmable "player" feeding the game code and assets into the SNES‘s memory bit by bit. The robot can input data for as long as needed, making it possible to program far more complex games than the SNES was ever intended to run.

Porting Super Mario 64 to the SNES

Getting Super Mario 64, a game designed for the N64‘s significantly more powerful hardware, to run on the SNES was a monumental challenge. As mentioned, the N64 has a much faster CPU and RAM, but most importantly, it has the Reality Coprocessor to handle SM64‘s groundbreaking 3D rendering.

Since the SNES has no dedicated 3D graphics chip, SethBling had to get creative. He realized he could leverage the SNES‘s tile-based 2D graphics rendering to approximate 3D by rapidly redrawing the scene. This is similar to how the Super FX chip in games like Star Fox achieved pseudo-3D graphics on the SNES.

To make this work, SethBling wrote a custom SM64 port that converts the game‘s 3D levels and characters into 2D tile maps and sprites that the SNES can display. He then used the robot to program this data into the console‘s memory, a process that took a staggering 175 hours of continuous controller input.

The results, while not perfect, are astounding. The SNES port retains the core gameplay of Mario running and jumping through the game‘s iconic levels. However, due to the limited processing power and video memory, the game only outputs a 256×224 resolution at around 2 frames per second.

Side-by-side comparison of SM64 on N64 vs. SNES

Is it playable? Not really. But the fact that it runs at all is a testament to SethBling‘s programming skills and the surprising flexibility of the SNES hardware when pushed to its absolute limit.

Teaching an Old Console New Tricks with Portal

After successfully porting Super Mario 64, SethBling set his sights on an even more ambitious target: bringing Valve‘s 2007 hit Portal to the SNES. Once again relying on his robot assistant, he embarked on an arduous journey to translate the game‘s complex physics and portal rendering mechanics into a form the 16-bit console could execute.

All told, the Portal port required a mind-boggling 637,000 button presses delivered over 372 hours to program the game logic byte by byte. To put that in perspective, that‘s over 15 straight days of controller inputs!

When the program is activated, the SNES allocates a portion of its 128 KB of main RAM to store the game code and reserves most of the 64 KB of video RAM for the tile-based map data. By rapidly redrawing the screen, the SNES can approximate the look and feel of Portal‘s 3D environments.

Portal's first puzzle running on an SNES

Of course, there are significant compromises involved in cramming a game as complex as Portal onto the SNES. The resolution is limited to 256×224, the textures are extremely basic, and the frame rate hovers around 1 FPS. The portal rendering, while functional, is a far cry from the smooth, perspective-correct effect seen on modern PCs.

Nevertheless, the fact that Portal runs on the SNES at all is a stunning accomplishment. It‘s a testament to the enduring ingenuity and creativity of passionate programmers like SethBling.

Pushing Retro Hardware to Its Limits

SethBling‘s SNES ports of SM64 and Portal may be the most extreme examples, but the tradition of pushing aging hardware to do things it was never meant to do is as old as the gaming industry itself.

In the early 1990s, the demoscene subculture emerged as programmers competed to create the most impressive audio-visual presentations within the tight constraints of microcomputers like the Commodore 64 and Amiga. These demos, often just a few kilobytes in size, squeezed every last ounce of performance out of the limited hardware.

More recently, a programmer named Vitor Vilela created a native SNES port of the original Doom, a game that famously pushed early gaming PCs to their breaking point. By leveraging special chips included in some SNES cartridges, Vilela was able to translate Doom‘s fast-paced 3D gameplay to the 16-bit console with stunning results.

These projects demonstrate the enduring appeal of retro gaming hardware and the lengths passionate fans and developers will go to keep classic games alive on authentic hardware. As time marches on and original consoles and cartridges begin to fail, the efforts of programmers like SethBling and Vilela become increasingly vital to preserving gaming history.

The Importance of Digital Preservation

That brings us to perhaps the most important aspect of SethBling‘s SNES ports: their role in ensuring classic games remain playable and accessible for generations to come. With each passing year, aging gaming hardware and media becomes more difficult to maintain, putting the futures of countless iconic titles in jeopardy.

Emulation and ROM hacking have long been vital tools in the fight for game preservation, but they have limitations. Playing Super Mario 64 on an N64 emulator may approximate the original experience, but it can never fully replicate the feel of playing on original hardware with an authentic controller.

By finding ways to port classic games to other consoles, even those not powerful enough to run them natively, SethBling and other pioneering programmers are helping to ensure these titles live on in a playable form. It may not be the ideal way to experience them, but it‘s far better than allowing them to fade into obscurity.

There are also significant historical and educational benefits to this kind of retro software experimentation. By reverse engineering and rebuilding classic games to run on different platforms, programmers gain invaluable insights into how the original developers tackled complex problems with limited resources.

Analyzing the code of a game like Super Mario 64 or Portal is like a hands-on lesson in computer graphics, physics simulation, game design, and optimization all rolled into one. Aspiring game developers can learn more from studying these classic titles than they ever could from a textbook.

The Power of Knowledge Sharing

Perhaps the most inspiring aspect of SethBling‘s SNES porting project is the fact that he documented and shared the entire process on his YouTube channel. Through detailed videos and accompanying code repositories, he has pulled back the curtain on what was previously seen as an almost mystical technical feat.

By making his process transparent and accessible, SethBling is empowering a new generation of programmers and gaming enthusiasts to follow in his footsteps. He‘s demystifying the world of emulation, ROM hacking, and retro hardware manipulation, and providing a roadmap for others to experiment and innovate.

This kind of open knowledge sharing is more important than ever in an era where technology is constantly evolving and old platforms are quickly left behind. By ensuring that the hard-earned wisdom of trailblazing programmers is passed down and built upon, we can keep the spirit of innovation and creativity alive in the gaming community.

As the lines between gaming and education continue to blur, it‘s exciting to think about what boundary-breaking projects the next generation of SethBlings will come up with. With accessible tools like the Raspberry Pi and Arduino, the barriers to entry for hardware hacking and experimentation are lower than ever.

Combined with the wealth of knowledge available online through channels like SethBling‘s and communities like freeCodeCamp, there‘s never been a better time for aspiring programmers and gaming enthusiasts to dive in and start tinkering. Who knows what impossible feats they‘ll make possible next?

Conclusion

SethBling‘s Super Mario 64 and Portal ports to the SNES may seem like novelty projects at first glance, but they represent something much more significant. They‘re a testament to the enduring power of passionate individuals to push technology beyond its intended limits and to find new ways to keep classic gaming experiences alive.

As a full-stack developer, I‘m constantly amazed by the creativity and resourcefulness of the gaming community. From the earliest days of the industry, programmers have been finding ways to squeeze jaw-dropping graphics and gameplay out of extremely limited hardware.

SethBling‘s robot-assisted porting method may be unconventional, but it‘s part of a long tradition of innovation and boundary-pushing in the world of gaming. By sharing his process and encouraging others to experiment, he‘s helping to ensure that spirit of creativity lives on.

As we look to the future of gaming and technology, it‘s clear that the line between playing and creating will only continue to blur. With accessible tools and knowledge sharing, the next generation of innovative programmers and game developers is already hard at work shaping the future of the medium.

I, for one, can‘t wait to see what they come up with next. In the meantime, if you‘ll excuse me, I have a sudden urge to dust off my old SNES and see what other impossible ports the community has cooked up. Happy coding!

Similar Posts