Click the view to capture the mouse · WASD / arrows move · mouse looks · Ctrl or click fires · Space jumps · C crouches · Shift walks (or runs: the Run setting) · 1–0 weapons · G hand grenades · / or wheel cycles · Tab inventory ([ ] select, Enter use) · Q quad · I invulnerability · B rebreather · E environment suit · F1 help computer · ` console (god, noclip, notarget, give, use, kill, map) · P pause · Esc menu (F2 save, F3 load, F10 quit) · F6 quick save · F9 quick load (saves live in this browser). On touch screens the left half of the view moves, the right half looks, a tap fires, and the buttons fire, jump, change weapon and open the menu. A gamepad works too: left stick moves, right stick looks, RT fires, A jumps, B crouches, LB/RB change weapon, Start opens the menu (the d-pad, A and B drive it).
SQL console — the live game database
How it works
- The BSP becomes tables. A Quake 2 map (IBSP 38) is copied in lump by lump:
FACESwith their plane and texture mapping,FACE_VERTS(edges and surfedges resolved),NODES,LEAVESwith their cluster and a decompressed PVS as a hex string,LEAFFACES, and the collision geometry Quake 2 ships instead of clipnodes:BRUSHESandBRUSHSIDESwith their planes and contents, indexed throughLEAFBRUSHES. The MD2 models contributeMODELSand their frame runs inANIMS; the entity lump becomesMAP_ENTS. - Collision is a recursive procedure.
RHCisCM_RecursiveHullCheck: the moving box's extents push each split plane out, the segment is split at the plane and both sides are visited nearest first; in every leaf reached,CLIP_LEAFclips the segment against each brush whose contents match the mask (CM_ClipBoxToBrush).TRACE_MOVEruns it against the world and every door and platform (rotating doors are traced in their own rotated space) and tests monsters and the player with a Minkowski slab test.FLY_MOVE,WALK_MOVE(the 18-unit step),MOVE_STEPandPUSH_MOVEare g_phys.c in PSQL. - The game is PSQL.
Q2_TICruns at 20 Hz: pmove's ducking, friction, acceleration, jumping and swimming, and the view's bob; doors and their teams, rotating doors, platforms, buttons, trains with path corners, rotating fans, timers; triggers (once, multiple, relay, always, key, counter, hurt, push), targets (speaker, explosion, splash, secret, goal, help, laser, changelevel), items from stimpacks to the power shield, the ten weapons from the blaster to the BFG10K, damage with armour and quad, gibs, and the monster AI of g_ai.c for the guards, enforcers, gunners, berserkers, flyers, parasites and the tank. - The renderer is a query.
FRAME_ALLfinds the leaf and cluster the eye is in and, once per cluster, marks every face of every leaf whose cluster is in its PVS (Quake's visframe) with its plane and bounding sphere. A frame is then a scan of the marked faces with the back-face and frustum tests as expressions, aggregated withLIST()into one row of face ids; doors, platforms and the fan are brush models and add a row each at their own origin. The same result set carries the alias models and sprites in the PVS with their pose and frame, the light styles, the sounds and effects of the tic: one round trip per frame. The other renderer mode,FRAME_FACES, projects every vertex in SQL as well. - JavaScript only paints. It rasterises the polygons with perspective-correct spans over a surface cache
(the .wal texture × the lightmap, through colormap.pcx, as ref_soft did), blends translucent surfaces through the
alpha map, draws the MD2 models with Gouraud light sampled from the lightmap below them, the sky box, particles,
and the status bar from pics/. Sounds are rows in
SOUND_EVENTS, spatialised with the Web Audio API; the map's looped speakers play at their origins. The soundtrack was CD audio: droptrack02.ogg… intomusic/and each map plays itsworldspawntrack; without them a synthesised drone fills in.
A port of Firebird Quake to Quake 2. The engine is
Electric Firebird (firebird-wasm). The game
data is the Quake 2 demo (id Software, 1997), which may be freely redistributed; drop in a registered
pak0.pak to play the full game's base unit. Quake 2 is a trademark of id Software.