Here at Ars, we’re big fans of emulators that go past perfectly recreating the original hardware and move on to enhancing the game-playing experience. Whether that means converting 2D NES sprites to 3D polygons or removing latency frames after controller presses, we’re there.
So we were more than happy to recently stumble upon WideNES, a new emulation project that extends the visible area of an NES game map past the usual 4:3, 256×240 resolution screen area we’re used to. Using WideNES, you can even zoom out and pan through previous screens using the keyboard and mouse wheel while still playing the game.
The generalized methods used by WideNES are described in a fascinating blog post by University of Waterloo student Daniel Prilik, who created the algorithm. Basically, the WideNES system watches the background “map” data constantly scrolling through the emulated NES PPU as you play. It also closely monitors the PPUSCROLL register, which controls the actual screen scrolling by pointing to different parts of VRAM as the player moves.
By sampling that background data, and overwriting and amending it carefully as the screen scrolls, “more and more of the map is revealed, and in turn, recorded,” Prilik writes.
That map recording isn’t very useful on, say, the first run-through of a Super Mario Bros. level, where you can’t see ahead of your current position. But if Mario dies and starts the level over, the stored map data can “effectively [let] players see more of the level by ‘peeking’ past the edge of the NES’s screen” as Prilik puts it. And in a game like Metroid or The Legend of Zelda, the WideNES algorithm can effectively build a map of where you’ve been and let you peruse at will before you backtrack (unfortunately, reading the entirety of a game’s map data from ROM data before gameplay starts is a difficult problem to generalize across the NES library, Prilik writes).
While Prilik says his basic algorithm works for a wide variety of side-scrolling NES games, some special code was needed to account for things like certain on-screen menus, diagonal scrolling, and full scene transitions (such as finishing a level or entering a dungeon in The Legend of Zelda). The algorithm also ignores sprites, so enemies and other major, moving elements of the game won’t appear outside the usual bounds of an NES screen.
Right now, the WideNES algorithm only works on ANESE, a custom NES emulator Prilik built that he admits is “far, far from ‘production ready.'” But the central rules and heuristics in the “core” of WideNES could be ported to other emulators as an option. If you’re interested in making that happen, or in taking a deeper dive into how the whole thing works, dive into the GitHub page and get hacking.
Listing image by Daniel Prilik