Loading…
Firebird
Click the view to capture the mouse · WASD / arrows move · Ctrl or click fire · Space/E use · Shift run · 1–7 weapons (1 again: chainsaw, 3 again: super shotgun) · Tab map · P pause. On touch screens the left half moves, the right half turns, and a tap fires.
SQL console — the live game database
Ctrl+Enter
How it works
- The WAD becomes tables.
VERTEXES,LINEDEFS,SIDEDEFS,SECTORS,SEGS,SSECTORS,NODESandTHINGSare copied in as rows. Sprite frames and texture sizes become tables too. - The game is PSQL.
DOOM_TICruns at 35 Hz: player movement with wall sliding (CHECK_POSITION), doors and lifts (MOVERS), monster AI with line-of-sight (CHECK_SIGHT), hitscan weapons, rockets, plasma and the BFG (with splash damage and the 40-ray BFG spray), pickups, secrets, light effects, the boss-death specials, Commander Keen and the Icon of Sin. - The BSP is a recursive CTE.
INIT_MAPfinds every thing's sector by walkingNODESfor all things at once withWITH RECURSIVE. - The renderer is a query.
FRAME_WALLSwalks the BSP front to back like DOOM'sR_RenderBSPNode. It skips subtrees whose bounding boxes are already hidden, and trackssolidsegsas one character per screen column. For each visible seg it intersects every column's ray, then carries DOOM'sceilingclip/floorclipwindow down each column. Switch Renderer to brute force to project every linedef instead (about 3× slower, same picture).FRAME_WALLS_WINDOWEDstates the clipping withMAX() OVER (PARTITION BY col ORDER BY depth). Each slice also reports the ceiling and floor rows it uncovers. The browser files those into visplanes and draws them as horizontal spans, like DOOM'sR_MakeSpans;FRAME_VISPLANESlists them.FRAME_SPRITESpicks the rotation frame for each monster. - Sound is a table too. Procedures insert rows into
SOUND_EVENTSfor gunfire, doors, lifts, switches, pickups, pain, deaths and monster sightings. The browser plays the WAD's DMX sound lumps, attenuated and panned from where the sound happened. Music is the WAD's MIDI/MUS lumps played by a small FM synthesiser that uses the WAD's ownGENMIDIOPL2 instrument bank, as DOOM's Adlib driver did. Audio starts after your first click or key press. - JavaScript only paints. It looks up texels and colormaps for the rows Firebird returns.
Inspired by CedarDB's SQL DOOM and
DOOMQL, and by
DuckDB-DOOM. The engine is
Electric Firebird (firebird-wasm).
The game data is Freedoom. DOOM is a trademark of id Software.