# ashimregme/mini-militia architecture

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

- Interactive diagram: https://gitdiagram.com/ashimregme/mini-militia
- Repository: https://github.com/ashimregme/mini-militia

## Overview

Mini Militia is a browser-based canvas shooter. The main workflow is: the page loads assets, starts the game, accepts keyboard and mouse input, moves the player and AI enemies through a tiled arena, and resolves weapon fire, collisions, scoring, and respawn or game-over state. The graph reflects the sampled runtime code and README controls; unsampled rendering and camera wiring is omitted rather than inferred.

Main entry points: [`js/Game.js`](https://github.com/ashimregme/mini-militia/blob/master/js/Game.js) (Game Runtime), [`js/Preload.js`](https://github.com/ashimregme/mini-militia/blob/master/js/Preload.js) (Asset Startup), [`js/RobotUnit.js`](https://github.com/ashimregme/mini-militia/blob/master/js/RobotUnit.js) (AI Enemy), [`js/Resources.js`](https://github.com/ashimregme/mini-militia/blob/master/js/Resources.js) (Resource Catalog)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_startup["Startup and Assets"]
  node_preload["Asset Startup<br/>[Preload.js]"]
  node_resources["Resource Catalog<br/>[Resources.js]"]
  node_assets["Game Assets"]
  node_audio["Audio Assets"]
end

subgraph group_world["Arena and Combat"]
  node_ground["Tile Arena<br/>[TileGround.js]"]
  node_collision["Tile Collision"]
  node_weapon["Weapon<br/>[Weapon.js]"]
  node_bullet["Projectile<br/>[Bullet.js]"]
end

subgraph group_actors["Player and Enemies"]
  node_player_controller["Player Wrapper<br/>[Shyame.js]"]
  node_actor["Player Actor<br/>[Actor.js]"]
  node_robot["AI Enemy<br/>[RobotUnit.js]"]
end

subgraph group_runtime["Game Runtime"]
  node_game["Game Runtime<br/>[Game.js]"]
  node_camera["Camera<br/>[Camera.js]"]
  node_util["Game Utilities<br/>[Util.js]"]
end

node_player(("Player"))

node_player -->|"opens game"| node_preload
node_preload -->|"creates catalog"| node_resources
node_preload -->|"registers images"| node_assets
node_preload -->|"registers audio"| node_audio
node_preload -->|"starts after loading"| node_game
node_resources -.->|"loads images"| node_assets
node_resources -.->|"loads audio"| node_audio
node_game -->|"creates arena"| node_ground
node_game -->|"creates handler"| node_collision
node_game -->|"creates player"| node_player_controller
node_game -->|"spawns enemies"| node_robot
node_player_controller -->|"creates actor"| node_actor
node_actor -->|"checks movement"| node_collision
node_robot -->|"checks movement"| node_collision
node_actor -->|"creates weapon"| node_weapon
node_robot -->|"creates weapon"| node_weapon
node_weapon -->|"creates projectile"| node_bullet
node_game -.->|"coordinates view"| node_camera
node_robot -->|"uses distance and random"| node_util

click node_preload "https://github.com/ashimregme/mini-militia/blob/master/js/Preload.js"
click node_resources "https://github.com/ashimregme/mini-militia/blob/master/js/Resources.js"
click node_assets "https://github.com/ashimregme/mini-militia/tree/master/images"
click node_audio "https://github.com/ashimregme/mini-militia/tree/master/audio"
click node_game "https://github.com/ashimregme/mini-militia/blob/master/js/Game.js"
click node_player_controller "https://github.com/ashimregme/mini-militia/blob/master/js/Shyame.js"
click node_actor "https://github.com/ashimregme/mini-militia/blob/master/js/Actor.js"
click node_robot "https://github.com/ashimregme/mini-militia/blob/master/js/RobotUnit.js"
click node_ground "https://github.com/ashimregme/mini-militia/blob/master/js/TileGround.js"
click node_collision "https://github.com/ashimregme/mini-militia/blob/master/js/CollisionHandler.js"
click node_weapon "https://github.com/ashimregme/mini-militia/blob/master/js/Weapon.js"
click node_bullet "https://github.com/ashimregme/mini-militia/blob/master/js/Bullet.js"
click node_camera "https://github.com/ashimregme/mini-militia/blob/master/js/Camera.js"
click node_util "https://github.com/ashimregme/mini-militia/blob/master/js/Util.js"

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_preload,node_resources,node_assets,node_audio toneBlue
class node_ground,node_collision,node_weapon,node_bullet toneAmber
class node_player_controller,node_actor,node_robot toneMint
class node_game,node_camera,node_util toneRose
class node_player toneIndigo
```

## Components

### Startup and Assets

- [Asset Startup](https://github.com/ashimregme/mini-militia/blob/master/js/Preload.js): `js/Preload.js`
- [Resource Catalog](https://github.com/ashimregme/mini-militia/blob/master/js/Resources.js): `js/Resources.js`
- [Game Assets](https://github.com/ashimregme/mini-militia/tree/master/images): `images`
- [Audio Assets](https://github.com/ashimregme/mini-militia/tree/master/audio): `audio`

### Arena and Combat

- [Tile Arena](https://github.com/ashimregme/mini-militia/blob/master/js/TileGround.js): `js/TileGround.js`
- [Tile Collision](https://github.com/ashimregme/mini-militia/blob/master/js/CollisionHandler.js): `js/CollisionHandler.js`
- [Weapon](https://github.com/ashimregme/mini-militia/blob/master/js/Weapon.js): `js/Weapon.js`
- [Projectile](https://github.com/ashimregme/mini-militia/blob/master/js/Bullet.js): `js/Bullet.js`

### Player and Enemies

- [Player Wrapper](https://github.com/ashimregme/mini-militia/blob/master/js/Shyame.js): `js/Shyame.js`
- [Player Actor](https://github.com/ashimregme/mini-militia/blob/master/js/Actor.js): `js/Actor.js`
- [AI Enemy](https://github.com/ashimregme/mini-militia/blob/master/js/RobotUnit.js): `js/RobotUnit.js`

### Game Runtime

- [Game Runtime](https://github.com/ashimregme/mini-militia/blob/master/js/Game.js): `js/Game.js`
- [Camera](https://github.com/ashimregme/mini-militia/blob/master/js/Camera.js): `js/Camera.js`
- [Game Utilities](https://github.com/ashimregme/mini-militia/blob/master/js/Util.js): `js/Util.js`

### Other components

- **Player**

## Connections

- Player → Asset Startup: opens game (evidence: `README.md`)
- Asset Startup → Resource Catalog: creates catalog (evidence: `js/Preload.js`)
- Asset Startup → Game Assets: registers images (evidence: `js/Preload.js`)
- Asset Startup → Audio Assets: registers audio (evidence: `js/Preload.js`)
- Asset Startup → Game Runtime: starts after loading (evidence: `js/Preload.js`)
- Resource Catalog → Game Assets: loads images
- Resource Catalog → Audio Assets: loads audio
- Game Runtime → Tile Arena: creates arena (evidence: `js/Game.js`)
- Game Runtime → Tile Collision: creates handler (evidence: `js/Game.js`)
- Game Runtime → Player Wrapper: creates player (evidence: `js/Game.js`)
- Game Runtime → AI Enemy: spawns enemies (evidence: `js/Game.js`)
- Player Wrapper → Player Actor: creates actor (evidence: `js/Shyame.js`)
- Player Actor → Tile Collision: checks movement (evidence: `js/Actor.js`)
- AI Enemy → Tile Collision: checks movement (evidence: `js/RobotUnit.js`)
- Player Actor → Weapon: creates weapon (evidence: `js/Actor.js`)
- AI Enemy → Weapon: creates weapon (evidence: `js/RobotUnit.js`)
- Weapon → Projectile: creates projectile (evidence: `js/Weapon.js`)
- Game Runtime → Camera: coordinates view
- AI Enemy → Game Utilities: uses distance and random (evidence: `js/RobotUnit.js`)
