Raspberry Pi Pico Receives Playable Doom Port
'RPi' and tear
Doom runs on anything, so they say. We've seen it run on a pregnancy test, oscilloscope and ebook reader. But footage released by Texas-based coder Graham Sanderson of the original 2.5D demon-blasting FPS running on the Raspberry Pi Pico proves that our favorite $4 micro controller has the power to "rip and tear" through other boards.
The code in question originates with Chocolate Doom, a historically accurate source port of the game. The problem with getting an accurate game of Doom out of a Pico, however, is the storage. With 2MB of flash on the board, the 4MB WAD file that comprises the original shareware Doom’s levels is going to need to be significantly compressed. And wow, Sanderson’s GitHub write up of his project goes into quite some detail on this subject - it’s a good read if you’re into variable byte-count integers and Huffman coding. Or even if you’re not, as there's a whole lot of detail about how Doom works in there too.
His compression technique is called WHD, for ‘Where’s Half the Data?’, and manages to squash the WAD file down by 57%, reencoding the audio along the way. The resulting executable fits in the Pico’s 256kb of RAM with 34kb to spare, which allows for six save game slots.
The game’s graphics output is to VGA, for that proper ‘90s feel, at a resolution of 1280 x 1024, a multiple of the original resolution that modern TVs are more likely to support. Luckily, this sort of pixel-doubling can be done easily by the pico_scanvideo library, by leaving the pixel values on the pins for longer to achieve horizontal scaling, and by repeating the values across multiple scan lines for vertical scaling.
And while the Pico’s dual-core CPU is kept busy rendering the game, the GPIO pins are put to work connecting up to four players in multiplayer. There is a lot more detail in Sanderson’s write-up of the project, covering subjects such as displaying text and the bits of the screen that aren’t 3D rendered, as well as the distinctive end screen of the game, and his choices about whether or not to implement a frame buffer.
Sanderson notes that an 8MB version of the Pico (Pimoroni's Tiny 2040 and Adafruit's Feather RP2040 for example) could run Doom II and Ultimate Doom too, should you not have had enough of ‘90s demon-blasting. There are more videos on Sanderson's YouTube channel, which are well worth watching.
Stay On the Cutting Edge: Get the Tom's Hardware Newsletter
Get Tom's Hardware's best news and in-depth reviews, straight to your inbox.
Ian Evenden is a UK-based news writer for Tom’s Hardware US. He’ll write about anything, but stories about Raspberry Pi and DIY robots seem to find their way to him.