
Someone got Doom running inside an SQL database
Developer Lukas Vogel's SQLDoom project renders the classic shooter almost entirely with SQL queries: 1,300 lines of code across 89 common table expressions generate 35 frames per second, while a small Python client handles input and display.
Lukas Vogel has gotten the 1993 classic Doom running inside an SQL database. In a lengthy blog post, the developer explains how his SQLDoom project renders the game almost entirely with SQL queries, acknowledging up front that "rendering Doom in a database is obviously a bad idea."
How it works
SQLDoom is not an emulator. A small Python client handles input, output, timing and the display of each frame on screen, while the game logic itself lives behind it, in a set of CedarDB tables. Roughly 1,300 lines of SQL queries, spread across 89 common table expressions, implement that logic and generate 35 bitmap framebuffers per second.
Translating Doom's classic WAD files into a relational database turned out to be relatively straightforward, because the original engine already breaks levels down into vertices, lines and sectors. Even Doom's binary space partitioning (BSP) trees fit into SQL: a sort_key precomputed for each object at load time lets a plain ORDER BY statement decide, for every frame, which parts of a wall to draw and which to ignore, which keeps rendering fast.

From ASCII art to full color
SQLDoom is a major improvement over Vogel's earlier DoomQL project, which set out last year to build "a multiplayer Doom-like shooter entirely in SQL." That attempt ended up with raycasting-based, grayscale ASCII graphics closer to Wolfenstein 3D's right-angled maps than to Doom. The new project produces full-color 640×480 frames that could pass for the original executable's output.
The trickiest part was rendering floors and ceilings. The original game draws them column by column with "visplanes" and state mutations that do not translate well to SQL. Vogel's replacement, which he calls "pretty hacky," iterates over an ordered list of panels.
Performance and multiplayer
Despite the overhead of reading and writing SQL tables for everything, Vogel says SQLDoom runs at about 60 fps on a Ryzen 7 laptop, with occasional dips to 35 fps in busy scenes. He also argues that the database gives multiplayer servers a real edge: it keeps a steady reference snapshot of the game state and handles concurrency and access on its own, so there are "no partially applied updates, physics bugs, or disagreements over whether the rocket actually hit."
Running it yourself takes the GitHub code, a copy of CedarDB and a Doom WAD file. There is also a free hosted demo match for those who want to skip the setup, though Ars Technica's own test of that version ran poorly.
SiTech — AI-powered web development
We build fast, modern websites and bring AI into real business workflows. Have a project or a question? We'd love to help.