# ashbirx/hexaswarm architecture

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

- Interactive diagram: https://gitdiagram.com/ashbirx/hexaswarm
- Repository: https://github.com/ashbirx/hexaswarm

## Overview

HEXASWARM is a single-file raylib survival shooter: the player rotates and fires a stationary turret, survives waves of enemies that can merge into stronger hunters, and pursues a high score. The principal game stages and screens are implemented in `src/raylib_game.c`; `src/vfx.h` supplies its visual-effects layer. The excerpts do not show all input, persistence, or asset-loading code, so those documented capabilities are represented without guessing their internal call paths.

Main entry points: [`src/raylib_game.c`](https://github.com/ashbirx/hexaswarm/blob/main/src/raylib_game.c) (Game Runtime), [`src/vfx.h`](https://github.com/ashbirx/hexaswarm/blob/main/src/vfx.h) (Effects Module)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gameplay["Combat Loop"]
  node_game["Game Runtime<br/>[raylib_game.c]"]
  node_turret["Turret Combat<br/>[raylib_game.c]"]
  node_bullets["Bullet Hits<br/>[raylib_game.c]"]
  node_enemies["Enemy Swarm<br/>[raylib_game.c]"]
  node_merging["Enemy Merging<br/>[raylib_game.c]"]
  node_survival["Survival Scoring<br/>[raylib_game.c]"]
  node_highscore["High Score<br/>[raylib_game.c]"]
end

subgraph group_screens["Game Screens"]
  node_screens["Screen Flow<br/>[raylib_game.c]"]
  node_title["Title Screen<br/>[raylib_game.c]"]
  node_howtoplay["How To Play<br/>[raylib_game.c]"]
  node_pause["Pause Screen<br/>[raylib_game.c]"]
  node_ending["End Screen<br/>[raylib_game.c]"]
end

subgraph group_effects["Visual Effects"]
  node_vfx["Effects Module<br/>[vfx.h]"]
end

subgraph group_resources["Game Resources"]
  node_assets["Game Assets"]
end

node_player(("Player"))
node_raylib["raylib"]
node_localstorage[("Local Storage")]

node_player -->|"plays"| node_game
node_game -->|"runs"| node_turret
node_turret -->|"fires"| node_bullets
node_bullets -->|"hits"| node_enemies
node_enemies -->|"merge nearby"| node_merging
node_merging -->|"threatens"| node_survival
node_survival -->|"tracks run"| node_highscore
node_game -->|"dispatches"| node_screens
node_screens -->|"shows"| node_title
node_screens -->|"shows"| node_howtoplay
node_screens -->|"shows"| node_pause
node_screens -->|"shows"| node_ending
node_game -->|"calls"| node_vfx
node_game -->|"uses"| node_raylib
node_highscore -->|"saves locally"| node_localstorage

click node_game "https://github.com/ashbirx/hexaswarm/blob/main/src/raylib_game.c"
click node_turret "https://github.com/ashbirx/hexaswarm/blob/main/src/raylib_game.c"
click node_bullets "https://github.com/ashbirx/hexaswarm/blob/main/src/raylib_game.c"
click node_enemies "https://github.com/ashbirx/hexaswarm/blob/main/src/raylib_game.c"
click node_merging "https://github.com/ashbirx/hexaswarm/blob/main/src/raylib_game.c"
click node_survival "https://github.com/ashbirx/hexaswarm/blob/main/src/raylib_game.c"
click node_highscore "https://github.com/ashbirx/hexaswarm/blob/main/src/raylib_game.c"
click node_screens "https://github.com/ashbirx/hexaswarm/blob/main/src/raylib_game.c"
click node_title "https://github.com/ashbirx/hexaswarm/blob/main/src/raylib_game.c"
click node_howtoplay "https://github.com/ashbirx/hexaswarm/blob/main/src/raylib_game.c"
click node_pause "https://github.com/ashbirx/hexaswarm/blob/main/src/raylib_game.c"
click node_ending "https://github.com/ashbirx/hexaswarm/blob/main/src/raylib_game.c"
click node_vfx "https://github.com/ashbirx/hexaswarm/blob/main/src/vfx.h"
click node_assets "https://github.com/ashbirx/hexaswarm/tree/main/src/resources"

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,node_turret,node_bullets,node_enemies,node_merging,node_survival,node_highscore toneBlue
class node_screens,node_title,node_howtoplay,node_pause,node_ending,node_localstorage toneAmber
class node_vfx toneMint
class node_assets toneRose
class node_player,node_raylib toneIndigo
```

## Components

### Combat Loop

- [Game Runtime](https://github.com/ashbirx/hexaswarm/blob/main/src/raylib_game.c): `src/raylib_game.c`
- [Turret Combat](https://github.com/ashbirx/hexaswarm/blob/main/src/raylib_game.c): `src/raylib_game.c`
- [Bullet Hits](https://github.com/ashbirx/hexaswarm/blob/main/src/raylib_game.c): `src/raylib_game.c`
- [Enemy Swarm](https://github.com/ashbirx/hexaswarm/blob/main/src/raylib_game.c): `src/raylib_game.c`
- [Enemy Merging](https://github.com/ashbirx/hexaswarm/blob/main/src/raylib_game.c): `src/raylib_game.c`
- [Survival Scoring](https://github.com/ashbirx/hexaswarm/blob/main/src/raylib_game.c): `src/raylib_game.c`
- [High Score](https://github.com/ashbirx/hexaswarm/blob/main/src/raylib_game.c): `src/raylib_game.c`

### Game Screens

- [Screen Flow](https://github.com/ashbirx/hexaswarm/blob/main/src/raylib_game.c): `src/raylib_game.c`
- [Title Screen](https://github.com/ashbirx/hexaswarm/blob/main/src/raylib_game.c): `src/raylib_game.c`
- [How To Play](https://github.com/ashbirx/hexaswarm/blob/main/src/raylib_game.c): `src/raylib_game.c`
- [Pause Screen](https://github.com/ashbirx/hexaswarm/blob/main/src/raylib_game.c): `src/raylib_game.c`
- [End Screen](https://github.com/ashbirx/hexaswarm/blob/main/src/raylib_game.c): `src/raylib_game.c`

### Visual Effects

- [Effects Module](https://github.com/ashbirx/hexaswarm/blob/main/src/vfx.h): `src/vfx.h`

### Game Resources

- [Game Assets](https://github.com/ashbirx/hexaswarm/tree/main/src/resources): `src/resources`

### Other components

- **Player**
- **raylib**
- **Local Storage**

## Connections

- Player → Game Runtime: plays (evidence: `README.md`)
- Game Runtime → Turret Combat: runs (evidence: `README.md`)
- Turret Combat → Bullet Hits: fires (evidence: `README.md`)
- Bullet Hits → Enemy Swarm: hits (evidence: `README.md`)
- Enemy Swarm → Enemy Merging: merge nearby (evidence: `README.md`)
- Enemy Merging → Survival Scoring: threatens (evidence: `README.md`)
- Survival Scoring → High Score: tracks run (evidence: `README.md`)
- Game Runtime → Screen Flow: dispatches (evidence: `src/raylib_game.c`)
- Screen Flow → Title Screen: shows (evidence: `src/raylib_game.c`)
- Screen Flow → How To Play: shows (evidence: `src/raylib_game.c`)
- Screen Flow → Pause Screen: shows (evidence: `README.md`)
- Screen Flow → End Screen: shows (evidence: `src/raylib_game.c`)
- Game Runtime → Effects Module: calls (evidence: `src/raylib_game.c`)
- Game Runtime → raylib: uses (evidence: `src/raylib_game.c`)
- High Score → Local Storage: saves locally (evidence: `README.md`)
