# tabishnavaid/emberwing architecture

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

- Interactive diagram: https://gitdiagram.com/tabishnavaid/emberwing
- Repository: https://github.com/tabishnavaid/emberwing

## Overview

Emberwing is a self-contained, canvas-based lobby game. A guest chooses a level, finds a procedurally selected dragon by holding a pointer light, steers it through a flight, and brings it home; the game records the rescue in the nightly flock and aurora. The graph preserves the documented celebration, operator, sound, motion-capture, and level-specific gameplay capabilities. Scene orchestration and ownership links are shown where the index, excerpts, or README support them; unsampled internals are not treated as inspected.

Main entry points: [`src/main.js`](https://github.com/tabishnavaid/emberwing/blob/main/src/main.js) (Game bootstrap), [`src/scenes/Flight.js`](https://github.com/tabishnavaid/emberwing/blob/main/src/scenes/Flight.js) (Dragon flight), [`src/core/AuroraStore.js`](https://github.com/tabishnavaid/emberwing/blob/main/src/core/AuroraStore.js) (Nightly save), [`src/core/Audio.js`](https://github.com/tabishnavaid/emberwing/blob/main/src/core/Audio.js) (Live audio)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_play["Guest journey"]
  node_main["Game bootstrap<br/>[main.js]"]
  node_scenes["Scene manager<br/>[SceneManager.js]"]
  node_attract["Level selection<br/>[Attract.js]"]
  node_choose["Dragon choice<br/>[Choose.js]"]
  node_find["Find dragon<br/>[FindDragon.js]"]
  node_home["Rescue home<br/>[Home.js]"]
  node_endcard["Rescue card<br/>[EndCard.js]"]
  node_celebration["Flock celebration<br/>[Celebration.js]"]
end

subgraph group_game["Flight gameplay"]
  node_flight["Dragon flight<br/>[Flight.js]"]
  node_hazards["Hazards and enemies<br/>[Hazards.js]"]
  node_points["Score tracking<br/>[Points.js]"]
end

subgraph group_state["Night state"]
  node_dragons["Dragon generation<br/>[dragons.js]"]
  node_store[("Nightly save<br/>[AuroraStore.js]")]
  node_flock["Rescued flock<br/>[flock.js]"]
end

subgraph group_presentation["Canvas presentation"]
  node_aurora["Aurora wall<br/>[aurora.js]"]
  node_routes["Flight routes<br/>[routes.js]"]
  node_world["World scenery<br/>[world.js]"]
  node_dragonart["Dragon rendering<br/>[dragon.js]"]
  node_critters["Enemy rendering<br/>[critters.js]"]
  node_artcore["Canvas art assets"]
end

subgraph group_controls["Controls and sound"]
  node_input["Pointer input<br/>[Input.js]"]
  node_adapters["Input adapters<br/>[adapters.js]"]
  node_calibration["Motion calibration<br/>[Calibration.js]"]
  node_operator["Operator controls<br/>[Operator.js]"]
  node_soundbutton["Sound control<br/>[SoundButton.js]"]
  node_audio["Live audio<br/>[Audio.js]"]
  node_synth["Audio synthesis<br/>[synth.js]"]
  node_tune["Folk tune<br/>[tune.js]"]
end

node_guest(("Guest"))
node_mocap(("Motion-capture rig"))
node_localstorage[("Browser storage")]

node_guest -->|"starts game"| node_main
node_main -->|"initializes"| node_scenes
node_main -->|"initializes"| node_input
node_main -->|"initializes"| node_adapters
node_main -->|"initializes"| node_store
node_main -->|"initializes"| node_audio
node_main -->|"initializes"| node_operator
node_main -->|"initializes"| node_soundbutton
node_input -->|"uses"| node_adapters
node_mocap -.->|"sends motion"| node_adapters
node_operator -->|"invokes"| node_calibration
node_guest -->|"chooses level"| node_attract
node_scenes -->|"routes scenes"| node_attract
node_attract -.->|"starts rescue"| node_choose
node_choose -->|"selects dragon"| node_dragons
node_choose -.->|"routes onward"| node_find
node_find -->|"starts flight"| node_flight
node_flight -->|"updates hazards"| node_hazards
node_flight -->|"tracks score"| node_points
node_flight -.->|"completes rescue"| node_home
node_home -.->|"saves rescue"| node_store
node_store -->|"persists nightly state"| node_localstorage
node_home -.->|"shows result"| node_endcard
node_store -->|"provides rescued dragons"| node_flock
node_flock -->|"draws members"| node_dragonart
node_store -->|"provides ribbons"| node_aurora
node_endcard -.->|"triggers milestone"| node_celebration
node_flight -->|"renders route"| node_routes
node_routes -->|"draws scenery"| node_world
node_find -->|"renders dragon"| node_dragonart
node_flight -->|"uses enemies"| node_critters
node_flight -.->|"uses flock power-up"| node_flock
node_flight -->|"reads steering"| node_input
node_soundbutton -->|"toggles sound"| node_audio
node_audio -->|"synthesizes audio"| node_synth
node_audio -->|"plays tune"| node_tune
node_scenes -->|"draws interface"| node_artcore
node_aurora -.->|"layers sky"| node_world
node_dragons -->|"supplies dragon traits"| node_dragonart

click node_main "https://github.com/tabishnavaid/emberwing/blob/main/src/main.js"
click node_scenes "https://github.com/tabishnavaid/emberwing/blob/main/src/core/SceneManager.js"
click node_attract "https://github.com/tabishnavaid/emberwing/blob/main/src/scenes/Attract.js"
click node_choose "https://github.com/tabishnavaid/emberwing/blob/main/src/scenes/Choose.js"
click node_find "https://github.com/tabishnavaid/emberwing/blob/main/src/scenes/FindDragon.js"
click node_flight "https://github.com/tabishnavaid/emberwing/blob/main/src/scenes/Flight.js"
click node_hazards "https://github.com/tabishnavaid/emberwing/blob/main/src/core/Hazards.js"
click node_points "https://github.com/tabishnavaid/emberwing/blob/main/src/core/Points.js"
click node_home "https://github.com/tabishnavaid/emberwing/blob/main/src/scenes/Home.js"
click node_endcard "https://github.com/tabishnavaid/emberwing/blob/main/src/scenes/EndCard.js"
click node_celebration "https://github.com/tabishnavaid/emberwing/blob/main/src/scenes/Celebration.js"
click node_dragons "https://github.com/tabishnavaid/emberwing/blob/main/src/core/dragons.js"
click node_store "https://github.com/tabishnavaid/emberwing/blob/main/src/core/AuroraStore.js"
click node_flock "https://github.com/tabishnavaid/emberwing/blob/main/src/art/flock.js"
click node_aurora "https://github.com/tabishnavaid/emberwing/blob/main/src/art/aurora.js"
click node_routes "https://github.com/tabishnavaid/emberwing/blob/main/src/art/routes.js"
click node_world "https://github.com/tabishnavaid/emberwing/blob/main/src/art/world.js"
click node_dragonart "https://github.com/tabishnavaid/emberwing/blob/main/src/art/dragon.js"
click node_critters "https://github.com/tabishnavaid/emberwing/blob/main/src/art/critters.js"
click node_artcore "https://github.com/tabishnavaid/emberwing/tree/main/src/art"
click node_input "https://github.com/tabishnavaid/emberwing/blob/main/src/input/Input.js"
click node_adapters "https://github.com/tabishnavaid/emberwing/blob/main/src/input/adapters.js"
click node_calibration "https://github.com/tabishnavaid/emberwing/blob/main/src/input/Calibration.js"
click node_operator "https://github.com/tabishnavaid/emberwing/blob/main/src/core/Operator.js"
click node_soundbutton "https://github.com/tabishnavaid/emberwing/blob/main/src/input/SoundButton.js"
click node_audio "https://github.com/tabishnavaid/emberwing/blob/main/src/core/Audio.js"
click node_synth "https://github.com/tabishnavaid/emberwing/blob/main/src/core/synth.js"
click node_tune "https://github.com/tabishnavaid/emberwing/blob/main/src/core/tune.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_main,node_scenes,node_attract,node_choose,node_find,node_home,node_endcard,node_celebration toneBlue
class node_flight,node_hazards,node_points,node_localstorage toneAmber
class node_dragons,node_store,node_flock toneMint
class node_aurora,node_routes,node_world,node_dragonart,node_critters,node_artcore toneRose
class node_input,node_adapters,node_calibration,node_operator,node_soundbutton,node_audio,node_synth,node_tune,node_guest,node_mocap toneIndigo
```

## Components

### Guest journey

- [Game bootstrap](https://github.com/tabishnavaid/emberwing/blob/main/src/main.js): `src/main.js`
- [Scene manager](https://github.com/tabishnavaid/emberwing/blob/main/src/core/SceneManager.js): `src/core/SceneManager.js`
- [Level selection](https://github.com/tabishnavaid/emberwing/blob/main/src/scenes/Attract.js): `src/scenes/Attract.js`
- [Dragon choice](https://github.com/tabishnavaid/emberwing/blob/main/src/scenes/Choose.js): `src/scenes/Choose.js`
- [Find dragon](https://github.com/tabishnavaid/emberwing/blob/main/src/scenes/FindDragon.js): `src/scenes/FindDragon.js`
- [Rescue home](https://github.com/tabishnavaid/emberwing/blob/main/src/scenes/Home.js): `src/scenes/Home.js`
- [Rescue card](https://github.com/tabishnavaid/emberwing/blob/main/src/scenes/EndCard.js): `src/scenes/EndCard.js`
- [Flock celebration](https://github.com/tabishnavaid/emberwing/blob/main/src/scenes/Celebration.js): `src/scenes/Celebration.js`

### Flight gameplay

- [Dragon flight](https://github.com/tabishnavaid/emberwing/blob/main/src/scenes/Flight.js): `src/scenes/Flight.js`
- [Hazards and enemies](https://github.com/tabishnavaid/emberwing/blob/main/src/core/Hazards.js): `src/core/Hazards.js`
- [Score tracking](https://github.com/tabishnavaid/emberwing/blob/main/src/core/Points.js): `src/core/Points.js`

### Night state

- [Dragon generation](https://github.com/tabishnavaid/emberwing/blob/main/src/core/dragons.js): `src/core/dragons.js`
- [Nightly save](https://github.com/tabishnavaid/emberwing/blob/main/src/core/AuroraStore.js): `src/core/AuroraStore.js`
- [Rescued flock](https://github.com/tabishnavaid/emberwing/blob/main/src/art/flock.js): `src/art/flock.js`

### Canvas presentation

- [Aurora wall](https://github.com/tabishnavaid/emberwing/blob/main/src/art/aurora.js): `src/art/aurora.js`
- [Flight routes](https://github.com/tabishnavaid/emberwing/blob/main/src/art/routes.js): `src/art/routes.js`
- [World scenery](https://github.com/tabishnavaid/emberwing/blob/main/src/art/world.js): `src/art/world.js`
- [Dragon rendering](https://github.com/tabishnavaid/emberwing/blob/main/src/art/dragon.js): `src/art/dragon.js`
- [Enemy rendering](https://github.com/tabishnavaid/emberwing/blob/main/src/art/critters.js): `src/art/critters.js`
- [Canvas art assets](https://github.com/tabishnavaid/emberwing/tree/main/src/art): `src/art`

### Controls and sound

- [Pointer input](https://github.com/tabishnavaid/emberwing/blob/main/src/input/Input.js): `src/input/Input.js`
- [Input adapters](https://github.com/tabishnavaid/emberwing/blob/main/src/input/adapters.js): `src/input/adapters.js`
- [Motion calibration](https://github.com/tabishnavaid/emberwing/blob/main/src/input/Calibration.js): `src/input/Calibration.js`
- [Operator controls](https://github.com/tabishnavaid/emberwing/blob/main/src/core/Operator.js): `src/core/Operator.js`
- [Sound control](https://github.com/tabishnavaid/emberwing/blob/main/src/input/SoundButton.js): `src/input/SoundButton.js`
- [Live audio](https://github.com/tabishnavaid/emberwing/blob/main/src/core/Audio.js): `src/core/Audio.js`
- [Audio synthesis](https://github.com/tabishnavaid/emberwing/blob/main/src/core/synth.js): `src/core/synth.js`
- [Folk tune](https://github.com/tabishnavaid/emberwing/blob/main/src/core/tune.js): `src/core/tune.js`

### Other components

- **Guest**
- **Motion-capture rig**
- **Browser storage**

## Connections

- Guest → Game bootstrap: starts game
- Game bootstrap → Scene manager: initializes (evidence: `src/main.js`)
- Game bootstrap → Pointer input: initializes (evidence: `src/main.js`)
- Game bootstrap → Input adapters: initializes (evidence: `src/main.js`)
- Game bootstrap → Nightly save: initializes (evidence: `src/main.js`)
- Game bootstrap → Live audio: initializes (evidence: `src/main.js`)
- Game bootstrap → Operator controls: initializes (evidence: `src/main.js`)
- Game bootstrap → Sound control: initializes (evidence: `src/main.js`)
- Pointer input → Input adapters: uses (evidence: `src/main.js`)
- Motion-capture rig → Input adapters: sends motion
- Operator controls → Motion calibration: invokes (evidence: `src/core/Operator.js`)
- Guest → Level selection: chooses level
- Scene manager → Level selection: routes scenes (evidence: `src/core/SceneManager.js`)
- Level selection → Dragon choice: starts rescue
- Dragon choice → Dragon generation: selects dragon (evidence: `src/scenes/Choose.js`)
- Dragon choice → Find dragon: routes onward
- Find dragon → Dragon flight: starts flight (evidence: `src/scenes/FindDragon.js`)
- Dragon flight → Hazards and enemies: updates hazards (evidence: `src/scenes/Flight.js`)
- Dragon flight → Score tracking: tracks score (evidence: `src/scenes/Flight.js`)
- Dragon flight → Rescue home: completes rescue
- Rescue home → Nightly save: saves rescue
- Nightly save → Browser storage: persists nightly state
- Rescue home → Rescue card: shows result
- Nightly save → Rescued flock: provides rescued dragons (evidence: `src/art/flock.js`)
- Rescued flock → Dragon rendering: draws members (evidence: `src/art/flock.js`)
- Nightly save → Aurora wall: provides ribbons (evidence: `src/art/aurora.js`)
- Rescue card → Flock celebration: triggers milestone
- Dragon flight → Flight routes: renders route (evidence: `src/art/routes.js`)
- Flight routes → World scenery: draws scenery (evidence: `src/art/routes.js`)
- Find dragon → Dragon rendering: renders dragon (evidence: `src/scenes/FindDragon.js`)
- Dragon flight → Enemy rendering: uses enemies (evidence: `src/scenes/Flight.js`)
- Dragon flight → Rescued flock: uses flock power-up (evidence: `src/scenes/Flight.js`)
- Dragon flight → Pointer input: reads steering (evidence: `src/scenes/Flight.js`)
- Sound control → Live audio: toggles sound (evidence: `src/input/SoundButton.js`)
- Live audio → Audio synthesis: synthesizes audio (evidence: `src/core/Audio.js`)
- Live audio → Folk tune: plays tune (evidence: `src/core/Audio.js`)
- Scene manager → Canvas art assets: draws interface (evidence: `src/core/SceneManager.js`)
- Aurora wall → World scenery: layers sky
- Dragon generation → Dragon rendering: supplies dragon traits (evidence: `src/art/dragon.js`)
