# waifwu/tsukirebuild architecture

> Architecture diagram of the GitHub repository waifwu/tsukirebuild, 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/waifwu/tsukirebuild
- Repository: https://github.com/waifwu/tsukirebuild

## Overview

TsukiREbuild is a browser-playable JavaScript/WebGL2 port of Tsukihime, also hosted in Android and desktop apps. The player enters through the opening page, starts the game, and the VM loads scripts and game data to drive dialogue, graphics, sound, and interactive screens; saves preserve progress. The graph includes documented language, gallery, flowchart, and platform capabilities. Several feature modules are unsampled, so their internal call relationships are omitted rather than inferred.

Main entry points: [`web/app/js/ui.js`](https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/ui.js) (Game screens), [`web/app/js/main.js`](https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/main.js) (Runtime coordinator), [`web/app/js/vm.js`](https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/vm.js) (Script VM), [`web/app/js/renderer.js`](https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/renderer.js) (WebGL renderer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Game runtime"]
  node_main["Runtime coordinator<br/>[main.js]"]
  node_vm["Script VM<br/>[vm.js]"]
  node_lang["Language assets<br/>[lang.js]"]
  node_renderer["WebGL renderer<br/>[renderer.js]"]
  node_audio["Audio engine<br/>[audio.js]"]
end

subgraph group_experience["Presentation and interaction"]
  node_textbox["Dialogue text<br/>[textbox.js]"]
  node_ui["Game screens<br/>[ui.js]"]
  node_touch["Touch controls<br/>[touch.js]"]
  node_effects["Visual effects<br/>[effects.js]"]
  node_animation["Animation<br/>[animation.js]"]
  node_screenfx["Screen effects<br/>[screenfx.js]"]
end

subgraph group_progress["Game features and state"]
  node_gallery["Gallery<br/>[gallery.js]"]
  node_flowchart["Story flowchart<br/>[flowchart.js]"]
  node_flowmodel["Flowchart model<br/>[flowchart-model.js]"]
  node_savefile["Save files<br/>[savefile.js]"]
  node_unlocks["Unlock tracking<br/>[unlocks.js]"]
end

subgraph group_platforms["Hosting and apps"]
  node_browser(("Web browser"))
  node_server["Local web server<br/>[server.py]"]
  node_desktop["Desktop host<br/>[main.js]"]
  node_android["Android host<br/>[MainActivity.java]"]
  node_updates["Android updater<br/>[Updates.java]"]
end

node_player(("Player"))

node_player -->|"starts game"| node_main
node_main -->|"creates screens"| node_ui
node_main -->|"coordinates"| node_vm
node_vm -->|"loads localized assets"| node_lang
node_vm -->|"drives graphics"| node_renderer
node_vm -->|"dispatches sound"| node_audio
node_vm -->|"supplies dialogue"| node_textbox
node_renderer -->|"uses animation"| node_animation
node_renderer -->|"uses effects"| node_effects
node_renderer -->|"uses screen effects"| node_screenfx
node_effects -->|"calls"| node_screenfx
node_ui -->|"renders log"| node_textbox
node_ui -->|"uses model"| node_flowmodel
node_ui -->|"uses controls"| node_touch
node_ui -.->|"opens gallery"| node_gallery
node_ui -.->|"opens flowchart"| node_flowchart
node_main -->|"saves progress"| node_savefile
node_main -->|"persists unlocks"| node_unlocks
node_browser -->|"requests game"| node_server
node_desktop -->|"hosts web app"| node_main
node_android -->|"checks updates"| node_updates

click node_main "https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/main.js"
click node_vm "https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/vm.js"
click node_lang "https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/lang.js"
click node_renderer "https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/renderer.js"
click node_audio "https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/audio.js"
click node_textbox "https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/textbox.js"
click node_ui "https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/ui.js"
click node_touch "https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/touch.js"
click node_effects "https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/effects.js"
click node_animation "https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/animation.js"
click node_screenfx "https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/screenfx.js"
click node_gallery "https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/gallery.js"
click node_flowchart "https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/flowchart.js"
click node_flowmodel "https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/flowchart-model.js"
click node_savefile "https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/savefile.js"
click node_unlocks "https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/unlocks.js"
click node_server "https://github.com/waifwu/tsukirebuild/blob/main/web/server.py"
click node_desktop "https://github.com/waifwu/tsukirebuild/blob/main/web-dev/desktop/main.js"
click node_android "https://github.com/waifwu/tsukirebuild/blob/main/web-dev/android/src/date/arcueid/tsukirebuild/MainActivity.java"
click node_updates "https://github.com/waifwu/tsukirebuild/blob/main/web-dev/android/src/date/arcueid/tsukirebuild/Updates.java"

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_main,node_vm,node_lang,node_renderer,node_audio toneBlue
class node_textbox,node_ui,node_touch,node_effects,node_animation,node_screenfx toneAmber
class node_gallery,node_flowchart,node_flowmodel,node_savefile,node_unlocks toneMint
class node_browser,node_server,node_desktop,node_android,node_updates toneRose
class node_player toneIndigo
```

## Components

### Game runtime

- [Runtime coordinator](https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/main.js): `web/app/js/main.js`
- [Script VM](https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/vm.js): `web/app/js/vm.js`
- [Language assets](https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/lang.js): `web/app/js/lang.js`
- [WebGL renderer](https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/renderer.js): `web/app/js/renderer.js`
- [Audio engine](https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/audio.js): `web/app/js/audio.js`

### Presentation and interaction

- [Dialogue text](https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/textbox.js): `web/app/js/textbox.js`
- [Game screens](https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/ui.js): `web/app/js/ui.js`
- [Touch controls](https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/touch.js): `web/app/js/touch.js`
- [Visual effects](https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/effects.js): `web/app/js/effects.js`
- [Animation](https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/animation.js): `web/app/js/animation.js`
- [Screen effects](https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/screenfx.js): `web/app/js/screenfx.js`

### Game features and state

- [Gallery](https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/gallery.js): `web/app/js/gallery.js`
- [Story flowchart](https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/flowchart.js): `web/app/js/flowchart.js`
- [Flowchart model](https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/flowchart-model.js): `web/app/js/flowchart-model.js`
- [Save files](https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/savefile.js): `web/app/js/savefile.js`
- [Unlock tracking](https://github.com/waifwu/tsukirebuild/blob/main/web/app/js/unlocks.js): `web/app/js/unlocks.js`

### Hosting and apps

- **Web browser**
- [Local web server](https://github.com/waifwu/tsukirebuild/blob/main/web/server.py): `web/server.py`
- [Desktop host](https://github.com/waifwu/tsukirebuild/blob/main/web-dev/desktop/main.js): `web-dev/desktop/main.js`
- [Android host](https://github.com/waifwu/tsukirebuild/blob/main/web-dev/android/src/date/arcueid/tsukirebuild/MainActivity.java): `web-dev/android/src/date/arcueid/tsukirebuild/MainActivity.java`
- [Android updater](https://github.com/waifwu/tsukirebuild/blob/main/web-dev/android/src/date/arcueid/tsukirebuild/Updates.java): `web-dev/android/src/date/arcueid/tsukirebuild/Updates.java`

### Other components

- **Player**

## Connections

- Player → Runtime coordinator: starts game (evidence: `web/app/js/main.js`)
- Runtime coordinator → Game screens: creates screens (evidence: `web/app/js/main.js`)
- Runtime coordinator → Script VM: coordinates (evidence: `web/app/js/main.js`)
- Script VM → Language assets: loads localized assets (evidence: `web/app/js/vm.js`)
- Script VM → WebGL renderer: drives graphics (evidence: `web/app/js/vm.js`)
- Script VM → Audio engine: dispatches sound (evidence: `web/app/js/vm.js`)
- Script VM → Dialogue text: supplies dialogue (evidence: `web/app/js/vm.js`)
- WebGL renderer → Animation: uses animation (evidence: `web/app/js/renderer.js`)
- WebGL renderer → Visual effects: uses effects (evidence: `web/app/js/renderer.js`)
- WebGL renderer → Screen effects: uses screen effects (evidence: `web/app/js/renderer.js`)
- Visual effects → Screen effects: calls (evidence: `web/app/js/effects.js`)
- Game screens → Dialogue text: renders log (evidence: `web/app/js/ui.js`)
- Game screens → Flowchart model: uses model (evidence: `web/app/js/ui.js`)
- Game screens → Touch controls: uses controls (evidence: `web/app/js/ui.js`)
- Game screens → Gallery: opens gallery
- Game screens → Story flowchart: opens flowchart
- Runtime coordinator → Save files: saves progress (evidence: `web/app/js/main.js`)
- Runtime coordinator → Unlock tracking: persists unlocks (evidence: `web/app/js/main.js`)
- Web browser → Local web server: requests game (evidence: `web/server.py`)
- Desktop host → Runtime coordinator: hosts web app (evidence: `web-dev/desktop/main.js`)
- Android host → Android updater: checks updates (evidence: `web-dev/android/src/date/arcueid/tsukirebuild/MainActivity.java`)
