# eomtaejun/haystack architecture

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

- Interactive diagram: https://gitdiagram.com/eomtaejun/haystack
- Repository: https://github.com/eomtaejun/haystack

## Overview

HAYSTACK is a browser-based first-person 3D game: the player explores a farm, removes hay one strand at a time, exposes a seeded needle, and picks it up to win. Its runtime is concentrated in src/main.ts, so the graph separates meaningful game responsibilities that share that implementation path rather than implying separate modules. The README documents autosave, controls, procedural scenery, sound, and deployment-independent browser play; excerpts show scene construction, needle placement, digging effects, and input handling. Unsampled runtime details are represented only where documented.

Main entry points: [`src/main.ts`](https://github.com/eomtaejun/haystack/blob/main/src/main.ts) (Game runtime)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_world["Game world"]
  node_farm["Farm environment<br/>[main.ts]"]
  node_hay["Hay terrain<br/>[main.ts]"]
  node_straw["Strand effects<br/>[main.ts]"]
end

subgraph group_play["Player experience"]
  node_runtime["Game runtime<br/>[main.ts]"]
  node_controls["Movement controls<br/>[main.ts]"]
  node_gameplay["Dig and pickup<br/>[main.ts]"]
  node_hud["HUD and menus<br/>[main.ts]"]
  node_sound["Sound effects<br/>[main.ts]"]
end

subgraph group_progress["Game progress"]
  node_needle["Needle placement<br/>[main.ts]"]
  node_save["Progress autosave<br/>[main.ts]"]
  node_storage[("Browser storage")]
end

node_player(("Player"))
node_three["Three.js"]

node_player -->|"plays"| node_runtime
node_runtime -->|"builds"| node_farm
node_runtime -->|"builds"| node_hay
node_runtime -->|"handles input"| node_controls
node_controls -->|"triggers digging"| node_gameplay
node_gameplay -->|"removes strands"| node_hay
node_gameplay -->|"spawns effects"| node_straw
node_gameplay -->|"updates position"| node_needle
node_player -->|"picks up"| node_needle
node_runtime -->|"shows status"| node_hud
node_runtime -->|"plays effects"| node_sound
node_runtime -->|"autosaves progress"| node_save
node_save -->|"writes records"| node_storage
node_runtime -->|"renders with"| node_three

click node_runtime "https://github.com/eomtaejun/haystack/blob/main/src/main.ts"
click node_farm "https://github.com/eomtaejun/haystack/blob/main/src/main.ts"
click node_hay "https://github.com/eomtaejun/haystack/blob/main/src/main.ts"
click node_straw "https://github.com/eomtaejun/haystack/blob/main/src/main.ts"
click node_needle "https://github.com/eomtaejun/haystack/blob/main/src/main.ts"
click node_controls "https://github.com/eomtaejun/haystack/blob/main/src/main.ts"
click node_gameplay "https://github.com/eomtaejun/haystack/blob/main/src/main.ts"
click node_hud "https://github.com/eomtaejun/haystack/blob/main/src/main.ts"
click node_sound "https://github.com/eomtaejun/haystack/blob/main/src/main.ts"
click node_save "https://github.com/eomtaejun/haystack/blob/main/src/main.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_farm,node_hay,node_straw toneBlue
class node_runtime,node_controls,node_gameplay,node_hud,node_sound toneAmber
class node_needle,node_save,node_storage toneMint
class node_player,node_three toneIndigo
```

## Components

### Game world

- [Farm environment](https://github.com/eomtaejun/haystack/blob/main/src/main.ts): `src/main.ts`
- [Hay terrain](https://github.com/eomtaejun/haystack/blob/main/src/main.ts): `src/main.ts`
- [Strand effects](https://github.com/eomtaejun/haystack/blob/main/src/main.ts): `src/main.ts`

### Player experience

- [Game runtime](https://github.com/eomtaejun/haystack/blob/main/src/main.ts): `src/main.ts`
- [Movement controls](https://github.com/eomtaejun/haystack/blob/main/src/main.ts): `src/main.ts`
- [Dig and pickup](https://github.com/eomtaejun/haystack/blob/main/src/main.ts): `src/main.ts`
- [HUD and menus](https://github.com/eomtaejun/haystack/blob/main/src/main.ts): `src/main.ts`
- [Sound effects](https://github.com/eomtaejun/haystack/blob/main/src/main.ts): `src/main.ts`

### Game progress

- [Needle placement](https://github.com/eomtaejun/haystack/blob/main/src/main.ts): `src/main.ts`
- [Progress autosave](https://github.com/eomtaejun/haystack/blob/main/src/main.ts): `src/main.ts`
- **Browser storage**

### Other components

- **Player**
- **Three.js**

## Connections

- Player → Game runtime: plays (evidence: `README.md`)
- Game runtime → Farm environment: builds (evidence: `src/main.ts`)
- Game runtime → Hay terrain: builds (evidence: `src/main.ts`)
- Game runtime → Movement controls: handles input (evidence: `src/main.ts`)
- Movement controls → Dig and pickup: triggers digging (evidence: `src/main.ts`)
- Dig and pickup → Hay terrain: removes strands (evidence: `src/main.ts`)
- Dig and pickup → Strand effects: spawns effects (evidence: `src/main.ts`)
- Dig and pickup → Needle placement: updates position (evidence: `src/main.ts`)
- Player → Needle placement: picks up (evidence: `README.md`)
- Game runtime → HUD and menus: shows status (evidence: `README.md`)
- Game runtime → Sound effects: plays effects (evidence: `README.md`)
- Game runtime → Progress autosave: autosaves progress (evidence: `README.md`)
- Progress autosave → Browser storage: writes records (evidence: `README.md`)
- Game runtime → Three.js: renders with (evidence: `src/main.ts`)
