RetroArch 1.7.2 — Achieving better latency than original hardware through new runahead method

libretro
3 min readMar 31, 2018

--

Even though sub-frame latency in software emulators has been achieved, some developers kept pushing beyond, and found a way to surpass even real hardware in response time. We have Dwedit to thank for this particular method.

Most systems more complex than the Atari 2600 will display a reaction to input after one or two frames have already been shown. For example, Super Mario Bros on the NES always has one frame of input latency on real hardware. Super Mario World on SNES has two frames of latency.

The Libretro forum post linked above provided patches to RetroArch that can effectively “remove” this baked-in latency by running multiple instances of a core simultaneously, and quickly emulating multiple frames at a time if input changes.

This strategy has some analogs to frame rollback, similar to how GGPO handles high-lag connections. And in fact, if you set the “read ahead” frames on the experimental builds ridiculously high, you can get a feeling for what’s going on behind the scenes.

Here’s another article from a few years ago illustrating the basic concept.

Accurate? No way. Fascinating? You betcha. Mere “same latency as real hardware” is SO last month…

This feature has since been incorporated into RetroArch and will make its first proper debut in the upcoming RetroArch 1.7.2. Users who want to get a sneak peek at this feature can already experiment with it by downloading the latest nightly version of RetroArch, and downloading the latest version of the Snes9x core.

Once the game is running, go to Settings -> Frame Throttle.

The setting ‘Run-Ahead to Reduce Latency’ is what you want to enable. From there on out, you can specify the amount of frames that you want to run ahead. Be advised that how well this will work with the game in question will depend on the game’s built-in amount of lag frames, so experimentation is key here.

Be aware that this method is highly resource intensive. The higher the number of frames you are going to run ahead of emulation, the higher demands it places on your CPU. For instance, Snes9x on a Core i7 7700k CPU would normally run at 1500fps with Super Mario World. With runahead set to 2 frames, we get 440fps. With runahead set to 4 frames, it will be lowered even further to 250fps. So fast cores are key for making this latency reduction approach feasible.

Right now, we are going to be enabling this feature for the Windows, Linux, macOS, and Android versions. Console ports that depend on static linking won’t be able to take advantage of this feature.

We hope you will look forward to this feature and tons of other exciting changes that will be packed into RetroArch 1.7.2! Playing Super Mario World and other SNES games with their built-in 2/3 frames of latency removed is definitely a game changer and will hopefully breath fresh air into these old games.

If you would like a technical breakdown of this method, read this post here by Dwedit, the author of this method (incidentally, he also made PocketNES a long time ago, a NES emulator for the Game Boy Advance which was a big breakthrough back in its day).

--

--