# waxmell99/live_till_the_end architecture

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

- Interactive diagram: https://gitdiagram.com/waxmell99/live_till_the_end
- Repository: https://github.com/waxmell99/live_till_the_end

## Overview

Survive Until the War Ends is an offline, browser-based Western Front survival game. Players create a soldier, then repeatedly read a scene and choose an action; the engine resolves risk, effects, time, events, and possible endings, while the app saves each updated life. Supporting branches expose the diary, letters, comrades, map, and historical archive, and present the authored game in English or Chinese. The graph follows relationships shown by README and source-index references; some UI wiring and unsampled subsystem internals are not excerpted, so those links are omitted.

Main entry points: [`src/components/GameScreen.tsx`](https://github.com/waxmell99/live_till_the_end/blob/main/src/components/GameScreen.tsx) (Game screen), [`src/game/engine.ts`](https://github.com/waxmell99/live_till_the_end/blob/main/src/game/engine.ts) (Game engine), [`src/App.tsx`](https://github.com/waxmell99/live_till_the_end/blob/main/src/App.tsx) (App flow), [`src/components/Dossier.tsx`](https://github.com/waxmell99/live_till_the_end/blob/main/src/components/Dossier.tsx) (Field dossier)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Game interface"]
  node_app["App flow<br/>[App.tsx]"]
  node_creation["Character creation"]
  node_intro["Opening screen<br/>[IntroScreen.tsx]"]
  node_gameui["Game screen<br/>[GameScreen.tsx]"]
  node_eventui["Event choices<br/>[EventPanel.tsx]"]
  node_statusui["Status panel<br/>[StatusPanel.tsx]"]
  node_comradesui["Comrades panel<br/>[ComradesPanel.tsx]"]
  node_dossier["Field dossier<br/>[Dossier.tsx]"]
  node_mapui["Field map<br/>[MapPanel.tsx]"]
  node_ending["Ending screen<br/>[EndScreen.tsx]"]
  node_ambient["Ambient sound<br/>[useAmbientSound.ts]"]
end

subgraph group_rules["Game rules"]
  node_engine["Game engine<br/>[engine.ts]"]
  node_random["Seeded randomness<br/>[random.ts]"]
  node_save[("Save and restore<br/>[save.ts]")]
  node_simulation["Life simulation<br/>[simulation.ts]"]
  node_presentation["Narrative presentation<br/>[presentation.ts]"]
end

subgraph group_content["World and stories"]
  node_events["Event catalogue"]
  node_history["Historical records<br/>[history.ts]"]
  node_letters["Letters<br/>[letters.ts]"]
  node_npcs["Comrade definitions<br/>[npcs.ts]"]
end

subgraph group_language["Localization"]
  node_zhcontent["Chinese authored content"]
  node_localization["Content localization<br/>[content.ts]"]
  node_languageprovider["Language preference<br/>[index.tsx]"]
  node_switcher["Language switcher"]
end

node_player(("Player"))

node_player -->|"starts or continues"| node_intro
node_intro -->|"requests game flow"| node_app
node_app -->|"loads and saves"| node_save
node_app -->|"opens creation"| node_creation
node_creation -->|"submits profile"| node_app
node_app -->|"creates life"| node_engine
node_app -->|"renders active life"| node_gameui
node_gameui -->|"resolves choices"| node_engine
node_gameui -->|"renders scene"| node_eventui
node_gameui -->|"renders status"| node_statusui
node_gameui -->|"renders comrades"| node_comradesui
node_gameui -->|"opens dossier"| node_dossier
node_gameui -->|"renders map"| node_mapui
node_gameui -->|"renders ending"| node_ending
node_gameui -->|"persists life"| node_save
node_gameui -->|"uses ambience"| node_ambient
node_eventui -->|"gets event and choices"| node_engine
node_engine -->|"draws seeded results"| node_random
node_engine -->|"selects event"| node_events
node_engine -->|"reads timeline"| node_history
node_engine -->|"records received letters"| node_letters
node_engine -->|"reads comrade data"| node_npcs
node_simulation -->|"exercises game rules"| node_engine
node_eventui -->|"renders narrative"| node_presentation
node_dossier -->|"shows archive"| node_history
node_dossier -->|"shows kept letters"| node_letters
node_dossier -->|"formats entries"| node_presentation
node_comradesui -->|"shows comrades"| node_npcs
node_presentation -->|"resolves names"| node_npcs
node_localization -->|"looks up source events"| node_events
node_localization -->|"uses Chinese text"| node_zhcontent
node_languageprovider -.->|"provides language"| node_localization
node_switcher -->|"changes preference"| node_languageprovider
node_creation -->|"uses translations"| node_languageprovider
node_eventui -->|"localizes scene"| node_localization
node_dossier -->|"localizes archive"| node_localization

click node_app "https://github.com/waxmell99/live_till_the_end/blob/main/src/App.tsx"
click node_creation "https://github.com/waxmell99/live_till_the_end/blob/main/src/components/CharacterCreation.tsx"
click node_intro "https://github.com/waxmell99/live_till_the_end/blob/main/src/components/IntroScreen.tsx"
click node_gameui "https://github.com/waxmell99/live_till_the_end/blob/main/src/components/GameScreen.tsx"
click node_eventui "https://github.com/waxmell99/live_till_the_end/blob/main/src/components/EventPanel.tsx"
click node_statusui "https://github.com/waxmell99/live_till_the_end/blob/main/src/components/StatusPanel.tsx"
click node_comradesui "https://github.com/waxmell99/live_till_the_end/blob/main/src/components/ComradesPanel.tsx"
click node_dossier "https://github.com/waxmell99/live_till_the_end/blob/main/src/components/Dossier.tsx"
click node_mapui "https://github.com/waxmell99/live_till_the_end/blob/main/src/components/MapPanel.tsx"
click node_ending "https://github.com/waxmell99/live_till_the_end/blob/main/src/components/EndScreen.tsx"
click node_engine "https://github.com/waxmell99/live_till_the_end/blob/main/src/game/engine.ts"
click node_random "https://github.com/waxmell99/live_till_the_end/blob/main/src/game/random.ts"
click node_save "https://github.com/waxmell99/live_till_the_end/blob/main/src/game/save.ts"
click node_simulation "https://github.com/waxmell99/live_till_the_end/blob/main/src/game/simulation.ts"
click node_presentation "https://github.com/waxmell99/live_till_the_end/blob/main/src/game/presentation.ts"
click node_events "https://github.com/waxmell99/live_till_the_end/tree/main/src/data/events"
click node_history "https://github.com/waxmell99/live_till_the_end/blob/main/src/data/history.ts"
click node_letters "https://github.com/waxmell99/live_till_the_end/blob/main/src/data/letters.ts"
click node_npcs "https://github.com/waxmell99/live_till_the_end/blob/main/src/data/npcs.ts"
click node_zhcontent "https://github.com/waxmell99/live_till_the_end/blob/main/src/i18n/events-people.zh.ts"
click node_localization "https://github.com/waxmell99/live_till_the_end/blob/main/src/i18n/content.ts"
click node_languageprovider "https://github.com/waxmell99/live_till_the_end/blob/main/src/i18n/index.tsx"
click node_switcher "https://github.com/waxmell99/live_till_the_end/blob/main/src/components/LanguageSwitcher.tsx"
click node_ambient "https://github.com/waxmell99/live_till_the_end/blob/main/src/hooks/useAmbientSound.ts"

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_app,node_creation,node_intro,node_gameui,node_eventui,node_statusui,node_comradesui,node_dossier,node_mapui,node_ending,node_ambient toneBlue
class node_engine,node_random,node_save,node_simulation,node_presentation toneAmber
class node_events,node_history,node_letters,node_npcs toneMint
class node_zhcontent,node_localization,node_languageprovider,node_switcher toneRose
class node_player toneIndigo
```

## Components

### Game interface

- [App flow](https://github.com/waxmell99/live_till_the_end/blob/main/src/App.tsx): `src/App.tsx`
- [Character creation](https://github.com/waxmell99/live_till_the_end/blob/main/src/components/CharacterCreation.tsx): `src/components/CharacterCreation.tsx`
- [Opening screen](https://github.com/waxmell99/live_till_the_end/blob/main/src/components/IntroScreen.tsx): `src/components/IntroScreen.tsx`
- [Game screen](https://github.com/waxmell99/live_till_the_end/blob/main/src/components/GameScreen.tsx): `src/components/GameScreen.tsx`
- [Event choices](https://github.com/waxmell99/live_till_the_end/blob/main/src/components/EventPanel.tsx): `src/components/EventPanel.tsx`
- [Status panel](https://github.com/waxmell99/live_till_the_end/blob/main/src/components/StatusPanel.tsx): `src/components/StatusPanel.tsx`
- [Comrades panel](https://github.com/waxmell99/live_till_the_end/blob/main/src/components/ComradesPanel.tsx): `src/components/ComradesPanel.tsx`
- [Field dossier](https://github.com/waxmell99/live_till_the_end/blob/main/src/components/Dossier.tsx): `src/components/Dossier.tsx`
- [Field map](https://github.com/waxmell99/live_till_the_end/blob/main/src/components/MapPanel.tsx): `src/components/MapPanel.tsx`
- [Ending screen](https://github.com/waxmell99/live_till_the_end/blob/main/src/components/EndScreen.tsx): `src/components/EndScreen.tsx`
- [Ambient sound](https://github.com/waxmell99/live_till_the_end/blob/main/src/hooks/useAmbientSound.ts): `src/hooks/useAmbientSound.ts`

### Game rules

- [Game engine](https://github.com/waxmell99/live_till_the_end/blob/main/src/game/engine.ts): `src/game/engine.ts`
- [Seeded randomness](https://github.com/waxmell99/live_till_the_end/blob/main/src/game/random.ts): `src/game/random.ts`
- [Save and restore](https://github.com/waxmell99/live_till_the_end/blob/main/src/game/save.ts): `src/game/save.ts`
- [Life simulation](https://github.com/waxmell99/live_till_the_end/blob/main/src/game/simulation.ts): `src/game/simulation.ts`
- [Narrative presentation](https://github.com/waxmell99/live_till_the_end/blob/main/src/game/presentation.ts): `src/game/presentation.ts`

### World and stories

- [Event catalogue](https://github.com/waxmell99/live_till_the_end/tree/main/src/data/events): `src/data/events`
- [Historical records](https://github.com/waxmell99/live_till_the_end/blob/main/src/data/history.ts): `src/data/history.ts`
- [Letters](https://github.com/waxmell99/live_till_the_end/blob/main/src/data/letters.ts): `src/data/letters.ts`
- [Comrade definitions](https://github.com/waxmell99/live_till_the_end/blob/main/src/data/npcs.ts): `src/data/npcs.ts`

### Localization

- [Chinese authored content](https://github.com/waxmell99/live_till_the_end/blob/main/src/i18n/events-people.zh.ts): `src/i18n/events-people.zh.ts`
- [Content localization](https://github.com/waxmell99/live_till_the_end/blob/main/src/i18n/content.ts): `src/i18n/content.ts`
- [Language preference](https://github.com/waxmell99/live_till_the_end/blob/main/src/i18n/index.tsx): `src/i18n/index.tsx`
- [Language switcher](https://github.com/waxmell99/live_till_the_end/blob/main/src/components/LanguageSwitcher.tsx): `src/components/LanguageSwitcher.tsx`

### Other components

- **Player**

## Connections

- Player → Opening screen: starts or continues (evidence: `README.md`)
- Opening screen → App flow: requests game flow (evidence: `src/App.tsx`)
- App flow → Save and restore: loads and saves (evidence: `src/App.tsx`)
- App flow → Character creation: opens creation (evidence: `src/App.tsx`)
- Character creation → App flow: submits profile (evidence: `src/App.tsx`)
- App flow → Game engine: creates life (evidence: `src/App.tsx`)
- App flow → Game screen: renders active life (evidence: `src/App.tsx`)
- Game screen → Game engine: resolves choices (evidence: `src/components/GameScreen.tsx`)
- Game screen → Event choices: renders scene (evidence: `src/components/GameScreen.tsx`)
- Game screen → Status panel: renders status (evidence: `src/components/GameScreen.tsx`)
- Game screen → Comrades panel: renders comrades (evidence: `src/components/GameScreen.tsx`)
- Game screen → Field dossier: opens dossier (evidence: `src/components/GameScreen.tsx`)
- Game screen → Field map: renders map (evidence: `src/components/GameScreen.tsx`)
- Game screen → Ending screen: renders ending (evidence: `src/components/GameScreen.tsx`)
- Game screen → Save and restore: persists life (evidence: `README.md`)
- Game screen → Ambient sound: uses ambience (evidence: `src/components/GameScreen.tsx`)
- Event choices → Game engine: gets event and choices (evidence: `src/components/EventPanel.tsx`)
- Game engine → Seeded randomness: draws seeded results (evidence: `src/game/engine.ts`)
- Game engine → Event catalogue: selects event (evidence: `src/game/engine.ts`)
- Game engine → Historical records: reads timeline (evidence: `src/game/engine.ts`)
- Game engine → Letters: records received letters (evidence: `src/game/engine.ts`)
- Game engine → Comrade definitions: reads comrade data (evidence: `src/game/engine.ts`)
- Life simulation → Game engine: exercises game rules (evidence: `src/game/simulation.ts`)
- Event choices → Narrative presentation: renders narrative (evidence: `src/components/EventPanel.tsx`)
- Field dossier → Historical records: shows archive (evidence: `src/components/Dossier.tsx`)
- Field dossier → Letters: shows kept letters (evidence: `src/components/Dossier.tsx`)
- Field dossier → Narrative presentation: formats entries (evidence: `src/components/Dossier.tsx`)
- Comrades panel → Comrade definitions: shows comrades (evidence: `src/components/ComradesPanel.tsx`)
- Narrative presentation → Comrade definitions: resolves names (evidence: `src/game/presentation.ts`)
- Content localization → Event catalogue: looks up source events (evidence: `src/i18n/content.ts`)
- Content localization → Chinese authored content: uses Chinese text (evidence: `src/i18n/content.ts`)
- Language preference → Content localization: provides language (evidence: `src/i18n/content.ts`)
- Language switcher → Language preference: changes preference (evidence: `src/components/LanguageSwitcher.tsx`)
- Character creation → Language preference: uses translations (evidence: `src/components/CharacterCreation.tsx`)
- Event choices → Content localization: localizes scene (evidence: `src/components/EventPanel.tsx`)
- Field dossier → Content localization: localizes archive (evidence: `src/components/Dossier.tsx`)
