How cryptocode/terminal-doom works
Terminal Doom adapts the Doom engine for play in modern terminals: the engine advances gameplay and produces pixel frames, while the terminal-facing layer presents them and handles input. The README documents libvaxis as the renderer/input handler and miniaudio as the playback backend; the source tree shown here contains the Doom engine and miniaudio bridge, but not the Zig application layer. Gameplay, rendering, WAD resources, menus, and sound are represented as distinct subsystems. Some connections are documented only in the README or inferred from SOURCE INDEX references; unsampled implementation details are not assumed.
Main entry points: g_game.c Game state · w_wad.c WAD resources · d_main.c Engine startup · d_loop.c Doom loop
Components 18
Engine runtime
- Engine startup
src/doomgeneric/d_main.c - Doom loop
src/doomgeneric/d_loop.c
Gameplay
- Game state
src/doomgeneric/g_game.c - Level setup
src/doomgeneric/p_setup.c - World simulation
src/doomgeneric/p_tick.c - Combat and AI
src/doomgeneric/p_enemy.c - Save and load
src/doomgeneric/p_saveg.c
Rendering and UI
- Menus and options
src/doomgeneric/m_menu.c - HUD and status
src/doomgeneric/st_stuff.c - World renderer
src/doomgeneric/r_main.c - Pixel buffer
src/doomgeneric/v_video.c
Game resources
- WAD resources
src/doomgeneric/w_wad.c
Sound playback
- Sound interface
src/doomgeneric/s_sound.c - Miniaudio bridge
src/miniaudio/doom_miniaudio_sound_bridge.c - Miniaudio
src/miniaudio/miniaudio.h
Other components
- Player
- Terminal app
- libvaxis
Connections 19
- Player → Terminal app: provides input
- Terminal app → libvaxis: uses for input
- libvaxis → Terminal app: renders frames
- Engine startup → Doom loop: starts
- Engine startup → WAD resources: loads resources
src/doomgeneric/d_main.c - Engine startup → Sound interface: initializes sound
src/doomgeneric/d_main.c - Doom loop → Game state: ticks game
- Game state → Level setup: sets up levels
src/doomgeneric/g_game.c - Game state → Save and load: saves and loads
src/doomgeneric/g_game.c - Level setup → WAD resources: reads map data
- World simulation → Combat and AI: updates actors
- Game state → Menus and options: handles events
src/doomgeneric/g_game.c - World renderer → WAD resources: reads graphics
- World renderer → Pixel buffer: draws pixels
- Doom loop → Terminal app: presents each frame
- Terminal app → Pixel buffer: encodes frame
- Sound interface → Miniaudio bridge: dispatches playback
- Miniaudio bridge → WAD resources: reads sound data
src/miniaudio/doom_miniaudio_sound_bridge.c - Miniaudio bridge → Miniaudio: uses playback API
src/miniaudio/doom_miniaudio_sound_bridge.c