A 3D first-person shooter game implemented entirely in SQL using DuckDB-WASM.
DuckDB-DOOM is an experimental game that demonstrates the power of SQL for computational tasks. The entire game logic, including 3D raycasting, enemy AI, collision detection, and rendering is implemented using SQL queries running in DuckDB's WebAssembly build.
- True first-person 3D rendering using raycasting techniques
- Collision detection
- Enemy NPCs
- Shooting mechanics with bullets
- Minimap display
- All game logic implemented in SQL
- Open
index.html
in a modern web browser - Use WASD keys to move:
- W: Move forward
- S: Move backward
- A: Turn left
- D: Turn right
- Spacebar: Shoot
- L: Toggle verbose logging (to browser console)
This project uses:
- DuckDB-WASM: SQL database that runs in the browser
- Pure HTML/JavaScript for the UI
- SQL for all game mechanics and rendering
The game uses SQL in interesting ways:
- 3D Rendering: Uses recursive CTEs to implement raycasting
- Game state: Stored in tables (player, enemies, bullets, map)
- Physics: SQL queries handle collision detection and movement
- Rendering: Views transform the 3D world state into ASCII art
No installation needed! Just clone the repository and open index.html
in a web browser:
git clone https://github.com/patricktrainer/duckdb-doom.git
cd duckdb-doom
# Open index.html in your browser
Contributions are welcome! Some ideas for improvements:
- Add textures to walls
- Improve enemy AI features
- Add sound effects
- Create additional levels
MIT License - see LICENSE for details.
- Inspired by the original DOOM game
- Thanks to the DuckDB team for their amazing WebAssembly build