Tools

DOOMQL: A Doom-like Game Running Inside SQLite and Displayed via Datasette

Peter Gostev created DOOMQL — a small Doom-like game where SQLite queries drive movement, collision, enemies and every rendered pixel.

DOOMQL: A Doom-like Game Running Inside SQLite and Displayed via Datasette

Peter Gostev created a project called DOOMQL that runs an original Doom-like game where SQL queries drive the entire game logic and rendering. Gostev developed the project with assistance from GPT-5.6 Sol. The premise asks an intentionally provocative question: what if SQLite were not just a place to store game data but the game engine itself?

What DOOMQL does

DOOMQL implements a small, original Doom-style game in which SQL controls player movement, collision detection, enemy behavior, combat, progression and every RGB pixel on the screen. The implementation includes a large SQL query using a recursive CTE that effectively implements a ray-tracing–like rendering pipeline inside SQLite.

Installation and running

DOOMQL is provided as a Python terminal script. The repository can be cloned and the script run with these steps:

Running the script creates a SQLite database at /tmp/doomql/.doomql/doomql.sqlite, which stores the game state.

Visualising the game with Datasette

The SQLite file can be explored and visualised interactively with Datasette. The author runs Datasette with the Datasette Apps plugin using this command:

uvx --prerelease=allow --with datasette-apps datasette /tmp/doomql/.doomql/doomql.sqlite -p 4444 --root --secret 1 --internal internal.db

The --with datasette-apps option installs the Datasette Apps plugin, which lets you create custom HTML+JavaScript apps that can execute SQL queries directly inside the Datasette UI.

Building an interactive app for the screen state

Gostev created a Datasette App and pasted a prompt into Claude chat (Fable 5) asking it to build an app that displays the current screen state using the frame_pixels view with x, y, r, g, b columns and refreshes once a second. This produced a working HTML+JavaScript app inside Datasette that reflected the live state of the game as it ran in the terminal.

After that, he requested an additional feature: add a minimap. The Datasette App was then updated to include a minimap alongside the main display.

Source and app code

The author shared the HTML app code so others can paste it into their own Datasette instance (using the uvx --with datasette-apps recipe above) to try the visualization and the game themselves.

Why this matters

DOOMQL demonstrates that a relational database and SQL queries can be used in unconventional ways — here, to implement game logic and pixel rendering typically handled by dedicated game engines. The project also illustrates how generative AI tools (GPT-5.6 Sol and Claude/Fable 5 in this case) can assist in prototyping experimental systems and how Datasette's extensibility enables real-time, web-based visualization of database-driven applications.

Next steps

Because the repository and the shared HTML application are available, anyone interested can reproduce the setup, examine the SQL-based implementation, and extend the Datasette App to add features or experiments of their own.


(Details based on the project description by Peter Gostev, and the tools mentioned: GPT-5.6 Sol, Claude (Fable 5), Datasette, Datasette Apps.)