DEVOURED
We ported the original Doom to SQL
CedarDB successfully ported the original 1993 Doom game loop and renderer to run entirely inside a SQL database.
What: CedarDB reimplemented Doom's game logic, BSP-based rendering, and entity-component systems using 5,900 lines of SQL. The game runs at 35 Hz logic ticks with a decoupled renderer capable of 60 FPS, demonstrating that set-based relational operations can handle real-time simulation requirements.
Why it matters: This project proves that the declarative set-based model of modern relational databases can serve as a robust engine for complex state-machine simulation and procedural rendering.
Deep dive
- Game state is stored in tables; logic is executed via PL/pgSQL-like procedural extensions.
- Rendering is achieved through complex CTE chains that project 3D spatial data into a 2D framebuffer.
- Uses BSP trees for front-to-back occlusion ordering to avoid Z-buffering.
- Window functions are employed as a substitute for imperative loops during floor/ceiling (visplane) calculation.
- The system handles multi-user deathmatch by leveraging database concurrency and shared state primitives.
Decoder
- BSP (Binary Space Partitioning): A method for recursive spatial subdivision, used by Doom to determine the rendering order of geometry.
- Visplane: The flat horizontal surfaces (floors and ceilings) in Doom that require specific occlusion logic.
- CTE (Common Table Expression): A temporary result set within a SQL query that makes complex recursive operations like BSP traversal readable.
Original article
Full article content is not available for inline reading.
Explore all 53 articles in today's digest
Fresh dev news, AI-digested daily. Never miss a trend at devoured.fyi