# vuonggiakayn98/bangbang_offline architecture

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

- Interactive diagram: https://gitdiagram.com/vuonggiakayn98/bangbang_offline
- Repository: https://github.com/vuonggiakayn98/bangbang_offline

## Overview

BangBang HTML5 is a locally hosted tank-combat game with a browser client, Python server, and SQLite persistence. The main path is player login and lobby selection, room/mode entry, server-simulated combat, then browser presentation and saved progress. Separate branches cover PvE and competitive modes, accounts and inventory, and the local web-buff tool. The README documents the play and buff workflows; edges from sampled source are limited to relationships shown by excerpts or the source index.

Main entry points: [`server/sixcube_server.py`](https://github.com/vuonggiakayn98/bangbang_offline/blob/main/server/sixcube_server.py) (Game sockets), [`server/battle_runtime.py`](https://github.com/vuonggiakayn98/bangbang_offline/blob/main/server/battle_runtime.py) (Battle runtime), [`www/html5/app.js`](https://github.com/vuonggiakayn98/bangbang_offline/blob/main/www/html5/app.js) (Game UI), [`server/app.py`](https://github.com/vuonggiakayn98/bangbang_offline/blob/main/server/app.py) (HTTP server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser game"]
  node_browser_game["Game UI<br/>[app.js]"]
  node_battle_view["Battle view<br/>[battle_view.js]"]
  node_connection["Game connection"]
end

subgraph group_server["Game server"]
  node_http_server["HTTP server<br/>[app.py]"]
  node_socket_server["Game sockets<br/>[sixcube_server.py]"]
end

subgraph group_combat["Combat runtime"]
  node_entry["Battle entry<br/>[battle_entry.py]"]
  node_runtime["Battle runtime<br/>[battle_runtime.py]"]
  node_combat_rules["Combat rules<br/>[base_mode.py]"]
  node_combat_geometry["Combat geometry<br/>[combat_geometry.py]"]
  node_bot_ai["Bot strategy<br/>[bot_ai.py]"]
  node_mode_rules["Mode rules<br/>[occupy_rules.py]"]
  node_pve_catalog["PvE modes<br/>[pve_catalog.py]"]
end

subgraph group_player["Accounts and items"]
  node_auth["Authentication<br/>[auth_store.py]"]
  node_characters["Characters<br/>[characters.py]"]
  node_storage[("SQLite persistence<br/>[storage.py]")]
end

subgraph group_admin["Local web buff"]
  node_buff_admin["Buff service<br/>[admin_buff.py]"]
  node_buff_ui["Buff web UI<br/>[admin.js]"]
  node_buff_accounts["Account tools<br/>[accounts.js]"]
end

node_player_actor(("Player"))

node_player_actor -->|"plays in"| node_browser_game
node_browser_game -->|"creates"| node_connection
node_browser_game -->|"creates"| node_battle_view
node_player_actor -->|"opens locally"| node_http_server
node_http_server -->|"starts"| node_socket_server
node_connection -.->|"connects to"| node_socket_server
node_socket_server -->|"dispatches battle entry"| node_entry
node_socket_server -->|"dispatches combat"| node_runtime
node_entry -->|"selects modes"| node_pve_catalog
node_entry -->|"uses mode rules"| node_mode_rules
node_runtime -->|"uses"| node_combat_rules
node_runtime -->|"uses"| node_combat_geometry
node_runtime -->|"updates bots"| node_bot_ai
node_socket_server -->|"uses login"| node_auth
node_auth -->|"reads and writes"| node_storage
node_characters -->|"persists character data"| node_storage
node_http_server -->|"routes requests"| node_buff_admin
node_player_actor -->|"manages locally"| node_buff_ui
node_buff_ui -.->|"uses account tools"| node_buff_accounts
node_buff_ui -->|"sends items by mail"| node_buff_admin

click node_browser_game "https://github.com/vuonggiakayn98/bangbang_offline/blob/main/www/html5/app.js"
click node_battle_view "https://github.com/vuonggiakayn98/bangbang_offline/blob/main/www/html5/battle_view.js"
click node_connection "https://github.com/vuonggiakayn98/bangbang_offline/blob/main/www/html5/m81337_connection.js"
click node_http_server "https://github.com/vuonggiakayn98/bangbang_offline/blob/main/server/app.py"
click node_socket_server "https://github.com/vuonggiakayn98/bangbang_offline/blob/main/server/sixcube_server.py"
click node_entry "https://github.com/vuonggiakayn98/bangbang_offline/blob/main/server/battle_entry.py"
click node_runtime "https://github.com/vuonggiakayn98/bangbang_offline/blob/main/server/battle_runtime.py"
click node_combat_rules "https://github.com/vuonggiakayn98/bangbang_offline/blob/main/server/base_mode.py"
click node_combat_geometry "https://github.com/vuonggiakayn98/bangbang_offline/blob/main/server/combat_geometry.py"
click node_bot_ai "https://github.com/vuonggiakayn98/bangbang_offline/blob/main/server/bot_ai.py"
click node_mode_rules "https://github.com/vuonggiakayn98/bangbang_offline/blob/main/server/occupy_rules.py"
click node_pve_catalog "https://github.com/vuonggiakayn98/bangbang_offline/blob/main/server/pve_catalog.py"
click node_auth "https://github.com/vuonggiakayn98/bangbang_offline/blob/main/server/auth_store.py"
click node_characters "https://github.com/vuonggiakayn98/bangbang_offline/blob/main/server/characters.py"
click node_storage "https://github.com/vuonggiakayn98/bangbang_offline/blob/main/server/storage.py"
click node_buff_admin "https://github.com/vuonggiakayn98/bangbang_offline/blob/main/server/admin_buff.py"
click node_buff_ui "https://github.com/vuonggiakayn98/bangbang_offline/blob/main/www/admin/buff/admin.js"
click node_buff_accounts "https://github.com/vuonggiakayn98/bangbang_offline/blob/main/www/admin/buff/accounts.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_browser_game,node_battle_view,node_connection toneBlue
class node_http_server,node_socket_server toneAmber
class node_entry,node_runtime,node_combat_rules,node_combat_geometry,node_bot_ai,node_mode_rules,node_pve_catalog toneMint
class node_auth,node_characters,node_storage toneRose
class node_buff_admin,node_buff_ui,node_buff_accounts,node_player_actor toneIndigo
```

## Components

### Browser game

- [Game UI](https://github.com/vuonggiakayn98/bangbang_offline/blob/main/www/html5/app.js): `www/html5/app.js`
- [Battle view](https://github.com/vuonggiakayn98/bangbang_offline/blob/main/www/html5/battle_view.js): `www/html5/battle_view.js`
- [Game connection](https://github.com/vuonggiakayn98/bangbang_offline/blob/main/www/html5/m81337_connection.js): `www/html5/m81337_connection.js`

### Game server

- [HTTP server](https://github.com/vuonggiakayn98/bangbang_offline/blob/main/server/app.py): `server/app.py`
- [Game sockets](https://github.com/vuonggiakayn98/bangbang_offline/blob/main/server/sixcube_server.py): `server/sixcube_server.py`

### Combat runtime

- [Battle entry](https://github.com/vuonggiakayn98/bangbang_offline/blob/main/server/battle_entry.py): `server/battle_entry.py`
- [Battle runtime](https://github.com/vuonggiakayn98/bangbang_offline/blob/main/server/battle_runtime.py): `server/battle_runtime.py`
- [Combat rules](https://github.com/vuonggiakayn98/bangbang_offline/blob/main/server/base_mode.py): `server/base_mode.py`
- [Combat geometry](https://github.com/vuonggiakayn98/bangbang_offline/blob/main/server/combat_geometry.py): `server/combat_geometry.py`
- [Bot strategy](https://github.com/vuonggiakayn98/bangbang_offline/blob/main/server/bot_ai.py): `server/bot_ai.py`
- [Mode rules](https://github.com/vuonggiakayn98/bangbang_offline/blob/main/server/occupy_rules.py): `server/occupy_rules.py`
- [PvE modes](https://github.com/vuonggiakayn98/bangbang_offline/blob/main/server/pve_catalog.py): `server/pve_catalog.py`

### Accounts and items

- [Authentication](https://github.com/vuonggiakayn98/bangbang_offline/blob/main/server/auth_store.py): `server/auth_store.py`
- [Characters](https://github.com/vuonggiakayn98/bangbang_offline/blob/main/server/characters.py): `server/characters.py`
- [SQLite persistence](https://github.com/vuonggiakayn98/bangbang_offline/blob/main/server/storage.py): `server/storage.py`

### Local web buff

- [Buff service](https://github.com/vuonggiakayn98/bangbang_offline/blob/main/server/admin_buff.py): `server/admin_buff.py`
- [Buff web UI](https://github.com/vuonggiakayn98/bangbang_offline/blob/main/www/admin/buff/admin.js): `www/admin/buff/admin.js`
- [Account tools](https://github.com/vuonggiakayn98/bangbang_offline/blob/main/www/admin/buff/accounts.js): `www/admin/buff/accounts.js`

### Other components

- **Player**

## Connections

- Player → Game UI: plays in
- Game UI → Game connection: creates (evidence: `www/html5/app.js`)
- Game UI → Battle view: creates (evidence: `www/html5/app.js`)
- Player → HTTP server: opens locally
- HTTP server → Game sockets: starts (evidence: `server/app.py`)
- Game connection → Game sockets: connects to
- Game sockets → Battle entry: dispatches battle entry (evidence: `server/sixcube_server.py`)
- Game sockets → Battle runtime: dispatches combat (evidence: `server/sixcube_server.py`)
- Battle entry → PvE modes: selects modes (evidence: `server/battle_entry.py`)
- Battle entry → Mode rules: uses mode rules (evidence: `server/battle_entry.py`)
- Battle runtime → Combat rules: uses (evidence: `server/battle_runtime.py`)
- Battle runtime → Combat geometry: uses (evidence: `server/battle_runtime.py`)
- Battle runtime → Bot strategy: updates bots (evidence: `server/battle_runtime.py`)
- Game sockets → Authentication: uses login (evidence: `server/sixcube_server.py`)
- Authentication → SQLite persistence: reads and writes (evidence: `server/auth_store.py`)
- Characters → SQLite persistence: persists character data (evidence: `server/characters.py`)
- HTTP server → Buff service: routes requests (evidence: `server/app.py`)
- Player → Buff web UI: manages locally
- Buff web UI → Account tools: uses account tools
- Buff web UI → Buff service: sends items by mail
