# tmm64/quake2-full-momen architecture

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

- Interactive diagram: https://gitdiagram.com/tmm64/quake2-full-momen
- Repository: https://github.com/tmm64/quake2-full-momen

## Overview

Quake II is a networked first-person game: a player sends input through the client, the server advances the level and game rules, and updated state returns to the client for presentation. Its product includes single-player and multiplayer play, game modes including CTF, menus and console, audio, and both OpenGL and software rendering. The tree shows platform-specific system and device implementations. The excerpts are partial, so the graph reflects documented structure and source-supported interfaces; some subsystem wiring is intentionally omitted where it could not be verified.

Main entry points: [`game/g_main.c`](https://github.com/tmm64/quake2-full-momen/blob/master/game/g_main.c) (Game Rules), [`client/cl_main.c`](https://github.com/tmm64/quake2-full-momen/blob/master/client/cl_main.c) (Client Runtime), [`qcommon/net_chan.c`](https://github.com/tmm64/quake2-full-momen/blob/master/qcommon/net_chan.c) (Network Channels), [`client/cl_scrn.c`](https://github.com/tmm64/quake2-full-momen/blob/master/client/cl_scrn.c) (Screen and HUD)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client"]
  node_client_main["Client Runtime<br/>[cl_main.c]"]
  node_client_input["Input<br/>[cl_input.c]"]
  node_client_parse["Server State Parsing<br/>[cl_parse.c]"]
  node_client_screen["Screen and HUD<br/>[cl_scrn.c]"]
  node_client_menu["Menus and Console<br/>[menu.c]"]
end

subgraph group_server["Server and Game"]
  node_server_main["Server Runtime<br/>[sv_main.c]"]
  node_server_user["Client Commands<br/>[sv_user.c]"]
  node_server_entities["Entity Updates<br/>[sv_ents.c]"]
  node_server_game["Game Interface<br/>[sv_game.c]"]
  node_game_main["Game Rules<br/>[g_main.c]"]
  node_game_client["Player Lifecycle<br/>[p_client.c]"]
  node_game_world["World and Physics<br/>[g_phys.c]"]
  node_game_combat["Combat and Items<br/>[g_combat.c]"]
  node_game_monsters["Monsters and AI<br/>[g_monster.c]"]
  node_ctf["CTF Mode<br/>[g_ctf.c]"]
end

subgraph group_shared["Shared Runtime"]
  node_network["Network Channels<br/>[net_chan.c]"]
  node_commands["Commands and Config<br/>[cmd.c]"]
  node_collision["Map Collision<br/>[cmodel.c]"]
end

subgraph group_presentation["Presentation and Platform"]
  node_renderer_gl["OpenGL Renderer<br/>[gl_rmain.c]"]
  node_renderer_soft["Software Renderer<br/>[r_main.c]"]
  node_sound["Client Audio<br/>[snd_mix.c]"]
  node_platform["Platform I/O<br/>[sys_linux.c]"]
end

node_player(("Player"))
node_network_peer(("Remote Peer"))

node_player -->|"provides input"| node_client_input
node_player -->|"uses menus"| node_client_menu
node_client_input -->|"submits commands"| node_client_main
node_client_main -->|"sends packets"| node_network
node_network_peer -->|"exchanges packets"| node_network
node_network -->|"delivers packets"| node_server_main
node_server_main -->|"dispatches commands"| node_server_user
node_server_user -->|"forwards input"| node_server_game
node_server_game -->|"calls game API"| node_game_main
node_game_main -->|"handles players"| node_game_client
node_game_main -->|"advances world"| node_game_world
node_game_main -->|"applies game rules"| node_game_combat
node_game_main -->|"updates monsters"| node_game_monsters
node_game_main -.->|"uses CTF rules"| node_ctf
node_game_world -->|"queries map"| node_collision
node_server_main -->|"builds updates"| node_server_entities
node_server_entities -->|"encodes state"| node_network
node_network -->|"delivers updates"| node_client_parse
node_client_parse -->|"updates client state"| node_client_main
node_client_main -->|"prepares presentation"| node_client_screen
node_client_screen -->|"submits scene"| node_renderer_gl
node_client_screen -.->|"submits scene"| node_renderer_soft
node_client_main -->|"updates audio"| node_sound
node_platform -->|"provides system services"| node_client_main

click node_client_main "https://github.com/tmm64/quake2-full-momen/blob/master/client/cl_main.c"
click node_client_input "https://github.com/tmm64/quake2-full-momen/blob/master/client/cl_input.c"
click node_client_parse "https://github.com/tmm64/quake2-full-momen/blob/master/client/cl_parse.c"
click node_client_screen "https://github.com/tmm64/quake2-full-momen/blob/master/client/cl_scrn.c"
click node_client_menu "https://github.com/tmm64/quake2-full-momen/blob/master/client/menu.c"
click node_server_main "https://github.com/tmm64/quake2-full-momen/blob/master/server/sv_main.c"
click node_server_user "https://github.com/tmm64/quake2-full-momen/blob/master/server/sv_user.c"
click node_server_entities "https://github.com/tmm64/quake2-full-momen/blob/master/server/sv_ents.c"
click node_server_game "https://github.com/tmm64/quake2-full-momen/blob/master/server/sv_game.c"
click node_game_main "https://github.com/tmm64/quake2-full-momen/blob/master/game/g_main.c"
click node_game_client "https://github.com/tmm64/quake2-full-momen/blob/master/game/p_client.c"
click node_game_world "https://github.com/tmm64/quake2-full-momen/blob/master/game/g_phys.c"
click node_game_combat "https://github.com/tmm64/quake2-full-momen/blob/master/game/g_combat.c"
click node_game_monsters "https://github.com/tmm64/quake2-full-momen/blob/master/game/g_monster.c"
click node_ctf "https://github.com/tmm64/quake2-full-momen/blob/master/ctf/g_ctf.c"
click node_network "https://github.com/tmm64/quake2-full-momen/blob/master/qcommon/net_chan.c"
click node_commands "https://github.com/tmm64/quake2-full-momen/blob/master/qcommon/cmd.c"
click node_collision "https://github.com/tmm64/quake2-full-momen/blob/master/qcommon/cmodel.c"
click node_renderer_gl "https://github.com/tmm64/quake2-full-momen/blob/master/ref_gl/gl_rmain.c"
click node_renderer_soft "https://github.com/tmm64/quake2-full-momen/blob/master/ref_soft/r_main.c"
click node_sound "https://github.com/tmm64/quake2-full-momen/blob/master/client/snd_mix.c"
click node_platform "https://github.com/tmm64/quake2-full-momen/blob/master/linux/sys_linux.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_client_main,node_client_input,node_client_parse,node_client_screen,node_client_menu toneBlue
class node_server_main,node_server_user,node_server_entities,node_server_game,node_game_main,node_game_client,node_game_world,node_game_combat,node_game_monsters,node_ctf toneAmber
class node_network,node_commands,node_collision toneMint
class node_renderer_gl,node_renderer_soft,node_sound,node_platform toneRose
class node_player,node_network_peer toneIndigo
```

## Components

### Client

- [Client Runtime](https://github.com/tmm64/quake2-full-momen/blob/master/client/cl_main.c): `client/cl_main.c`
- [Input](https://github.com/tmm64/quake2-full-momen/blob/master/client/cl_input.c): `client/cl_input.c`
- [Server State Parsing](https://github.com/tmm64/quake2-full-momen/blob/master/client/cl_parse.c): `client/cl_parse.c`
- [Screen and HUD](https://github.com/tmm64/quake2-full-momen/blob/master/client/cl_scrn.c): `client/cl_scrn.c`
- [Menus and Console](https://github.com/tmm64/quake2-full-momen/blob/master/client/menu.c): `client/menu.c`

### Server and Game

- [Server Runtime](https://github.com/tmm64/quake2-full-momen/blob/master/server/sv_main.c): `server/sv_main.c`
- [Client Commands](https://github.com/tmm64/quake2-full-momen/blob/master/server/sv_user.c): `server/sv_user.c`
- [Entity Updates](https://github.com/tmm64/quake2-full-momen/blob/master/server/sv_ents.c): `server/sv_ents.c`
- [Game Interface](https://github.com/tmm64/quake2-full-momen/blob/master/server/sv_game.c): `server/sv_game.c`
- [Game Rules](https://github.com/tmm64/quake2-full-momen/blob/master/game/g_main.c): `game/g_main.c`
- [Player Lifecycle](https://github.com/tmm64/quake2-full-momen/blob/master/game/p_client.c): `game/p_client.c`
- [World and Physics](https://github.com/tmm64/quake2-full-momen/blob/master/game/g_phys.c): `game/g_phys.c`
- [Combat and Items](https://github.com/tmm64/quake2-full-momen/blob/master/game/g_combat.c): `game/g_combat.c`
- [Monsters and AI](https://github.com/tmm64/quake2-full-momen/blob/master/game/g_monster.c): `game/g_monster.c`
- [CTF Mode](https://github.com/tmm64/quake2-full-momen/blob/master/ctf/g_ctf.c): `ctf/g_ctf.c`

### Shared Runtime

- [Network Channels](https://github.com/tmm64/quake2-full-momen/blob/master/qcommon/net_chan.c): `qcommon/net_chan.c`
- [Commands and Config](https://github.com/tmm64/quake2-full-momen/blob/master/qcommon/cmd.c): `qcommon/cmd.c`
- [Map Collision](https://github.com/tmm64/quake2-full-momen/blob/master/qcommon/cmodel.c): `qcommon/cmodel.c`

### Presentation and Platform

- [OpenGL Renderer](https://github.com/tmm64/quake2-full-momen/blob/master/ref_gl/gl_rmain.c): `ref_gl/gl_rmain.c`
- [Software Renderer](https://github.com/tmm64/quake2-full-momen/blob/master/ref_soft/r_main.c): `ref_soft/r_main.c`
- [Client Audio](https://github.com/tmm64/quake2-full-momen/blob/master/client/snd_mix.c): `client/snd_mix.c`
- [Platform I/O](https://github.com/tmm64/quake2-full-momen/blob/master/linux/sys_linux.c): `linux/sys_linux.c`

### Other components

- **Player**
- **Remote Peer**

## Connections

- Player → Input: provides input
- Player → Menus and Console: uses menus
- Input → Client Runtime: submits commands
- Client Runtime → Network Channels: sends packets
- Remote Peer → Network Channels: exchanges packets
- Network Channels → Server Runtime: delivers packets
- Server Runtime → Client Commands: dispatches commands
- Client Commands → Game Interface: forwards input
- Game Interface → Game Rules: calls game API
- Game Rules → Player Lifecycle: handles players
- Game Rules → World and Physics: advances world
- Game Rules → Combat and Items: applies game rules
- Game Rules → Monsters and AI: updates monsters
- Game Rules → CTF Mode: uses CTF rules
- World and Physics → Map Collision: queries map
- Server Runtime → Entity Updates: builds updates
- Entity Updates → Network Channels: encodes state
- Network Channels → Server State Parsing: delivers updates
- Server State Parsing → Client Runtime: updates client state
- Client Runtime → Screen and HUD: prepares presentation
- Screen and HUD → OpenGL Renderer: submits scene
- Screen and HUD → Software Renderer: submits scene
- Client Runtime → Client Audio: updates audio
- Platform I/O → Client Runtime: provides system services
