cURL Doom Puts Id Software's Classic in Your Text-Only Terminal — Via an HTTP Connection
Clever bidirectional flow allows a single cURL GET request to turn into a streaming and mostly-playable ANSI art Doom session.
Developer Sawyer X has taken the challenge of running id Software's classic first-person shooter Doom to a whole new realm — by having it render its graphics to an HTTP server that streams them as ANSI art to a terminal via cURL.
"cURL Doom [is] Doom, played over cURL," X explains of the sensibly-named project. "[It's an] HTTP server rendering DOOM frames into ANSI half-blocks, streamed to the terminal over HTTP with cURL. No install, no dependencies except cURL and Bash."
Released in 1993, Doom was a smash-hit for Id Software — and in the years since the first-person shooter has become a go-to for porting to new and unusual platforms, thanks in part to modest-by-modern-standards system requirements and the company's decision to make the source code publicly available each time it moves from one game engine to a newer one. It's been ported to everything from GPS receivers and office phones to microcontrollers, and recently to the Domain Name Service (DNS) IP address lookup system by Adam Rice.
Rice's work, in fact, may have served as inspiration for cURL Doom, though the two work differently: Doom Over DNS works by encoding the game data as DNS TXT records, to be downloaded and assembled for native execution on your local machine; while cURL Doom runs the game remotely, using an HTTP server only for the game's video output — which is encoded as colored ANSI half-block characters, allowing it to be displayed at a text-only terminal.
"One streaming HTTP request, two directions: keystrokes go up the request body, ANSI frames come down the response body," X writes of what happens in the background. "No key-loop wrapper, no per-keystroke round-trip. This is Just a single TCP connection doing both halves at once. The catch: the shell normally puts the terminal in canonical mode, which (a) line-buffers stdin so cURL doesn't see a key until you hit Enter, and (b) echoes everything you type on top of the frames. So you have to flip the terminal into raw mode first, and put it back when you're done."
The source code for the project is available on GitHub under the permissive MIT license, along with instructions for running it.