Doom Rendered Entirely in SQL Database, Achieving 35 FPS
Introduction
In a remarkable feat of technical ingenuity, developer Lukas Vogel has managed to render the iconic first-person shooter Doom entirely within an SQL database. This ambitious project, named SQLDoom, not only demonstrates the surprising capabilities of relational databases for tasks far beyond typical data management but also pushes the boundaries of what was previously thought possible in game development using such unconventional tools. The result is a playable version of Doom, complete with full-color graphics and a respectable frame rate.
Key Details
- Project Name: SQLDoom
- Core Technology: SQL database (CedarDB) for game logic and state.
- Frame Rate: Achieves 35 frames per second (FPS).
- Resolution: Renders at 640x480 resolution.
- Graphics: Full-color bitmap framebuffers.
- Implementation: Uses a Python client for input/output and timing, with approximately 1,300 lines of SQL queries across 89 common table expressions (CTEs) to implement game logic.
- Data Storage: Game geometry and state are stored in CedarDB tables.
Background
This is not Vogel’s first foray into the realm of database-driven gaming. Last year, he developed DoomQL, an earlier project that aimed to create a multiplayer Doom-like shooter entirely within SQL. However, DoomQL was significantly limited, producing only grayscale ASCII graphics and employing a raycasting engine reminiscent of older titles like Wolfenstein 3D. The visual output was rudimentary, lacking the fidelity and color of the original Doom. SQLDoom represents a substantial leap forward, overcoming the limitations of its predecessor to deliver a much more visually faithful and performant experience.
Impact Analysis
The success of SQLDoom is multifaceted. Firstly, it highlights the potential for creative problem-solving in software development, showcasing how existing, often rigid, technologies can be repurposed for entirely novel applications. Secondly, it provides a unique benchmark for the performance and capabilities of modern SQL databases, demonstrating their capacity to handle complex computational tasks. The ability to generate 35 full-color frames per second within a database environment is a testament to the underlying efficiency of the chosen database system and the cleverness of the SQL implementation. Vogel’s approach to converting Doom’s WAD files, breaking down level geometry into vertices, lines, and sectors, proved highly adaptable to SQL structures. Even complex elements like binary-space partition trees were managed by pre-computing sort keys, allowing simple “ORDER BY” SQL statements to dictate rendering order and visibility, thereby optimizing performance.
“Rendering Doom in a database is obviously a bad idea,” Lukas Vogel writes in a lengthy blog post explaining how exactly he managed to render Doom using an SQL database.
Broader Context
The concept of running complex software, especially games, within unexpected environments has a long history, often driven by curiosity and the desire to test technological limits. From running Doom on calculators to rendering it on unconventional displays, developers have consistently sought to challenge the norms. SQLDoom fits into this lineage, but with a unique twist: it leverages the structured, data-centric nature of relational databases. While not a practical way to develop or play games commercially, SQLDoom serves as a powerful proof-of-concept. It underscores that the line between data storage and computation is becoming increasingly blurred, and that the tools we use for one purpose can sometimes be surprisingly adept at another.
Future Outlook
While SQLDoom is unlikely to spawn a new genre of database-native gaming, Vogel’s work could inspire further exploration into unconventional computing paradigms. It might encourage developers to think more creatively about how game logic and state can be managed, potentially leading to innovations in areas like distributed computing or specialized data processing. The techniques developed for SQLDoom, particularly the efficient translation of geometric data and rendering logic into SQL queries, could have niche applications in fields that require complex data manipulation and visualization within a database context. For the broader gaming community, it remains a fascinating, albeit unorthodox, achievement that sparks conversation and wonder.
Conclusion
Lukas Vogel’s SQLDoom project is a testament to human ingenuity and the surprising versatility of technology. By successfully rendering Doom within an SQL database at a playable frame rate, he has not only recreated a beloved classic in an entirely new medium but also challenged conventional notions of what databases are capable of. While the practical applications might be limited, the project’s impact lies in its demonstration of creative problem-solving and its ability to push the boundaries of computational art and engineering. SQLDoom stands as a memorable example of making the seemingly impossible, possible.
Source: arstechnica.com