Lukas Vogel has developed a project called SQLDoom, which renders the classic video game Doom entirely within a SQL database. The project achieves frame rates of up to 35 frames per second, a significant improvement over Vogel's previous attempt, DoomQL, which produced grayscale ASCII graphics.
SQLDoom utilizes a small Python client to manage game timing, input, and output, displaying each frame on the screen. The game's geometry and state are stored in CedarDB tables, with approximately 1,300 lines of SQL queries across 89 common table expressions handling the game logic and generating the visual output. This approach allows for full-color 640x480 frames.
Vogel explains that converting Doom's WAD files to a relational database was feasible due to the game's structure of vertices, lines, and sectors. Even the binary-space partition trees were adapted for SQL, using a pre-computed sort_key to determine visible walls each frame via simple 'ORDER BY' statements. While rendering floors and ceilings presented some challenges, Vogel employed a 'pretty hacky' method involving iterating over an ordered list of panels.
Despite the overhead of database operations, Vogel reported achieving around 60 fps on a Ryzen 7 laptop, with occasional dips to 35 fps in complex scenes. He also noted that the database's consistent 'reference snapshot' of game state offers benefits for multiplayer servers, preventing issues like partially applied updates or disagreements over game events.