# evanrinehart/doom architecture

> Architecture diagram of the GitHub repository evanrinehart/doom, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/evanrinehart/doom
- Repository: https://github.com/evanrinehart/doom

## Overview

#### Purpose and Build Targets
This repository preserves Doom 1.10-era C source across three execution targets: the Linux game port, DOS IPX networking utilities, and DOS serial-link utilities. The primary playable build is `linuxdoom-1.10/`, built through `linuxdoom-1.10/Makefile`; process startup is `linuxdoom-1.10/i_main.c`, which transfers control to game initialization in `linuxdoom-1.10/d_main.c`.

#### Engine Orchestration and Game States
`d_main.c` owns high-level startup, game loop, demo/title sequencing, and subsystem coordination. `g_game.c` implements game-state transitions, player commands, level progression, demos, and save/load integration. Shared global runtime state and core type definitions form a broad boundary in `linuxdoom-1.10/doomstat.h`, `linuxdoom-1.10/doomdef.h`, and `linuxdoom-1.10/doomdata.h`.

#### Fixed-Tick Simulation
The simulation advances through Doom “tics,” collecting commands and executing thinkers deterministically. Network/game tick handling is centered on `linuxdoom-1.10/d_net.c`; thinker scheduling is in `linuxdoom-1.10/p_tick.c`; player movement, interaction, enemies, and world specials are distributed through `linuxdoom-1.10/p_user.c`, `linuxdoom-1.10/p_enemy.c`, and `linuxdoom-1.10/p_spec.c`. This separates simulation state from rendering and platform I/O.

#### Level, WAD, and Memory Data Boundary
Game content is loaded from WAD archives by `linuxdoom-1.10/w_wad.c`. `linuxdoom-1.10/p_setup.c` turns map lumps into runtime geometry, things, sectors, and line structures; `linuxdoom-1.10/r_data.c` loads renderer-facing textures, flats, sprites, and colormaps. The custom zone allocator in `linuxdoom-1.10/z_zone.c` manages tagged allocations and enables level/resource lifecycle cleanup.

#### Software Rendering Pipeline
The renderer traverses BSP world geometry, projects visible walls/planes/sprites, and rasterizes into a software framebuffer. Primary stages are `linuxdoom-1.10/r_main.c` (frame orchestration), `linuxdoom-1.10/r_bsp.c` (visibility traversal), `linuxdoom-1.10/r_segs.c` and `linuxdoom-1.10/r_plane.c` (walls/floors/ceilings), and `linuxdoom-1.10/r_things.c` (sprites). `linuxdoom-1.10/i_video.c` is the platform video boundary; `linuxdoom-1.10/v_video.c` provides engine-level screen drawing.

#### Presentation and Audio
HUD, status bar, menus, intermission, finale, and automap are presentation layers over game state: `linuxdoom-1.10/hu_stuff.c`, `linuxdoom-1.10/st_stuff.c`, and `linuxdoom-1.10/m_menu.c`. Sound effect/music policy is in `linuxdoom-1.10/s_sound.c`; hardware/platform audio is isolated in `linuxdoom-1.10/i_sound.c`. Input, timing, errors, and process services similarly terminate at `linuxdoom-1.10/i_system.c`.

#### Multiplayer Transports
The engine-facing network abstraction is `linuxdoom-1.10/i_net.c` and `linuxdoom-1.10/i_net.h`, feeding the tic command/network layer. Legacy DOS IPX transport and setup tooling live separately in `ipx/IPXNET.C`, `ipx/DOOMNET.C`, and `ipx/IPXSETUP.C`. Serial multiplayer has parallel utilities in `sersrc/PORT.C`, `sersrc/DOOMNET.C`, and `sersrc/SERSETUP.C`; these are distinct transport implementations rather than services used by the Linux runtime.

Main entry points: [`linuxdoom-1.10/d_main.c`](https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/d_main.c) (Game director), [`linuxdoom-1.10/p_setup.c`](https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/p_setup.c) (Level setup), [`linuxdoom-1.10/r_main.c`](https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/r_main.c) (Frame renderer), [`linuxdoom-1.10/g_game.c`](https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/g_game.c) (Game state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_linux["Linux Doom Runtime"]
  node_makefile["Linux build<br/>Makefile<br/>[Makefile]"]
  node_main["Process startup<br/>platform entry<br/>[i_main.c]"]
  node_director["Game director<br/>engine orchestration<br/>[d_main.c]"]
  node_game["Game state<br/>gameplay control<br/>[g_game.c]"]
  node_core_state["Core runtime state<br/>shared definitions<br/>[doomstat.h]"]
  node_net_tick["Tic networking<br/>deterministic tick<br/>[d_net.c]"]
  node_simulation["Thinker simulation<br/>world simulation<br/>[p_tick.c]"]
  node_net_platform["Linux network I/O<br/>network boundary<br/>[i_net.c]"]
  node_presentation["HUD and menus<br/>presentation<br/>[hu_stuff.c]"]
  node_sound["Sound policy<br/>audio engine<br/>[s_sound.c]"]
  node_system["System services<br/>platform boundary<br/>[i_system.c]"]
end

subgraph group_content["Content and Rendering"]
  node_wad[("WAD archive loader<br/>content archive<br/>[w_wad.c]")]
  node_zone["Zone allocator<br/>tagged memory<br/>[z_zone.c]"]
  node_level["Level setup<br/>map loader<br/>[p_setup.c]"]
  node_render_data["Render resources<br/>renderer data<br/>[r_data.c]"]
  node_renderer["Frame renderer<br/>software renderer<br/>[r_main.c]"]
  node_bsp["BSP traversal<br/>visibility stage<br/>[r_bsp.c]"]
  node_video["Video output<br/>video boundary<br/>[i_video.c]"]
end

subgraph group_dos_ipx["DOS IPX Utilities"]
  node_ipx["IPX transport<br/>DOS IPX utility<br/>[IPXNET.C]"]
  node_ipx_setup["IPX setup<br/>DOS setup utility<br/>[IPXSETUP.C]"]
end

subgraph group_dos_serial["DOS Serial Utilities"]
  node_serial["Serial transport<br/>DOS serial utility<br/>[PORT.C]"]
  node_serial_setup["Serial setup<br/>DOS setup utility<br/>[SERSETUP.C]"]
end

node_makefile -->|"builds"| node_main
node_main -->|"starts"| node_director
node_director -->|"coordinates"| node_game
node_director -->|"runs"| node_net_tick
node_director -->|"draws frames through"| node_renderer
node_director -->|"updates"| node_presentation
node_game -->|"reads and updates"| node_core_state
node_game -->|"loads levels"| node_level
node_net_tick -->|"exchanges commands via"| node_net_platform
node_net_tick -->|"advances"| node_simulation
node_simulation -->|"updates"| node_core_state
node_presentation -->|"reads"| node_core_state
node_sound -->|"uses platform services"| node_system
node_wad -->|"supplies map lumps"| node_level
node_wad -->|"supplies art lumps"| node_render_data
node_zone -->|"owns level allocations"| node_level
node_zone -->|"owns resource allocations"| node_render_data
node_level -->|"provides world geometry"| node_renderer
node_render_data -->|"provides render assets"| node_renderer
node_renderer -->|"traverses visible world"| node_bsp
node_bsp -->|"rasterizes framebuffer for"| node_video
node_ipx_setup -->|"configures"| node_ipx
node_serial_setup -->|"configures"| node_serial

click node_makefile "https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/Makefile"
click node_main "https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/i_main.c"
click node_director "https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/d_main.c"
click node_game "https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/g_game.c"
click node_core_state "https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/doomstat.h"
click node_net_tick "https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/d_net.c"
click node_simulation "https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/p_tick.c"
click node_net_platform "https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/i_net.c"
click node_presentation "https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/hu_stuff.c"
click node_sound "https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/s_sound.c"
click node_system "https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/i_system.c"
click node_wad "https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/w_wad.c"
click node_zone "https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/z_zone.c"
click node_level "https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/p_setup.c"
click node_render_data "https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/r_data.c"
click node_renderer "https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/r_main.c"
click node_bsp "https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/r_bsp.c"
click node_video "https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/i_video.c"
click node_ipx "https://github.com/evanrinehart/doom/blob/master/ipx/IPXNET.C"
click node_ipx_setup "https://github.com/evanrinehart/doom/blob/master/ipx/IPXSETUP.C"
click node_serial "https://github.com/evanrinehart/doom/blob/master/sersrc/PORT.C"
click node_serial_setup "https://github.com/evanrinehart/doom/blob/master/sersrc/SERSETUP.C"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_makefile,node_main,node_director,node_game,node_core_state,node_net_tick,node_simulation,node_net_platform,node_presentation,node_sound,node_system toneBlue
class node_wad,node_zone,node_level,node_render_data,node_renderer,node_bsp,node_video toneAmber
class node_ipx,node_ipx_setup toneMint
class node_serial,node_serial_setup toneRose
```

## Components

### Linux Doom Runtime

Primary playable build and engine runtime.

- [Linux build](https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/Makefile): Makefile · `linuxdoom-1.10/Makefile`
- [Process startup](https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/i_main.c): platform entry · `linuxdoom-1.10/i_main.c`
- [Game director](https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/d_main.c): engine orchestration · Startup, main loop, demos, and title sequencing. · `linuxdoom-1.10/d_main.c`
- [Game state](https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/g_game.c): gameplay control · Transitions, commands, levels, demos, and saves. · `linuxdoom-1.10/g_game.c`
- [Core runtime state](https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/doomstat.h): shared definitions · Global state and core game data types. · `linuxdoom-1.10/doomstat.h`
- [Tic networking](https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/d_net.c): deterministic tick · Collects commands and advances game tics. · `linuxdoom-1.10/d_net.c`
- [Thinker simulation](https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/p_tick.c): world simulation · Schedules player, enemy, and special world behavior. · `linuxdoom-1.10/p_tick.c`
- [Linux network I/O](https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/i_net.c): network boundary · `linuxdoom-1.10/i_net.c`
- [HUD and menus](https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/hu_stuff.c): presentation · HUD, status bar, and menu layers over game state. · `linuxdoom-1.10/hu_stuff.c`
- [Sound policy](https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/s_sound.c): audio engine · `linuxdoom-1.10/s_sound.c`
- [System services](https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/i_system.c): platform boundary · Input, timing, errors, and process services. · `linuxdoom-1.10/i_system.c`

### Content and Rendering

WAD-backed level setup and software rendering.

- [WAD archive loader](https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/w_wad.c): content archive · `linuxdoom-1.10/w_wad.c`
- [Zone allocator](https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/z_zone.c): tagged memory · Controls resource and level allocation lifecycles. · `linuxdoom-1.10/z_zone.c`
- [Level setup](https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/p_setup.c): map loader · Builds runtime geometry, things, sectors, and lines. · `linuxdoom-1.10/p_setup.c`
- [Render resources](https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/r_data.c): renderer data · Loads textures, flats, sprites, and colormaps. · `linuxdoom-1.10/r_data.c`
- [Frame renderer](https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/r_main.c): software renderer · Coordinates BSP visibility and world rasterization. · `linuxdoom-1.10/r_main.c`
- [BSP traversal](https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/r_bsp.c): visibility stage · `linuxdoom-1.10/r_bsp.c`
- [Video output](https://github.com/evanrinehart/doom/blob/master/linuxdoom-1.10/i_video.c): video boundary · Presents the software framebuffer. · `linuxdoom-1.10/i_video.c`

### DOS IPX Utilities

Standalone IPX multiplayer transport and setup tools.

- [IPX transport](https://github.com/evanrinehart/doom/blob/master/ipx/IPXNET.C): DOS IPX utility · Standalone DOS IPX networking implementation. · `ipx/IPXNET.C`
- [IPX setup](https://github.com/evanrinehart/doom/blob/master/ipx/IPXSETUP.C): DOS setup utility · `ipx/IPXSETUP.C`

### DOS Serial Utilities

Standalone serial-link transport and setup tools.

- [Serial transport](https://github.com/evanrinehart/doom/blob/master/sersrc/PORT.C): DOS serial utility · Standalone DOS serial-link implementation. · `sersrc/PORT.C`
- [Serial setup](https://github.com/evanrinehart/doom/blob/master/sersrc/SERSETUP.C): DOS setup utility · `sersrc/SERSETUP.C`

## Connections

- Linux build → Process startup: builds
- Process startup → Game director: starts
- Game director → Game state: coordinates
- Game director → Tic networking: runs
- Game director → Frame renderer: draws frames through
- Game director → HUD and menus: updates
- Game state → Core runtime state: reads and updates
- Game state → Level setup: loads levels
- Tic networking → Linux network I/O: exchanges commands via
- Tic networking → Thinker simulation: advances
- Thinker simulation → Core runtime state: updates
- HUD and menus → Core runtime state: reads
- Sound policy → System services: uses platform services
- WAD archive loader → Level setup: supplies map lumps
- WAD archive loader → Render resources: supplies art lumps
- Zone allocator → Level setup: owns level allocations
- Zone allocator → Render resources: owns resource allocations
- Level setup → Frame renderer: provides world geometry
- Render resources → Frame renderer: provides render assets
- Frame renderer → BSP traversal: traverses visible world
- BSP traversal → Video output: rasterizes framebuffer for
- IPX setup → IPX transport: configures
- Serial setup → Serial transport: configures
