Lukas Vogel released a project named SQLDoom that runs the classic first‑person shooter Doom by storing the entire game world and logic inside a relational database called CedarDB. The implementation relies on roughly 1,300 lines of SQL queries and 89 common table expressions, while a lightweight Python client handles player input, timing, and frame output.
Key Takeaways
- SQLDoom demonstrates that a full Doom level can be generated and updated using only SQL statements.
- The project’s core consists of about 1,300 lines of SQL and 89 common table expressions.
- CedarDB stores both geometry and game state, while a minimal Python client provides the rendering loop.
| Metric | Value | Why it matters |
|---|---|---|
| Project | SQLDoom | Shows SQL can drive real‑time graphics. |
| Creator | Lukas Vogel | Provides a single‑author perspective on the experiment. |
| Database Engine | CedarDB | Acts as the sole repository for game data and logic. |
| SQL Query Count | ≈ 1,300 lines | Indicates the level of procedural complexity required. |
| Common Table Expressions | 89 | Highlights extensive use of CTEs for recursive and hierarchical queries. |
What SQLDoom Is
At its core, SQLDoom is a proof‑of‑concept that re‑creates Doom’s rendering pipeline using only relational queries. Instead of a traditional game engine written in C or C++, every wall, sprite, and enemy position lives as a row in CedarDB tables. When the player moves, the Python client issues a new set of SQL statements that recompute visibility, collision, and rendering order, then returns a bitmap that the client displays.
Architecture Overview
We observed that the system splits responsibilities cleanly: the Python client is deliberately thin, acting as a bridge between the operating system’s input devices and the database’s query engine. All heavy lifting—ray casting, sector traversal, and state updates—occurs inside SQL. The use of 89 common table expressions suggests that the author leverages recursive CTEs to walk sector graphs and compute line‑of‑sight, a technique more common in analytics than in real‑time gaming.
SQL Query Complexity
The roughly 1,300 lines of SQL are organized into a series of modular queries that each address a specific aspect of the game loop: loading map geometry, calculating floor and ceiling heights, determining visible walls, and updating enemy AI. By nesting CTEs, the author can express multi‑step transformations without leaving the SQL environment, effectively turning the database into a stateful game engine.
Performance Considerations
Running a real‑time title like Doom on a database raises natural questions about latency and frame rate. While the source does not provide benchmark numbers, the reliance on a lightweight Python client for timing implies that the author measured execution time within the client loop. The fact that the entire engine fits within a single relational schema suggests that CedarDB’s query optimizer plays a critical role in maintaining acceptable responsiveness.
Context: SQL as a Game Engine
SQL is traditionally used for data retrieval and reporting, not for deterministic, frame‑by‑frame computation. SQLDoom therefore sits at the intersection of database research and game development, echoing earlier experiments that used spreadsheets or functional languages to drive graphics. By pushing the limits of CTEs and set‑based logic, Lukas Vogel demonstrates that relational algebra can express the same spatial reasoning required by classic 3D engines.
Why It Matters
SQLDoom challenges the conventional separation between data storage and application logic. If a relational engine can handle the deterministic updates of a fast‑paced game, developers might reconsider where to place business rules, especially in cloud‑native architectures where databases are already managed services. The project also serves as an educational sandbox for engineers who want to explore the expressive power of SQL beyond CRUD operations.
Frequently asked questions
Who created SQLDoom?
The project was authored by Lukas Vogel, who documented the experiment in a blog post.
What technologies does SQLDoom combine?
SQLDoom pairs a small Python client for input handling and frame display with CedarDB, a relational database that stores all game geometry and state.
How extensive is the SQL codebase?
The implementation consists of approximately 1,300 lines of SQL queries, organized into 89 common table expressions.
Is the source code publicly available?
The source article mentions a blog post but does not specify a repository location.
What is the significance of using CTEs?
Common table expressions enable recursive and hierarchical queries, which the author uses to model Doom’s sector‑based map traversal within pure SQL.
Bottom Line
SQLDoom proves that a relational database can serve as the sole engine for a classic 3D game, relying on roughly 1,300 lines of SQL and 89 CTEs to drive rendering and gameplay, while a minimal Python client handles I/O. The experiment expands the perceived capabilities of SQL and invites developers to explore database‑centric architectures for interactive applications.
As database platforms continue to evolve with faster in‑memory processing and native support for procedural logic, projects like SQLDoom hint at a future where the line between data storage and real‑time computation becomes increasingly blurred.
Reporting based on: original source.
Comments
Post a Comment