Doom Game Successfully Imported into SQL Database
Innovative Project Renders Doom Using SQL Database
In an intriguing development, Lukas Vogel has successfully rendered the classic video game Doom within a relational database system. Through a detailed blog post, Vogel explains the unconventional approach he took to achieve this feat, highlighting the complexities and underlying technology involved.
While it might seem absurd to run a game like Doom in a SQL database, the project—known as SQLDoom—utilizes a small Python client that manages the game’s inputs, outputs, timing, and graphics. At the heart of this innovative approach lies a series of CedarDB tables, which meticulously track the game’s geometry and state. Over 1,300 SQL queries, distributed across 89 common table expressions, handle the game logic, resulting in the generation of 35 bitmap framebuffers each second.
This new initiative marks a significant step forward from Vogel’s earlier attempt, DoomQL, which aimed to create a multiplayer shooter entirely within SQL. That project ultimately produced raycasting-based graphics reminiscent of the early Wolfenstein 3D visuals, characterized by simple grayscale ASCII. In contrast, SQLDoom advances the technology to deliver vibrant, full-color 640×480 frames, reminiscent of the original Doom experience.
The Mechanics Behind the Magic
Vogel notes that translating Doom’s iconic WAD files into a relational database was a relatively straightforward process. He attributes this to the way the game’s levels are organized into vertices, lines, and sectors. Even Doom’s well-known binary-space partition trees lend themselves to SQL manipulation, utilizing a pre-computed sort_key for each object at load time. By implementing a simple “ORDER BY” SQL statement, Vogel is able to efficiently determine which wall segments to display frame by frame, optimizing performance dramatically.
Editor’s Take
The ability to run Doom on a SQL database opens new avenues for exploration in game development and database technology. This innovative project illustrates the flexibility of relational databases and may inspire developers to reconsider how traditional software paradigms can be reimagined. As industries evolve, such creativity could lead to more efficient tools and techniques, benefiting both developers and end users alike.
Source: arstechnica.com