Tuesday, January 14

Raspberry Pi 4 and the State of Video Game Emulation

The modern ideal of pixel art is a fallacy. Videogame art crammed onto cartridges and floppy discs were beholden to the CRT display technology of their day. Transmitting analog video within the confines of dingy yellow-RCA-connector-blur, the images were really just a suggestion of on-screen shapes rather than clearly defined graphics. Even when using the superior RGB-video-over-SCART cables, most consumer grade CRT televisions never generated more than about 400 lines, so the exacting nature of digitized plots became a fuzzy raster when traced by an electron beam. It wasn’t until the late 90s when the confluence of high resolution PC monitors, file sharing, and open source emulation software that the masses saw pixels for the sharp square blocks of color that they are.

More importantly, emulation software is not restricted to any one type of display technology any more than the strata of device it runs on. The open-source nature of videogame emulators always seems to congregate around the Lowest Common Denominator of devices, giving the widest swath of gamers the chance to play. Now, that “L.C.D.” may very well be the Raspberry Pi 4. The single board computer’s mix of tinker-friendly IO at an astonishingly affordable entry price has made it a natural home for emulators, but at fifty bucks what options unlock within the emulation scene?

The Dubious Price Tag That’s  Still Quite Low, All-In

Raspberry Pi 4 with Thermometer
The raspberry pi 4 runs a little hot out of the box.

The technological gap between the Raspberry Pi 4 and its predecessor is sizeable. A 22% jump in clock speed, upwards of four times the RAM, and support for 4K resolution all while retaining the same footprint should not be undersold. Those advancements were coupled with a heightened 3A power requirement meaning extra cost as not just any PSU over USB-C will do. All those additional amps added up to a worryingly hot surface temperature anywhere from 50 to 80 °C on launch firmware. Even with updated firmware, any serious user will want an additional cooling solution in place. You will also shell out some clams for all the gaming accouterments: keyboard/gamepad, micro-HDMI cable, and flash storage. Ultimately the promise of an inexpensive emulation box fluctuates depending on the amount of pre-existing equipment. But even considering all of the add-ons, to have a dedicated gaming rig at this entry price is pretty incredible. The question is, what kind of gaming is possible?

When it comes to arcade game emulation on a Raspberry Pi, most users’ first stop is the RetroPie distribution. It provides a lightweight user interface that scales well on a variety of resolutions. RetroPie employs the use of advMAME v3.9 as its arcade machine emulation software. While plenty capable, advMAME is actually a port of MAME v0.108 which dates back to 2006. The bulk of emulators written in that time typically prioritized speed over accuracy in order to maintain playability, so the concept of a CRT filter or console chip-level cycle accuracy was hardly possible given the constraints of mid-2000s hardware. This example is not to denigrate any of the developers of advMAME or the RetroPie wrapper, but to point out that there is a cost to the relative convenience of a Raspberry Pi. If the proficiency of emulation is relegated to the era of the original Xbox, then why not use a Xbox instead? The rebuttal is simply two words… runahead mode. And the quad-core nature of the Pi 4 makes it particularly well suited for this.

Run (Kokiri) Forest, Run

For the uninitiated, Retroarch is a frontend that aggregates a large collection of emulation software and is part of retroPie. The development team behind Retroarch announced Raspberry Pi 4 support for a latency-reduction process known as runahead mode. Their description highlights the low-latency benefits of the effort: “The runahead feature calculates the frames as fast as possible in the background to rollback the action as close as possible to the input command requested.” Emulators can be resource intensive, soaking up all the available CPU horsepower and memory. Controller polling can fall out of sync with what is currently displayed on screen when a particular game sequence becomes more demanding. Things can get laggy.

Enabling Retroarch’s runahead mode on the select emulation cores for which it is available (Genesis Plus GX, Snes9x 2010, and VBA Next) can alleviate the input lag caused by the emulator itself.

Runahead Mode Process Flow
Process flow diagram of two-instance runahead mode in Retroarch.

When runahead mode is properly implemented on a Raspberry Pi 4, games control more-or-less as they did on the original hardware. This means losing a life in a run n’ gun the likes of Gunstar Heroes is solely due to user-error. On the other hand, turn based games in the vein of Final Fantasy are safe to play without runahead mode enabled. Those behemoths sure are patient folk.

It should be noted that this revolutionary feature is predicated upon being paired with a halfway decent LCD and wired gamepad/keyboard. Unfortunately, all the simultaneous instances of a game cannot overcome a poor pixel response time or a sub-par Bluetooth radio controller.

Optical Media Shifts Into View

For the first time in the Pi-lineage, there are multiple options for disc-based console emulators. Dreamcast, PSP, Saturn, and even PlayStation 2 cores via Retroarch v1.7.8 have all made their way onto Raspberry Pi 4. Granted the bulk of these systems do not run at full-speed quite yet, but there are some real overachievers still in their nascent beta forms. Specifically redream, a recently developed Sega Dreamcast emulator, has shown remarkable progress (video below) despite having no Raspberry Pi builds considered stable. Games play at or around sixty frames per second at a 720p resolution. The venerated Dolphin emulator (Gamecube/Wii) has even shown signs of promise running on the single board computer.

Beyond Gamecube, there are an array of arcade games that have only now been emulated due to their complexity and are not likely to run on a Raspberry Pi for years to come. Recreating the authentic 20th-century arcade experience may not be within reach in this form factor as more comprehensive emulators like the current iteration of MAME are simply too taxing to run currently. The yearly cadence of new Pi device revisions will prove difficult to retain developer’s attention, and further maturation of emulation software will only help alleviate a device’s lack of raw computing prowess. Runahead mode and access to previously inaccessible emulators certainly bolster the viability of the Raspberry Pi 4 as an all-in-one solution, though what’s most important is that these good ol’ games are being played at all.

No comments:

Post a Comment