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) · Alt + arrows sidestep · Ins + W/S look up and down · End levels the view ·
1–0 weapons · G hand grenades · / or the wheel cycles (down next, up previous) · Tab inventory ([ ] select, Enter use, Backspace drop) · Q quad · I invulnerability · B rebreather · E environment suit · L silencer · H power shield · F1 help computer · T chat (the console with say typed: the words go to every player) · ` console (god, noclip, notarget, give, use, kill, wave 0–4: a gesture the other players see, map, skill 0–3: nightmare is 3, the console's alone; several commands on a line with ; between, alias naming a line and wait holding the rest of one to the next frame; bind, unbind, unbindall and bindlist over the keys, menu_main and its kin opening the menus, a key bound to any other line (bind k god, bind t "say hello") running it as it goes down; the cvars name, hand, sensitivity, cl_run, m_pitch, crosshair, s_volume, cd_volume, cd_loopcount, cd_looptrack, cd_nocd (the music's loop: the map's track that many times, then the loop track; or none), freelook, lookspring, lookstrafe, m_forward, m_side (the mouse look: with freelook 0 the mouse's vertical walks unless +mlook, \ by default, is held), m_yaw (the turn a mouse count), cl_gun (0: no view weapon), con_notifytime (the notify lines' seconds), vid_gamma (the brightness) and vid_fullscreen, netgraph (a joined page's frames graphed along the bottom), cl_predict (0: a joined page paints the host's frames as they come, no move run ahead), cl_showmiss (1: each prediction miss printed), ref_soft's r_fullbright, r_drawentities, r_drawworld, r_lerpmodels, r_novis and r_speeds (the world unlit, the entities or the world left out, the poses unblended, every leaf marked, the frame's figures printed once a second) and cvarlist over the settings; writeconfig downloads them with the keys as config.cfg and exec runs one picked, as the Config controls do, whose autoexec box keeps the config picked to run at every start (exec autoexec runs it again, unautoexec drops it); clear empties the console's scrollback and condump name downloads it as name.txt; echo prints its words, cmdlist lists the commands, version names the build, pause pauses a single-player game, path names the pak, dir maps/*.bsp lists its files, modellist, imagelist and soundlist what is loaded, score shows a shared game's score board and putaway puts every screen away; viewsize 40–100 draws the view in a smaller rectangle with the backtile around it, sizeup and sizedown (= and -) step it by ten; serverinfo lists the game's cvars, userinfo this page's, status the clients with their frags and pings; help is F1's word, sv_gravity the level's gravity for the game running, bob_up, bob_pitch, bob_roll, run_pitch, run_roll, sv_rollangle and sv_rollspeed the view's bob and roll (p_view.c's cvars, on the game row too), hostname the host's name (the serverinfo's, a joined page's stats line's); deathmatch, coop and maxclients are the Players select's words, latched for the next game; timescale 0.5 is slow motion, 2 twice the pace) · P pause (single player: a game shared over the network runs on under the menu and P) ·
Esc menu (F2 save, F3 load, where D on a slot writes it as a file, F10 quit; the options' customize controls rebinds the movement, fire, weapon, inventory, help, silencer and power shield keys, the mouse buttons and the wheel among the keys; multiplayer's join and start network server are the page's Join and Host, its player setup gives your name, for the obituaries and the score board, and your handedness: the shots come from the left or the centre and the gun is drawn so) · F6 quick save · F9 quick load (saves live in this browser; a host's load keeps its guests' clients; the Saves controls write the game as a file and play one back, so a game moves between browsers).
The page installs as an app and, once it has run, runs without a network ("offline ready"); a pak picked from the PAK control is kept in this browser and loads at the next start (the button beside it goes back to the demo's), and a picked music folder's tracks are kept as they play.
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, the d-pad selects (left/right) and uses (up) an inventory item, Y shows the inventory, Back the help computer, Start opens the menu (the d-pad, A and B drive it).
With two to four players (coop, or deathmatch: the maps' deathmatch weapons and spots, no monsters, frags at the top right, F1 the score board, with each player's ping over the network;
dmflags, fraglimit, timelimit and cheats at the console) the view is split in two or four, the keyboard and mouse are the first player's and the gamepads the others' (640×480 gives four views of 320×240).
Over the network: one page hosts (Host makes an offer to send to the other player), the other joins (Join takes the offer and makes an answer to send back),
and the host's game runs with the guest's player in it (coop, or a deathmatch when the host's Players select says so), each page its own view; Host again while hosting makes an offer for a third and a fourth player, who join the game as it runs;
a joined page that ticks spectate (or spectator 1 at its console) only watches: no body, a noclip move through the level, nothing hurts it and the monsters ignore it, its attack key chases a player (3.20's chase cam: the view behind that player's), jump lets go, chase n at its console picks one; its console's game commands (god, give, kill…) run at the host for its player; at the host's console players lists the clients and what drives each and kick n drops a guest;
two players whose networks a STUN server cannot cross give both pages a TURN relay (rtc_ice turn:host:3478 user pass at the console, kept in the settings; rtc_ice none drops it);
a relay of your own for the texts (npm run signal in the repository, rtc_signal http://host:8787 at the console of both pages; from this https page an http relay is reached at localhost only, elsewhere put it behind https) lets Host show a four-letter code instead, typed after Join or given to connect at the console (disconnect leaves, reconnect joins the last host again: Host again keeps the host's code).
The page opens on the attract loop, the pak's recording with the main menu over it, and goes back to it after a game; a new game starts from the menu, the Map select or the console.
The Demo select (or demomap q2demo1 at the console) plays a recording too; a key or a click brings the menu up over it; timedemo q2demo1 plays it as fast as the page paints and reports the frames a second, screenshot downloads the view as quake00.png.
record name at the console records the game from then on as a demo of its own, stop (or the level's end) downloads it as name.dm2, which the select plays here and Quake 2 plays itself with the same pak (a joined page records the frames the host sends it the same way);
the recordings are kept across reloads (demos lists them, deldemo name drops one), and a .dm2 file of your own opens from the Demo select's file button.
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 (and, as logic without their models, the full game's gladiators, iron maidens, brains, medics, mutants, icaruses, technicians, sharks, the supertank, the hornet, Jorg and Makron). - 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/(or pick the folder: its tracks are kept as they play) 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.