# zpy0411/tankedazhan architecture

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

- Interactive diagram: https://gitdiagram.com/zpy0411/tankedazhan
- Repository: https://github.com/zpy0411/tankedazhan

## Overview

This is a browser-based, canvas-rendered tank battle game. The main workflow runs from keyboard or touch input through the frame loop and game-state controller into player movement, enemy waves, combat, pickups, and rendered scenes; high scores persist in browser storage. Separate systems provide boss encounters, map and wave definitions, synthesized audio, and particle effects. The graph follows shown calls and references; UI rendering links and other wiring hidden in omitted game sections are not asserted as verified.

Main entry points: [`js/game.js`](https://github.com/zpy0411/tankedazhan/blob/main/js/game.js) (Game Controller), [`js/entities/player.js`](https://github.com/zpy0411/tankedazhan/blob/main/js/entities/player.js) (Player Tank), [`js/input.js`](https://github.com/zpy0411/tankedazhan/blob/main/js/input.js) (Input Manager), [`js/entities/bullet.js`](https://github.com/zpy0411/tankedazhan/blob/main/js/entities/bullet.js) (Projectiles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Game Runtime"]
  node_frame_loop["Frame Loop<br/>[main.js]"]
  node_game_controller["Game Controller<br/>[game.js]"]
  node_input["Input Manager<br/>[input.js]"]
end

subgraph group_combat["Combat Entities"]
  node_player_tank["Player Tank<br/>[player.js]"]
  node_tank_base["Tank Base<br/>[tank.js]"]
  node_enemy_tanks["Enemy Tanks<br/>[enemy.js]"]
  node_boss_encounter["Boss Encounter<br/>[boss.js]"]
  node_projectiles["Projectiles<br/>[bullet.js]"]
end

subgraph group_world["World And Progression"]
  node_map_waves["Map And Waves<br/>[levels.js]"]
  node_powerups["Powerups<br/>[powerup.js]"]
  node_game_config["Game Config<br/>[config.js]"]
end

subgraph group_feedback["Presentation And Feedback"]
  node_canvas_ui["Canvas UI<br/>[ui.js]"]
  node_audio_system["Audio System<br/>[audio.js]"]
  node_particle_effects["Particle Effects<br/>[particles.js]"]
  node_browser_storage[("Browser Storage")]
end

node_browser_player(("Player"))
node_web_audio["Web Audio"]

node_browser_player -->|"provides controls"| node_input
node_frame_loop -->|"updates and renders"| node_game_controller
node_frame_loop -->|"ends input frame"| node_input
node_game_controller -->|"consumes actions"| node_input
node_game_controller -->|"creates player"| node_player_tank
node_game_controller -->|"spawns enemies"| node_enemy_tanks
node_game_controller -->|"creates boss"| node_boss_encounter
node_game_controller -->|"updates bullets"| node_projectiles
node_game_controller -->|"applies pickups"| node_powerups
node_player_tank -->|"reads controls"| node_input
node_player_tank -->|"extends"| node_tank_base
node_enemy_tanks -->|"extends"| node_tank_base
node_enemy_tanks -->|"fires"| node_projectiles
node_boss_encounter -->|"emits patterns"| node_projectiles
node_boss_encounter -->|"targets player"| node_player_tank
node_tank_base -->|"checks wall tiles"| node_map_waves
node_player_tank -->|"fires"| node_projectiles
node_player_tank -->|"plays effects"| node_audio_system
node_player_tank -->|"emits effects"| node_particle_effects
node_game_controller -->|"controls music"| node_audio_system
node_game_controller -->|"spawns effects"| node_particle_effects
node_game_controller -->|"saves high score"| node_browser_storage
node_audio_system -->|"synthesizes sound"| node_web_audio
node_game_controller -.->|"renders scenes"| node_canvas_ui
node_map_waves -.->|"supplies levels"| node_game_controller
node_game_config -.->|"configures gameplay"| node_game_controller

click node_frame_loop "https://github.com/zpy0411/tankedazhan/blob/main/js/main.js"
click node_game_controller "https://github.com/zpy0411/tankedazhan/blob/main/js/game.js"
click node_input "https://github.com/zpy0411/tankedazhan/blob/main/js/input.js"
click node_player_tank "https://github.com/zpy0411/tankedazhan/blob/main/js/entities/player.js"
click node_tank_base "https://github.com/zpy0411/tankedazhan/blob/main/js/entities/tank.js"
click node_enemy_tanks "https://github.com/zpy0411/tankedazhan/blob/main/js/entities/enemy.js"
click node_boss_encounter "https://github.com/zpy0411/tankedazhan/blob/main/js/boss.js"
click node_projectiles "https://github.com/zpy0411/tankedazhan/blob/main/js/entities/bullet.js"
click node_map_waves "https://github.com/zpy0411/tankedazhan/blob/main/js/levels.js"
click node_powerups "https://github.com/zpy0411/tankedazhan/blob/main/js/powerup.js"
click node_game_config "https://github.com/zpy0411/tankedazhan/blob/main/js/config.js"
click node_canvas_ui "https://github.com/zpy0411/tankedazhan/blob/main/js/ui.js"
click node_audio_system "https://github.com/zpy0411/tankedazhan/blob/main/js/audio.js"
click node_particle_effects "https://github.com/zpy0411/tankedazhan/blob/main/js/particles.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_frame_loop,node_game_controller,node_input toneBlue
class node_player_tank,node_tank_base,node_enemy_tanks,node_boss_encounter,node_projectiles toneAmber
class node_map_waves,node_powerups,node_game_config toneMint
class node_canvas_ui,node_audio_system,node_particle_effects,node_browser_storage toneRose
class node_browser_player,node_web_audio toneIndigo
```

## Components

### Game Runtime

- [Frame Loop](https://github.com/zpy0411/tankedazhan/blob/main/js/main.js): `js/main.js`
- [Game Controller](https://github.com/zpy0411/tankedazhan/blob/main/js/game.js): `js/game.js`
- [Input Manager](https://github.com/zpy0411/tankedazhan/blob/main/js/input.js): `js/input.js`

### Combat Entities

- [Player Tank](https://github.com/zpy0411/tankedazhan/blob/main/js/entities/player.js): `js/entities/player.js`
- [Tank Base](https://github.com/zpy0411/tankedazhan/blob/main/js/entities/tank.js): `js/entities/tank.js`
- [Enemy Tanks](https://github.com/zpy0411/tankedazhan/blob/main/js/entities/enemy.js): `js/entities/enemy.js`
- [Boss Encounter](https://github.com/zpy0411/tankedazhan/blob/main/js/boss.js): `js/boss.js`
- [Projectiles](https://github.com/zpy0411/tankedazhan/blob/main/js/entities/bullet.js): `js/entities/bullet.js`

### World And Progression

- [Map And Waves](https://github.com/zpy0411/tankedazhan/blob/main/js/levels.js): `js/levels.js`
- [Powerups](https://github.com/zpy0411/tankedazhan/blob/main/js/powerup.js): `js/powerup.js`
- [Game Config](https://github.com/zpy0411/tankedazhan/blob/main/js/config.js): `js/config.js`

### Presentation And Feedback

- [Canvas UI](https://github.com/zpy0411/tankedazhan/blob/main/js/ui.js): `js/ui.js`
- [Audio System](https://github.com/zpy0411/tankedazhan/blob/main/js/audio.js): `js/audio.js`
- [Particle Effects](https://github.com/zpy0411/tankedazhan/blob/main/js/particles.js): `js/particles.js`
- **Browser Storage**

### Other components

- **Player**
- **Web Audio**

## Connections

- Player → Input Manager: provides controls (evidence: `js/input.js`)
- Frame Loop → Game Controller: updates and renders (evidence: `js/main.js`)
- Frame Loop → Input Manager: ends input frame (evidence: `js/main.js`)
- Game Controller → Input Manager: consumes actions (evidence: `js/game.js`)
- Game Controller → Player Tank: creates player (evidence: `js/game.js`)
- Game Controller → Enemy Tanks: spawns enemies (evidence: `js/game.js`)
- Game Controller → Boss Encounter: creates boss (evidence: `js/game.js`)
- Game Controller → Projectiles: updates bullets (evidence: `js/game.js`)
- Game Controller → Powerups: applies pickups (evidence: `js/game.js`)
- Player Tank → Input Manager: reads controls (evidence: `js/entities/player.js`)
- Player Tank → Tank Base: extends (evidence: `js/entities/player.js`)
- Enemy Tanks → Tank Base: extends (evidence: `js/entities/enemy.js`)
- Enemy Tanks → Projectiles: fires (evidence: `js/entities/enemy.js`)
- Boss Encounter → Projectiles: emits patterns (evidence: `js/boss.js`)
- Boss Encounter → Player Tank: targets player (evidence: `js/boss.js`)
- Tank Base → Map And Waves: checks wall tiles (evidence: `js/entities/tank.js`)
- Player Tank → Projectiles: fires (evidence: `js/entities/player.js`)
- Player Tank → Audio System: plays effects (evidence: `js/entities/player.js`)
- Player Tank → Particle Effects: emits effects (evidence: `js/entities/player.js`)
- Game Controller → Audio System: controls music (evidence: `js/game.js`)
- Game Controller → Particle Effects: spawns effects (evidence: `js/game.js`)
- Game Controller → Browser Storage: saves high score (evidence: `js/game.js`)
- Audio System → Web Audio: synthesizes sound (evidence: `js/audio.js`)
- Game Controller → Canvas UI: renders scenes
- Map And Waves → Game Controller: supplies levels
- Game Config → Game Controller: configures gameplay
