SQL-Powered Doom Clone: Abusing DuckDB-WASM for 3D Rendering

This project explores the unconventional use of DuckDB-WASM, a browser-based analytical database, to build a rudimentary 3D game engine. The author built a text-based Doom clone where game state, including map, player position, and enemies, is stored in DuckDB tables. Game logic and rendering are handled using SQL queries, surprisingly achieving raycasting and 3D scene rendering via recursive CTEs. JavaScript acts as an orchestrator, managing input, the game loop, and sprite rendering. The process involved overcoming challenges with WASM loading, SQL dialect nuances, query planner issues, and asynchronous race conditions. The resulting game achieves 6-7 FPS, demonstrating the surprising power of SQL for unconventional tasks and the impressive performance of DuckDB-WASM.
Read more