# egamijun/ikkou architecture

> Architecture diagram of the GitHub repository egamijun/ikkou, 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/egamijun/ikkou
- Repository: https://github.com/egamijun/ikkou

## Overview

IKKOU is a browser-based, top-down horror game: the player enters through the Next.js page, the client mounts Phaser with a registered content bundle, and the main scene runs exploration until capture or escape. Room layouts and ghost definitions are authored as JSON and assembled into typed content. The gameplay scene owns movement, ghost pursuit and spotting, visibility rendering, keys, and floor changes; it also invokes procedural audio and dispatches to the appropriate ending scene. The excerpts show scene setup and key transitions, but not every gameplay method, so internal gameplay relationships are summarized rather than expanded.

Main entry points: [`apps/game/src/game/scenes/MainScene.ts`](https://github.com/egamijun/ikkou/blob/main/apps/game/src/game/scenes/MainScene.ts) (Gameplay scene), [`apps/game/src/game/config.ts`](https://github.com/egamijun/ikkou/blob/main/apps/game/src/game/config.ts) (Phaser setup), [`packages/content/src/index.ts`](https://github.com/egamijun/ikkou/blob/main/packages/content/src/index.ts) (Default bundle), [`apps/game/src/components/GameCanvas.tsx`](https://github.com/egamijun/ikkou/blob/main/apps/game/src/components/GameCanvas.tsx) (Game canvas)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web entry"]
  node_home["Home page<br/>[page.tsx]"]
  node_canvas["Game canvas<br/>[GameCanvas.tsx]"]
end

subgraph group_content["Game content"]
  node_bundle["Default bundle<br/>[index.ts]"]
  node_roomdata["Room maps"]
  node_ghostdata["Ghost definitions"]
  node_schemas["Content schemas<br/>[types.ts]"]
end

subgraph group_runtime["Game runtime"]
  node_config["Phaser setup<br/>[config.ts]"]
  node_boot["Boot scene<br/>[BootScene.ts]"]
  node_main["Gameplay scene<br/>[MainScene.ts]"]
  node_audio["Procedural audio<br/>[audio.ts]"]
end

subgraph group_endings["Game outcomes"]
  node_gameover["Capture ending<br/>[GameOverScene.ts]"]
  node_clear["Escape ending<br/>[ClearScene.ts]"]
end

node_player(("Player"))

node_player -->|"opens"| node_home
node_home -->|"loads client"| node_canvas
node_canvas -->|"uses bundle"| node_bundle
node_canvas -->|"creates game"| node_config
node_bundle -->|"registers maps"| node_roomdata
node_bundle -->|"registers ghost"| node_ghostdata
node_bundle -->|"types as"| node_schemas
node_config -->|"registers scene"| node_boot
node_config -->|"registers scene"| node_main
node_config -->|"registers scene"| node_gameover
node_config -->|"registers scene"| node_clear
node_config -->|"stores bundle"| node_bundle
node_boot -->|"starts"| node_main
node_main -->|"invokes"| node_audio
node_main -->|"starts on capture"| node_gameover
node_main -->|"starts on escape"| node_clear
node_gameover -->|"restarts"| node_main
node_clear -->|"restarts"| node_main

click node_home "https://github.com/egamijun/ikkou/blob/main/apps/game/src/app/page.tsx"
click node_canvas "https://github.com/egamijun/ikkou/blob/main/apps/game/src/components/GameCanvas.tsx"
click node_bundle "https://github.com/egamijun/ikkou/blob/main/packages/content/src/index.ts"
click node_roomdata "https://github.com/egamijun/ikkou/tree/main/packages/content/rooms"
click node_ghostdata "https://github.com/egamijun/ikkou/tree/main/packages/content/ghosts"
click node_schemas "https://github.com/egamijun/ikkou/blob/main/packages/content/src/types.ts"
click node_config "https://github.com/egamijun/ikkou/blob/main/apps/game/src/game/config.ts"
click node_boot "https://github.com/egamijun/ikkou/blob/main/apps/game/src/game/scenes/BootScene.ts"
click node_main "https://github.com/egamijun/ikkou/blob/main/apps/game/src/game/scenes/MainScene.ts"
click node_audio "https://github.com/egamijun/ikkou/blob/main/apps/game/src/game/audio.ts"
click node_gameover "https://github.com/egamijun/ikkou/blob/main/apps/game/src/game/scenes/GameOverScene.ts"
click node_clear "https://github.com/egamijun/ikkou/blob/main/apps/game/src/game/scenes/ClearScene.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_home,node_canvas toneBlue
class node_bundle,node_roomdata,node_ghostdata,node_schemas toneAmber
class node_config,node_boot,node_main,node_audio toneMint
class node_gameover,node_clear toneRose
class node_player toneIndigo
```

## Components

### Web entry

- [Home page](https://github.com/egamijun/ikkou/blob/main/apps/game/src/app/page.tsx): `apps/game/src/app/page.tsx`
- [Game canvas](https://github.com/egamijun/ikkou/blob/main/apps/game/src/components/GameCanvas.tsx): `apps/game/src/components/GameCanvas.tsx`

### Game content

- [Default bundle](https://github.com/egamijun/ikkou/blob/main/packages/content/src/index.ts): `packages/content/src/index.ts`
- [Room maps](https://github.com/egamijun/ikkou/tree/main/packages/content/rooms): `packages/content/rooms`
- [Ghost definitions](https://github.com/egamijun/ikkou/tree/main/packages/content/ghosts): `packages/content/ghosts`
- [Content schemas](https://github.com/egamijun/ikkou/blob/main/packages/content/src/types.ts): `packages/content/src/types.ts`

### Game runtime

- [Phaser setup](https://github.com/egamijun/ikkou/blob/main/apps/game/src/game/config.ts): `apps/game/src/game/config.ts`
- [Boot scene](https://github.com/egamijun/ikkou/blob/main/apps/game/src/game/scenes/BootScene.ts): `apps/game/src/game/scenes/BootScene.ts`
- [Gameplay scene](https://github.com/egamijun/ikkou/blob/main/apps/game/src/game/scenes/MainScene.ts): `apps/game/src/game/scenes/MainScene.ts`
- [Procedural audio](https://github.com/egamijun/ikkou/blob/main/apps/game/src/game/audio.ts): `apps/game/src/game/audio.ts`

### Game outcomes

- [Capture ending](https://github.com/egamijun/ikkou/blob/main/apps/game/src/game/scenes/GameOverScene.ts): `apps/game/src/game/scenes/GameOverScene.ts`
- [Escape ending](https://github.com/egamijun/ikkou/blob/main/apps/game/src/game/scenes/ClearScene.ts): `apps/game/src/game/scenes/ClearScene.ts`

### Other components

- **Player**

## Connections

- Player → Home page: opens (evidence: `README.md`)
- Home page → Game canvas: loads client (evidence: `apps/game/src/app/page.tsx`)
- Game canvas → Default bundle: uses bundle (evidence: `apps/game/src/components/GameCanvas.tsx`)
- Game canvas → Phaser setup: creates game (evidence: `apps/game/src/components/GameCanvas.tsx`)
- Default bundle → Room maps: registers maps (evidence: `packages/content/src/index.ts`)
- Default bundle → Ghost definitions: registers ghost (evidence: `packages/content/src/index.ts`)
- Default bundle → Content schemas: types as (evidence: `packages/content/src/index.ts`)
- Phaser setup → Boot scene: registers scene (evidence: `apps/game/src/game/config.ts`)
- Phaser setup → Gameplay scene: registers scene (evidence: `apps/game/src/game/config.ts`)
- Phaser setup → Capture ending: registers scene (evidence: `apps/game/src/game/config.ts`)
- Phaser setup → Escape ending: registers scene (evidence: `apps/game/src/game/config.ts`)
- Phaser setup → Default bundle: stores bundle (evidence: `apps/game/src/game/config.ts`)
- Boot scene → Gameplay scene: starts (evidence: `apps/game/src/game/scenes/BootScene.ts`)
- Gameplay scene → Procedural audio: invokes (evidence: `apps/game/src/game/scenes/MainScene.ts`)
- Gameplay scene → Capture ending: starts on capture (evidence: `apps/game/src/game/scenes/MainScene.ts`)
- Gameplay scene → Escape ending: starts on escape (evidence: `apps/game/src/game/scenes/MainScene.ts`)
- Capture ending → Gameplay scene: restarts (evidence: `apps/game/src/game/scenes/GameOverScene.ts`)
- Escape ending → Gameplay scene: restarts (evidence: `apps/game/src/game/scenes/ClearScene.ts`)
