# w0termel0n/spellslinger architecture

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

- Interactive diagram: https://gitdiagram.com/w0termel0n/spellslinger
- Repository: https://github.com/w0termel0n/spellslinger

## Overview

SpellSlinger combines rune drawing and dataset contribution with a spell-combat game. In rune identification, a drawn stroke is classified by the CNN and checked against a geometric template; in the game, recognized spells are subject to gameplay rules and effects. The tree and excerpts establish the GUI, model, validator, spell definitions, and game modules, but the README is empty and much of the game implementation is unsampled, so uncertain runtime dispatches are omitted or marked unverified.

Main entry points: [`src/run_game.py`](https://github.com/w0termel0n/spellslinger/blob/main/src/run_game.py) (Game runtime), [`draw_gui.py`](https://github.com/w0termel0n/spellslinger/blob/main/draw_gui.py) (Rune drawer), [`src/model.py`](https://github.com/w0termel0n/spellslinger/blob/main/src/model.py) (Rune CNN), [`src/spell_list.py`](https://github.com/w0termel0n/spellslinger/blob/main/src/spell_list.py) (Spell attributes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runes["Rune authoring"]
  node_gui_entry["GUI launcher<br/>[run.py]"]
  node_rune_gui["Rune drawer<br/>[draw_gui.py]"]
  node_dataset[("Rune samples")]
end

subgraph group_recognition["Rune recognition"]
  node_trainer_entry["Training launcher<br/>[run_training.py]"]
  node_model["Rune CNN<br/>[model.py]"]
  node_validator["Path validator<br/>[validator.py]"]
end

subgraph group_combat["Combat runtime"]
  node_game["Game runtime<br/>[run_game.py]"]
end

subgraph group_domain["Spell domain"]
  node_spell_factory["Spell factory<br/>[spell.py]"]
  node_spell_data["Spell attributes<br/>[spell_list.py]"]
  node_spell_names["Spell labels<br/>[spells.py]"]
  node_effects["Effect handlers<br/>[effects.py]"]
end

node_user(("User"))

node_user -->|"launches"| node_gui_entry
node_gui_entry -->|"creates"| node_rune_gui
node_rune_gui -->|"loads and predicts"| node_model
node_rune_gui -->|"validates strokes"| node_validator
node_rune_gui -->|"maps predictions"| node_spell_names
node_rune_gui -->|"reads and writes samples"| node_dataset
node_user -->|"starts training"| node_trainer_entry
node_trainer_entry -->|"trains"| node_model
node_model -->|"loads images"| node_dataset
node_user -.->|"plays"| node_game
node_game -->|"creates spells"| node_spell_factory
node_game -->|"supplies spell data"| node_spell_data
node_game -.->|"checks rune paths"| node_validator
node_game -.->|"maps predictions"| node_spell_names
node_game -.->|"dispatches effects"| node_effects
node_spell_factory -->|"constructs from"| node_spell_data
node_effects -->|"reads spell names"| node_spell_data

click node_gui_entry "https://github.com/w0termel0n/spellslinger/blob/main/run.py"
click node_rune_gui "https://github.com/w0termel0n/spellslinger/blob/main/draw_gui.py"
click node_dataset "https://github.com/w0termel0n/spellslinger/tree/main/dataset"
click node_trainer_entry "https://github.com/w0termel0n/spellslinger/blob/main/run_training.py"
click node_model "https://github.com/w0termel0n/spellslinger/blob/main/src/model.py"
click node_validator "https://github.com/w0termel0n/spellslinger/blob/main/src/validator.py"
click node_game "https://github.com/w0termel0n/spellslinger/blob/main/src/run_game.py"
click node_spell_factory "https://github.com/w0termel0n/spellslinger/blob/main/src/spell.py"
click node_spell_data "https://github.com/w0termel0n/spellslinger/blob/main/src/spell_list.py"
click node_spell_names "https://github.com/w0termel0n/spellslinger/blob/main/src/spells.py"
click node_effects "https://github.com/w0termel0n/spellslinger/blob/main/src/effects.py"

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_gui_entry,node_rune_gui,node_dataset,node_user toneBlue
class node_trainer_entry,node_model,node_validator toneAmber
class node_game toneMint
class node_spell_factory,node_spell_data,node_spell_names,node_effects toneRose
```

## Components

### Rune authoring

- [GUI launcher](https://github.com/w0termel0n/spellslinger/blob/main/run.py): `run.py`
- [Rune drawer](https://github.com/w0termel0n/spellslinger/blob/main/draw_gui.py): `draw_gui.py`
- [Rune samples](https://github.com/w0termel0n/spellslinger/tree/main/dataset): `dataset`

### Rune recognition

- [Training launcher](https://github.com/w0termel0n/spellslinger/blob/main/run_training.py): `run_training.py`
- [Rune CNN](https://github.com/w0termel0n/spellslinger/blob/main/src/model.py): `src/model.py`
- [Path validator](https://github.com/w0termel0n/spellslinger/blob/main/src/validator.py): `src/validator.py`

### Combat runtime

- [Game runtime](https://github.com/w0termel0n/spellslinger/blob/main/src/run_game.py): `src/run_game.py`

### Spell domain

- [Spell factory](https://github.com/w0termel0n/spellslinger/blob/main/src/spell.py): `src/spell.py`
- [Spell attributes](https://github.com/w0termel0n/spellslinger/blob/main/src/spell_list.py): `src/spell_list.py`
- [Spell labels](https://github.com/w0termel0n/spellslinger/blob/main/src/spells.py): `src/spells.py`
- [Effect handlers](https://github.com/w0termel0n/spellslinger/blob/main/src/effects.py): `src/effects.py`

### Other components

- **User**

## Connections

- User → GUI launcher: launches (evidence: `run.py`)
- GUI launcher → Rune drawer: creates (evidence: `run.py`)
- Rune drawer → Rune CNN: loads and predicts (evidence: `draw_gui.py`)
- Rune drawer → Path validator: validates strokes (evidence: `draw_gui.py`)
- Rune drawer → Spell labels: maps predictions (evidence: `draw_gui.py`)
- Rune drawer → Rune samples: reads and writes samples (evidence: `draw_gui.py`)
- User → Training launcher: starts training (evidence: `run_training.py`)
- Training launcher → Rune CNN: trains (evidence: `run_training.py`)
- Rune CNN → Rune samples: loads images (evidence: `src/model.py`)
- User → Game runtime: plays
- Game runtime → Spell factory: creates spells (evidence: `src/run_game.py`)
- Game runtime → Spell attributes: supplies spell data (evidence: `src/run_game.py`)
- Game runtime → Path validator: checks rune paths (evidence: `src/run_game.py`)
- Game runtime → Spell labels: maps predictions (evidence: `src/run_game.py`)
- Game runtime → Effect handlers: dispatches effects (evidence: `src/run_game.py`)
- Spell factory → Spell attributes: constructs from (evidence: `src/spell.py`)
- Effect handlers → Spell attributes: reads spell names (evidence: `src/effects.py`)
