
There was a time when Doom was the epitome of 3D PC gaming. Now it’s possible to run a multiplayer version of the game on the cheapest Raspberry Pi computer.
The Raspberry Pi Pico is a microcontroller with only 2MB of Flash memory for all the code and data to sit in. It costs less than a coffee in Starbucks.
That, however, didn’t prevent Graham Sanderson from getting a fully playable version of the classic game up and running on the limited hardware, as you can see from this video.
Sanderson wanted the Pico version of Doom to be as close to the original gaming experience as possible. That meant 320 x 200 resolution graphics, stereo sound effects, and all nine levels of the game.
That last one was a major challenge, given that the shareware version of Doom is 4MB in size, twice the available memory available on the Pico. “All in all, there are quite a number of interesting and perhaps unusual techniques used to shoe-horn the data into the new WHD (“Where’s Half the Data”) format,” Sanderson writes on his GitHub page about the project. “The saved game format had to be shrunk by a factor of about 10x to store saved games in flash too!”
Performance boosts
Getting the game to run at a smooth frame rate on such limited hardware also took an extraordinary number of optimizations. “There are thousands of code changes related to reducing the amount of memory used,” Sanderson writes in his lengthy write-up of how the hardware was tweaked to run the game.
And he admits it might not be 100% perfect. “Some of the levels in these later games can occasionally run out of space for the rendering data structures, causing some areas of the screen to become black, so it would be worth coming back later to reduce the RAM usage more, noting that there are several hundred static variables I haven’t really even scrutinized at all.”
It took Sanderson six months of work in his free time to complete the project and he admits that “getting everything to work well was quite the adventure”.
The code for the project can be found on his GitHub page if you fancy giving it a crack yourself.