# bshen2452-alt/as architecture

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

- Interactive diagram: https://gitdiagram.com/bshen2452-alt/as
- Repository: https://github.com/bshen2452-alt/as

## Overview

This is a browser-based, 20-round economic strategy game about competing AI firms across a three-layer supply chain. The player chooses a starting role, allocates employees and submits market and model decisions; five AI rivals decide simultaneously, then rounds resolve through the market, economy and events. Settlement reveals market signals and rankings, and the final result includes a generated narrative. The graph separates game rules, presentation, and localization/audio support. Some runtime wiring is unsampled, so uncertain links are omitted or marked dashed.

Main entry points: [`src/main.js`](https://github.com/bshen2452-alt/as/blob/main/src/main.js) (Browser app), [`src/game/GameEngine.js`](https://github.com/bshen2452-alt/as/blob/main/src/game/GameEngine.js) (Round controller), [`src/scene/SceneManager.js`](https://github.com/bshen2452-alt/as/blob/main/src/scene/SceneManager.js) (3D scene), [`src/scene/NodeMesh.js`](https://github.com/bshen2452-alt/as/blob/main/src/scene/NodeMesh.js) (Supply chain visuals)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_game["Game simulation"]
  node_game_engine["Round controller<br/>[GameEngine.js]"]
  node_ai["AI rivals<br/>[AIPlayer.js]"]
  node_player_state["Firm state<br/>[Player.js]"]
  node_config["Supply chain rules<br/>[Config.js]"]
  node_economy["Production economy<br/>[Economy.js]"]
  node_market["Resource market<br/>[Market.js]"]
  node_events["Industry events<br/>[EventEngine.js]"]
  node_event_design["Event definitions<br/>[EventDesign.js]"]
  node_narrative["Ending narrative"]
  node_flow["Round history<br/>[FlowRecorder.js]"]
end

subgraph group_presentation["Game presentation"]
  node_app["Browser app<br/>[main.js]"]
  node_hud["Game HUD<br/>[HUD.js]"]
  node_tutorial["Tutorial guidance<br/>[Tutorial.js]"]
  node_tooltip["Tooltips<br/>[Tooltip.js]"]
  node_scene["3D scene<br/>[SceneManager.js]"]
  node_nodes["Supply chain visuals<br/>[NodeMesh.js]"]
  node_camera["Camera controls"]
  node_post["Post processing<br/>[PostProcessing.js]"]
  node_visual_config["Visual settings"]
end

subgraph group_support["Player experience"]
  node_i18n["Locale service<br/>[index.js]"]
  node_english["English strings<br/>[en.js]"]
  node_chinese["Chinese strings<br/>[zh.js]"]
  node_audio["Audio manager<br/>[AudioManager.js]"]
end

node_player(("Player"))

node_player -.->|"plays through"| node_app
node_app -.->|"controls"| node_game_engine
node_app -->|"uses"| node_hud
node_app -->|"uses"| node_tutorial
node_app -->|"uses"| node_tooltip
node_app -->|"updates"| node_scene
node_app -->|"updates"| node_nodes
node_app -->|"controls"| node_camera
node_app -->|"uses"| node_flow
node_app -->|"uses"| node_audio
node_game_engine -->|"requests decisions"| node_ai
node_game_engine -->|"manages"| node_player_state
node_game_engine -->|"resolves production"| node_economy
node_game_engine -->|"uses market"| node_market
node_game_engine -->|"runs events"| node_events
node_game_engine -->|"reads rules"| node_config
node_game_engine -->|"builds ending"| node_narrative
node_events -->|"reads definitions"| node_event_design
node_scene -->|"delegates camera"| node_camera
node_scene -->|"uses effects"| node_post
node_nodes -->|"reads node rules"| node_config
node_nodes -->|"reads settings"| node_visual_config
node_i18n -->|"loads strings"| node_english
node_i18n -->|"loads strings"| node_chinese

click node_app "https://github.com/bshen2452-alt/as/blob/main/src/main.js"
click node_game_engine "https://github.com/bshen2452-alt/as/blob/main/src/game/GameEngine.js"
click node_ai "https://github.com/bshen2452-alt/as/blob/main/src/game/AIPlayer.js"
click node_player_state "https://github.com/bshen2452-alt/as/blob/main/src/game/Player.js"
click node_config "https://github.com/bshen2452-alt/as/blob/main/src/game/Config.js"
click node_economy "https://github.com/bshen2452-alt/as/blob/main/src/game/Economy.js"
click node_market "https://github.com/bshen2452-alt/as/blob/main/src/game/Market.js"
click node_events "https://github.com/bshen2452-alt/as/blob/main/src/game/EventEngine.js"
click node_event_design "https://github.com/bshen2452-alt/as/blob/main/src/game/EventDesign.js"
click node_narrative "https://github.com/bshen2452-alt/as/blob/main/src/game/NarrativeBuilder.js"
click node_flow "https://github.com/bshen2452-alt/as/blob/main/src/game/FlowRecorder.js"
click node_hud "https://github.com/bshen2452-alt/as/blob/main/src/ui/HUD.js"
click node_tutorial "https://github.com/bshen2452-alt/as/blob/main/src/ui/Tutorial.js"
click node_tooltip "https://github.com/bshen2452-alt/as/blob/main/src/ui/Tooltip.js"
click node_scene "https://github.com/bshen2452-alt/as/blob/main/src/scene/SceneManager.js"
click node_nodes "https://github.com/bshen2452-alt/as/blob/main/src/scene/NodeMesh.js"
click node_camera "https://github.com/bshen2452-alt/as/blob/main/src/scene/CameraController.js"
click node_post "https://github.com/bshen2452-alt/as/blob/main/src/scene/PostProcessing.js"
click node_visual_config "https://github.com/bshen2452-alt/as/blob/main/src/scene/NodeVisualConfig.js"
click node_i18n "https://github.com/bshen2452-alt/as/blob/main/src/i18n/index.js"
click node_english "https://github.com/bshen2452-alt/as/blob/main/src/i18n/en.js"
click node_chinese "https://github.com/bshen2452-alt/as/blob/main/src/i18n/zh.js"
click node_audio "https://github.com/bshen2452-alt/as/blob/main/src/audio/AudioManager.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_game_engine,node_ai,node_player_state,node_config,node_economy,node_market,node_events,node_event_design,node_narrative,node_flow toneBlue
class node_app,node_hud,node_tutorial,node_tooltip,node_scene,node_nodes,node_camera,node_post,node_visual_config toneAmber
class node_i18n,node_english,node_chinese,node_audio toneMint
class node_player toneIndigo
```

## Components

### Game simulation

- [Round controller](https://github.com/bshen2452-alt/as/blob/main/src/game/GameEngine.js): `src/game/GameEngine.js`
- [AI rivals](https://github.com/bshen2452-alt/as/blob/main/src/game/AIPlayer.js): `src/game/AIPlayer.js`
- [Firm state](https://github.com/bshen2452-alt/as/blob/main/src/game/Player.js): `src/game/Player.js`
- [Supply chain rules](https://github.com/bshen2452-alt/as/blob/main/src/game/Config.js): `src/game/Config.js`
- [Production economy](https://github.com/bshen2452-alt/as/blob/main/src/game/Economy.js): `src/game/Economy.js`
- [Resource market](https://github.com/bshen2452-alt/as/blob/main/src/game/Market.js): `src/game/Market.js`
- [Industry events](https://github.com/bshen2452-alt/as/blob/main/src/game/EventEngine.js): `src/game/EventEngine.js`
- [Event definitions](https://github.com/bshen2452-alt/as/blob/main/src/game/EventDesign.js): `src/game/EventDesign.js`
- [Ending narrative](https://github.com/bshen2452-alt/as/blob/main/src/game/NarrativeBuilder.js): `src/game/NarrativeBuilder.js`
- [Round history](https://github.com/bshen2452-alt/as/blob/main/src/game/FlowRecorder.js): `src/game/FlowRecorder.js`

### Game presentation

- [Browser app](https://github.com/bshen2452-alt/as/blob/main/src/main.js): `src/main.js`
- [Game HUD](https://github.com/bshen2452-alt/as/blob/main/src/ui/HUD.js): `src/ui/HUD.js`
- [Tutorial guidance](https://github.com/bshen2452-alt/as/blob/main/src/ui/Tutorial.js): `src/ui/Tutorial.js`
- [Tooltips](https://github.com/bshen2452-alt/as/blob/main/src/ui/Tooltip.js): `src/ui/Tooltip.js`
- [3D scene](https://github.com/bshen2452-alt/as/blob/main/src/scene/SceneManager.js): `src/scene/SceneManager.js`
- [Supply chain visuals](https://github.com/bshen2452-alt/as/blob/main/src/scene/NodeMesh.js): `src/scene/NodeMesh.js`
- [Camera controls](https://github.com/bshen2452-alt/as/blob/main/src/scene/CameraController.js): `src/scene/CameraController.js`
- [Post processing](https://github.com/bshen2452-alt/as/blob/main/src/scene/PostProcessing.js): `src/scene/PostProcessing.js`
- [Visual settings](https://github.com/bshen2452-alt/as/blob/main/src/scene/NodeVisualConfig.js): `src/scene/NodeVisualConfig.js`

### Player experience

- [Locale service](https://github.com/bshen2452-alt/as/blob/main/src/i18n/index.js): `src/i18n/index.js`
- [English strings](https://github.com/bshen2452-alt/as/blob/main/src/i18n/en.js): `src/i18n/en.js`
- [Chinese strings](https://github.com/bshen2452-alt/as/blob/main/src/i18n/zh.js): `src/i18n/zh.js`
- [Audio manager](https://github.com/bshen2452-alt/as/blob/main/src/audio/AudioManager.js): `src/audio/AudioManager.js`

### Other components

- **Player**

## Connections

- Player → Browser app: plays through
- Browser app → Round controller: controls (evidence: `src/main.js`)
- Browser app → Game HUD: uses (evidence: `src/main.js`)
- Browser app → Tutorial guidance: uses (evidence: `src/main.js`)
- Browser app → Tooltips: uses (evidence: `src/main.js`)
- Browser app → 3D scene: updates (evidence: `src/main.js`)
- Browser app → Supply chain visuals: updates (evidence: `src/main.js`)
- Browser app → Camera controls: controls (evidence: `src/main.js`)
- Browser app → Round history: uses (evidence: `src/main.js`)
- Browser app → Audio manager: uses (evidence: `src/main.js`)
- Round controller → AI rivals: requests decisions (evidence: `src/game/GameEngine.js`)
- Round controller → Firm state: manages (evidence: `src/game/GameEngine.js`)
- Round controller → Production economy: resolves production (evidence: `src/game/GameEngine.js`)
- Round controller → Resource market: uses market (evidence: `src/game/GameEngine.js`)
- Round controller → Industry events: runs events (evidence: `src/game/GameEngine.js`)
- Round controller → Supply chain rules: reads rules (evidence: `src/game/GameEngine.js`)
- Round controller → Ending narrative: builds ending (evidence: `src/game/GameEngine.js`)
- Industry events → Event definitions: reads definitions (evidence: `src/game/EventEngine.js`)
- 3D scene → Camera controls: delegates camera (evidence: `src/scene/SceneManager.js`)
- 3D scene → Post processing: uses effects (evidence: `src/scene/SceneManager.js`)
- Supply chain visuals → Supply chain rules: reads node rules (evidence: `src/scene/NodeMesh.js`)
- Supply chain visuals → Visual settings: reads settings (evidence: `src/scene/NodeMesh.js`)
- Locale service → English strings: loads strings (evidence: `src/i18n/index.js`)
- Locale service → Chinese strings: loads strings (evidence: `src/i18n/index.js`)
