# Trail Maze Rally

Wholesome browser maze-racing game for Tydbyts Kids.

## Product Shape

- Solo, local 1-4 player, and optional online room play.
- Junior, Trail, and Ranger rounds use exact right-side finish gates. Mega mode uses a giant maze with a shared center-camp goal.
- No chat, no voice, no avatars uploaded by children, no custom names, and no persistent child profiles.
- Static site friendly: `index.html`, `style.css`, and `game.js` can be hosted from the Tydbyts Kids site.
- Optional relay: `relay-server.mjs` adds WebSocket room codes for online races.

## v2 — What's in the current build

- **Critter racers** instead of dots: Rusty the fox, Splash the frog, Sunny the
  chick, and Pokey the turtle — with faces, eyes that look where they're going,
  smooth hop animation with squash-and-stretch, and fading footprints.
- **Scout the bunny — solo race buddy.** Alone, a kid still gets a real race:
  Scout solves the maze (breadth-first search) and hops it at a fair, beatable
  pace with little pauses. Toggleable. Finish banner celebrates "beats Scout!"
  or encourages a rematch.
- **Best times** per maze size/visibility stored locally (times only — no names,
  no profiles), with "New best time!" callouts.
- **Swipe controls** on the maze canvas for tablets/phones (plus the d-pad).
- **Background music** (procedural WebAudio, license-free) with its own toggle,
  and a victory fanfare.
- Smooth remote-player movement in online rooms (same relay protocol as before).

## Automated smoke test

```bash
node tools/smoke-maze.mjs           # trail size
node tools/smoke-maze.mjs junior    # any size key
```

Boots headless Chrome, races Scout by auto-walking the solution, verifies the
finish banner/standings/best time, saves screenshots to `smoke-out/`, and fails
on any page error.

## Copyright-Safe Adaptation

The prototype was inspired by old maze-race mechanics rather than Atari branding or artwork.

Borrowed safely as general game ideas:
- Randomized mazes.
- Race-to-exit scoring.
- Visibility variations.
- Simple hazards and quick rematches.
- Local multiplayer.

Avoided:
- The Atari title, trade dress, art style, sprites, sound expression, police/robber framing, manual text, and exact game-mode names.

Reference context:
- https://en.wikipedia.org/wiki/Maze_Craze
- https://atariage.com/manual_html_page.php?SoftwareLabelID=295
- https://www.atarimania.com/game-atari-2600-vcs-maze-craze_s6920.html

## Local Static Preview

From `tydbyts-sites-main`:

```bash
python3 -m http.server 8090
```

Open:

```text
http://127.0.0.1:8090/tydbytskids.com/games/trail-maze/
```

## Online Room Relay

The client auto-uses `ws://localhost:8787` on localhost. In production, set a relay URL by either:

```html
<script>window.TYDBYTS_MAZE_RELAY = "wss://relay.example.com";</script>
```

or with a query string:

```text
https://tydbytskids.com/games/trail-maze/?relay=wss://relay.example.com
```

Run the Node relay:

```bash
node tydbytskids.com/games/trail-maze/relay-server.mjs 8787
```

The relay only accepts `create`, `join`, `start`, and `move` payloads. It rejects chat-like fields and expires empty or inactive rooms.

## Next Kid-Safe Game Ideas

- **Barnyard Builder:** Cooperative tile placement where kids complete a farm path before sunset. No chat; shared board actions only.
- **Bookworm Sprint:** Reading-themed word-shape puzzle using curated vocabulary lists, not free text.
- **Starship Sorter:** Tommy Astro-style sorting game for colors, numbers, and shapes with short rounds.
- **Tree Farm Tally:** Gentle counting/planting game where players grow a family forest over timed rounds.
- **Trail Memory Match:** Card matching with original Tydbyts characters, local or room-based turns.
- **Campfire Checkers:** Original checkers variant with badges, simple animations, and no external player messaging.
