Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Software:Quake

From ReverseEngineering.wiki
Software
Developer id Software
Publisher id Software (shareware), GT Interactive (retail)
Engine Quake engine (own)
Platforms MS-DOS (32-bit protected mode, DJGPP); Windows (WinQuake, GLQuake); Linux; QuakeWorld client and server
Versions Source release reports VERSION 1.09 (WinQuake/GLQuake); QuakeWorld is a separate code base in the same release
License Engine source GPL-2.0 (1999 release); game data proprietary
Website https://github.com/id-Software/Quake
On this wiki Facts · Code · Notes · Topics

First-person shooter by id Software (1996, MS-DOS; later WinQuake, GLQuake and the QuakeWorld client/server). Game data ships in Format:PAK (Quake) archives, and the gameplay rules are not in the executable at all: they are QuakeC bytecode (Format:Progs.dat (QuakeC)) run by a small virtual machine in the engine. The engine source was released under GPL-2.0 in 1999.

Overview

Quake splits into an engine written in C and x86 assembly, and game logic written in QuakeC, a small C-like language compiled by qcc into progs.dat (QuakeWorld servers load qwprogs.dat). The engine reloads progs every time a server spawns a map. Monsters, weapons, items, triggers and the rules of deathmatch all live in progs, so reverse engineering the gameplay of Quake or of a Quake mod means decoding Format:Progs.dat (QuakeC), not disassembling the executable.

Even single player runs a local server and a client connected through a loopback network driver; the server owns the entities (edicts) and the QuakeC VM, the client only renders what it is told.

Architecture overview

Source files are grouped by prefix: host main loop and commands, sv_ server, cl_ client, pr_ QuakeC VM (pr_exec.c interpreter, pr_edict.c loader and entity fields, pr_cmds.c builtin functions), r_ and d_ software renderer, gl_ OpenGL renderer, snd_ sound, net_ networking, common.c file system and byte order, model.c loaders for brush, alias and sprite models, wad.c the gfx.wad reader, cmd.c/cvar.c the console.

Formats

Data File Page
Archive of all game files id1/pak0.pak, pak1.pak, ... Format:PAK (Quake)
Maps (geometry, BSP tree, lightmaps, visibility, entities) maps/*.bsp Format:BSP (Quake)
Animated models (monsters, weapons, items) progs/*.mdl Format:MDL (Quake)
Sprites (explosions, bubbles) progs/*.spr Format:SPR (Quake)
2D graphics (HUD, menus, console font) gfx.wad Format:WAD2 (Quake)
Game logic bytecode progs.dat, qwprogs.dat Format:Progs.dat (QuakeC)
Coloured lighting (later engines, not id) maps/*.lit Format:LIT (Quake)
Palette, colormap, loose pictures gfx/palette.lmp (768 bytes), gfx/colormap.lmp, gfx/*.lmp (raw data, no header except the qpic_t width/height of pictures)

Identification

  • Error strings that survive in the shipped executables and most ports: progs.dat has wrong version number (%i should be %i), %s is not a packfile, Mod_LoadBrushModel: %s has wrong version number (%i should be %i), Wad file %s doesn't have WAD2 id.
  • File and pack directory integrity checks use CRC-16/CCITT-FALSE (see facts); its 256-entry table starts with the 16-bit values 0x0000, 0x1021, 0x2042, 0x3063 (00 00 21 10 42 20 63 30 little endian). The table is generic and appears in unrelated programs too, so it only confirms a guess.
  • The progs header CRC tells which game a progs file was compiled for: 5927 for Quake (NetQuake), 54730 for QuakeWorld (see Format:Progs.dat (QuakeC)#Identification).
  • Unverified: the DOS QUAKE.EXE is a DJGPP v2 program (the DOS sources dos_v2.c include DJGPP's go32.h and dpmi.h); test by looking for go32/CWSDPMI strings and a COFF image behind the MZ stub.

Modding entry points

  • Game directories: id1 is the base; -game <dir> adds a mod directory on top. For each directory the engine adds the directory itself, then pak0.pak, pak1.pak, ... until the first missing number, each one prepended to the search path. Lookup walks the path from the most recently added element, so a mod directory beats id1 and a higher pak number beats a lower one.
  • Gameplay: a mod ships its own progs.dat; the engine only requires version 6 and the matching header CRC.
  • The QuakeC source of QuakeWorld is in the repository (qw-qc); the single-player QuakeC source was released separately by id and is not in it.

Code & repositories

  • {{Repo|url=https://github.com/id-Software/Quake%7Ccommit=bf4ac424ce754894ac8f1dae6a3981954bc9852d%7Clicense=GPL-2.0%7Cdescription=Official id Software GPL-2.0 source release (1999) of WinQuake, GLQuake, QuakeWorld and GLQuakeWorld, plus QuakeWorld's QuakeC source (qw-qc). Reference for every on-disk format of the game: PAK reader (WinQuake/common.c), BSP structures (bspfile.h), alias models (modelgen.h), sprites (spritegn.h), gfx.wad (wad.h), and the QuakeC VM and progs.dat layout (pr_comp.h, pr_edict.c, pr_exec.c). License: GPL-2.0, stated in readme.txt, the file headers and gnu.txt at the root (GitHub does not detect it). Game data is not included.|tested_on=Source read at commit bf4ac42; not built. Structure sizes and magic values were checked with a standard-library Python reader against LibreQuake v0.09-beta (BSD-licensed replacement data): pak0.pak, pak1.pak, all BSP, MDL, SPR files, gfx.wad, progs.dat and qwprogs.dat.|checked=checked 2026-10-17; last activity 2024-06-15}}
  • https://github.com/id-Software/Quake @ bf4ac424ce754894ac8f1dae6a3981954bc9852d · license: GPL-2.0-or-later (declared by the contributor; GitHub's detector did not recognize a license file)
    GPL release of the Quake source (WinQuake/bspfile.h, common.c, pr_comp.h, modelgen.h, spritegn.h).
    Tested on: source read, not run: source read · checked 2026-10-18; last activity 2024-06-15

Pitfalls

  • Inside one game directory the pak files are searched before the loose files of that same directory (the directory is added to the path first, its paks are prepended after it). A loose file does not override a file of the same name in that directory's pak.
  • Pack file names are compared with strcmp: case-sensitive and with forward slashes; shipped paks use lower case.
  • Hexen II, Half-Life (GoldSrc) and Quake II use formats derived from these but with different version numbers and layouts; nothing on these pages is checked against them.

Open questions

  • No Build: pages yet: which retail executables (DOS 1.06, WinQuake, GLQuake, QuakeWorld 2.x) match the source release exactly, and which compiler built each?