# Droid10 — droid10.com (game site)

> Read this first if you are an AI picking up work on this site. It tells you what the site is, where everything lives, and how to change it without breaking it.

## What it is

- Free casual-game site: **34 games** (Snake, 2048, Minesweeper, match-3, tower defense, fishing, farm racing, …). No ads, no paywall, no purchases. Every game runs entirely in the browser.
- Domains **droid10.com**, **www.droid10.com** and **game.droid10.com** are the same deployment (Cloudflare Pages project `droid10games`). The tools site is a different project at **tool.droid10.com** — do not confuse the two.
- Owner: Baozhong. The site's UI text is English with a Chinese toggle; the owner communicates in Chinese.

## Stack and deploy

- Plain static HTML/CSS/JS — **no build step**. `index.html` + `main.js` + `styles.css` at the root, one folder per game.
- Login/scores backend: Cloudflare Pages Functions (`functions/api/`) + D1 database `playmini-db` (database_id `6cb8fa0e-9abd-49f7-af34-76f7e9fbbf56`, bound as `DB` in `wrangler.toml`). Details in `BACKEND_API.md`. The backend is live and verified (test account `musecheck01` registered 2026-11-29, stays logged in across refresh).
- Deploy with **wrangler only**: `wrangler pages deploy <clean-copy> --project-name=droid10games`. Deploy from a clean copy of this folder, excluding `*.claude-*` and `*.orig-*` files (the reusable clean copy is `~/workspace/.tools/pptr/balloon-shooter-deploy1/` — rsync this folder into it first, then deploy from there). Never create test deployments on the production branch via the Pages direct-upload API: a deployment created on `main` becomes canonical production immediately, even before files are uploaded (2026-12-01 incident on the tools site: 10 minutes of 404/500).
- The Cloudflare token expires after about an hour (error 9109): refresh first with `npx cf auth whoami`, then pass the token as `CLOUDFLARE_API_TOKEN` for that process only. Never print or save the token value.
- After deploy, verify live with curl: homepage 200, sitemap count, one changed page 200. A wrangler success message alone is not proof — check the live bytes. Note the apex domain can serve a stale copy for ~1–2 minutes after deploy; wait 60 seconds and re-fetch once before concluding. If a deleted file still returns 200, re-check with `Cache-Control: no-cache, no-store` — the sandbox egress proxy caches.

## Structure

```
index.html          homepage: hero, search, category filter, game cards (loads games.json)
main.js             catalog rendering (?v=7 — bump ?v= whenever this file changes)
styles.css          shared design system (StackMatch-style warm cream, gold buttons)
auth.js             login/register modal client (?v=2); token in Authorization header
games.json          34 games: id/slug/title/description/category/controls/added_date/is_new
games/<slug>/       one folder per game: index.html + game.js (standalone, playable)
images/<slug>.jpg   homepage cover per game, 480×270 JPG (16:9)
shared/audio/       shared sounds: bgm.mp3 + 9 wav (ui_tap, match_success, …)
functions/api/      register, login, logout, me, scores (see BACKEND_API.md)
db/                 schema SQL for playmini-db (reference only; the live DB is in D1)
BACKEND_API.md      backend contract, verified 2026-11-29
robots.txt          Allow all; Sitemap: https://droid10.com/sitemap.xml
sitemap.xml         hand-maintained: homepage + 34 games + README.md = 36 URLs
README.md           this file (in the sitemap as https://droid10.com/README.md)
```

- `games.json`: `id` and `slug` unique, lowercase, hyphenated, matching `games/<slug>/`. Set `is_new: true` for the newest game only. Language: the homepage reads `localStorage.playmini_lang` (`en` default, `zh` available); game pages do not add their own language switcher.
- Covers: one 480×270 JPG per game in `images/`. Keep originals: when a game's art is redone, keep the old file as `*.orig-YYYYMMDD` in `images/` (deploy excludes `*.orig-*`).
- Scores: `functions/api/scores.js` keeps a slug whitelist (currently 32 of 34 games; `balloon-shooter` and `farm-racing` are not in it yet). Add a new game's slug to the whitelist when it ships, otherwise its scores are rejected.
- Sharing: only bubble-shooter has a real share implementation (`navigator.share` + copy-link fallback) — it is the template (`shared/share.js` pattern) for the others. Comments and multiplayer do not exist yet; the owner decides the order (login → share → comments → multiplayer).

## Adding a game

1. Pick a category the site does not have yet, or the next in the rotation. One new game per day at 01:00 (Asia/Shanghai), checked at 06:00.
2. Build it with Claude: one fresh claude.ai conversation per game, self-contained brief (design + rules + images as attachments), Claude delivers a zip **as a file attachment, never pasted code**. Test **only the attachment's original bytes, after checking its md5**. Never click Retry on a failed message; never click a human-verification box.
3. The game must have: a visible Start and Restart button, a `#score` and `#status` element, a win/lose/end state with a way to play again, mobile controls (touch/swipe/on-screen buttons) AND PC controls (keyboard/mouse), a board that fits a portrait phone screen.
4. Add the `games.json` entry, the 480×270 cover, and one line in `sitemap.xml`. Update the scores whitelist. Bump `main.js?v=` if `main.js` changed.
5. **Test pass → deploy immediately.** Do not wait for the next round; a round is an alarm clock, not the owner of the work.
6. Per-game rework limit: Claude at most to V3. Small issues that do not affect gameplay go into the run log for later batch fixing; a V3 with a gameplay-breaking problem is not deployed — report to the owner.

## Design system

- Style: StackMatch-like warm cream background, white rounded cards, gold primary buttons, brown text. Full-screen play pages; the game's name on the first screen; levels map to difficulty (50 levels + endless where the game supports it); pause menu holds Continue / Restart / Back.
- Aesthetics keywords (use in every image prompt and brief): visual harmony, balanced composition, analogous palette (green + beige + gold), clear visual hierarchy, value contrast, clean silhouettes, cohesive storybook style, readable at a glance, palette discipline, color as information, consistency, negative space, leading lines, rule of thirds. Layout: only the line "布局要符合美学" — never set layout numbers.
- **Never add smiley faces** to gameplay elements (pieces, bubbles, tokens). Only children's books and happy scenes get faces.
- Division of work (owner order): simple interface fixes, especially CSS-only changes, Muse fixes directly. Gameplay logic goes to Claude.

## SEO (do not break)

- `sitemap.xml` is hand-maintained: homepage + one line per game + this README = **36 URLs**, all `https://droid10.com`. Update it whenever a game is added or removed. `robots.txt` points at it.
- Google Analytics `G-B94T7NYCSM` on every page. GA data analysis is abandoned by owner order (2026-11-29) — do not retry it.
- A game's page must keep its title, description, canonical and JSON-LD when restyled.

## History (short)

- 2026-10-21: first publish (PlayMini). 2026-11-22: homepage redo. 2026-11-23–28: all 26 games in the rework queue rebuilt.
- 2026-11-29: login backend fixed and verified (D1 `playmini-db` created); domain move — game site took apex `droid10.com` + `www`, tools site moved to `tool.droid10.com`; fishing (32nd game) shipped.
- 2026-11-30: ludo shipped, then removed the same day by owner order (ugly interface); files kept in backup.
- 2026-12-01: balloon-shooter (33rd) shipped. 2026-12-02: farm-racing (34th) shipped; this README rewritten (the 2026-10-21 version still said the backend was "NOT deployed yet") and added to the sitemap (35 → 36).

## Never

- This site's source lives only locally — **there is no GitHub backup repo yet**. Do not push game code with the books-repo push script (that script is hard-coded to another repo). Do not invent a repo.
- Never spend money or bind a card (owner order 2026-11-03) unless the owner explicitly lifts it. No paid Claude upgrade, no new Claude accounts.
- Never invent numbers, domains, prices, traffic, or follower counts. Never claim "deployed" or "online" without a live check.
- Facebook is permanently abandoned; X posting and Claude re-registration are abandoned — do not retry any of them.
- The owner's phone check outranks any automated test. Success, failure, and unresolved must be reported separately.
