# sulkasormi/frogcomposband architecture

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

- Interactive diagram: https://gitdiagram.com/sulkasormi/frogcomposband
- Repository: https://github.com/sulkasormi/frogcomposband

## Overview

FrogComposband is a single-player roguelike game: a player starts the program, creates or loads a character, explores procedurally generated dungeons, and interacts through terminal or graphical front ends. The source tree shows distinct gameplay areas for commands and combat, magic, monsters, items, and dungeon generation, alongside persistence and shared game state. The excerpts and README establish the product and some module responsibilities, but do not expose the full gameplay loop; unverified runtime connections are therefore dashed and uncited.

Main entry points: [`src/cmd1.c`](https://github.com/sulkasormi/frogcomposband/blob/master/src/cmd1.c) (Player commands), [`src/main.c`](https://github.com/sulkasormi/frogcomposband/blob/master/src/main.c) (Game entry), [`src/dungeon.c`](https://github.com/sulkasormi/frogcomposband/blob/master/src/dungeon.c) (Dungeon generation), [`src/object2.c`](https://github.com/sulkasormi/frogcomposband/blob/master/src/object2.c) (Object system)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and display"]
  node_launcher["Game entry<br/>[main.c]"]
  node_terminal["Terminal UI<br/>[z-term.c]"]
  node_platform["Platform drivers<br/>[main-sdl.c]"]
end

subgraph group_world["World and combat"]
  node_commands["Player commands<br/>[cmd1.c]"]
  node_dungeon["Dungeon generation<br/>[dungeon.c]"]
  node_rooms["Room generation<br/>[rooms.c]"]
  node_combat["Melee combat<br/>[melee2.c]"]
  node_monsters["Monster spells<br/>[monspell.c]"]
  node_effects["Game effects<br/>[gf.c]"]
end

subgraph group_character["Character systems"]
  node_character["Character creation<br/>[py_birth.c]"]
  node_classes["Classes and races<br/>[classes.c]"]
  node_spells["Spell systems<br/>[do-spell.c]"]
  node_equipment["Equipment<br/>[equip.c]"]
  node_objects["Object system<br/>[object2.c]"]
end

subgraph group_shared["Shared services"]
  node_save["Save and load<br/>[save.c]"]
  node_state["Game state definitions<br/>[defines.h]"]
  node_inventory["Inventory API<br/>[inv.h]"]
  node_documentation["Document API<br/>[z-doc.h]"]
  node_generation_api["Generation API<br/>[generate.h]"]
end

node_player(("Player"))

node_player -.->|"starts game"| node_launcher
node_launcher -.->|"selects driver"| node_platform
node_player -.->|"creates character"| node_character
node_launcher -.->|"starts session"| node_character
node_character -.->|"chooses options"| node_classes
node_commands -.->|"explores"| node_dungeon
node_dungeon -.->|"builds rooms"| node_rooms
node_dungeon -.->|"uses API"| node_generation_api
node_commands -.->|"attacks"| node_combat
node_combat -.->|"fights"| node_monsters
node_commands -.->|"casts spells"| node_spells
node_spells -.->|"applies effects"| node_effects
node_commands -.->|"uses items"| node_objects
node_objects -.->|"uses inventory"| node_inventory
node_objects -.->|"equips items"| node_equipment
node_launcher -.->|"displays game"| node_terminal
node_commands -.->|"renders prompts"| node_terminal
node_launcher -.->|"loads or saves"| node_save
node_commands -.->|"updates state"| node_state
node_commands -.->|"renders help"| node_documentation

click node_launcher "https://github.com/sulkasormi/frogcomposband/blob/master/src/main.c"
click node_terminal "https://github.com/sulkasormi/frogcomposband/blob/master/src/z-term.c"
click node_platform "https://github.com/sulkasormi/frogcomposband/blob/master/src/main-sdl.c"
click node_commands "https://github.com/sulkasormi/frogcomposband/blob/master/src/cmd1.c"
click node_dungeon "https://github.com/sulkasormi/frogcomposband/blob/master/src/dungeon.c"
click node_rooms "https://github.com/sulkasormi/frogcomposband/blob/master/src/rooms.c"
click node_combat "https://github.com/sulkasormi/frogcomposband/blob/master/src/melee2.c"
click node_monsters "https://github.com/sulkasormi/frogcomposband/blob/master/src/monspell.c"
click node_effects "https://github.com/sulkasormi/frogcomposband/blob/master/src/gf.c"
click node_character "https://github.com/sulkasormi/frogcomposband/blob/master/src/py_birth.c"
click node_classes "https://github.com/sulkasormi/frogcomposband/blob/master/src/classes.c"
click node_spells "https://github.com/sulkasormi/frogcomposband/blob/master/src/do-spell.c"
click node_equipment "https://github.com/sulkasormi/frogcomposband/blob/master/src/equip.c"
click node_objects "https://github.com/sulkasormi/frogcomposband/blob/master/src/object2.c"
click node_save "https://github.com/sulkasormi/frogcomposband/blob/master/src/save.c"
click node_state "https://github.com/sulkasormi/frogcomposband/blob/master/src/defines.h"
click node_inventory "https://github.com/sulkasormi/frogcomposband/blob/master/src/inv.h"
click node_documentation "https://github.com/sulkasormi/frogcomposband/blob/master/src/z-doc.h"
click node_generation_api "https://github.com/sulkasormi/frogcomposband/blob/master/src/generate.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_launcher,node_terminal,node_platform toneBlue
class node_commands,node_dungeon,node_rooms,node_combat,node_monsters,node_effects toneAmber
class node_character,node_classes,node_spells,node_equipment,node_objects toneMint
class node_save,node_state,node_inventory,node_documentation,node_generation_api toneRose
class node_player toneIndigo
```

## Components

### Entry and display

- [Game entry](https://github.com/sulkasormi/frogcomposband/blob/master/src/main.c): `src/main.c`
- [Terminal UI](https://github.com/sulkasormi/frogcomposband/blob/master/src/z-term.c): `src/z-term.c`
- [Platform drivers](https://github.com/sulkasormi/frogcomposband/blob/master/src/main-sdl.c): `src/main-sdl.c`

### World and combat

- [Player commands](https://github.com/sulkasormi/frogcomposband/blob/master/src/cmd1.c): `src/cmd1.c`
- [Dungeon generation](https://github.com/sulkasormi/frogcomposband/blob/master/src/dungeon.c): `src/dungeon.c`
- [Room generation](https://github.com/sulkasormi/frogcomposband/blob/master/src/rooms.c): `src/rooms.c`
- [Melee combat](https://github.com/sulkasormi/frogcomposband/blob/master/src/melee2.c): `src/melee2.c`
- [Monster spells](https://github.com/sulkasormi/frogcomposband/blob/master/src/monspell.c): `src/monspell.c`
- [Game effects](https://github.com/sulkasormi/frogcomposband/blob/master/src/gf.c): `src/gf.c`

### Character systems

- [Character creation](https://github.com/sulkasormi/frogcomposband/blob/master/src/py_birth.c): `src/py_birth.c`
- [Classes and races](https://github.com/sulkasormi/frogcomposband/blob/master/src/classes.c): `src/classes.c`
- [Spell systems](https://github.com/sulkasormi/frogcomposband/blob/master/src/do-spell.c): `src/do-spell.c`
- [Equipment](https://github.com/sulkasormi/frogcomposband/blob/master/src/equip.c): `src/equip.c`
- [Object system](https://github.com/sulkasormi/frogcomposband/blob/master/src/object2.c): `src/object2.c`

### Shared services

- [Save and load](https://github.com/sulkasormi/frogcomposband/blob/master/src/save.c): `src/save.c`
- [Game state definitions](https://github.com/sulkasormi/frogcomposband/blob/master/src/defines.h): `src/defines.h`
- [Inventory API](https://github.com/sulkasormi/frogcomposband/blob/master/src/inv.h): `src/inv.h`
- [Document API](https://github.com/sulkasormi/frogcomposband/blob/master/src/z-doc.h): `src/z-doc.h`
- [Generation API](https://github.com/sulkasormi/frogcomposband/blob/master/src/generate.h): `src/generate.h`

### Other components

- **Player**

## Connections

- Player → Game entry: starts game
- Game entry → Platform drivers: selects driver (evidence: `src/main.c`)
- Player → Character creation: creates character
- Game entry → Character creation: starts session
- Character creation → Classes and races: chooses options
- Player commands → Dungeon generation: explores
- Dungeon generation → Room generation: builds rooms
- Dungeon generation → Generation API: uses API (evidence: `src/dungeon.c`)
- Player commands → Melee combat: attacks
- Melee combat → Monster spells: fights
- Player commands → Spell systems: casts spells
- Spell systems → Game effects: applies effects
- Player commands → Object system: uses items
- Object system → Inventory API: uses inventory
- Object system → Equipment: equips items
- Game entry → Terminal UI: displays game
- Player commands → Terminal UI: renders prompts
- Game entry → Save and load: loads or saves
- Player commands → Game state definitions: updates state
- Player commands → Document API: renders help
