# Broken Fairytale: Honey Village

Single-player browser narrative game built from the specification in `PRD.md`. The runtime uses Phaser 3, TypeScript, and Vite. It has no backend, persistence, external network requests, external fonts, or recorded audio.

## Run

```bash
npm install
npm run generate
npm run dev
```

Production output:

```bash
npm run build
npm run preview
```

The preview server defaults to `http://127.0.0.1:4173`.

## Controls

| Input | Action |
|---|---|
| `WASD` / arrow keys | Move |
| `E` / Enter | Interact, advance dialogue, confirm a choice |
| Up / Down | Select a dialogue choice |
| `1` / `2` / `3` | Select a dialogue choice directly |
| `` ` `` | Toggle the Debug panel |

## Debug panel

The Debug panel is hidden by default and leaves no visible UI while closed. It can set happiness, awareness, and the current day; teleport to any of the ten scenes; discover all nine clues; and force endings E1–E4. Debug state exists only in memory and resets when the title flow starts again.

## Original asset pipeline

Every shipped pixel asset was produced for this project by `tools/generate-assets.lua` through Aseprite 1.3.17.2. Editable sources are stored in `public/assets/source/`; exported RGBA sprite sheets are stored in `public/assets/`. The 256×64 tileset contains 64 original 16×16 tiles. `characters.png` contains the player's four directions and four walk frames, seven named NPC expression tiers, five extras, and two-frame bird animation. `portraits.png` contains the fixed smiling player portrait, E3 real-face portrait, and seven named NPC portraits.

Every map was produced for this project by `tools/generate-maps.mjs` and exported through Tiled 1.12.2. Editable TMX sources live in `public/maps/source/`; Tiled JSON exports live in `public/maps/`. Each map contains `ground`, `obstacles`, and `objects` layers. The object layer contains spawn points, paired doors, NPC positions, and interaction points.

The generation commands use the installed macOS application binaries. Custom locations can be supplied without changing the repository:

```bash
ASEPRITE=/path/to/aseprite TILED=/path/to/tiled npm run generate
```

The music loop, bird voice, dialogue beep, task chime, dusk bell, and E2 monitor beep are synthesized at runtime with Web Audio. No audio files are shipped.

## Verification

```bash
npm run build
npm test
```

The Playwright suite checks title/name entry, movement, all ten scene loads, Debug controls, corruption stages, all clues, an ending path, console errors, and integer scaling at 960×540 and 640×360.
