# pluviophilezack/elephant_and_rider architecture

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

- Interactive diagram: https://gitdiagram.com/pluviophilezack/elephant_and_rider
- Repository: https://github.com/pluviophilezack/elephant_and_rider

## Overview

This is a Phaser narrative game, not merely the Phaser/Vite template described by the README. The principal workflow is entering the overworld, exploring and triggering moral-choice events, accumulating moral scores and rain stones, then reaching an ending. The graph follows relationships visible in excerpts or source-index references; unsampled implementation details are represented only where the tree and documented behavior support a subsystem.

Main entry points: [`src/game/scenes/Overworld.js`](https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/scenes/Overworld.js) (Overworld), [`src/game/core/DialogueSystem.js`](https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/core/DialogueSystem.js) (Dialogue system), [`src/game/core/MoralState.js`](https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/core/MoralState.js) (Moral state), [`src/game/core/ChoiceSystem.js`](https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/core/ChoiceSystem.js) (Choice system)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_scenes["Game flow"]
  node_entry["Game entry<br/>[main.js]"]
  node_menu["Main menu<br/>[MainMenu.js]"]
  node_overworld["Overworld<br/>[Overworld.js]"]
  node_ending["Ending<br/>[Ending.js]"]
  node_credits["Event credits<br/>[EventCredits.js]"]
end

subgraph group_systems["Gameplay systems"]
  node_player_control["Player control"]
  node_trunk["Trunk controller<br/>[TrunkController.js]"]
  node_progress["Game progress<br/>[GameProgress.js]"]
  node_moral["Moral state<br/>[MoralState.js]"]
  node_pickup["Pickup registry<br/>[PickupRegistry.js]"]
  node_devtools["Developer tools<br/>[DevToolsManager.js]"]
  node_river["River travel"]
  node_dialogue["Dialogue system<br/>[DialogueSystem.js]"]
  node_choice["Choice system<br/>[ChoiceSystem.js]"]
  node_trigger["Trigger zones<br/>[TriggerZone.js]"]
end

subgraph group_events["Moral events"]
  node_authority["Herd authority<br/>[index.js]"]
  node_domain["Elephant domain<br/>[index.js]"]
  node_fairness["Water fairness<br/>[index.js]"]
  node_ingroup["Bird contest<br/>[index.js]"]
  node_purity["Flooded ruins<br/>[index.js]"]
  node_tutorial["Tutorial event<br/>[index.js]"]
end

subgraph group_presentation["Player interface"]
  node_hud["Rain-stone HUD<br/>[HUD.js]"]
  node_dialogue_box["Dialogue box<br/>[DialogueBox.js]"]
  node_choice_prompt["Choice prompt<br/>[ChoicePrompt.js]"]
end

node_player(("Player"))

node_player -->|"starts game"| node_entry
node_entry -->|"registers scene"| node_menu
node_entry -->|"registers scene"| node_overworld
node_entry -->|"registers scene"| node_ending
node_entry -->|"registers scene"| node_credits
node_menu -->|"uses progress"| node_progress
node_overworld -->|"creates controller"| node_player_control
node_overworld -->|"creates controller"| node_trunk
node_overworld -->|"creates registry"| node_pickup
node_overworld -->|"resets state"| node_moral
node_overworld -->|"creates HUD"| node_hud
node_overworld -->|"creates tools"| node_devtools
node_overworld -->|"sets up event"| node_tutorial
node_overworld -->|"sets up event"| node_authority
node_overworld -->|"sets up event"| node_domain
node_overworld -->|"sets up event"| node_fairness
node_overworld -->|"sets up event"| node_ingroup
node_overworld -->|"sets up event"| node_purity
node_overworld -->|"starts at threshold"| node_ending
node_overworld -->|"awards stones"| node_hud
node_ending -->|"reads scores"| node_moral
node_ending -->|"reads progress"| node_progress
node_player_control -->|"checks dialogue"| node_dialogue
node_dialogue -->|"creates box"| node_dialogue_box
node_choice -->|"creates prompt"| node_choice_prompt
node_devtools -->|"installs travel"| node_river
node_authority -->|"calls dialogue"| node_dialogue
node_authority -->|"uses choices"| node_choice
node_authority -->|"updates scores"| node_moral
node_authority -->|"creates zones"| node_trigger
node_domain -->|"uses dialogue"| node_dialogue
node_domain -->|"uses choices"| node_choice
node_domain -->|"uses scores"| node_moral
node_domain -->|"uses zones"| node_trigger
node_fairness -->|"calls dialogue"| node_dialogue
node_fairness -->|"uses choices"| node_choice
node_fairness -->|"updates scores"| node_moral
node_fairness -->|"uses zones"| node_trigger
node_ingroup -->|"uses dialogue"| node_dialogue
node_ingroup -->|"uses choices"| node_choice
node_ingroup -->|"updates scores"| node_moral
node_ingroup -->|"uses zones"| node_trigger
node_purity -->|"uses dialogue"| node_dialogue
node_purity -->|"uses choices"| node_choice
node_purity -->|"uses scores"| node_moral
node_purity -->|"uses zones"| node_trigger

click node_entry "https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/main.js"
click node_menu "https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/scenes/MainMenu.js"
click node_overworld "https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/scenes/Overworld.js"
click node_ending "https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/scenes/Ending.js"
click node_credits "https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/scenes/EventCredits.js"
click node_player_control "https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/core/PlayerController.js"
click node_trunk "https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/core/TrunkController.js"
click node_progress "https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/core/GameProgress.js"
click node_moral "https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/core/MoralState.js"
click node_pickup "https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/core/PickupRegistry.js"
click node_devtools "https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/core/DevToolsManager.js"
click node_river "https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/core/RiverTravelModule.js"
click node_dialogue "https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/core/DialogueSystem.js"
click node_choice "https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/core/ChoiceSystem.js"
click node_trigger "https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/core/TriggerZone.js"
click node_authority "https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/events/authority_herd/index.js"
click node_domain "https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/events/domain_elephants/index.js"
click node_fairness "https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/events/fairness_water/index.js"
click node_ingroup "https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/events/ingroup_bird_contest/index.js"
click node_purity "https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/events/purity_flooded_ruins/index.js"
click node_tutorial "https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/events/tutorial/index.js"
click node_hud "https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/ui/HUD.js"
click node_dialogue_box "https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/ui/DialogueBox.js"
click node_choice_prompt "https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/ui/ChoicePrompt.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_entry,node_menu,node_overworld,node_ending,node_credits toneBlue
class node_player_control,node_trunk,node_progress,node_moral,node_pickup,node_devtools,node_river,node_dialogue,node_choice,node_trigger toneAmber
class node_authority,node_domain,node_fairness,node_ingroup,node_purity,node_tutorial toneMint
class node_hud,node_dialogue_box,node_choice_prompt toneRose
class node_player toneIndigo
```

## Components

### Game flow

- [Game entry](https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/main.js): `src/game/main.js`
- [Main menu](https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/scenes/MainMenu.js): `src/game/scenes/MainMenu.js`
- [Overworld](https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/scenes/Overworld.js): `src/game/scenes/Overworld.js`
- [Ending](https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/scenes/Ending.js): `src/game/scenes/Ending.js`
- [Event credits](https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/scenes/EventCredits.js): `src/game/scenes/EventCredits.js`

### Gameplay systems

- [Player control](https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/core/PlayerController.js): `src/game/core/PlayerController.js`
- [Trunk controller](https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/core/TrunkController.js): `src/game/core/TrunkController.js`
- [Game progress](https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/core/GameProgress.js): `src/game/core/GameProgress.js`
- [Moral state](https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/core/MoralState.js): `src/game/core/MoralState.js`
- [Pickup registry](https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/core/PickupRegistry.js): `src/game/core/PickupRegistry.js`
- [Developer tools](https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/core/DevToolsManager.js): `src/game/core/DevToolsManager.js`
- [River travel](https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/core/RiverTravelModule.js): `src/game/core/RiverTravelModule.js`
- [Dialogue system](https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/core/DialogueSystem.js): `src/game/core/DialogueSystem.js`
- [Choice system](https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/core/ChoiceSystem.js): `src/game/core/ChoiceSystem.js`
- [Trigger zones](https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/core/TriggerZone.js): `src/game/core/TriggerZone.js`

### Moral events

- [Herd authority](https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/events/authority_herd/index.js): `src/game/events/authority_herd/index.js`
- [Elephant domain](https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/events/domain_elephants/index.js): `src/game/events/domain_elephants/index.js`
- [Water fairness](https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/events/fairness_water/index.js): `src/game/events/fairness_water/index.js`
- [Bird contest](https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/events/ingroup_bird_contest/index.js): `src/game/events/ingroup_bird_contest/index.js`
- [Flooded ruins](https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/events/purity_flooded_ruins/index.js): `src/game/events/purity_flooded_ruins/index.js`
- [Tutorial event](https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/events/tutorial/index.js): `src/game/events/tutorial/index.js`

### Player interface

- [Rain-stone HUD](https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/ui/HUD.js): `src/game/ui/HUD.js`
- [Dialogue box](https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/ui/DialogueBox.js): `src/game/ui/DialogueBox.js`
- [Choice prompt](https://github.com/pluviophilezack/elephant_and_rider/blob/main/src/game/ui/ChoicePrompt.js): `src/game/ui/ChoicePrompt.js`

### Other components

- **Player**

## Connections

- Player → Game entry: starts game (evidence: `README.md`)
- Game entry → Main menu: registers scene (evidence: `src/game/main.js`)
- Game entry → Overworld: registers scene (evidence: `src/game/main.js`)
- Game entry → Ending: registers scene (evidence: `src/game/main.js`)
- Game entry → Event credits: registers scene (evidence: `src/game/main.js`)
- Main menu → Game progress: uses progress (evidence: `src/game/scenes/MainMenu.js`)
- Overworld → Player control: creates controller (evidence: `src/game/scenes/Overworld.js`)
- Overworld → Trunk controller: creates controller (evidence: `src/game/scenes/Overworld.js`)
- Overworld → Pickup registry: creates registry (evidence: `src/game/scenes/Overworld.js`)
- Overworld → Moral state: resets state (evidence: `src/game/scenes/Overworld.js`)
- Overworld → Rain-stone HUD: creates HUD (evidence: `src/game/scenes/Overworld.js`)
- Overworld → Developer tools: creates tools (evidence: `src/game/scenes/Overworld.js`)
- Overworld → Tutorial event: sets up event (evidence: `src/game/scenes/Overworld.js`)
- Overworld → Herd authority: sets up event (evidence: `src/game/scenes/Overworld.js`)
- Overworld → Elephant domain: sets up event (evidence: `src/game/scenes/Overworld.js`)
- Overworld → Water fairness: sets up event (evidence: `src/game/scenes/Overworld.js`)
- Overworld → Bird contest: sets up event (evidence: `src/game/scenes/Overworld.js`)
- Overworld → Flooded ruins: sets up event (evidence: `src/game/scenes/Overworld.js`)
- Overworld → Ending: starts at threshold (evidence: `src/game/scenes/Overworld.js`)
- Overworld → Rain-stone HUD: awards stones (evidence: `src/game/scenes/Overworld.js`)
- Ending → Moral state: reads scores (evidence: `src/game/scenes/Ending.js`)
- Ending → Game progress: reads progress (evidence: `src/game/scenes/Ending.js`)
- Player control → Dialogue system: checks dialogue (evidence: `src/game/core/PlayerController.js`)
- Dialogue system → Dialogue box: creates box (evidence: `src/game/core/DialogueSystem.js`)
- Choice system → Choice prompt: creates prompt (evidence: `src/game/core/ChoiceSystem.js`)
- Developer tools → River travel: installs travel (evidence: `src/game/core/DevToolsManager.js`)
- Herd authority → Dialogue system: calls dialogue (evidence: `src/game/events/authority_herd/index.js`)
- Herd authority → Choice system: uses choices (evidence: `src/game/events/authority_herd/index.js`)
- Herd authority → Moral state: updates scores (evidence: `src/game/events/authority_herd/index.js`)
- Herd authority → Trigger zones: creates zones (evidence: `src/game/events/authority_herd/index.js`)
- Elephant domain → Dialogue system: uses dialogue (evidence: `src/game/events/domain_elephants/index.js`)
- Elephant domain → Choice system: uses choices (evidence: `src/game/events/domain_elephants/index.js`)
- Elephant domain → Moral state: uses scores (evidence: `src/game/events/domain_elephants/index.js`)
- Elephant domain → Trigger zones: uses zones (evidence: `src/game/events/domain_elephants/index.js`)
- Water fairness → Dialogue system: calls dialogue (evidence: `src/game/events/fairness_water/index.js`)
- Water fairness → Choice system: uses choices (evidence: `src/game/events/fairness_water/index.js`)
- Water fairness → Moral state: updates scores (evidence: `src/game/events/fairness_water/index.js`)
- Water fairness → Trigger zones: uses zones (evidence: `src/game/events/fairness_water/index.js`)
- Bird contest → Dialogue system: uses dialogue (evidence: `src/game/events/ingroup_bird_contest/index.js`)
- Bird contest → Choice system: uses choices (evidence: `src/game/events/ingroup_bird_contest/index.js`)
- Bird contest → Moral state: updates scores (evidence: `src/game/events/ingroup_bird_contest/index.js`)
- Bird contest → Trigger zones: uses zones (evidence: `src/game/events/ingroup_bird_contest/index.js`)
- Flooded ruins → Dialogue system: uses dialogue (evidence: `src/game/events/purity_flooded_ruins/index.js`)
- Flooded ruins → Choice system: uses choices (evidence: `src/game/events/purity_flooded_ruins/index.js`)
- Flooded ruins → Moral state: uses scores (evidence: `src/game/events/purity_flooded_ruins/index.js`)
- Flooded ruins → Trigger zones: uses zones (evidence: `src/game/events/purity_flooded_ruins/index.js`)
