# athindram/summoners-sim architecture

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

- Interactive diagram: https://gitdiagram.com/athindram/summoners-sim
- Repository: https://github.com/athindram/summoners-sim

## Overview

Summoner’s Sim is a desktop physics simulator for champion battles. The main loop loads champion definitions, creates Darius and Garen, advances movement, collisions, combat, regeneration, and abilities on a fixed timestep, then draws the fighters, ability effects, stats, and result. Pressing R resets the fight. The graph separates champion data and abilities from simulation and rendering. The excerpts show the main orchestration and champion registration; some implementation details of ability dispatch, combat, and physics were not shown, so those internal call relationships are omitted.

Main entry points: [`src/main.cpp`](https://github.com/athindram/summoners-sim/blob/main/src/main.cpp) (Battle Loop), [`src/champion_defs.cpp`](https://github.com/athindram/summoners-sim/blob/main/src/champion_defs.cpp) (Champion Registry), [`src/champions/darius.h`](https://github.com/athindram/summoners-sim/blob/main/src/champions/darius.h) (Darius Passive), [`src/combat.cpp`](https://github.com/athindram/summoners-sim/blob/main/src/combat.cpp) (Combat Rules)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_main["Battle Loop<br/>[main.cpp]"]
end

subgraph group_champions["Champion Model"]
  node_definitions["Champion Registry<br/>[champion_defs.cpp]"]
  node_champion["Fighter State<br/>[champion.h]"]
  node_ability["Ability Framework<br/>[ability.cpp]"]
  node_darius["Darius Passive<br/>[darius.h]"]
  node_garen["Garen Passive<br/>[garen.h]"]
end

subgraph group_simulation["Battle Simulation"]
  node_physics["Movement Physics<br/>[physics.cpp]"]
  node_combat["Combat Rules<br/>[combat.cpp]"]
end

subgraph group_presentation["Presentation"]
  node_ui["Stats Panels<br/>[ui.cpp]"]
end

node_player(("Player"))

node_player -->|"starts or resets"| node_main
node_main -->|"loads fighters"| node_definitions
node_main -->|"creates and draws"| node_champion
node_definitions -->|"registers passive"| node_darius
node_definitions -->|"registers passive"| node_garen
node_main -->|"advances collisions"| node_physics
node_main -->|"ticks combat"| node_combat
node_main -->|"ticks and draws"| node_ability
node_main -->|"draws stats"| node_ui
node_darius -->|"deals bleed damage"| node_combat

click node_main "https://github.com/athindram/summoners-sim/blob/main/src/main.cpp"
click node_definitions "https://github.com/athindram/summoners-sim/blob/main/src/champion_defs.cpp"
click node_champion "https://github.com/athindram/summoners-sim/blob/main/src/champion.h"
click node_ability "https://github.com/athindram/summoners-sim/blob/main/src/ability.cpp"
click node_darius "https://github.com/athindram/summoners-sim/blob/main/src/champions/darius.h"
click node_garen "https://github.com/athindram/summoners-sim/blob/main/src/champions/garen.h"
click node_physics "https://github.com/athindram/summoners-sim/blob/main/src/physics.cpp"
click node_combat "https://github.com/athindram/summoners-sim/blob/main/src/combat.cpp"
click node_ui "https://github.com/athindram/summoners-sim/blob/main/src/ui.cpp"

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 toneBlue
class node_definitions,node_champion,node_ability,node_darius,node_garen toneAmber
class node_physics,node_combat toneMint
class node_ui toneRose
class node_player toneIndigo
```

## Components

### Application

- [Battle Loop](https://github.com/athindram/summoners-sim/blob/main/src/main.cpp): `src/main.cpp`

### Champion Model

- [Champion Registry](https://github.com/athindram/summoners-sim/blob/main/src/champion_defs.cpp): `src/champion_defs.cpp`
- [Fighter State](https://github.com/athindram/summoners-sim/blob/main/src/champion.h): `src/champion.h`
- [Ability Framework](https://github.com/athindram/summoners-sim/blob/main/src/ability.cpp): `src/ability.cpp`
- [Darius Passive](https://github.com/athindram/summoners-sim/blob/main/src/champions/darius.h): `src/champions/darius.h`
- [Garen Passive](https://github.com/athindram/summoners-sim/blob/main/src/champions/garen.h): `src/champions/garen.h`

### Battle Simulation

- [Movement Physics](https://github.com/athindram/summoners-sim/blob/main/src/physics.cpp): `src/physics.cpp`
- [Combat Rules](https://github.com/athindram/summoners-sim/blob/main/src/combat.cpp): `src/combat.cpp`

### Presentation

- [Stats Panels](https://github.com/athindram/summoners-sim/blob/main/src/ui.cpp): `src/ui.cpp`

### Other components

- **Player**

## Connections

- Player → Battle Loop: starts or resets (evidence: `src/main.cpp`)
- Battle Loop → Champion Registry: loads fighters (evidence: `src/main.cpp`)
- Battle Loop → Fighter State: creates and draws (evidence: `src/main.cpp`)
- Champion Registry → Darius Passive: registers passive (evidence: `src/champion_defs.cpp`)
- Champion Registry → Garen Passive: registers passive (evidence: `src/champion_defs.cpp`)
- Battle Loop → Movement Physics: advances collisions (evidence: `src/main.cpp`)
- Battle Loop → Combat Rules: ticks combat (evidence: `src/main.cpp`)
- Battle Loop → Ability Framework: ticks and draws (evidence: `src/main.cpp`)
- Battle Loop → Stats Panels: draws stats (evidence: `src/main.cpp`)
- Darius Passive → Combat Rules: deals bleed damage (evidence: `src/champions/darius.h`)
