# 1145141919810tonny/webgalgameengine architecture

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

- Interactive diagram: https://gitdiagram.com/1145141919810tonny/webgalgameengine
- Repository: https://github.com/1145141919810tonny/webgalgameengine

## Overview

Shiori is a visual-novel engine: authors supply scene scripts and assets, the launcher hosts the browser-based engine, and players experience dialogue, visuals, audio, and saved story progress. The graph separates launcher hosting, DSL compilation, browser runtime, and presentation. Relationships within ScriptingCore are supported by source-index references and excerpts; launcher-to-engine hosting is documented in the README. Several browser subsystems are represented as capabilities, but their internal wiring was not sampled.

Main entry points: [`ScriptingCore/Host/DslRuntime.cs`](https://github.com/1145141919810tonny/webgalgameengine/blob/main/ScriptingCore/Host/DslRuntime.cs) (DSL runtime bridge), [`shiori engine/engine/engine_command.js`](https://github.com/1145141919810tonny/webgalgameengine/blob/main/shiori%20engine/engine/engine_command.js) (Story commands), [`ScriptingCore/Compile/Compiler.cs`](https://github.com/1145141919810tonny/webgalgameengine/blob/main/ScriptingCore/Compile/Compiler.cs) (Scene compiler), [`shiori engine/engine/engine_scene.js`](https://github.com/1145141919810tonny/webgalgameengine/blob/main/shiori%20engine/engine/engine_scene.js) (Scene execution)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_hosting["Launcher hosting"]
  node_launcher["Shiori launcher<br/>[MainWindow.xaml.cs]"]
  node_http["HTTP hosting<br/>[HttpServer.cs]"]
  node_vfs["Virtual asset files<br/>[VfsEngineFiles.cs]"]
  node_container[("SGD container<br/>[ContainerVfs.cs]")]
end

subgraph group_dsl["DSL compilation"]
  node_dslruntime["DSL runtime bridge<br/>[DslRuntime.cs]"]
  node_ksparser["Scene parser<br/>[Parser.cs]"]
  node_compiler["Scene compiler<br/>[Compiler.cs]"]
  node_macroload["Macro catalog<br/>[MacroCatalog.cs]"]
  node_registry["Command registry<br/>[Registry.cs]"]
  node_conditions["Condition validation<br/>[ConditionRules.cs]"]
  node_jsonemit["Runtime JSON<br/>[DslNodeJson.cs]"]
end

subgraph group_runtime["Story runtime"]
  node_engineboot["Engine bootstrap<br/>[engine_boot.js]"]
  node_scene["Scene execution<br/>[engine_scene.js]"]
  node_commands["Story commands<br/>[engine_command.js]"]
  node_variables["Story variables<br/>[vars.js]"]
  node_save["Save and progress<br/>[engine_save.js]"]
end

subgraph group_presentation["Presentation and media"]
  node_text["Dialogue rendering<br/>[engine_text.js]"]
  node_characters["Character rendering<br/>[engine_chars.js]"]
  node_background["Background rendering<br/>[engine_bg.js]"]
  node_audio["Audio playback<br/>[engine_audio.js]"]
  node_illustration["Illustration configuration<br/>[illustration.js]"]
end

node_creator(("Story creator"))
node_player(("Player"))

node_creator -->|"authors scripts"| node_dslruntime
node_launcher -.->|"starts service"| node_http
node_http -->|"hosts engine"| node_engineboot
node_vfs -->|"reads entries"| node_container
node_dslruntime -->|"compiles scenes"| node_compiler
node_dslruntime -->|"loads macros"| node_macroload
node_dslruntime -->|"emits nodes"| node_jsonemit
node_dslruntime -->|"creates registry"| node_registry
node_dslruntime -.->|"uses file source"| node_vfs
node_compiler -->|"parses fields"| node_ksparser
node_compiler -->|"looks up commands"| node_registry
node_compiler -->|"checks conditions"| node_conditions
node_macroload -->|"parses macro source"| node_ksparser
node_registry -.->|"provides snapshot"| node_dslruntime
node_jsonemit -.->|"returns JSON"| node_dslruntime
node_player -.->|"plays story"| node_engineboot
node_engineboot -.->|"initializes runtime"| node_scene
node_scene -.->|"dispatches commands"| node_commands
node_scene -.->|"uses story state"| node_variables
node_scene -.->|"saves progress"| node_save
node_commands -.->|"shows dialogue"| node_text
node_commands -.->|"updates characters"| node_characters
node_commands -.->|"updates background"| node_background
node_commands -.->|"controls audio"| node_audio
node_characters -.->|"uses configuration"| node_illustration

click node_launcher "https://github.com/1145141919810tonny/webgalgameengine/blob/main/Shiori/MainWindow.xaml.cs"
click node_http "https://github.com/1145141919810tonny/webgalgameengine/blob/main/Shiori/HttpServer.cs"
click node_vfs "https://github.com/1145141919810tonny/webgalgameengine/blob/main/Shiori/VfsEngineFiles.cs"
click node_container "https://github.com/1145141919810tonny/webgalgameengine/blob/main/Shiori/ContainerVfs.cs"
click node_dslruntime "https://github.com/1145141919810tonny/webgalgameengine/blob/main/ScriptingCore/Host/DslRuntime.cs"
click node_ksparser "https://github.com/1145141919810tonny/webgalgameengine/blob/main/ScriptingCore/Parse/Parser.cs"
click node_compiler "https://github.com/1145141919810tonny/webgalgameengine/blob/main/ScriptingCore/Compile/Compiler.cs"
click node_macroload "https://github.com/1145141919810tonny/webgalgameengine/blob/main/ScriptingCore/Load/MacroCatalog.cs"
click node_registry "https://github.com/1145141919810tonny/webgalgameengine/blob/main/ScriptingCore/Schema/Registry.cs"
click node_conditions "https://github.com/1145141919810tonny/webgalgameengine/blob/main/ScriptingCore/Validate/ConditionRules.cs"
click node_jsonemit "https://github.com/1145141919810tonny/webgalgameengine/blob/main/ScriptingCore/Emit/DslNodeJson.cs"
click node_engineboot "https://github.com/1145141919810tonny/webgalgameengine/blob/main/shiori%20engine/engine/engine_boot.js"
click node_scene "https://github.com/1145141919810tonny/webgalgameengine/blob/main/shiori%20engine/engine/engine_scene.js"
click node_commands "https://github.com/1145141919810tonny/webgalgameengine/blob/main/shiori%20engine/engine/engine_command.js"
click node_variables "https://github.com/1145141919810tonny/webgalgameengine/blob/main/shiori%20engine/system/vars.js"
click node_save "https://github.com/1145141919810tonny/webgalgameengine/blob/main/shiori%20engine/engine/engine_save.js"
click node_text "https://github.com/1145141919810tonny/webgalgameengine/blob/main/shiori%20engine/engine/engine_text.js"
click node_characters "https://github.com/1145141919810tonny/webgalgameengine/blob/main/shiori%20engine/engine/engine_chars.js"
click node_background "https://github.com/1145141919810tonny/webgalgameengine/blob/main/shiori%20engine/engine/engine_bg.js"
click node_audio "https://github.com/1145141919810tonny/webgalgameengine/blob/main/shiori%20engine/engine/engine_audio.js"
click node_illustration "https://github.com/1145141919810tonny/webgalgameengine/blob/main/shiori%20engine/config/illustration.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_launcher,node_http,node_vfs,node_container toneBlue
class node_dslruntime,node_ksparser,node_compiler,node_macroload,node_registry,node_conditions,node_jsonemit toneAmber
class node_engineboot,node_scene,node_commands,node_variables,node_save toneMint
class node_text,node_characters,node_background,node_audio,node_illustration toneRose
class node_creator,node_player toneIndigo
```

## Components

### Launcher hosting

- [Shiori launcher](https://github.com/1145141919810tonny/webgalgameengine/blob/main/Shiori/MainWindow.xaml.cs): `Shiori/MainWindow.xaml.cs`
- [HTTP hosting](https://github.com/1145141919810tonny/webgalgameengine/blob/main/Shiori/HttpServer.cs): `Shiori/HttpServer.cs`
- [Virtual asset files](https://github.com/1145141919810tonny/webgalgameengine/blob/main/Shiori/VfsEngineFiles.cs): `Shiori/VfsEngineFiles.cs`
- [SGD container](https://github.com/1145141919810tonny/webgalgameengine/blob/main/Shiori/ContainerVfs.cs): `Shiori/ContainerVfs.cs`

### DSL compilation

- [DSL runtime bridge](https://github.com/1145141919810tonny/webgalgameengine/blob/main/ScriptingCore/Host/DslRuntime.cs): `ScriptingCore/Host/DslRuntime.cs`
- [Scene parser](https://github.com/1145141919810tonny/webgalgameengine/blob/main/ScriptingCore/Parse/Parser.cs): `ScriptingCore/Parse/Parser.cs`
- [Scene compiler](https://github.com/1145141919810tonny/webgalgameengine/blob/main/ScriptingCore/Compile/Compiler.cs): `ScriptingCore/Compile/Compiler.cs`
- [Macro catalog](https://github.com/1145141919810tonny/webgalgameengine/blob/main/ScriptingCore/Load/MacroCatalog.cs): `ScriptingCore/Load/MacroCatalog.cs`
- [Command registry](https://github.com/1145141919810tonny/webgalgameengine/blob/main/ScriptingCore/Schema/Registry.cs): `ScriptingCore/Schema/Registry.cs`
- [Condition validation](https://github.com/1145141919810tonny/webgalgameengine/blob/main/ScriptingCore/Validate/ConditionRules.cs): `ScriptingCore/Validate/ConditionRules.cs`
- [Runtime JSON](https://github.com/1145141919810tonny/webgalgameengine/blob/main/ScriptingCore/Emit/DslNodeJson.cs): `ScriptingCore/Emit/DslNodeJson.cs`

### Story runtime

- [Engine bootstrap](https://github.com/1145141919810tonny/webgalgameengine/blob/main/shiori%20engine/engine/engine_boot.js): `shiori engine/engine/engine_boot.js`
- [Scene execution](https://github.com/1145141919810tonny/webgalgameengine/blob/main/shiori%20engine/engine/engine_scene.js): `shiori engine/engine/engine_scene.js`
- [Story commands](https://github.com/1145141919810tonny/webgalgameengine/blob/main/shiori%20engine/engine/engine_command.js): `shiori engine/engine/engine_command.js`
- [Story variables](https://github.com/1145141919810tonny/webgalgameengine/blob/main/shiori%20engine/system/vars.js): `shiori engine/system/vars.js`
- [Save and progress](https://github.com/1145141919810tonny/webgalgameengine/blob/main/shiori%20engine/engine/engine_save.js): `shiori engine/engine/engine_save.js`

### Presentation and media

- [Dialogue rendering](https://github.com/1145141919810tonny/webgalgameengine/blob/main/shiori%20engine/engine/engine_text.js): `shiori engine/engine/engine_text.js`
- [Character rendering](https://github.com/1145141919810tonny/webgalgameengine/blob/main/shiori%20engine/engine/engine_chars.js): `shiori engine/engine/engine_chars.js`
- [Background rendering](https://github.com/1145141919810tonny/webgalgameengine/blob/main/shiori%20engine/engine/engine_bg.js): `shiori engine/engine/engine_bg.js`
- [Audio playback](https://github.com/1145141919810tonny/webgalgameengine/blob/main/shiori%20engine/engine/engine_audio.js): `shiori engine/engine/engine_audio.js`
- [Illustration configuration](https://github.com/1145141919810tonny/webgalgameengine/blob/main/shiori%20engine/config/illustration.js): `shiori engine/config/illustration.js`

### Other components

- **Story creator**
- **Player**

## Connections

- Story creator → DSL runtime bridge: authors scripts
- Shiori launcher → HTTP hosting: starts service
- HTTP hosting → Engine bootstrap: hosts engine
- Virtual asset files → SGD container: reads entries (evidence: `Shiori/VfsEngineFiles.cs`)
- DSL runtime bridge → Scene compiler: compiles scenes (evidence: `ScriptingCore/Host/DslRuntime.cs`)
- DSL runtime bridge → Macro catalog: loads macros (evidence: `ScriptingCore/Host/DslRuntime.cs`)
- DSL runtime bridge → Runtime JSON: emits nodes (evidence: `ScriptingCore/Host/DslRuntime.cs`)
- DSL runtime bridge → Command registry: creates registry (evidence: `ScriptingCore/Host/DslRuntime.cs`)
- DSL runtime bridge → Virtual asset files: uses file source
- Scene compiler → Scene parser: parses fields (evidence: `ScriptingCore/Compile/Compiler.cs`)
- Scene compiler → Command registry: looks up commands (evidence: `ScriptingCore/Compile/Compiler.cs`)
- Scene compiler → Condition validation: checks conditions (evidence: `ScriptingCore/Compile/Compiler.cs`)
- Macro catalog → Scene parser: parses macro source
- Command registry → DSL runtime bridge: provides snapshot (evidence: `ScriptingCore/Host/DslRuntime.cs`)
- Runtime JSON → DSL runtime bridge: returns JSON (evidence: `ScriptingCore/Host/DslRuntime.cs`)
- Player → Engine bootstrap: plays story
- Engine bootstrap → Scene execution: initializes runtime
- Scene execution → Story commands: dispatches commands
- Scene execution → Story variables: uses story state
- Scene execution → Save and progress: saves progress
- Story commands → Dialogue rendering: shows dialogue
- Story commands → Character rendering: updates characters
- Story commands → Background rendering: updates background
- Story commands → Audio playback: controls audio
- Character rendering → Illustration configuration: uses configuration
