[ui] PlanetGarden: Analysis, review, lessons and the tablet smoke that always stops Chrome
This commit is contained in:
@@ -0,0 +1,121 @@
|
||||
# The planet garden — a gardener, gestures, and her own small world
|
||||
|
||||
Status: built on `feature/planet-garden`, merged to `main` 2026-11-17; built, not deployed. Decided by the author, Mark, on 2026-11-17, after
|
||||
seeing the garden as a page of buttons: *"It is a game: create a proper planet, a character who does
|
||||
the care, animations of how the character does it; tap the rose for actions; swipe in patterns;
|
||||
pull weeds by tapping them and swiping."* His answers the same day:
|
||||
|
||||
- **Her world:** a **round tiny planet** (reverses STYLE.md S2).
|
||||
- **The character:** a **human gardener, a boy or a girl, customised at the beginning** (reverses
|
||||
STYLE.md's *no people*).
|
||||
- **Gestures:** tap her to choose care; swipe weeds out; pour by tilting; patterns for the rest
|
||||
(sweep petals, drag the windbreak, stroke her petals). **Buttons stay** for keyboard and screen
|
||||
readers (CLAUDE.md §7: accessibility is not a phase).
|
||||
|
||||
Review: `feature-planet-garden.md`.
|
||||
|
||||
## 0. The risk the author accepted, and the guards
|
||||
|
||||
A child tending a rose on a small round planet is the most recognisable image of the book whose
|
||||
text, names and drawings CLAUDE.md §5.6 rule 3 forbids, and whose estate holds trademarks
|
||||
(GAMEPLAY.md §7). The author was told this in the choice itself and chose it. Recorded here, in
|
||||
STYLE.md and CLAUDE.md, with these guards, which become review points and avoid lines:
|
||||
|
||||
| Guard | Why |
|
||||
|:--|:--|
|
||||
| **The gardener is the player's own**: chosen and customised (boy or girl, skin tone, hair style and colour, clothes colour, a hat or not) | No two players' gardeners need look alike, and none is a fixed character from anywhere. |
|
||||
| **Never**: a scarf, a long coat or cape, a green suit with epaulettes, a crown, a sword; no outfit option recreates one | The book's boy is drawn with these. |
|
||||
| **The planet is a cultivated garden world**: meadow, the dry-stone wall, the garden bed, the chair, the wild berry bush; **no volcanoes, no baobab-like trees, no single lamp post** | The book's planet is bare with volcanoes and baobabs. |
|
||||
| **The look is our gouache** (STYLE.md §1), never pen-and-wash | The book's drawings are pen and watercolour. |
|
||||
| **No glass dome over her, ever; the windbreak is woven willow** | Unchanged (§4). |
|
||||
| **A legal check of the look before any public release** (store listings, Pages made public) | New gap; the author's risk, made visible. |
|
||||
|
||||
## 1. Why and what, in the player's terms
|
||||
|
||||
**The first open.** Before the garden, one quiet question: *Who tends her?* The player chooses a
|
||||
boy or a girl, then skin tone, hair, clothes colour, a hat. A small preview of their gardener turns
|
||||
as they choose. *This is me* finishes it. It can be changed later, from the garden.
|
||||
|
||||
**The garden is a small round world.** Her planet fills the lower half of the screen, the real sky
|
||||
above it (code, as now). On its top: the garden bed with the rose, the wall behind, the chair, the
|
||||
watering can by the bed; the gardener stands beside her.
|
||||
|
||||
**Tap the rose** and the care she needs right now opens around her as a small ring of choices (only
|
||||
what she needs; *Touch her* is always there). Choose one and the gardener walks over and does it,
|
||||
with the player's own hand in the gesture:
|
||||
|
||||
| Care | The gesture | The gardener |
|
||||
|:--|:--|:--|
|
||||
| **Water** | **Press the can and tilt**: drag sideways from it; the further the tilt, the faster the pour. Let go when her leaves lift (the same *by feel* as now). | Holds the can, tilting it as the player tilts; water falls. |
|
||||
| **Weeds** | Weeds show in the bed. **Tap a weed, then swipe up** from it: it stretches, then pops out with its roots. | Bends, tugs, the weed comes free, the gardener bumps down on the grass and gets up. |
|
||||
| **Fallen petals** | **Sweep**: one swipe sideways across the petals gathers them. | Sweeps them into a little pile and pockets them. |
|
||||
| **Wind** | **Drag the windbreak** from the side of the bed into the wind, on her windward side. | Carries it and sets it in the ground. |
|
||||
| **Touch her** | **Stroke** slowly across her petals: a fond answer. Quick, rushed taps: *Gently. I have thorns.* (thorns.md) | Reaches out and touches a petal. |
|
||||
|
||||
Every act is the same event as today (rose.md, thorns.md): nothing about growth, drift, the petal or
|
||||
her numbers changes. The gestures are how the player's hand meets the same rules.
|
||||
|
||||
**Keyboard and screen readers.** The ring's choices are buttons; each one also works without its
|
||||
gesture: *Water* still pours while Space or Enter is held; *Pull the weeds* pulls them all, one by
|
||||
one, while the gardener does it; *Gather the petals*, *Shade her*, *Touch her* likewise. The scene
|
||||
says what happens in one polite line.
|
||||
|
||||
**Reduced motion.** The gardener does not walk or bend: the scene shows the result at once.
|
||||
|
||||
## 2. Technical architecture
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
app["apps/rosea<br/>App.svelte"] --> shell["packages/ui<br/>Shell: first-open choice, then the scene"]
|
||||
shell --> scene["packages/ui/scene<br/>Planet.svelte (SVG): planet, bed, rose, can,<br/>weeds, petals, windbreak, gardener"]
|
||||
scene --> gestures["packages/ui/scene/gestures.ts<br/>pure: tilt, swipe up, sweep, drag, stroke"]
|
||||
scene --> engine["packages/engine<br/>rose (care, pour), touch (thorns),<br/>scene/ weedsToday, petalsToday (seeded counts)"]
|
||||
shell --> storage["packages/storage<br/>profile: gardener (shape-checked)"]
|
||||
```
|
||||
|
||||
| # | Decision | Why |
|
||||
|:--|:--|:--|
|
||||
| G1 | **One SVG scene** (`Planet.svelte`), every part its own group with a stand-in drawn in code until art is accepted; the sky stays code (S5). | One coordinate system for gestures, animation and layout; no canvas, so every part can carry an accessible name. |
|
||||
| G2 | **Gesture recognisers are pure functions** of pointer samples (`gestures.ts`): `tiltOf`, `isSwipeUp`, `isSweep`, `dropTarget`, `strokeOf`. Unit- and property-tested. | Input interpretation is not game logic, but it must be testable without a browser. The rules stay in the engine. |
|
||||
| G3 | **How many weeds and petals** a day shows is the engine's: `weedsToday(seed, day)` (2–4 when `weedsOn`), `petalsToday(seed, day)` (3–5 when `petalsOn`). One `weed` / `petals` care event when the **last** one is pulled or gathered. | A count on screen is the engine's (CLAUDE.md §6.2). Half-pulled weeds are not care yet: nothing is written until the job is done, and leaving half-way loses nothing earned. |
|
||||
| G4 | **Pour by tilt** maps tilt to the same pour rate the hold uses (`ROSE.fullPour` over `FULL_CAN_MS`), scaled 0–1.5× by tilt; the event's `amount` is unchanged in meaning. | Watering by feel (rose.md R1) stays one rule. |
|
||||
| G5 | **The gardener** is a separate component with poses (`stand`, `walk`, `pour`, `bend`, `pull`, `sweep`, `carry`, `reach`, `sit`) and a look from the player's choice. Poses are SVG stand-ins now; real art replaces them sheet by sheet. | Art and animation can arrive later without touching gestures or rules. |
|
||||
| G6 | **The gardener's look is stored in `profile`** as `{ presentation: 'boy' \| 'girl', skin, hair, hairColour, clothes, hat }`, each from a fixed list; shape-checked like every stored value. Never sent anywhere. | No free text; nothing identifying; local only (CLAUDE.md §4). |
|
||||
| G7 | **The ring** opens on a tap of the rose; it holds only her current needs plus *Touch her*; Escape or a tap outside closes it; focus moves into it and back. | Silence and calm: no permanent row of buttons over her. |
|
||||
|
||||
## 3. Risk analysis
|
||||
|
||||
| Risk | Answer |
|
||||
|:--|:--|
|
||||
| **Likeness to the book** (the author's accepted risk) | §0's guards, as avoid lines in every prompt, review points, and a legal check before release. |
|
||||
| **Soul: a child avatar for adult players** | The author chose boy or girl. Recorded as a question for his two-week play: does an adult player see themselves in a child gardener? A grown-up option is one list entry away. |
|
||||
| **Soul: fiddly gestures that make care feel like failing** | Generous thresholds; every gesture has a button; a missed gesture does nothing and says nothing; nothing is lost. |
|
||||
| **Motion** | `prefers-reduced-motion`: no walking or bending; results at once. |
|
||||
| **Accessibility** | Buttons for every act (G7); one polite line says what the gardener did; keyboard focus never trapped. |
|
||||
| Privacy | The gardener's look stays in `profile`, on the device; it is not in the rose file (keep-her-safe.md K4 is unchanged). |
|
||||
| Offline | Everything is code and bundled stand-ins. |
|
||||
|
||||
## 4. Gap analysis
|
||||
|
||||
- New: **G1.9** the planet garden (this); **G6.x** a legal check of the look before any public release.
|
||||
- STYLE.md: S2 (where she lives) and *no people* are reversed by the author; §3b *the gardener* is
|
||||
new; §4 and §7 gain the guards; the manifest gains the planet, the gardener's sheet and pose
|
||||
sheets, and the customisation parts.
|
||||
- Not in this feature: the gardener on the journey's other planets (Phase 2), the fox on her planet.
|
||||
|
||||
## 5. Verification matrix
|
||||
|
||||
| Case | Kind | Where |
|
||||
|:--|:--|:--|
|
||||
| `tiltOf`: sideways drag → 0–1 tilt; `isSwipeUp` needs upward distance and direction; `isSweep` needs sideways distance across the petals; `strokeOf` tells a slow stroke from a tap | unit + property | `ui/test/gestures.test.ts` |
|
||||
| `weedsToday` / `petalsToday`: 0 on a day without, 2–4 / 3–5 with, the same on every replay | unit + property | `engine/test/scene.test.ts` |
|
||||
| Gardener look: every option list is fixed; storage refuses anything else; it never enters the rose file | unit | `storage/test` |
|
||||
| First open asks *Who tends her?*; the choice is kept; *Change gardener* reopens it | unit | `ui/test/gardener.test.ts` |
|
||||
| Tap the rose: the ring shows only her needs plus *Touch her*; Escape closes it and focus returns | unit | `ui/test/planet.test.ts` |
|
||||
| Pulling every weed writes one `weed` event; leaving half-way writes none | unit | same |
|
||||
| A sweep across the petals writes one `petals` event; dragging the windbreak onto the windward side writes `shade` | unit | same |
|
||||
| Pour by tilt writes one `water` event whose amount follows the tilt and time | unit | same |
|
||||
| Buttons do every act without a gesture | unit | same |
|
||||
| Reduced motion: no animation classes | unit | same |
|
||||
| Built app: first-open choice, tap the rose, pull weeds by swiping, axe | e2e | `e2e/planet.spec.ts` |
|
||||
| The real tablet: the same by real touch | device | `scripts/android-smoke.ts` (made permanent here) |
|
||||
Reference in New Issue
Block a user