explaingit

tursodatabase/turso-vdbe-doom-example

Analysis updated 2026-05-18

28RustAudience · developerComplexity · 5/5Setup · hard

TLDR

A demo that runs the game Doom inside Turso, a SQLite compatible database, by compiling Doom to the database's own bytecode instead of SQL.

Mindmap

mindmap
  root((turso doom))
    What it does
      Runs Doom in a database
      Compiles LLVM IR to VDBE
      Streams frames as rows
    Tech stack
      Rust
      Turso VDBE
      clang LLVM IR
    Use cases
      Prove VM generality
      Load custom bytecode
      Browser and terminal demo
    Audience
      Developers
      Researchers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

See a real world demo of how a database's internal bytecode virtual machine can run arbitrary compiled programs, not just SQL.

USE CASE 2

Compile a C program to VDBE bytecode with vdbecc and load it into Turso as a runnable statement.

USE CASE 3

Run the Doom demo natively in a terminal or play it live in a browser on a canvas.

What is it built with?

RustTursoLLVM IRWebAssemblyJavaScript

How does it compare?

tursodatabase/turso-vdbe-doom-examplenonanti/narwhalreekta92/pinstar
Stars282828
LanguageRustRustRust
Setup difficultyhardeasyeasy
Complexity5/53/52/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · hard Time to first run · 1h+

Browser demo needs a WASI SDK build and cross-origin isolation headers for SharedArrayBuffer.

In plain English

This project runs the classic video game Doom inside Turso, a SQLite compatible database, as a demonstration of how general purpose a database's internal bytecode engine can be. Turso, like SQLite, works by compiling SQL queries into its own bytecode, called VDBE, and then running that bytecode on a small virtual machine built into the database. Normally SQL is the only thing that ever gets compiled down to that bytecode. This repository proves the virtual machine itself is powerful enough to run something completely unrelated to databases: it compiles the real id Software Doom game engine to VDBE bytecode and lets Turso's stock engine execute it, frame by frame, with no emulator and no reimplementation of Doom. To make this work, the authors built a small compiler called vdbecc that takes LLVM IR, an intermediate format produced by the clang compiler, and translates it into VDBE bytecode. Doom's C source is compiled to LLVM IR ahead of time, then vdbecc lowers that IR into a VDBE program that Turso can load and run like any prepared SQL statement. Doom's entire memory lives inside a single binary blob stored in one row of one table, and each video frame the game produces is streamed out as a result row, the same way a database would stream out query results. The game is driven by repeatedly stepping that statement, similar to pulling the next row from a cursor, and keyboard input is sent back in through statement bind parameters. Because Turso does not normally let you load a program you compiled yourself, this project is a small fork of Turso that adds just enough of a loading path to accept a vdbecc built program, using the database's existing byte access and blob read and write functions rather than any Doom specific engine code. The repository includes native and browser ways to run it, plus a test suite that checks vdbecc's output against a native compiled build for correctness. The database engine itself is unmodified apart from that loading addition, and full credit for it goes to the upstream Turso project.

Copy-paste prompts

Prompt 1
Explain how vdbecc turns LLVM IR into VDBE bytecode that Turso can run.
Prompt 2
Walk me through building and running the native terminal version of Doom on Turso.
Prompt 3
Show me how frames are streamed out of the VDBE program as database result rows.
Prompt 4
Set up the browser demo so I can play Doom compiled to VDBE bytecode in a canvas.

Frequently asked questions

What is turso-vdbe-doom-example?

A demo that runs the game Doom inside Turso, a SQLite compatible database, by compiling Doom to the database's own bytecode instead of SQL.

What language is turso-vdbe-doom-example written in?

Mainly Rust. The stack also includes Rust, Turso, LLVM IR.

How hard is turso-vdbe-doom-example to set up?

Setup difficulty is rated hard, with roughly 1h+ to a first successful run.

Who is turso-vdbe-doom-example for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.