# ttqwntian/dvnge architecture

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

- Interactive diagram: https://gitdiagram.com/ttqwntian/dvnge
- Repository: https://github.com/ttqwntian/dvnge

## Overview

Dvnge is a browser-based visual-novel engine. Players enter through the game page, which runs configured chapter content through the engine; the engine presents scenes and handles dialogue, choices, state, and media. Save management persists and restores play state, while a separate module imports and exports saved data. The engine excerpt is partial, so links between individual runtime features are shown only where documented or supported by the available code.

Main entry points: [`src/js/TTQ视觉小说引擎.js`](https://github.com/ttqwntian/dvnge/blob/main/src/js/TTQ%E8%A7%86%E8%A7%89%E5%B0%8F%E8%AF%B4%E5%BC%95%E6%93%8E.js) (Visual novel engine), [`src/js/导出入存档功能.js`](https://github.com/ttqwntian/dvnge/blob/main/src/js/%E5%AF%BC%E5%87%BA%E5%85%A5%E5%AD%98%E6%A1%A3%E5%8A%9F%E8%83%BD.js) (Save import/export), [`src/game.html`](https://github.com/ttqwntian/dvnge/blob/main/src/game.html) (Game page), [`src/js/游戏配置.js`](https://github.com/ttqwntian/dvnge/blob/main/src/js/%E6%B8%B8%E6%88%8F%E9%85%8D%E7%BD%AE.js) (Game configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Story runtime"]
  node_game["Game page<br/>[game.html]"]
  node_engine["Visual novel engine<br/>[TTQ视觉小说引擎.js]"]
  node_dialogue["Dialogue and choices<br/>[TTQ视觉小说引擎.js]"]
  node_scene["Scene presentation<br/>[TTQ视觉小说引擎.js]"]
  node_logic["Variables and branching<br/>[TTQ视觉小说引擎.js]"]
end

subgraph group_content["Game content"]
  node_chapterdata["Chapter scripts<br/>[序章.dvns]"]
  node_translations["Translated chapters"]
  node_config["Game configuration<br/>[游戏配置.js]"]
end

subgraph group_persistence["State and saves"]
  node_saveui["Save and load<br/>[TTQ视觉小说引擎.js]"]
  node_store[("Browser storage")]
  node_transfer["Save import/export<br/>[导出入存档功能.js]"]
  node_cg["CG collection<br/>[TTQ视觉小说引擎.js]"]
end

subgraph group_extensions["Language and extensions"]
  node_language["Language settings<br/>[游戏配置.js]"]
  node_custom["Custom functions<br/>[自定义功能.js]"]
end

node_player(("Player"))
node_file["Save file"]

node_player -->|"opens"| node_game
node_game -->|"starts"| node_engine
node_engine -->|"waits for"| node_config
node_engine -->|"loads chapters"| node_chapterdata
node_engine -.->|"loads translations"| node_translations
node_engine -->|"renders dialogue"| node_dialogue
node_engine -->|"updates scenes"| node_scene
node_engine -->|"evaluates choices"| node_logic
node_engine -->|"manages saves"| node_saveui
node_engine -->|"reads and writes"| node_store
node_saveui -->|"saves and loads"| node_store
node_transfer -->|"reads and writes"| node_store
node_file -->|"imports from"| node_transfer
node_transfer -->|"exports to"| node_file
node_config -->|"defines languages"| node_language
node_engine -.->|"runs custom code"| node_custom
node_engine -->|"tracks unlocks"| node_cg
node_cg -->|"persists collection"| node_store

click node_game "https://github.com/ttqwntian/dvnge/blob/main/src/game.html"
click node_engine "https://github.com/ttqwntian/dvnge/blob/main/src/js/TTQ%E8%A7%86%E8%A7%89%E5%B0%8F%E8%AF%B4%E5%BC%95%E6%93%8E.js"
click node_dialogue "https://github.com/ttqwntian/dvnge/blob/main/src/js/TTQ%E8%A7%86%E8%A7%89%E5%B0%8F%E8%AF%B4%E5%BC%95%E6%93%8E.js"
click node_scene "https://github.com/ttqwntian/dvnge/blob/main/src/js/TTQ%E8%A7%86%E8%A7%89%E5%B0%8F%E8%AF%B4%E5%BC%95%E6%93%8E.js"
click node_logic "https://github.com/ttqwntian/dvnge/blob/main/src/js/TTQ%E8%A7%86%E8%A7%89%E5%B0%8F%E8%AF%B4%E5%BC%95%E6%93%8E.js"
click node_chapterdata "https://github.com/ttqwntian/dvnge/blob/main/src/chapter/%E5%BA%8F%E7%AB%A0.dvns"
click node_translations "https://github.com/ttqwntian/dvnge/tree/main/src/chapter/tl"
click node_config "https://github.com/ttqwntian/dvnge/blob/main/src/js/%E6%B8%B8%E6%88%8F%E9%85%8D%E7%BD%AE.js"
click node_saveui "https://github.com/ttqwntian/dvnge/blob/main/src/js/TTQ%E8%A7%86%E8%A7%89%E5%B0%8F%E8%AF%B4%E5%BC%95%E6%93%8E.js"
click node_transfer "https://github.com/ttqwntian/dvnge/blob/main/src/js/%E5%AF%BC%E5%87%BA%E5%85%A5%E5%AD%98%E6%A1%A3%E5%8A%9F%E8%83%BD.js"
click node_language "https://github.com/ttqwntian/dvnge/blob/main/src/js/%E6%B8%B8%E6%88%8F%E9%85%8D%E7%BD%AE.js"
click node_custom "https://github.com/ttqwntian/dvnge/blob/main/src/js/%E8%87%AA%E5%AE%9A%E4%B9%89%E5%8A%9F%E8%83%BD.js"
click node_cg "https://github.com/ttqwntian/dvnge/blob/main/src/js/TTQ%E8%A7%86%E8%A7%89%E5%B0%8F%E8%AF%B4%E5%BC%95%E6%93%8E.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,node_engine,node_dialogue,node_scene,node_logic toneBlue
class node_chapterdata,node_translations,node_config toneAmber
class node_saveui,node_store,node_transfer,node_cg toneMint
class node_language,node_custom toneRose
class node_player,node_file toneIndigo
```

## Components

### Story runtime

- [Game page](https://github.com/ttqwntian/dvnge/blob/main/src/game.html): `src/game.html`
- [Visual novel engine](https://github.com/ttqwntian/dvnge/blob/main/src/js/TTQ%E8%A7%86%E8%A7%89%E5%B0%8F%E8%AF%B4%E5%BC%95%E6%93%8E.js): `src/js/TTQ视觉小说引擎.js`
- [Dialogue and choices](https://github.com/ttqwntian/dvnge/blob/main/src/js/TTQ%E8%A7%86%E8%A7%89%E5%B0%8F%E8%AF%B4%E5%BC%95%E6%93%8E.js): `src/js/TTQ视觉小说引擎.js`
- [Scene presentation](https://github.com/ttqwntian/dvnge/blob/main/src/js/TTQ%E8%A7%86%E8%A7%89%E5%B0%8F%E8%AF%B4%E5%BC%95%E6%93%8E.js): `src/js/TTQ视觉小说引擎.js`
- [Variables and branching](https://github.com/ttqwntian/dvnge/blob/main/src/js/TTQ%E8%A7%86%E8%A7%89%E5%B0%8F%E8%AF%B4%E5%BC%95%E6%93%8E.js): `src/js/TTQ视觉小说引擎.js`

### Game content

- [Chapter scripts](https://github.com/ttqwntian/dvnge/blob/main/src/chapter/%E5%BA%8F%E7%AB%A0.dvns): `src/chapter/序章.dvns`
- [Translated chapters](https://github.com/ttqwntian/dvnge/tree/main/src/chapter/tl): `src/chapter/tl`
- [Game configuration](https://github.com/ttqwntian/dvnge/blob/main/src/js/%E6%B8%B8%E6%88%8F%E9%85%8D%E7%BD%AE.js): `src/js/游戏配置.js`

### State and saves

- [Save and load](https://github.com/ttqwntian/dvnge/blob/main/src/js/TTQ%E8%A7%86%E8%A7%89%E5%B0%8F%E8%AF%B4%E5%BC%95%E6%93%8E.js): `src/js/TTQ视觉小说引擎.js`
- **Browser storage**
- [Save import/export](https://github.com/ttqwntian/dvnge/blob/main/src/js/%E5%AF%BC%E5%87%BA%E5%85%A5%E5%AD%98%E6%A1%A3%E5%8A%9F%E8%83%BD.js): `src/js/导出入存档功能.js`
- [CG collection](https://github.com/ttqwntian/dvnge/blob/main/src/js/TTQ%E8%A7%86%E8%A7%89%E5%B0%8F%E8%AF%B4%E5%BC%95%E6%93%8E.js): `src/js/TTQ视觉小说引擎.js`

### Language and extensions

- [Language settings](https://github.com/ttqwntian/dvnge/blob/main/src/js/%E6%B8%B8%E6%88%8F%E9%85%8D%E7%BD%AE.js): `src/js/游戏配置.js`
- [Custom functions](https://github.com/ttqwntian/dvnge/blob/main/src/js/%E8%87%AA%E5%AE%9A%E4%B9%89%E5%8A%9F%E8%83%BD.js): `src/js/自定义功能.js`

### Other components

- **Player**
- **Save file**

## Connections

- Player → Game page: opens
- Game page → Visual novel engine: starts
- Visual novel engine → Game configuration: waits for
- Visual novel engine → Chapter scripts: loads chapters
- Visual novel engine → Translated chapters: loads translations
- Visual novel engine → Dialogue and choices: renders dialogue
- Visual novel engine → Scene presentation: updates scenes
- Visual novel engine → Variables and branching: evaluates choices
- Visual novel engine → Save and load: manages saves
- Visual novel engine → Browser storage: reads and writes
- Save and load → Browser storage: saves and loads
- Save import/export → Browser storage: reads and writes
- Save file → Save import/export: imports from
- Save import/export → Save file: exports to
- Game configuration → Language settings: defines languages
- Visual novel engine → Custom functions: runs custom code
- Visual novel engine → CG collection: tracks unlocks
- CG collection → Browser storage: persists collection
