CedarDB engineers ported the original DOOM to run entirely in SQL. The renderer alone is 1,300 lines of SQL spread across 89 common table expressions. The remaining game logic adds another 4,000 lines, with a thin Python shim handling keyboard input, timing, and bitmap display.

WAD asset storage in relational tables was the easy part. The hard problem was replicating DOOM's software renderer, which runs at a fixed 35 fps and uses raycasting tricks to fake 3D geometry. Those tricks are fundamentally data transformations, which maps onto SQL's strengths better than almost any other game engine would.

The original article walks through how each rendering stage was decomposed into CTEs, why DOOM's pre-GPU architecture made it an unusually tractable target, and how timing constraints were enforced without native loop constructs. Source code is on GitHub. If SQL DOOM is too orthodox, CedarDB links to prior implementations in regular expressions and Microsoft Word.

[READ ORIGINAL →]