Database expert runs Doom in SQL with just 5,900 lines of code

Lukas Vogel runs Doom in SQL with just 5,900 lines of code. The SQLDoom project uses CedarDB to handle game logic and rendering without external graphics libraries.

Database expert runs Doom in SQL with just 5,900 lines of code

We often treat databases as silent workhorses, but a new project proves they can run a classic 1993 shooter with surprising efficiency. SQLDoom transforms the CedarDB relational database into a playable Doom engine, showing that SQL can handle complex game logic without external graphics libraries. This experiment matters because it demonstrates how modern database features can replace traditional application code for real-time processing tasks.

Lukas Vogel ports classic shooter to CedarDB using 5,900 lines of SQL

The project was built by Lukas Vogel, who ported the original Doom game directly into the CedarDB environment. CedarDB is a Postgres-compatible relational database management system designed for high-performance analytics. Vogel used this backend to store every aspect of the game state, from player positions to enemy behaviors, treating the database as the central processing unit.

The core game logic runs on 5,900 lines of SQL, which is actually shorter than the original 9,000 lines of C source code. A separate 1,300-line SQL graphical renderer handles the visual output by spanning 89 different database tables. The system processes game logic at the original 35 Hz frequency, using SQL UPDATE statements with WHERE clauses to update entities in parallel.

A 1,000-line Python frontend manages user input, sound playback, and display updates, acting as the peripheral interface for the database. Multiplayer state synchronization relies on database transactions, using START TRANSACTION and COMMIT commands to ensure data consistency across players. The project serves as a technical sequel to the earlier DoomQL experiment, offering a more complete and functional implementation of running a game entirely within a database.

SQLDoom is available as a software demonstration of CedarDB's capabilities. The project is free to access and does not have a separate commercial price or limited availability window. It stands as a proof-of-concept for developers interested in leveraging database engines for unconventional computational tasks.

Discussion

0 comments

Log in to join the thread with a thoughtful take, question, or correction.

Add to the discussion