Tech

Tinkerer ports Doom to Pi Pico

It is with a sense of inevitability that we can confirm somebody has managed to make Doom work on the diminutive RP2040-based Raspberry Pi Pico microcontroller board.

Running the ’90s first-person shooter game on hardware ranging from ATMs to pregnancy testers is very much a badge of honor for hardcore tinkerers and the surprise is perhaps not so much that the RP2040 hardware is up to the job, but that it has taken so long for someone to do it. After all, it is just over a year since the board first arrived.

A quick glance at online stores shows that the Pico is currently not made of unobtainium and actually in stock at outlets.

At first glance the RP2040 does not look like the most constrained of platforms to which to port a minimalist version of Doom, but it is certainly one of the cheapest (assuming one has all the necessary dongles to attach to the bare board to bring forth the visuals and soundtrack). Getting the full experience running, however… well, that’s certainly a challenge.

Pi Pico

Pi Pico

The port was performed by Graham Sanderson and the full shareware game (DOOM1.WAD) is playable on a vanilla Pi Pico (with 2MB of flash storage). “RP2040 boards with 8M should be able to play at least the full Ultimate Doom and DOOM II WADs,” he said.

The graphics run at the classic 320×200 resolution through VGA. Multiplayer apparently works (sadly, we couldn’t test that) as does the sound, music, and, most importantly for your awful-at-shooters writer, so do the cheats.

While the two CortexM0+ CPUs should make for enough horsepower, the 264K of RAM is a headache, particularly when one considers how much is needed for display buffers and the desire to avoid swapping too much into the comparatively slower flash storage. 2M of flash also meant some novel compression techniques were needed in order to get everything in place.

“A straight RP2040 compile of the Chocolate Doom source code off which RP2040 Doom is based requires 300K of static mutable data, and a minimum of about another 700K for dynamic allocation,” said Sanderson. “The math clearly does not add up.”

Hence trade-offs and shunting data into flash while keeping things balanced to ensure performance is not hit.

Indeed, Sanderson claims the game rocks along usually between 30-35 FPS. Not figures to light up the eyes of someone who has just dropped a four-figure sum on a gaming rig, but more than plenty for those of us that remember squinting at a postage stamp-sized square of action on an Amstrad ALT386SX.

In true enthusiast style, Sanderson developed the port in his free time, over the course of six months (complete with the inevitable hiatuses when it got a bit hard) and the result is both an impressive demonstration of what the microcontroller can do and an education in efficient programming.

While Sanderson did not use code from the other minimalist Doom ports out in the wild, he did give credit to Chocolate Doom and iD Software.

Now, if only some of that creative genius could be applied to the industry’s supply chain problems. Then perhaps the Pi 4 Model B might join the Pico in non-unobtainium status. ®


Source link

Related Articles

Back to top button