Engineers Run Original Doom Entirely Inside Pure SQL Queries

SHARE:
Engineers Run Original Doom Entirely Inside Pure SQL Queries

In an unprecedented demonstration of relational database power, engineers have ported id Software's 1993 classic Doom into pure SQL, executing both game logic and rendering directly within database engines.

In the pantheon of hardware and software benchmarks, a singular rite of passage has persisted for three decades: "Can it run Doom?" From digital cameras and smart pregnancy tests to tractor diagnostic terminals, John Carmack and John Romero’s 1993 masterpiece has appeared on virtually every computational surface imaginable. Now, database engineers at CedarDB have pushed the boundary into abstract computing by porting the complete game logic, physics engine, renderer, and even multiplayer deathmatch functionality into pure SQL queries, as revealed in their technical breakdown on CedarDB.

Rather than embedding an external C runtime inside user-defined functions (UDFs) or calling out to precompiled binaries, the engineering team executed the core engine directly as relational operations. The port takes the original game state and transforms it into structured tables. Player movement, hitscan weapon calculations, line-of-sight checks, and enemy artificial intelligence are expressed as complex recursive Common Table Expressions (CTEs), window functions, and analytical joins. Every tick of the engine corresponds to iterative query executions that ingest input tables and project updated gamestate states across relational tables.

The most visually demanding hurdle was translating Doom’s pseudo-3D software renderer into set theory. The original engine, archived on the id Software GitHub repository, relies on binary space partitioning (BSP) trees to efficiently order sector rendering and draw walls column by column. The CedarDB implementation reinterprets these BSP traversals as relational joins against pre-parsed map geometry, projecting subsector coordinates into 2D screen coordinates and mapping wall textures onto frame buffer tables. The resulting frame is generated as an ASCII or raw pixel array table emitted per query cycle.

ADVERTISEMENT

Multiplayer capability took the experiment one step further by leveraging relational concurrency controls. The deathmatch mode routes multiple concurrent player connections through independent client interfaces that commit input updates to an active state table. By capitalizing on atomic transactions and database isolation levels, the database engine enforces collision detection, ammunition depletion, and respawn timers concurrently without corrupting shared entity tables. Rather than utilizing bespoke UDP networking protocols, the game synchronization relies on the very ACID guarantees originally designed for financial ledger consistency.

While running a first-person shooter in a query planner sounds like an eccentric stunt, it showcases a serious evolution in database execution engines. Modern analytical systems (OLAP and HTAP engines) increasingly rely on just-in-time (JIT) compilation via LLVM, SIMD vectorization, and memory-aligned columnar layouts. These optimizations blur the line between a traditional relational database and a high-performance general-purpose virtual machine. By proving that a query engine can execute a complex 35-frames-per-second real-time loop, the engineers highlight how far modern query optimization has advanced beyond simple table scans.

Sources & Primary References

Want real-time AI & tech intelligence dispatches?

Join the official TrendingTech Daily Telegram channel for breaking research, model launches, and market analysis.

Join Telegram Channel
Partner Intelligence

Automate Your Data & AI Infrastructure

Deploy autonomous agent pipelines and custom data integrations with Automation by Meir.

Discover AI Solutions →
Lex Fridman Podcast #419 — Sam Altman: OpenAI, GPT-5 & AGI
Lex Fridman & Sam Altman · 2 hr 18 min