# paxy484/vernichtung architecture

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

- Interactive diagram: https://gitdiagram.com/paxy484/vernichtung
- Repository: https://github.com/paxy484/vernichtung

## Overview

Vernichtung is a portable C/SDL2 2.5D game engine rebuilding classic Doom-style gameplay and rendering while removing several legacy limits. Its principal flow is launching with IWAD/PWAD assets, loading map and visual resources, then running gameplay updates and BSP rendering; music is a parallel asset-to-audio path with MUS-to-MIDI translation and optional FluidSynth. The sampled excerpts show archive queries from rendering and module hooks in the main entry point, but do not expose the full loop calls, so uncertain wiring is marked dashed or omitted.

Main entry points: [`src/main.c`](https://github.com/paxy484/vernichtung/blob/main/src/main.c) (Engine Loop), [`src/i_music.c`](https://github.com/paxy484/vernichtung/blob/main/src/i_music.c) (Music Subsystem), [`src/u_archive.c`](https://github.com/paxy484/vernichtung/blob/main/src/u_archive.c) (WAD Archive Loading), [`include/untergangtype.h`](https://github.com/paxy484/vernichtung/blob/main/include/untergangtype.h) (Runtime Types)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_engine["Engine Runtime"]
  node_main["Engine Loop<br/>[main.c]"]
  node_types["Runtime Types<br/>[untergangtype.h]"]
  node_defs["Game Constants<br/>[untergangdef.h]"]
  node_physics["Player Physics<br/>[p_physics.c]"]
end

subgraph group_world["World and Rendering"]
  node_renderer["BSP Renderer<br/>[r_main.c]"]
end

subgraph group_media["Assets and Audio"]
  node_archive[("WAD Archive Loading<br/>[u_archive.c]")]
  node_music["Music Subsystem<br/>[i_music.c]"]
  node_translator["MUS to MIDI<br/>[mus2mid.c]"]
  node_music_api["Music API<br/>[i_music.h]"]
  node_midi_api["Translator API<br/>[mus2mid.h]"]
end

subgraph group_platform["Platform I/O"]
  node_input["Input Handling<br/>[i_input.c]"]
  node_video["Framebuffer and Title<br/>[i_video.c]"]
end

node_player(("Player"))
node_iwad["IWAD / PWAD Files"]
node_sdl["SDL2"]
node_fluidsynth["FluidSynth"]

node_player -->|"launches"| node_main
node_main -->|"loads archives"| node_iwad
node_main -.->|"invokes loaders"| node_archive
node_main -.->|"dispatches input"| node_input
node_main -.->|"updates movement"| node_physics
node_main -.->|"requests rendering"| node_renderer
node_main -.->|"starts music"| node_music
node_main -.->|"uses display"| node_video
node_renderer -->|"fetches textures"| node_archive
node_archive -->|"reads lumps"| node_iwad
node_video -->|"reads title lump"| node_iwad
node_archive -->|"fills palette"| node_video
node_music -->|"translates music"| node_translator
node_music -->|"loads dynamically"| node_fluidsynth
node_music -->|"opens audio"| node_sdl
node_main -->|"runs platform"| node_sdl
node_input -->|"uses state"| node_types
node_physics -->|"uses world state"| node_types
node_renderer -->|"reads geometry"| node_types
node_archive -->|"populates assets"| node_types
node_types -->|"includes constants"| node_defs
node_music -.->|"implements API"| node_music_api
node_translator -.->|"implements API"| node_midi_api

click node_main "https://github.com/paxy484/vernichtung/blob/main/src/main.c"
click node_types "https://github.com/paxy484/vernichtung/blob/main/include/untergangtype.h"
click node_defs "https://github.com/paxy484/vernichtung/blob/main/include/untergangdef.h"
click node_input "https://github.com/paxy484/vernichtung/blob/main/src/i_input.c"
click node_physics "https://github.com/paxy484/vernichtung/blob/main/src/p_physics.c"
click node_renderer "https://github.com/paxy484/vernichtung/blob/main/src/r_main.c"
click node_video "https://github.com/paxy484/vernichtung/blob/main/src/i_video.c"
click node_archive "https://github.com/paxy484/vernichtung/blob/main/src/u_archive.c"
click node_music "https://github.com/paxy484/vernichtung/blob/main/src/i_music.c"
click node_translator "https://github.com/paxy484/vernichtung/blob/main/src/mus2mid.c"
click node_music_api "https://github.com/paxy484/vernichtung/blob/main/include/i_music.h"
click node_midi_api "https://github.com/paxy484/vernichtung/blob/main/include/mus2mid.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_main,node_types,node_defs,node_physics toneBlue
class node_renderer toneAmber
class node_archive,node_music,node_translator,node_music_api,node_midi_api toneMint
class node_input,node_video toneRose
class node_player,node_iwad,node_sdl,node_fluidsynth toneIndigo
```

## Components

### Engine Runtime

- [Engine Loop](https://github.com/paxy484/vernichtung/blob/main/src/main.c): `src/main.c`
- [Runtime Types](https://github.com/paxy484/vernichtung/blob/main/include/untergangtype.h): `include/untergangtype.h`
- [Game Constants](https://github.com/paxy484/vernichtung/blob/main/include/untergangdef.h): `include/untergangdef.h`
- [Player Physics](https://github.com/paxy484/vernichtung/blob/main/src/p_physics.c): `src/p_physics.c`

### World and Rendering

- [BSP Renderer](https://github.com/paxy484/vernichtung/blob/main/src/r_main.c): `src/r_main.c`

### Assets and Audio

- [WAD Archive Loading](https://github.com/paxy484/vernichtung/blob/main/src/u_archive.c): `src/u_archive.c`
- [Music Subsystem](https://github.com/paxy484/vernichtung/blob/main/src/i_music.c): `src/i_music.c`
- [MUS to MIDI](https://github.com/paxy484/vernichtung/blob/main/src/mus2mid.c): `src/mus2mid.c`
- [Music API](https://github.com/paxy484/vernichtung/blob/main/include/i_music.h): `include/i_music.h`
- [Translator API](https://github.com/paxy484/vernichtung/blob/main/include/mus2mid.h): `include/mus2mid.h`

### Platform I/O

- [Input Handling](https://github.com/paxy484/vernichtung/blob/main/src/i_input.c): `src/i_input.c`
- [Framebuffer and Title](https://github.com/paxy484/vernichtung/blob/main/src/i_video.c): `src/i_video.c`

### Other components

- **Player**
- **IWAD / PWAD Files**
- **SDL2**
- **FluidSynth**

## Connections

- Player → Engine Loop: launches (evidence: `README.adoc`)
- Engine Loop → IWAD / PWAD Files: loads archives (evidence: `src/main.c`)
- Engine Loop → WAD Archive Loading: invokes loaders
- Engine Loop → Input Handling: dispatches input
- Engine Loop → Player Physics: updates movement
- Engine Loop → BSP Renderer: requests rendering
- Engine Loop → Music Subsystem: starts music
- Engine Loop → Framebuffer and Title: uses display
- BSP Renderer → WAD Archive Loading: fetches textures (evidence: `src/r_main.c`)
- WAD Archive Loading → IWAD / PWAD Files: reads lumps (evidence: `src/u_archive.c`)
- Framebuffer and Title → IWAD / PWAD Files: reads title lump (evidence: `src/i_video.c`)
- WAD Archive Loading → Framebuffer and Title: fills palette (evidence: `src/u_archive.c`)
- Music Subsystem → MUS to MIDI: translates music (evidence: `README.adoc`)
- Music Subsystem → FluidSynth: loads dynamically
- Music Subsystem → SDL2: opens audio (evidence: `src/i_music.c`)
- Engine Loop → SDL2: runs platform (evidence: `README.adoc`)
- Input Handling → Runtime Types: uses state (evidence: `src/i_input.c`)
- Player Physics → Runtime Types: uses world state (evidence: `src/p_physics.c`)
- BSP Renderer → Runtime Types: reads geometry (evidence: `src/r_main.c`)
- WAD Archive Loading → Runtime Types: populates assets (evidence: `src/u_archive.c`)
- Runtime Types → Game Constants: includes constants (evidence: `include/untergangtype.h`)
- Music Subsystem → Music API: implements API (evidence: `src/i_music.c`)
- MUS to MIDI → Translator API: implements API (evidence: `src/mus2mid.c`)
