A Database-Powered Gaming Experience
Software developer Lukas Vogel has achieved a remarkable technical feat by porting the iconic game Doom to run exclusively inside a SQL database. This project, dubbed SQLDoom, manages both the core game logic and the visual rendering through complex database queries rather than traditional game engine architecture.
The game utilizes CedarDB tables to house level geometry and active game states. To bridge the gap between the database and the user, a lightweight Python script is employed to manage input, timing, and visual output. The system manages to render a 640×480 resolution image in full color at an average of 35 frames per second, powered by approximately 1,300 lines of SQL code distributed across 89 distinct query blocks.
Evolution from Previous Attempts
This project serves as an ambitious successor to a previous initiative known as DoomQL, which surfaced last year. That earlier version relied on raycasting and displayed the game using grayscale text characters, creating an experience closer to Wolfenstein 3D. Because the initial version lacked the BSP-tree traversal that defined Doom’s original rendering style, Vogel was motivated to push the boundaries further.
Regarding the unconventional nature of the project, Vogel remarked:
«Rendering Doom in a database is obviously a bad idea»
Overcoming Technical Hurdles
To realize this version, the developer had to reconstruct vital components of Doom's rendering pipeline using database operations. While handling level geometry was manageable—thanks to a sort key that dictates the drawing order of wall sections—managing floors and ceilings proved significantly more complex. Since the original engine's visplane system does not translate well into SQL, Vogel implemented a creative, albeit unconventional, method of looping through sorted panels to render these surfaces.
In terms of hardware performance, Vogel notes that the game achieves roughly 60 frames per second on a laptop equipped with a Ryzen 7 7840U processor, though performance may dip to 35 fps during visually dense sequences. Despite the significant overhead inherent in database operations, this iteration remains faster than his previous attempt.
Multiplayer Capabilities and Future Potential
SQLDoom even supports deathmatch gameplay, with public servers available in the United States and Europe. While some early testers noted potential latency, it is believed that these issues stem from server conditions rather than the port's architecture. Vogel highlights a major advantage of this approach, stating that using a database maintains a consistent game state with «no partially applied updates, physics bugs, or disagreements over whether the rocket actually hit».
The project acts as a functional demonstration for CedarDB, a system designed to compile intricate queries directly into machine code. Those interested in experiencing it can either execute the code locally using CedarDB alongside the original Doom WAD files or connect to the live online servers.
