Software:Doom
| Developer | id Software |
|---|---|
| Publisher | id Software (shareware and registered), GT Interactive (The Ultimate Doom, Doom II) |
| Platforms | MS-DOS (original, 32-bit protected mode); Linux (1997 source release); many later ports |
| Versions | 1.0 to 1.9 (DOS, 1993-1995); 1.10 in the Linux source release |
| License | Source code GPL-2.0 (game data proprietary) |
| Website | https://github.com/id-Software/DOOM |
| On this wiki | Facts · Code · Notes · Topics |
First-person shooter by id Software (December 1993, MS-DOS). All game data lives in Format:WAD (Doom engine) archives; the engine source was released in 1997 (Linux port, version 1.10) and relicensed under GPL-2.0, so its data structures and algorithms can be read directly instead of reverse engineered.
Overview
The engine (later called id Tech 1) renders a 2D map with floor and ceiling heights through a precomputed BSP tree and runs the game simulation at a fixed 35 tics per second (TICRATE). The same engine and data formats are shared by Doom II, The Ultimate Doom, Final Doom and, with extensions, Heretic, Hexen and Strife; knowledge on this page and on Format:WAD (Doom engine) applies to them unless stated otherwise.
The 1997 source release (directory linuxdoom-1.10 of the id Software repository) is the Linux port. It reports itself as version 110. The DOS sound code is not included: the release notes say a copyrighted third-party sound library was used and had to be removed, and the IPX network driver is shipped separately (ipx/).
Architecture overview
Modules are named by prefix: am_ automap, d_ main loop and networking, f_ finale and screen wipe, g_ game flow (demos, saves), hu_ heads-up text, i_ system interface (video, sound, timer, network), m_ misc (menus, fixed point, random, argv), p_ play simulation, r_ renderer, s_ sound, st_ status bar, w_ WAD access, wi_ intermission, z_ zone allocator.
- Numbers: almost everything is 16.16 fixed point (
fixed_t,FRACUNIT= 0x10000). Angles are 32-bit binary angles (ANG90= 0x40000000); trigonometry uses lookup tables (finesinewith 10240 entries,finetangent4096,tantoangle2049) indexed byangle >> 19. - Randomness: one fixed 256-byte table, read by two independent indices (see facts). Demo playback and network play rely on it being deterministic.
- Actors: every monster, item and projectile is a
mobj_tdriven by a state machine. The tablesstates(967 entries),mobjinfo(137 types) andsprnames(138 four-letter sprite names) are compiled into the executable (info.c). - Input: each tic, each player's input is packed into a
ticcmd_t; demos store exactly these commands, network games exchange them.
Formats
| Data | File | Page |
|---|---|---|
| All game data (maps, graphics, sounds, music, palettes) | .WAD (IWAD, PWAD) |
Format:WAD (Doom engine) |
| Recorded demos | .LMP, or DEMO1-DEMO4 lumps in the IWAD |
Format:Doom demo (LMP) |
| Saved games | DOOMSAV0.DSG to DOOMSAV5.DSG |
Format:Doom savegame (DSG) |
Identification
- The 256-byte random table starts with the bytes
00 08 6D DC DE F1 95 6B 4B F8 FE 8C 10 42 4A 15; finding it in an executable identifies Doom-engine code (any port, console version or derived game) and locatesP_Random/M_Randomby cross-reference. finesinestarts with the 32-bit values 25, 75, 125, 175 (19 00 00 00 4B 00 00 00 7D 00 00 00 AF 00 00 00little-endian).- Error strings such as
W_GetNumForName: %s not found!andDemo is from a different game version!survive in most builds and ports.
Modding entry points
- PWADs loaded with
-fileoverride IWAD lumps by name because lump lookup returns the last match (Format:WAD (Doom engine)#Lump lookup). - Behaviour that is not in the WAD (monster stats, states, weapon frames, text) is compiled in; DeHackEd-style patches change those tables in the executable. Unverified: the DOS v1.9 executable stores
statesandmobjinfowith the same 28-byte and 92-byte records as the source; test by searching the executable for the firstmobjinforow (doomednum -1, spawnstate 149, spawnhealth 100 as 32-bit integers).
Code & repositories
- https://github.com/id-Software/DOOM @
a77dfb96cb91780ca334d0d4cfd86957558007e0· license: GPL-2.0
Official id Software source release of Doom (GPL-2.0): the 1997 Linux port, version 1.10 (linuxdoom-1.10), plus the DOS IPX network driver and the DOS assembly inner loops as a README. Reference for the WAD reader (w_wad.c), map lump structures (doomdata.h, p_setup.c), picture and texture formats (r_defs.h, r_data.c), demo and savegame code (g_game.c, p_saveg.c), the RNG (m_random.c), fixed point (m_fixed.c) and the compiled-in state and actor tables (info.c). The DOS sound library code is not included.
Tested on: Source read at commit a77dfb9; not built. Structure sizes, map lump order, demo layout and palette sizes were checked with a standard-library Python reader against the Freedoom 0.13.0 IWADs (freedoom1.wad, freedoom2.wad). · checked 2026-10-17; last activity 2024-05-24
Pitfalls
P_Random(gameplay) andM_Random(menus, effects) share one table but have separate indices; onlyP_Randommust stay in sync for demos. Calling the wrong one in a port desynchronises demos.- The source is version 1.10 (Linux); retail DOS releases differ in small ways (version byte 109 for 1.9, DOS-only code paths). Check behaviour against the retail executable before assuming the source matches a given DOS build.
- Freedoom IWADs are a free, BSD-licensed replacement for the game data and are convenient test samples; they are not byte-identical to the commercial IWADs.
Open questions
- Which compiler and DOS extender built each retail DOOM.EXE version, and do the
states/mobjinfotables sit at the same file offsets in 1.9 registered and The Ultimate Doom? Unverified lead: Watcom C with the DOS/4GW extender (a linear executable); test by checking the MZ stub andDOS/4GWstrings in DOOM.EXE.