# id-software/quake architecture

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

- Interactive diagram: https://gitdiagram.com/id-software/quake
- Repository: https://github.com/id-software/quake

## Overview

This repository contains several Quake game-engine variants: software- and OpenGL-rendered WinQuake and QuakeWorld. The principal networked workflow takes player input through the client, exchanges commands and state with the server, simulates the world, then updates the client view and audio. The graph emphasizes QuakeWorld’s client/server split and shows software and OpenGL rendering as alternatives. README and file names establish the variants and capabilities; most runtime links are architectural rather than verified from the partial excerpts.

Main entry points: [`QW/client/cl_main.c`](https://github.com/id-software/quake/blob/master/QW/client/cl_main.c) (Client Control), [`QW/client/net_chan.c`](https://github.com/id-software/quake/blob/master/QW/client/net_chan.c) (Client Networking), [`QW/server/sv_nchan.c`](https://github.com/id-software/quake/blob/master/QW/server/sv_nchan.c) (Server Networking), [`QW/client/net_udp.c`](https://github.com/id-software/quake/blob/master/QW/client/net_udp.c) (UDP Transport)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client Runtime"]
  node_client_control["Client Control<br/>[cl_main.c]"]
  node_input["Input Commands<br/>[cl_input.c]"]
  node_client_net["Client Networking<br/>[net_chan.c]"]
  node_client_parse["State Parsing<br/>[cl_parse.c]"]
  node_client_entities["Entity Updates<br/>[cl_ents.c]"]
  node_demos["Demo Playback<br/>[cl_demo.c]"]
end

subgraph group_server["Server Simulation"]
  node_server_net["Server Networking<br/>[sv_nchan.c]"]
  node_server_user["Client Commands<br/>[sv_user.c]"]
  node_server_control["Server Control<br/>[sv_main.c]"]
  node_server_physics["World Physics<br/>[sv_phys.c]"]
  node_world["World Collision<br/>[world.c]"]
  node_game_scripts["Game Script VM<br/>[pr_exec.c]"]
  node_server_send["State Broadcast<br/>[sv_send.c]"]
end

subgraph group_presentation["Presentation"]
  node_software_render["Software Renderer<br/>[r_main.c]"]
  node_gl_render["OpenGL Renderer<br/>[gl_rmain.c]"]
  node_screen["Screen and HUD<br/>[screen.c]"]
  node_sound["Sound Mixing<br/>[snd_mix.c]"]
end

subgraph group_platform["Platform I/O"]
  node_udp["UDP Transport<br/>[net_udp.c]"]
  node_audio_device["Audio Device<br/>[snd_linux.c]"]
  node_display["Display Device<br/>[vid.h]"]
end

node_player(("Player"))

node_player -->|"provides input"| node_input
node_input -->|"builds commands"| node_client_control
node_client_control -->|"sends commands"| node_client_net
node_client_net -->|"transmits packets"| node_udp
node_udp -->|"delivers packets"| node_server_net
node_server_net -->|"dispatches commands"| node_server_user
node_server_control -->|"runs simulation"| node_server_physics
node_server_physics -->|"checks collisions"| node_world
node_server_physics -->|"executes game logic"| node_game_scripts
node_server_control -->|"sends state"| node_server_send
node_server_send -->|"queues updates"| node_server_net
node_server_net -->|"transmits updates"| node_udp
node_udp -->|"delivers updates"| node_client_net
node_client_net -->|"dispatches messages"| node_client_parse
node_client_parse -->|"updates entities"| node_client_entities
node_client_control -->|"renders frame"| node_software_render
node_client_control -->|"renders frame"| node_gl_render
node_software_render -->|"draws view"| node_screen
node_gl_render -->|"draws view"| node_screen
node_screen -->|"presents frame"| node_display
node_client_control -->|"updates audio"| node_sound
node_sound -->|"outputs sound"| node_audio_device
node_demos -->|"replays messages"| node_client_parse

click node_client_control "https://github.com/id-software/quake/blob/master/QW/client/cl_main.c"
click node_input "https://github.com/id-software/quake/blob/master/QW/client/cl_input.c"
click node_client_net "https://github.com/id-software/quake/blob/master/QW/client/net_chan.c"
click node_udp "https://github.com/id-software/quake/blob/master/QW/client/net_udp.c"
click node_client_parse "https://github.com/id-software/quake/blob/master/QW/client/cl_parse.c"
click node_client_entities "https://github.com/id-software/quake/blob/master/QW/client/cl_ents.c"
click node_demos "https://github.com/id-software/quake/blob/master/QW/client/cl_demo.c"
click node_server_net "https://github.com/id-software/quake/blob/master/QW/server/sv_nchan.c"
click node_server_user "https://github.com/id-software/quake/blob/master/QW/server/sv_user.c"
click node_server_control "https://github.com/id-software/quake/blob/master/QW/server/sv_main.c"
click node_server_physics "https://github.com/id-software/quake/blob/master/QW/server/sv_phys.c"
click node_world "https://github.com/id-software/quake/blob/master/QW/server/world.c"
click node_game_scripts "https://github.com/id-software/quake/blob/master/QW/server/pr_exec.c"
click node_server_send "https://github.com/id-software/quake/blob/master/QW/server/sv_send.c"
click node_software_render "https://github.com/id-software/quake/blob/master/QW/client/r_main.c"
click node_gl_render "https://github.com/id-software/quake/blob/master/QW/client/gl_rmain.c"
click node_screen "https://github.com/id-software/quake/blob/master/QW/client/screen.c"
click node_sound "https://github.com/id-software/quake/blob/master/QW/client/snd_mix.c"
click node_audio_device "https://github.com/id-software/quake/blob/master/QW/client/snd_linux.c"
click node_display "https://github.com/id-software/quake/blob/master/QW/client/vid.h"

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_client_control,node_input,node_client_net,node_client_parse,node_client_entities,node_demos toneBlue
class node_server_net,node_server_user,node_server_control,node_server_physics,node_world,node_game_scripts,node_server_send toneAmber
class node_software_render,node_gl_render,node_screen,node_sound toneMint
class node_udp,node_audio_device,node_display toneRose
class node_player toneIndigo
```

## Components

### Client Runtime

- [Client Control](https://github.com/id-software/quake/blob/master/QW/client/cl_main.c): `QW/client/cl_main.c`
- [Input Commands](https://github.com/id-software/quake/blob/master/QW/client/cl_input.c): `QW/client/cl_input.c`
- [Client Networking](https://github.com/id-software/quake/blob/master/QW/client/net_chan.c): `QW/client/net_chan.c`
- [State Parsing](https://github.com/id-software/quake/blob/master/QW/client/cl_parse.c): `QW/client/cl_parse.c`
- [Entity Updates](https://github.com/id-software/quake/blob/master/QW/client/cl_ents.c): `QW/client/cl_ents.c`
- [Demo Playback](https://github.com/id-software/quake/blob/master/QW/client/cl_demo.c): `QW/client/cl_demo.c`

### Server Simulation

- [Server Networking](https://github.com/id-software/quake/blob/master/QW/server/sv_nchan.c): `QW/server/sv_nchan.c`
- [Client Commands](https://github.com/id-software/quake/blob/master/QW/server/sv_user.c): `QW/server/sv_user.c`
- [Server Control](https://github.com/id-software/quake/blob/master/QW/server/sv_main.c): `QW/server/sv_main.c`
- [World Physics](https://github.com/id-software/quake/blob/master/QW/server/sv_phys.c): `QW/server/sv_phys.c`
- [World Collision](https://github.com/id-software/quake/blob/master/QW/server/world.c): `QW/server/world.c`
- [Game Script VM](https://github.com/id-software/quake/blob/master/QW/server/pr_exec.c): `QW/server/pr_exec.c`
- [State Broadcast](https://github.com/id-software/quake/blob/master/QW/server/sv_send.c): `QW/server/sv_send.c`

### Presentation

- [Software Renderer](https://github.com/id-software/quake/blob/master/QW/client/r_main.c): `QW/client/r_main.c`
- [OpenGL Renderer](https://github.com/id-software/quake/blob/master/QW/client/gl_rmain.c): `QW/client/gl_rmain.c`
- [Screen and HUD](https://github.com/id-software/quake/blob/master/QW/client/screen.c): `QW/client/screen.c`
- [Sound Mixing](https://github.com/id-software/quake/blob/master/QW/client/snd_mix.c): `QW/client/snd_mix.c`

### Platform I/O

- [UDP Transport](https://github.com/id-software/quake/blob/master/QW/client/net_udp.c): `QW/client/net_udp.c`
- [Audio Device](https://github.com/id-software/quake/blob/master/QW/client/snd_linux.c): `QW/client/snd_linux.c`
- [Display Device](https://github.com/id-software/quake/blob/master/QW/client/vid.h): `QW/client/vid.h`

### Other components

- **Player**

## Connections

- Player → Input Commands: provides input
- Input Commands → Client Control: builds commands
- Client Control → Client Networking: sends commands
- Client Networking → UDP Transport: transmits packets
- UDP Transport → Server Networking: delivers packets
- Server Networking → Client Commands: dispatches commands
- Server Control → World Physics: runs simulation
- World Physics → World Collision: checks collisions
- World Physics → Game Script VM: executes game logic
- Server Control → State Broadcast: sends state
- State Broadcast → Server Networking: queues updates
- Server Networking → UDP Transport: transmits updates
- UDP Transport → Client Networking: delivers updates
- Client Networking → State Parsing: dispatches messages
- State Parsing → Entity Updates: updates entities
- Client Control → Software Renderer: renders frame
- Client Control → OpenGL Renderer: renders frame
- Software Renderer → Screen and HUD: draws view
- OpenGL Renderer → Screen and HUD: draws view
- Screen and HUD → Display Device: presents frame
- Client Control → Sound Mixing: updates audio
- Sound Mixing → Audio Device: outputs sound
- Demo Playback → State Parsing: replays messages
