A programmer has built a working version of Doom that runs inside an SQL database, with the database itself rendering full-color views of the game at 35 frames per second, he wrote in a blog post this week.
Lukas Vogel, the programmer behind the project, called SQLDoom, is candid about the premise. “Rendering Doom in a database is obviously a bad idea,” Mr. Vogel wrote, before going on to describe doing it anyway.
The setup uses a small Python client to handle input and output, drive the game’s timing and display each frame. Behind it, a series of CedarDB tables tracks the game’s geometry and state, while about 1,300 lines of SQL queries spread across 89 common table expressions carry the game logic and generate 35 bitmap framebuffers per second.
The result is full-color 640×480 frames that look like they could have come from the original Doom executable. That is a step up from Mr. Vogel’s previous attempt, DoomQL, which last year set out to build “a multiplayer Doom-like shooter entirely in SQL” and ended up with raycasting-based, grayscale ASCII graphics closer to the 90-degree-angled maps of Wolfenstein 3D.
Converting Doom’s classic WAD files into a relational database turned out to be fairly straightforward, Mr. Vogel wrote, because the original game already broke levels down into vertices, lines and sectors. Even the game’s binary-space partition trees can be expressed in SQL with a sort_key precomputed for each position at load time. A simple ORDER BY statement then determines, every frame, which pieces of wall to display and which to ignore, sharply improving performance.
All of it runs at 35 frames a second.

