We ported the original Doom to SQL
2 days ago
- The project ports the original 1993 Doom's game logic and renderer entirely to SQL, running inside a database.
- The game loop runs at 35 FPS, and the renderer produces a 320x200 frame buffer at up to 60 Hz on a laptop, with Python handling input, timing, and display.
- Multiplayer deathmatch supports up to 4 players with a queue system; live game state can be queried via SQL while waiting.
- Rendering uses BSP trees for front-to-back ordering, translating the WAD file into relational tables (about 1000 lines of Python for import).
- Game logic is implemented in ~5900 lines of SQL, and the renderer in ~1300 lines of SQL, with performance typically well under the 28.6 ms tic budget.
- Key advantages include data-centric design, easy modding (e.g., modifying weapon properties via SQL), and built-in multiplayer features like atomic transactions and access control.
- Despite being SQL-based, the compiled query code performs reasonably close to the original C code, with about 2.4x more instructions per operation.