# teytra/rustvoidgame architecture

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

- Interactive diagram: https://gitdiagram.com/teytra/rustvoidgame
- Repository: https://github.com/teytra/rustvoidgame

## Overview

A small terminal RPG: the player creates a character, chooses rest, combat, statistics, or exit, and combat can award XP and level-ups. The main module owns the game loop and gameplay functions; Creature holds character state and scoring, while input.rs handles line input and pauses. README only identifies the product as a game, so the workflow is based on sampled source; no separate unsampled subsystems are shown.

Main entry points: [`src/main.rs`](https://github.com/teytra/rustvoidgame/blob/main/src/main.rs) (Game Loop), [`src/input.rs`](https://github.com/teytra/rustvoidgame/blob/main/src/input.rs) (Input Helpers), [`src/creature.rs`](https://github.com/teytra/rustvoidgame/blob/main/src/creature.rs) (Creature State)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_game["Gameplay"]
  node_game_loop["Game Loop<br/>[main.rs]"]
  node_combat["Combat<br/>[main.rs]"]
  node_rest["Rest<br/>[main.rs]"]
  node_statistics_exit["Stats and Exit<br/>[main.rs]"]
  node_xp_progression["XP Progression<br/>[main.rs]"]
end

subgraph group_domain["Character Model"]
  node_creature["Creature State<br/>[creature.rs]"]
end

subgraph group_io["Terminal I/O"]
  node_input["Input Helpers<br/>[input.rs]"]
end

node_player(("Player"))
node_terminal(("Terminal"))

node_player -->|"chooses actions"| node_game_loop
node_game_loop -->|"reads input"| node_input
node_input -->|"reads lines"| node_terminal
node_game_loop -->|"prints menu"| node_terminal
node_game_loop -->|"creates player"| node_creature
node_game_loop -->|"dispatches"| node_rest
node_game_loop -->|"dispatches"| node_combat
node_game_loop -->|"dispatches"| node_statistics_exit
node_rest -->|"updates health"| node_creature
node_rest -->|"waits"| node_input
node_combat -->|"reads choice"| node_input
node_combat -->|"waits"| node_input
node_combat -->|"creates enemy"| node_creature
node_combat -->|"calculates XP"| node_xp_progression
node_combat -->|"prints battle"| node_terminal
node_xp_progression -->|"updates stats"| node_creature
node_statistics_exit -->|"reads stats"| node_creature
node_statistics_exit -->|"waits"| node_input
node_statistics_exit -->|"prints details"| node_terminal
node_creature -.->|"score displayed by caller"| node_input

click node_game_loop "https://github.com/teytra/rustvoidgame/blob/main/src/main.rs"
click node_combat "https://github.com/teytra/rustvoidgame/blob/main/src/main.rs"
click node_rest "https://github.com/teytra/rustvoidgame/blob/main/src/main.rs"
click node_statistics_exit "https://github.com/teytra/rustvoidgame/blob/main/src/main.rs"
click node_xp_progression "https://github.com/teytra/rustvoidgame/blob/main/src/main.rs"
click node_creature "https://github.com/teytra/rustvoidgame/blob/main/src/creature.rs"
click node_input "https://github.com/teytra/rustvoidgame/blob/main/src/input.rs"

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_game_loop,node_combat,node_rest,node_statistics_exit,node_xp_progression toneBlue
class node_creature toneAmber
class node_input toneMint
class node_player,node_terminal toneIndigo
```

## Components

### Gameplay

- [Game Loop](https://github.com/teytra/rustvoidgame/blob/main/src/main.rs): `src/main.rs`
- [Combat](https://github.com/teytra/rustvoidgame/blob/main/src/main.rs): `src/main.rs`
- [Rest](https://github.com/teytra/rustvoidgame/blob/main/src/main.rs): `src/main.rs`
- [Stats and Exit](https://github.com/teytra/rustvoidgame/blob/main/src/main.rs): `src/main.rs`
- [XP Progression](https://github.com/teytra/rustvoidgame/blob/main/src/main.rs): `src/main.rs`

### Character Model

- [Creature State](https://github.com/teytra/rustvoidgame/blob/main/src/creature.rs): `src/creature.rs`

### Terminal I/O

- [Input Helpers](https://github.com/teytra/rustvoidgame/blob/main/src/input.rs): `src/input.rs`

### Other components

- **Player**
- **Terminal**

## Connections

- Player → Game Loop: chooses actions
- Game Loop → Input Helpers: reads input
- Input Helpers → Terminal: reads lines
- Game Loop → Terminal: prints menu
- Game Loop → Creature State: creates player
- Game Loop → Rest: dispatches
- Game Loop → Combat: dispatches
- Game Loop → Stats and Exit: dispatches
- Rest → Creature State: updates health
- Rest → Input Helpers: waits
- Combat → Input Helpers: reads choice
- Combat → Input Helpers: waits
- Combat → Creature State: creates enemy
- Combat → XP Progression: calculates XP
- Combat → Terminal: prints battle
- XP Progression → Creature State: updates stats
- Stats and Exit → Creature State: reads stats
- Stats and Exit → Input Helpers: waits
- Stats and Exit → Terminal: prints details
- Creature State → Input Helpers: score displayed by caller
