Introduction to the Doom Repository

Author

Robert Ness

Published

May 6, 2025

1 General Overview

This tour examines Linux DOOM 1.10’s architecture, from its build system and platform abstraction layers through its core engine components: memory management, resource loading, rendering, game logic, physics, AI, UI, sound, and networking.

The next steps examine how DOOM initializes, starting with the build system and following through to the main entry point.


1.0.1 πŸ“‚ File: linuxdoom-1.10/Makefile

This Makefile compiles DOOM for Linux, building object files in linux/ and linking them with X11, networking, and math libraries.


1.0.2 πŸ“„ File: README.TXT (lines 12–20)

The code is currently Linux-only but designed to be portable. The rendering model uses horizontal/vertical constant-Z lines with fixed-band lighting.


1.0.3 πŸ“„ File: linuxdoom-1.10/i_main.c (lines 34–44)

main stores command-line args in myargc/myargv and calls D_DoomMain() to hand off control to the engine.


1.0.4 πŸ“‚ File: linuxdoom-1.10/d_main.h

D_DoomMain() handles system startup while D_PostEvent() processes input events into the game queue.


1.0.5 πŸ“„ File: linuxdoom-1.10/d_main.c (lines 792–800)

D_DoomMain is the game’s initialization function. It sets up all major subsystems and either starts a demo or begins a new game.


1.0.6 πŸ“„ File: linuxdoom-1.10/d_main.c (lines 352–360)

The main game loop processes input, updates game state, handles sound, and renders each frame. Demo recording can be initialized when the game starts.


1.0.7 πŸ“„ File: linuxdoom-1.10/i_system.c (lines 76–84)

I_ZoneBase provides memory for the zone allocator by allocating a block of the requested size. I_AllocLow allocates zero-initialized memory.


1.0.8 πŸ“„ File: linuxdoom-1.10/i_video.h (lines 1–8)

Functions that handle platform-specific graphics display, including initialization, shutdown, palette setting, and screen updates.


1.0.9 πŸ“„ File: linuxdoom-1.10/i_sound.h (lines 1–6)

Declares the core sound system functions for initializing, updating, submitting, and shutting down sound output.


1.0.10 πŸ“„ File: linuxdoom-1.10/i_net.h (lines 1–6)

Declares network functions I_InitNetwork() for setup and I_NetCmd() for multiplayer communication.


The next files show how DOOM isolates platform-specific code into an OS abstraction layer, handling memory, graphics, sound, and networking on Unix systems.


1.0.11 πŸ“„ File: linuxdoom-1.10/z_zone.h (lines 30–42)

Memory allocations use purge tags to control when they can be freed. Tags under 100 are protected, while higher tags allow purging.


1.0.12 πŸ“„ File: linuxdoom-1.10/z_zone.c (lines 93–101)

Z_Init() uses I_ZoneBase to reserve a main heap zone and creates one large free block.


1.0.13 πŸ“„ File: linuxdoom-1.10/z_zone.c (lines 181–191)

Z_Malloc allocates memory blocks with additional tracking information for Doom’s memory management system.


1.0.14 πŸ“‚ File: linuxdoom-1.10/w_wad.h

w_wad.h defines structures and functions for reading DOOM’s WAD resource files, handling file headers, directory entries, and memory-cached game assets.


Z_Malloc allocates memory from the heap zone and tracks its lifetime through tags, allowing the system to manage memory for different game resources.


1.0.15 πŸ“„ File: linuxdoom-1.10/p_setup.c (lines 133–136)

Z_Malloc allocates memory for the vertexes array used by BSP and rendering code, with PU_LEVEL tag for lifetime tracking.


1.0.16 πŸ“„ File: linuxdoom-1.10/w_wad.c (lines 292–300)

Z_Malloc allocates memory from the heap zone and manages memory lifetime through tags like PU_STATIC for permanent allocations and PU_LEVEL for level-specific data that gets freed between maps.


1.0.17 πŸ“‚ File: linuxdoom-1.10/doomdata.h

doomdata.h defines on-disk WAD map structures: mapvertex_t, mapsidedef_t, maplinedef_t, mapsector_t, mapsubsector_t, mapseg_t, mapnode_t, and mapthing_t for level geometry and entities.


1.0.18 πŸ“„ File: linuxdoom-1.10/d_main.c (lines 1020–1022)

Z_Malloc allocates memory for the game’s vertex data structure, requesting numvertexes*sizeof(vertex_t) bytes with the PU_LEVEL tag.


1.0.19 πŸ“„ File: linuxdoom-1.10/p_setup.c (lines 136–137)

W_InitMultipleFiles loads and indexes all specified IWAD/PWAD archives before any other subsystem initialization begins.


W_CacheLumpNum loads raw lump data into memory and returns a pointer that gets cast to mapvertex_t* for BSP building.


1.0.20 πŸ“‚ File: linuxdoom-1.10/r_main.h

r_main.h defines renderer functions for initialization, viewport setup, frame rendering, and BSP geometry.


1.0.21 πŸ“„ File: linuxdoom-1.10/r_main.c (lines 868–875)

This function coordinates the main rendering sequence for the player’s view, from BSP traversal through final sprite drawing.