diff --git a/.agents/FEATURES.md b/.agents/FEATURES.md index cf2e974..88e1fd6 100644 --- a/.agents/FEATURES.md +++ b/.agents/FEATURES.md @@ -21,4 +21,4 @@ One row per feature, with its analysis document (CLAUDE.md §5.1). Gaps live in | Where the sunset is: choose a town (or skip to a guess from the device's zone), kept on the device; tonight's sunset in the garden | 1 | Merged to `main`; built, not deployed | [sunset-place.md](features/sunset-place.md) | [feature-sunset-place.md](reviews/feature-sunset-place.md) | | The sun: real sunrise, sunset and solar noon on the device; polar day and night | 1 | Merged to `main`; engine only, the app does not show it yet | [sun.md](features/sun.md) | [feature-sun.md](reviews/feature-sun.md) | | Her planet and the gardener: a round tiny planet, a boy or girl chosen at the first open, the ring of care by a tap on her, care by gesture (tilt the can, swipe weeds up, sweep petals, drag the windbreak, stroke her); every gesture also a button | 1 | Merged to `main`; built, not deployed. Code stand-ins; the painted art waits on the board | [planet-garden.md](features/planet-garden.md) | [feature-planet-garden.md](reviews/feature-planet-garden.md) | -| The art pipeline and the art board: STYLE.md (S1–S5 and the fox's F1–F4 approved), the manifest (Phase 1–3, 53 pictures), stand-ins, `tools/art-prep`, the published board | 0 | Merged to `main`; board published (private). The app is unchanged. Gate waits on the first real picture | [art-pipeline.md](features/art-pipeline.md) | [feature-art-board.md](reviews/feature-art-board.md), [art-phase2-3-pictures.md](reviews/art-phase2-3-pictures.md) | +| The art pipeline and the art board: STYLE.md (S1–S6 and the fox's F1–F4 approved), the manifest (Phases 1–5: 95 cards, 538 pictures, of them 55 gardener layer sheets), stand-ins, `tools/art-prep`, the published board | 0 | Merged to `main`; board published (private). The app is unchanged. Gate waits on the first real picture | [art-pipeline.md](features/art-pipeline.md) | [feature-art-board.md](reviews/feature-art-board.md), [art-phase2-3-pictures.md](reviews/art-phase2-3-pictures.md), [art-board-v2.md](reviews/art-board-v2.md), [art-gardener-layers.md](reviews/art-gardener-layers.md) | diff --git a/.agents/GAP_ANALYSIS.md b/.agents/GAP_ANALYSIS.md index dbf137b..4f0aad6 100644 --- a/.agents/GAP_ANALYSIS.md +++ b/.agents/GAP_ANALYSIS.md @@ -40,7 +40,7 @@ board exist, and the first real picture is the author's to make. | G0.21 | No PNG icons | Open (predicted trap). iOS ignores SVG for `apple-touch-icon`. Comes through the art pipeline. Narrowed 2026-11-17: the apps make PNG/ICO icons from `icon.svg` at build time (`tauri icon`, never committed); the PWA still has none, and the picture is still the placeholder. | | G0.22 | No CI | Open. Every gate ran on this machine only. With G0.13. Since 2026-11-17 the APK and the Windows installer are also built by hand here (G-T7). | | G0.23 | Source maps are built and would be published | Open. `sourcemap: true`; maps are not precached. Decide with G0.13 whether the repository is public. If not, use `'hidden'`. | -| G0.24 | No art pipeline: `docs/ART.md`, `art/STYLE.md` (drafted with the author), `art/manifest.json` for Phase 1 assets, SVG placeholders, `tools/art-prep` | **Pipeline built 2026-11-01** (`feature/art-board`): docs/ART.md, the Phase 1 manifest (25 pictures), 29 generated stand-ins, `tools/art-prep` (50 tests; 5 of 5 put-back bugs caught), the art board published. STYLE.md approved by the author 2026-11-01 (S1–S5 kept as drafted; `docs/style-approved`). The board grew to 53 pictures with Phases 2–3 (`art/phase2-3-pictures`); the fox's look F1–F4 approved with a deep red-orange coat (`art/fox-coat`). 2026-11-07, `art/board-v2`: the first `rose-sheet` came out as watercolour with a smiley on a ball; STYLE.md §1 and every prompt rewritten (look first, face on the petals, no pixel numbers, the book's motifs checked in review, not named), and the board grew to 86 pictures for Phases 1–5 (board version 4). **Still open:** the **Phase 0 gate**, one real picture through every step into `art/final/`. | +| G0.24 | No art pipeline: `docs/ART.md`, `art/STYLE.md` (drafted with the author), `art/manifest.json` for Phase 1 assets, SVG placeholders, `tools/art-prep` | **Pipeline built 2026-11-01** (`feature/art-board`): docs/ART.md, the Phase 1 manifest (25 pictures), 29 generated stand-ins, `tools/art-prep` (50 tests; 5 of 5 put-back bugs caught), the art board published. STYLE.md approved by the author 2026-11-01 (S1–S5 kept as drafted; `docs/style-approved`). The board grew to 53 pictures with Phases 2–3 (`art/phase2-3-pictures`); the fox's look F1–F4 approved with a deep red-orange coat (`art/fox-coat`). 2026-11-07, `art/board-v2`: the first `rose-sheet` came out as watercolour with a smiley on a ball; STYLE.md §1 and every prompt rewritten (look first, face on the petals, no pixel numbers, the book's motifs checked in review, not named), and the board grew to 86 pictures for Phases 1–5 (board version 4). 2026-11-17, `art/gardener-layers`: the gardener the player dresses is drawn in layered parts (the author's answer): a guide and 55 layer sheets, register checked by `art:accept`, 10 of 10 put-back bugs caught; the board has 95 cards and 538 pictures. **Still open:** the **Phase 0 gate**, one real picture through every step into `art/final/`. | | ~~G0.25~~ | ~~No slot for *A Letter from the Gardener*~~ | Closed 2026-11-01, merged to `main`. `docs/LETTER.md` holds slots as comments only; the page opens at `#letter` once it has words. 16 ui tests, and e2e on both the empty and a temporary written letter. Mutations caught: the link while empty, any link scheme, focus not moving, *heal* in the letter. | | ~~G0.28~~ | ~~CLAUDE.md §5.7's CPU limit was only read, and broken three times on 2026-11-02~~ | Closed 2026-11-02 on `fix/cpu-guard`: `pnpm guard:cpu` runs before every full run, waits up to 3 min, then refuses. 13 tests; seen waiting 51 s on a busy machine, refusing, and stopping `pnpm test` before any test ran. | | G0.27 | The quiet door to real help has no numbers (§5.6 rule 5) | Open. The slot is in `docs/LETTER.md`. Support lines are real-world facts the author must verify, per country, so the door exists only once the letter does. | @@ -62,6 +62,7 @@ sentences). Phase 1 is built in code, not deployed (no host yet, G0.13). | ~~G1.8~~ | ~~Two tabs (CLAUDE.md §8, predicted)~~ | Closed 2026-11-07 on `fix/two-tabs`. Measured first: two e2e tests failed (an open tab saw neither care nor a town from the other). Storage announces committed writes on a `BroadcastChannel`; the rose and the garden read again, adding to what they show. No lock needed: nothing stored drifts. 7 of 7 put-back bugs caught. | | ~~G1.10~~ | ~~The garden named only the sunset, never the sunrise (ROADMAP Phase 1: *sunset and sunrise*)~~ | Closed 2026-11-17 on `feature/sunrise`: from sunset until it comes, the line names the real sunrise; the in-game sunset still names the sunset. engine `nextSunEvent` with a 300-run property; e2e at 05:00 in Brno; seen on a real Android tablet. 5 of 5 put-back bugs caught. | | ~~G1.9~~ | ~~The garden was a page of buttons, not a game (the author, 2026-11-17)~~ | Closed 2026-11-17 on `feature/planet-garden`: her round planet, a gardener the player chooses at the first open (fixed lists, kept in `profile`, never in the rose file), the ring of care by a tap on her, care by gesture with a button for each. 84 ui tests incl. 7 on the planet and 7 on gestures; e2e `planet.spec.ts` 3; 9 of 9 put-back bugs caught (2 only after tests were added); 7 of 7 by real touch on the Android tablet. **Open in it:** painted art for the planet and the gardener, and how customised looks are drawn (STYLE.md §3b, the author's). | +| G1.11 | The app does not stack painted gardener layers | Open. Decided 2026-11-17 (STYLE.md §3b): the scene stacks body, clothes, apron, hair and hat from `art/final/`, in the look the player chose, and keeps its code drawing for any look whose layers are not all accepted. Comes with the first accepted layers; needs a size budget for 55 sheets (docs/ART.md §4: 440 cells would not all be precached). | | G1.3 | Towns have no Czech names (*Vídeň*) | Open. Natural Earth has none; arrives with Czech copy. | ## The platform track — four versions (from 2026-11-17) diff --git a/.agents/features/planet-garden.md b/.agents/features/planet-garden.md index d229b94..0f089a4 100644 --- a/.agents/features/planet-garden.md +++ b/.agents/features/planet-garden.md @@ -79,7 +79,7 @@ flowchart LR | 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. | +| 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. Painted art comes as **layered parts** (decided by the author 2026-11-17, STYLE.md §3b): body, clothes, apron and boots, hair, hat, each painted over one guide in register and stacked in the scene (G1.11). | 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. | diff --git a/.agents/reviews/art-gardener-layers.md b/.agents/reviews/art-gardener-layers.md new file mode 100644 index 0000000..f2bfca3 --- /dev/null +++ b/.agents/reviews/art-gardener-layers.md @@ -0,0 +1,103 @@ +# Review — `art/gardener-layers` + +The author's answer on 2026-11-17 to the open art question of the planet garden (STYLE.md §3b): the +gardener the player dresses is drawn in **layered parts**. Not a few painted looks, not colours tinted +in code. This branch turns that answer into the art pipeline. The app does not change: it keeps its +code drawing until painted layers are accepted (G1.11). + +## What changed + +- **STYLE.md §3b** records the decision. + - A **guide** (`gardener-poses-sheet`, the first-look girl whole in 8 poses) is now never shipped. + - Five layers are stacked back to front: body (skin, face, a cream vest and shorts), clothes, + apron and boots, hair, hat. + - Each layer is painted over the guide in register, always as a whole sheet. + - The count is **55 layer sheets** of 8 pictures. + - New review point 12: a layer holds only its part and stacks into one child. +- **art/manifest.json** gains `layers`. + - It holds the words for every value the app offers, with the app's own colour codes. + - It names the first looks and the five parts. +- **tools/art-prep** + - `expandLayers` writes the layers out as ordinary sprite sheets right after the guide, with the + two first looks' seven layers first. + - `checkManifest` refuses a guide that is missing, not a sprite sheet, or shipped. It also refuses + a part whose subject names a choice it is not painted for, a choice with no words, and forbidden + words. + - A layer's prompt attaches `gardener-sheet` and the guide. It names only its part, not the whole + first look, and its pictures have no one-at-a-time prompts. + - `art:accept` refuses: + - one picture of a layer made alone; + - any layer before the guide is in `art/final/`; + - a layer whose part strays more than 8 % of its cell outside the guide's figure, naming the + pictures. + - Stand-ins: the code gardener is split into the same five parts, so the layer stand-ins stack + into whole figures. This was checked by eye: the first-look girl, and a boy with skin-6, dusk + clothes, red curls and a cap. +- **The board** has a *Gardener layers* group. A layer card says to attach the guide and has no + *One at a time*. + +## Findings + +| # | Kind | Finding | Resolution | +|:--|:--|:--|:--| +| 1 | Scope | 55 layer sheets make 440 pictures. The board grows from 40 cards and 98 pictures to 95 cards and 538 pictures. That is the real cost of *layered parts*, and it is the author's to know. | The board puts the seven first-look layers first. A look can be judged once its five are in, and the rest can follow over time (§3b). | +| 2 | Correctness | Image generators do not keep layers in register by themselves. A layer made from text alone will drift. | The prompt makes the guide an attachment to paint over. `art:accept` measures register against the accepted guide and refuses the whole sheet if a part is off (8 % of the cell, `REGISTER`). The tolerance is a first guess: a curly bob or a wide hat may need more. Tune it on the first real layers. | +| 3 | Correctness | The guide holds the watering can and the windbreak in its poses. A layer that copied them would draw a second can over the scene's own. | Every layer avoids "any other thing the guide holds (the game draws them)". | +| 4 | Soul / likeness | Fair hair, short curls and sage clothes can be chosen together. STYLE.md's *never* list names "golden curls with a green outfit". | The words say *light honey-fair* and never *golden*. The gardener always wears the apron and boots, never a scarf or coat. Review points 10 and 12 apply to a whole stacked look as well as each layer. **Open for Mark:** whether the app should keep fair + curly from sage. It is one rule in the choice, not in the art. | +| 5 | Privacy | Nothing leaves the device. The art board is a private page holding generated pictures and Mark's notes only. | — | +| 6 | Test honesty | The first drill run reported CAUGHT without saying which test failed. A catch by an unrelated test proves nothing (`lessons/testing.md`). | Rerun with names: each of the 10 drills is caught by the test written for it. | + +## Bug drills (put back, test run, restored) + +10 of 10 caught, each by its own test: + +1. No register check. +2. One picture of a layer accepted alone. +3. A layer accepted before its guide. +4. No hat gets a layer. +5. A shipped guide passes the check. +6. A layer gets an ordinary sheet prompt. +7. A layer's pictures get one-at-a-time prompts. +8. A layer attaches only the character sheet. +9. A prompt colour drifts from the app's. +10. The first looks are not put first. + +## Gates + +lint 0 and typecheck 0. + +Unit tests: 578. + +| Package | Tests | +|:--|--:| +| cpu-guard | 13 | +| identity | 5 | +| schema | 19 | +| content | 88 | +| storage | 70 | +| art-prep | 80 | +| tauri | 40 | +| engine | 179 | +| ui | 84 | + +The other gates: + +- e2e: 26. +- offline: 1. +- `lint:copy`: 26 files, 0 problems. +- Fixtures: 13 of 13 rejected. + +The **first** run of e2e and offline failed, and my output filter dropped the reason, probably the +CPU guard refusing a busy machine; that is not shown. Both passed when rerun unchanged. The app is +unchanged by this branch. + +## Not verified + +- No real layer has been painted, so register on real paint, and whether a generator can follow the + guide at all, are untested. +- The app does not stack painted layers yet (G1.11). +- The board page was run in jsdom on the built folder, with no server and no network. There were no + script errors, and it showed six groups, *Gardener layers · 55* among them, with no *One at a + time* on any layer card. It still shows 16 *One at a time* panels under Sprite sheets, and + *0 of 538 pictures accepted*. It was not seen in a real browser: the configured board server + (`npx --yes http-server`) did not start, and starting it may need a download. diff --git a/HANDOVER.md b/HANDOVER.md index 54ae8a5..b882213 100644 --- a/HANDOVER.md +++ b/HANDOVER.md @@ -162,10 +162,12 @@ The notification decision is made: in-app only on the web (G0.26). After an accept, Claude reads the row (`ArtifactData get art/`), downloads the picture (`Artifact read` with the asset id as `path`), runs `pnpm art:accept`, commits on `art/`, and writes `final` back into the row. -4. **The gardener in paint:** the board asks for the first look (a girl, braids, sage, a straw hat). - Painted art cannot be recoloured for every skin, hair and clothes choice the way the stand-in is: - layered parts, a few painted looks, or tints? (STYLE.md §3b). Also: a gardener changed in one tab - shows in another only after a reload (the rose's care does update live). +4. **The gardener in paint:** *layered parts* (Mark, 2026-11-17; STYLE.md §3b). Make + `gardener-sheet`, then the guide `gardener-poses-sheet`, and accept both; then the seven first-look + layers (first in the board's *Gardener layers* group), each painted over the guide. The other 48 + can follow over time. Open for Mark: may the choice keep fair curls away from sage clothes (the + book's look)? Review: [`.agents/reviews/art-gardener-layers.md`](.agents/reviews/art-gardener-layers.md). + Also: a gardener changed in one tab shows in another only after a reload. 5. **A GitHub repository** for Pages, and whether it is public (G0.13, G0.23). 6. **Node is upgraded** (22.23.4); unpinning the dependencies pinned for 22.11 remains (G0.20). 7. **The rose's tuning** (`.agents/features/rose.md` R2, R4, R5, R6, all in `ROSE` in diff --git a/art/STYLE.md b/art/STYLE.md index 0c1ecb6..98f6dd6 100644 --- a/art/STYLE.md +++ b/art/STYLE.md @@ -150,9 +150,22 @@ Every gardener picture follows `gardener-sheet`. - **The choices the player makes** (skin tone, hair style and colour, clothes colour, straw hat, cap or none) are the app's (`gardener.schema.json`). The board paints **the first look** (the girl: braids, brown hair, sage clothes, straw hat; and the boy, short hair, the same colours) so the - character can be judged. **How the other looks are drawn** (separate layers for hair and hat, or - clothes painted to be tinted in code) **is still open** and waits for Mark: it decides how many - pictures the gardener needs. + character can be judged. +- **Every look is stacked from painted layers** (decided by Mark 2026-11-17: *layered parts*, not a + few painted looks, not colours tinted in code). The app stacks five transparent layers, back to + front: **body** (skin, with the face, and a plain cream vest and shorts), **clothes** (the girl's + tunic or the boy's shirt and trousers), **apron and boots**, **hair**, **hat**. Each layer is a + sprite sheet with the same eight poses as `gardener-poses-sheet`, **the guide**: the girl in the + first look, whole, never shown in the app. A layer is painted over the guide in register — only + its part, exactly where it sits on the guide's figure, everything else transparent — and always + as a whole sheet: one picture at a time would not line up. `pnpm art:accept` refuses a layer + whose part strays more than 8 % of its cell outside the guide's figure, and any layer before the + guide is accepted. The layers never hold the watering can or the windbreak: the game draws them. +- **How many:** one layer sheet for each value the player can choose — 6 bodies (skin), 10 clothes + (girl and boy in 5 colours), 1 apron, 36 hairs (6 styles in 6 colours), 2 hats (no hat needs + none): **55 layer sheets** of 8 pictures, all listed by `art/manifest.json` (`layers`). The seven + that stack the two first looks come first on the board; until a look's layers are all accepted, + the app keeps its code drawing for that look. - **Never:** a scarf, a long coat or cape, a suit with epaulettes, a crown, a sword, golden curls with a green outfit, or anything that recreates the book's boy. He or she is a gardener at work. - **Size:** standing, a little taller than the rose. @@ -293,6 +306,8 @@ tick them: *Accept* is one tap. apron, boots; no scarf, long coat, cape, suit, crown or sword, and nothing like the book's boy. 11. Her planet is a cultivated garden world: meadow, her bed, the wall, the chair; no volcanoes, no baobab-like trees, no lone lamp post, and not the look of the book's little planet. +12. A gardener layer holds only its part, in register with the guide: stacked with the other + layers of a look, it makes one child, with nothing doubled, missing or shifted. --- diff --git a/art/manifest.json b/art/manifest.json index 3a93c5a..a9a76a2 100644 --- a/art/manifest.json +++ b/art/manifest.json @@ -717,7 +717,7 @@ }, { "phase": 1, - "shipped": true, + "shipped": false, "character": "gardener", "allow": [ "people, hands or human faces" @@ -738,9 +738,9 @@ "background": "transparent", "smallest": 120, "usedBy": [ - "The gardener at work on her planet (planet-garden.md G5): each pose is shown while the care it belongs to happens." + "The guide every gardener layer is painted over (STYLE.md §3b): never shown in the app, which stacks the layers into the look the player chose. Make it right after gardener-sheet, and accept it before any layer." ], - "purpose": "The gardener's poses for each act of care, the girl in the first look.", + "purpose": "The guide: the girl in the first look, whole, in every pose of care. Each layer is painted over it in register.", "angle": "The whole girl gardener in every cell, in side view facing right unless the cell says otherwise, at the same scale as gardener-sheet, the same light from the left.", "grid": { "cols": 4, @@ -1751,5 +1751,133 @@ 6 ] } + ], + "layers": [ + { + "character": "gardener", + "over": "gardener-poses-sheet", + "phase": 1, + "words": { + "skin": { + "skin-1": "very light, rosy skin (#F6DCC8)", + "skin-2": "light, warm skin (#E8BF9C)", + "skin-3": "warm, medium golden-brown skin (#CF9A72)", + "skin-4": "warm tan-brown skin (#A9714B)", + "skin-5": "deep brown skin (#7F5236)", + "skin-6": "very deep brown skin (#553422)" + }, + "presentation": { + "girl": "the girl's plain short-sleeved tunic, falling to just above the knee", + "boy": "the boy's plain short-sleeved shirt and simple trousers to the ankle" + }, + "clothes": { + "sage": "sage green (#7FA07A)", + "rose": "dusty rose (#C85A6E)", + "honey": "honey ochre (#B98A5A)", + "dusk": "dusk blue (#5B6FA6)", + "plum": "soft plum (#7A4F6E)" + }, + "hair": { + "short": "short hair, cut just above the ears", + "curly": "short soft curls close round the head", + "ponytail": "hair tied back in one ponytail", + "braids": "hair in two braids to the shoulders", + "bob": "a chin-length bob with a short fringe", + "bun": "hair in a small round bun at the back of the head" + }, + "hairColour": { + "black": "black (#2B2324)", + "dark-brown": "dark brown (#4A2F24)", + "brown": "warm brown (#7A4B2E)", + "auburn": "auburn (#9A4A2A)", + "red": "copper red (#B5532C)", + "fair": "light honey-fair (#D9B26A)" + }, + "hat": { + "straw-hat": "a wide straw hat with a low round crown", + "cap": "a soft cream cotton cap with a short peak", + "none": "no hat" + } + }, + "first": [ + { + "skin": "skin-3", + "presentation": "girl", + "clothes": "sage", + "hair": "braids", + "hairColour": "brown", + "hat": "straw-hat" + }, + { + "skin": "skin-3", + "presentation": "boy", + "clothes": "sage", + "hair": "short", + "hairColour": "brown", + "hat": "straw-hat" + } + ], + "parts": [ + { + "part": "body", + "axes": [ + "skin" + ], + "subject": "only the gardener's body, in {skin}: the head with the same tiny painted face as the guide, the ears, neck, arms, hands and legs; and a plain, close-fitting cream vest and short shorts where the clothes will cover them. No hair, no clothes over the vest, no apron, boots or hat." + }, + { + "part": "clothes", + "axes": [ + "presentation", + "clothes" + ], + "subject": "only the gardener's clothes: {presentation}, all in {clothes}, worn exactly as on the guide. Where skin, hair, the apron or the boots would be, leave it transparent." + }, + { + "part": "apron", + "axes": [], + "subject": "only the gardener's cream canvas apron with one pocket, and the small sturdy brown boots, exactly as on the guide. Nothing else." + }, + { + "part": "hair", + "axes": [ + "hair", + "hairColour" + ], + "subject": "only the gardener's hair: {hair}, {hairColour}, sitting on the guide's head exactly. The whole hairstyle, as if there were no hat; no face, skin or hat." + }, + { + "part": "hat", + "axes": [ + "hat" + ], + "skip": [ + "none" + ], + "subject": "only the gardener's hat: {hat}, sitting on the guide's head exactly where the guide's hat is. Nothing else." + } + ], + "include": [ + "exactly the size, pose and position of the figure in the attached guide, picture by picture", + "the part only; fully transparent everywhere else" + ], + "avoid": [ + "any part of the gardener other than the one named", + "the watering can, the windbreak or any other thing the guide holds (the game draws them)", + "ground or grass under them" + ], + "allow": [ + "people, hands or human faces" + ], + "checks": [ + 2, + 4, + 5, + 6, + 7, + 10, + 12 + ] + } ] } diff --git a/art/placeholders/gardener-apron.svg b/art/placeholders/gardener-apron.svg new file mode 100644 index 0000000..6262155 --- /dev/null +++ b/art/placeholders/gardener-apron.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-body-skin-1.svg b/art/placeholders/gardener-body-skin-1.svg new file mode 100644 index 0000000..a691d79 --- /dev/null +++ b/art/placeholders/gardener-body-skin-1.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-body-skin-2.svg b/art/placeholders/gardener-body-skin-2.svg new file mode 100644 index 0000000..1090e31 --- /dev/null +++ b/art/placeholders/gardener-body-skin-2.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-body-skin-3.svg b/art/placeholders/gardener-body-skin-3.svg new file mode 100644 index 0000000..5965d0f --- /dev/null +++ b/art/placeholders/gardener-body-skin-3.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-body-skin-4.svg b/art/placeholders/gardener-body-skin-4.svg new file mode 100644 index 0000000..70f5571 --- /dev/null +++ b/art/placeholders/gardener-body-skin-4.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-body-skin-5.svg b/art/placeholders/gardener-body-skin-5.svg new file mode 100644 index 0000000..b4a075e --- /dev/null +++ b/art/placeholders/gardener-body-skin-5.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-body-skin-6.svg b/art/placeholders/gardener-body-skin-6.svg new file mode 100644 index 0000000..97ec28a --- /dev/null +++ b/art/placeholders/gardener-body-skin-6.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-carry.svg b/art/placeholders/gardener-carry.svg index 91a665e..3019705 100644 --- a/art/placeholders/gardener-carry.svg +++ b/art/placeholders/gardener-carry.svg @@ -1,4 +1,4 @@ - + diff --git a/art/placeholders/gardener-clothes-boy-dusk.svg b/art/placeholders/gardener-clothes-boy-dusk.svg new file mode 100644 index 0000000..4d7b0b6 --- /dev/null +++ b/art/placeholders/gardener-clothes-boy-dusk.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-clothes-boy-honey.svg b/art/placeholders/gardener-clothes-boy-honey.svg new file mode 100644 index 0000000..3347dde --- /dev/null +++ b/art/placeholders/gardener-clothes-boy-honey.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-clothes-boy-plum.svg b/art/placeholders/gardener-clothes-boy-plum.svg new file mode 100644 index 0000000..c1ea95c --- /dev/null +++ b/art/placeholders/gardener-clothes-boy-plum.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-clothes-boy-rose.svg b/art/placeholders/gardener-clothes-boy-rose.svg new file mode 100644 index 0000000..5e8fb94 --- /dev/null +++ b/art/placeholders/gardener-clothes-boy-rose.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-clothes-boy-sage.svg b/art/placeholders/gardener-clothes-boy-sage.svg new file mode 100644 index 0000000..68289b5 --- /dev/null +++ b/art/placeholders/gardener-clothes-boy-sage.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-clothes-girl-dusk.svg b/art/placeholders/gardener-clothes-girl-dusk.svg new file mode 100644 index 0000000..df6b7c9 --- /dev/null +++ b/art/placeholders/gardener-clothes-girl-dusk.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-clothes-girl-honey.svg b/art/placeholders/gardener-clothes-girl-honey.svg new file mode 100644 index 0000000..4066832 --- /dev/null +++ b/art/placeholders/gardener-clothes-girl-honey.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-clothes-girl-plum.svg b/art/placeholders/gardener-clothes-girl-plum.svg new file mode 100644 index 0000000..6633bcc --- /dev/null +++ b/art/placeholders/gardener-clothes-girl-plum.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-clothes-girl-rose.svg b/art/placeholders/gardener-clothes-girl-rose.svg new file mode 100644 index 0000000..95204e3 --- /dev/null +++ b/art/placeholders/gardener-clothes-girl-rose.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-clothes-girl-sage.svg b/art/placeholders/gardener-clothes-girl-sage.svg new file mode 100644 index 0000000..d2c0f65 --- /dev/null +++ b/art/placeholders/gardener-clothes-girl-sage.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-bob-auburn.svg b/art/placeholders/gardener-hair-bob-auburn.svg new file mode 100644 index 0000000..f5f5b54 --- /dev/null +++ b/art/placeholders/gardener-hair-bob-auburn.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-bob-black.svg b/art/placeholders/gardener-hair-bob-black.svg new file mode 100644 index 0000000..8507b3d --- /dev/null +++ b/art/placeholders/gardener-hair-bob-black.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-bob-brown.svg b/art/placeholders/gardener-hair-bob-brown.svg new file mode 100644 index 0000000..6bf4879 --- /dev/null +++ b/art/placeholders/gardener-hair-bob-brown.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-bob-dark-brown.svg b/art/placeholders/gardener-hair-bob-dark-brown.svg new file mode 100644 index 0000000..deb05ab --- /dev/null +++ b/art/placeholders/gardener-hair-bob-dark-brown.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-bob-fair.svg b/art/placeholders/gardener-hair-bob-fair.svg new file mode 100644 index 0000000..8ab09d4 --- /dev/null +++ b/art/placeholders/gardener-hair-bob-fair.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-bob-red.svg b/art/placeholders/gardener-hair-bob-red.svg new file mode 100644 index 0000000..61a3461 --- /dev/null +++ b/art/placeholders/gardener-hair-bob-red.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-braids-auburn.svg b/art/placeholders/gardener-hair-braids-auburn.svg new file mode 100644 index 0000000..a4cd32e --- /dev/null +++ b/art/placeholders/gardener-hair-braids-auburn.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-braids-black.svg b/art/placeholders/gardener-hair-braids-black.svg new file mode 100644 index 0000000..663d1ee --- /dev/null +++ b/art/placeholders/gardener-hair-braids-black.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-braids-brown.svg b/art/placeholders/gardener-hair-braids-brown.svg new file mode 100644 index 0000000..99b4487 --- /dev/null +++ b/art/placeholders/gardener-hair-braids-brown.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-braids-dark-brown.svg b/art/placeholders/gardener-hair-braids-dark-brown.svg new file mode 100644 index 0000000..a449374 --- /dev/null +++ b/art/placeholders/gardener-hair-braids-dark-brown.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-braids-fair.svg b/art/placeholders/gardener-hair-braids-fair.svg new file mode 100644 index 0000000..5b4467d --- /dev/null +++ b/art/placeholders/gardener-hair-braids-fair.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-braids-red.svg b/art/placeholders/gardener-hair-braids-red.svg new file mode 100644 index 0000000..1421d67 --- /dev/null +++ b/art/placeholders/gardener-hair-braids-red.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-bun-auburn.svg b/art/placeholders/gardener-hair-bun-auburn.svg new file mode 100644 index 0000000..236743b --- /dev/null +++ b/art/placeholders/gardener-hair-bun-auburn.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-bun-black.svg b/art/placeholders/gardener-hair-bun-black.svg new file mode 100644 index 0000000..781d9cc --- /dev/null +++ b/art/placeholders/gardener-hair-bun-black.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-bun-brown.svg b/art/placeholders/gardener-hair-bun-brown.svg new file mode 100644 index 0000000..608b522 --- /dev/null +++ b/art/placeholders/gardener-hair-bun-brown.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-bun-dark-brown.svg b/art/placeholders/gardener-hair-bun-dark-brown.svg new file mode 100644 index 0000000..8391fe5 --- /dev/null +++ b/art/placeholders/gardener-hair-bun-dark-brown.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-bun-fair.svg b/art/placeholders/gardener-hair-bun-fair.svg new file mode 100644 index 0000000..98a7c37 --- /dev/null +++ b/art/placeholders/gardener-hair-bun-fair.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-bun-red.svg b/art/placeholders/gardener-hair-bun-red.svg new file mode 100644 index 0000000..b5603d4 --- /dev/null +++ b/art/placeholders/gardener-hair-bun-red.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-curly-auburn.svg b/art/placeholders/gardener-hair-curly-auburn.svg new file mode 100644 index 0000000..abfd368 --- /dev/null +++ b/art/placeholders/gardener-hair-curly-auburn.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-curly-black.svg b/art/placeholders/gardener-hair-curly-black.svg new file mode 100644 index 0000000..73a5de0 --- /dev/null +++ b/art/placeholders/gardener-hair-curly-black.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-curly-brown.svg b/art/placeholders/gardener-hair-curly-brown.svg new file mode 100644 index 0000000..704088e --- /dev/null +++ b/art/placeholders/gardener-hair-curly-brown.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-curly-dark-brown.svg b/art/placeholders/gardener-hair-curly-dark-brown.svg new file mode 100644 index 0000000..b385e86 --- /dev/null +++ b/art/placeholders/gardener-hair-curly-dark-brown.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-curly-fair.svg b/art/placeholders/gardener-hair-curly-fair.svg new file mode 100644 index 0000000..df47997 --- /dev/null +++ b/art/placeholders/gardener-hair-curly-fair.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-curly-red.svg b/art/placeholders/gardener-hair-curly-red.svg new file mode 100644 index 0000000..d0a39a2 --- /dev/null +++ b/art/placeholders/gardener-hair-curly-red.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-ponytail-auburn.svg b/art/placeholders/gardener-hair-ponytail-auburn.svg new file mode 100644 index 0000000..4766b20 --- /dev/null +++ b/art/placeholders/gardener-hair-ponytail-auburn.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-ponytail-black.svg b/art/placeholders/gardener-hair-ponytail-black.svg new file mode 100644 index 0000000..3e96d07 --- /dev/null +++ b/art/placeholders/gardener-hair-ponytail-black.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-ponytail-brown.svg b/art/placeholders/gardener-hair-ponytail-brown.svg new file mode 100644 index 0000000..f0aebdd --- /dev/null +++ b/art/placeholders/gardener-hair-ponytail-brown.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-ponytail-dark-brown.svg b/art/placeholders/gardener-hair-ponytail-dark-brown.svg new file mode 100644 index 0000000..d2792c3 --- /dev/null +++ b/art/placeholders/gardener-hair-ponytail-dark-brown.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-ponytail-fair.svg b/art/placeholders/gardener-hair-ponytail-fair.svg new file mode 100644 index 0000000..29a6a5f --- /dev/null +++ b/art/placeholders/gardener-hair-ponytail-fair.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-ponytail-red.svg b/art/placeholders/gardener-hair-ponytail-red.svg new file mode 100644 index 0000000..22b9a83 --- /dev/null +++ b/art/placeholders/gardener-hair-ponytail-red.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-short-auburn.svg b/art/placeholders/gardener-hair-short-auburn.svg new file mode 100644 index 0000000..fad70c1 --- /dev/null +++ b/art/placeholders/gardener-hair-short-auburn.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-short-black.svg b/art/placeholders/gardener-hair-short-black.svg new file mode 100644 index 0000000..3ca02fc --- /dev/null +++ b/art/placeholders/gardener-hair-short-black.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-short-brown.svg b/art/placeholders/gardener-hair-short-brown.svg new file mode 100644 index 0000000..8c8a74c --- /dev/null +++ b/art/placeholders/gardener-hair-short-brown.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-short-dark-brown.svg b/art/placeholders/gardener-hair-short-dark-brown.svg new file mode 100644 index 0000000..a291f76 --- /dev/null +++ b/art/placeholders/gardener-hair-short-dark-brown.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-short-fair.svg b/art/placeholders/gardener-hair-short-fair.svg new file mode 100644 index 0000000..8cf4fc8 --- /dev/null +++ b/art/placeholders/gardener-hair-short-fair.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hair-short-red.svg b/art/placeholders/gardener-hair-short-red.svg new file mode 100644 index 0000000..669211f --- /dev/null +++ b/art/placeholders/gardener-hair-short-red.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hat-cap.svg b/art/placeholders/gardener-hat-cap.svg new file mode 100644 index 0000000..ea36184 --- /dev/null +++ b/art/placeholders/gardener-hat-cap.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-hat-straw-hat.svg b/art/placeholders/gardener-hat-straw-hat.svg new file mode 100644 index 0000000..99a7bd5 --- /dev/null +++ b/art/placeholders/gardener-hat-straw-hat.svg @@ -0,0 +1,4 @@ + + + + diff --git a/art/placeholders/gardener-poses-sheet.svg b/art/placeholders/gardener-poses-sheet.svg index 66ba910..fdf3245 100644 --- a/art/placeholders/gardener-poses-sheet.svg +++ b/art/placeholders/gardener-poses-sheet.svg @@ -1,4 +1,4 @@ - + diff --git a/art/placeholders/gardener-pour.svg b/art/placeholders/gardener-pour.svg index 8c24246..6a44f33 100644 --- a/art/placeholders/gardener-pour.svg +++ b/art/placeholders/gardener-pour.svg @@ -1,4 +1,4 @@ - + diff --git a/art/placeholders/gardener-pull.svg b/art/placeholders/gardener-pull.svg index 666f590..d510f70 100644 --- a/art/placeholders/gardener-pull.svg +++ b/art/placeholders/gardener-pull.svg @@ -1,4 +1,4 @@ - + diff --git a/art/placeholders/gardener-reach.svg b/art/placeholders/gardener-reach.svg index b68508b..2010d5b 100644 --- a/art/placeholders/gardener-reach.svg +++ b/art/placeholders/gardener-reach.svg @@ -1,4 +1,4 @@ - + diff --git a/art/placeholders/gardener-sheet.svg b/art/placeholders/gardener-sheet.svg index c910949..9189017 100644 --- a/art/placeholders/gardener-sheet.svg +++ b/art/placeholders/gardener-sheet.svg @@ -1,4 +1,4 @@ - + diff --git a/art/placeholders/gardener-sit.svg b/art/placeholders/gardener-sit.svg index e553fc8..28d9608 100644 --- a/art/placeholders/gardener-sit.svg +++ b/art/placeholders/gardener-sit.svg @@ -1,4 +1,4 @@ - + diff --git a/art/placeholders/gardener-stand.svg b/art/placeholders/gardener-stand.svg index 94db29c..88314a9 100644 --- a/art/placeholders/gardener-stand.svg +++ b/art/placeholders/gardener-stand.svg @@ -1,4 +1,4 @@ - + diff --git a/art/placeholders/gardener-sweep.svg b/art/placeholders/gardener-sweep.svg index 873b8ee..a6d5663 100644 --- a/art/placeholders/gardener-sweep.svg +++ b/art/placeholders/gardener-sweep.svg @@ -1,4 +1,4 @@ - + diff --git a/art/placeholders/gardener-walk.svg b/art/placeholders/gardener-walk.svg index 5c64d37..f9160db 100644 --- a/art/placeholders/gardener-walk.svg +++ b/art/placeholders/gardener-walk.svg @@ -1,4 +1,4 @@ - + diff --git a/tools/art-prep/board/index.html b/tools/art-prep/board/index.html index f2c0644..8360f4e 100644 --- a/tools/art-prep/board/index.html +++ b/tools/art-prep/board/index.html @@ -275,7 +275,11 @@ { type: 'layer', title: 'Scenes', note: 'The garden at four times of day, the planets (drafts until each planet is designed), and the frame for a shared sky. The sky stays transparent: the app draws the real sky, sun and stars behind it.' }, { type: 'sprite', title: 'Single pictures', note: 'One thing on a transparent background, placed into a scene in the app.' }, { type: 'icon', title: 'Icons', note: 'The home-screen icon, its version for phones that crop it to a shape, and the tiny mark for browser tabs. Keep the important part in the middle; phones cut the corners.' }, + { type: 'spritesheet', key: 'layers', layers: true, title: 'Gardener layers', note: 'The gardener the player dresses is stacked from these, back to front: body (skin), clothes, apron and boots, hair, hat. Make the guide (gardener-poses-sheet, in Sprite sheets) first and accept it. Then each layer: attach the guide and gardener-sheet, and paint only the part the card names over the guide, whole sheet at once, so the parts line up. The first looks come first: once their seven are in, the girl and the boy can be judged stacked.' }, ]; + for (const g of GROUPS) if (!g.key) g.key = g.type; + /** A layer belongs to Gardener layers only; every other card to the group of its type. */ + const inGroup = (g, a) => a.type === g.type && Boolean(g.layers) === Boolean(a.over); const FILTERS = [['all', 'All'], ['todo', 'To make'], ['uploaded', 'To review'], ['retry', 'Another try'], ['accepted', 'Accepted']]; const STATUS_TEXT = { todo: 'To make', uploaded: 'To review', retry: 'Another try', accepted: 'Accepted' }; const EMPTY_TEXT = 'Drop, paste or choose your picture'; @@ -362,10 +366,10 @@ function applyFilter() { for (const g of GROUPS) { - const sec = document.getElementById('group-' + g.type); + const sec = document.getElementById('group-' + g.key); if (!sec) continue; let shown = 0; - for (const a of data.assets.filter((x) => x.type === g.type)) { + for (const a of data.assets.filter((x) => inGroup(g, x))) { const show = filter === 'all' || cardStatus(a) === filter; cards[a.id].el.hidden = !show; if (show) shown++; @@ -407,10 +411,15 @@ refs.mine.append(refs.overlay); refs.yields = h('ol', { class: 'yields', 'aria-label': `The ${a.cells.filter(Boolean).length} pictures this sheet makes, in reading order` }, a.cells.map((c, i) => (c ? h('li', {}, h('b', { text: String(i + 1) }), c.id) : h('li', {}, h('b', { text: String(i + 1) }), '(empty)')))); - refs.oneSummary = h('summary', { text: 'One at a time' }); - refs.one = h('details', { class: 'cells-one' }, refs.oneSummary, - h('p', { class: 'muted', text: 'When the whole sheet will not keep to its grid, make each picture on its own: copy its prompt, attach the same reference picture, and upload what it made into its slot. Each is accepted on its own; the sheet is done when all its pictures are in.' }), - h('div', { class: 'cellgrid' }, a.cells.map((c, i) => (c ? buildCell(a, c, i) : null)))); + if (a.over) { + // A layer is painted over its guide, whole: one picture at a time would not line up (STYLE.md §3b). + refs.one = h('p', { class: 'muted', text: `A layer: attach ${a.over} as the guide and paint only this part over it, the whole sheet at once. Its pictures are never made one at a time, or the parts would not line up.` }); + } else { + refs.oneSummary = h('summary', { text: 'One at a time' }); + refs.one = h('details', { class: 'cells-one' }, refs.oneSummary, + h('p', { class: 'muted', text: 'When the whole sheet will not keep to its grid, make each picture on its own: copy its prompt, attach the same reference picture, and upload what it made into its slot. Each is accepted on its own; the sheet is done when all its pictures are in.' }), + h('div', { class: 'cellgrid' }, a.cells.map((c, i) => (c ? buildCell(a, c, i) : null)))); + } } refs.auto = h('ul', { class: 'auto', 'aria-label': 'Automatic checks' }); refs.small = h('div', { class: 'small', hidden: true }); @@ -573,7 +582,7 @@ const shown = cardStatus(a); el.dataset.status = shown; refs.pill.className = 'pill ' + shown; refs.pill.textContent = STATUS_TEXT[shown]; - if (refs.one) { + if (refs.oneSummary) { for (const c of cellsIn(a)) updateCell(c.id); const done = picturesDone(a); const waiting = cellsIn(a).filter((c) => statusOf(c.id) === 'uploaded').length; @@ -686,10 +695,10 @@ function renderAll() { const main = $('#groups'); main.replaceChildren(...GROUPS.map((g) => { - const list = data.assets.filter((a) => a.type === g.type); + const list = data.assets.filter((a) => inGroup(g, a)); if (!list.length) return null; - return h('section', { class: 'group', id: 'group-' + g.type, 'aria-labelledby': 'gh-' + g.type }, - h('h2', { id: 'gh-' + g.type, text: `${g.title} · ${list.length}` }), + return h('section', { class: 'group', id: 'group-' + g.key, 'aria-labelledby': 'gh-' + g.key }, + h('h2', { id: 'gh-' + g.key, text: `${g.title} · ${list.length}` }), h('p', { class: 'muted', text: g.note }), h('div', { class: 'grid' }, list.map(buildCard))); }).filter(Boolean)); @@ -718,7 +727,7 @@ const r = rows[id]; items.push({ id, target, prompt, width: w, height: hgt, background: bg, attach: attach || [], note: statusOf(id) === 'retry' && r && r.note ? r.note : '' }); }; - for (const g of GROUPS) for (const a of data.assets.filter((x) => x.type === g.type)) { + for (const g of GROUPS) for (const a of data.assets.filter((x) => inGroup(g, x))) { if (a.type !== 'spritesheet') { if (want(statusOf(a.id))) item(a.id, a, a.prompt, a.width, a.height, a.background, a.attach); continue; } if (cardStatus(a) === 'accepted') continue; const cells = cellsIn(a); diff --git a/tools/art-prep/src/accept.ts b/tools/art-prep/src/accept.ts index 9400ecd..5a6beb8 100644 --- a/tools/art-prep/src/accept.ts +++ b/tools/art-prep/src/accept.ts @@ -96,9 +96,53 @@ async function rgba(input: Buffer): Promise<{ px: Buffer; width: number; height: return { px: data, width: info.width, height: info.height }; } -export async function acceptPicture(input: Buffer, id: string, m: Manifest): Promise { +/** Where a cell's drawing lies, as shares of the cell (0–1), or null when nothing is drawn. */ +interface Extent { + readonly x0: number; + readonly y0: number; + readonly x1: number; + readonly y1: number; +} + +function extent(px: Buffer, width: number, x0: number, y0: number, x1: number, y1: number): Extent | null { + let lx = Infinity, ly = Infinity, hx = -Infinity, hy = -Infinity; + for (let y = y0; y < y1; y++) { + for (let x = x0; x < x1; x++) { + if ((px[(y * width + x) * 4 + 3] ?? 0) < ALPHA) continue; + lx = Math.min(lx, x); hx = Math.max(hx, x); ly = Math.min(ly, y); hy = Math.max(hy, y); + } + } + if (lx === Infinity) return null; + const w = x1 - x0, h = y1 - y0; + return { x0: (lx - x0) / w, y0: (ly - y0) / h, x1: (hx + 1 - x0) / w, y1: (hy + 1 - y0) / h }; +} + +/** + * How far a layer may reach past its guide's figure, as a share of the cell: hair and a hat may + * be a little fuller than the guide's braids and straw hat, never somewhere else. + */ +export const REGISTER = 0.08; + +/** The guide's cells, as accepted into art/final/: cell id → its WebP. */ +export type Guide = ReadonlyMap; + +async function guideExtent(guide: Guide, cell: string): Promise { + const file = guide.get(cell); + if (!file) return null; + const { px, width, height } = await rgba(file); + return extent(px, width, 0, 0, width, height); +} + +export async function acceptPicture(input: Buffer, id: string, m: Manifest, guide?: Guide): Promise { const target = findTarget(m, id); const a = target.asset; + if (a.over && target.cell) { + throw new Refused(`${id}: a layer is painted whole over its guide (${a.over}), never one picture at a time; the parts would not line up. Accept ${a.id} whole.`); + } + const guideCells = a.over && a.grid ? (m.assets.find((g) => g.id === a.over)?.cells ?? []) : []; + if (a.over && guideCells.some((c) => !guide?.has(c.id))) { + throw new Refused(`${id}: its guide ${a.over} is not in art/final/ yet. Accept the guide first: every layer is checked against it.`); + } const notes: string[] = []; const { px, width, height } = await rgba(input).catch((e: unknown) => { throw new Refused(`${id}: the file could not be read as a picture (${String(e)})`); @@ -137,6 +181,18 @@ export async function acceptPicture(input: Buffer, id: string, m: Manifest): Pro }); if (empty.length) throw new Refused(`${id}: nothing drawn in ${empty.join(', ')}. The whole sheet is refused.`); if (painted.length) throw new Refused(`${id}: painted on a background in ${painted.join(', ')}. The whole sheet is refused.`); + if (a.over && guide) { + // In register: each picture's part lies on the guide's figure in the same cell (STYLE.md §3b). + const off: string[] = []; + for (const [i, r] of regions.entries()) { + const mine = extent(px, width, r.left, r.top, r.left + r.width, r.top + r.height); + const under = await guideExtent(guide, guideCells[i]?.id ?? ''); + if (!mine || !under) continue; + const out = Math.max(under.x0 - mine.x0, under.y0 - mine.y0, mine.x1 - under.x1, mine.y1 - under.y1); + if (out > REGISTER) off.push(`${r.id} (${Math.round(out * 100)} % of the cell outside the guide's figure)`); + } + if (off.length) throw new Refused(`${id}: not in register with ${a.over} in ${off.join(', ')}. Paint it over the guide again; the whole sheet is refused.`); + } const files: FinalFile[] = []; for (const r of regions) { const out = await encode(fitCell(sharp(input).extract({ left: r.left, top: r.top, width: r.width, height: r.height })), BUDGET.cell, r.id); diff --git a/tools/art-prep/src/board.ts b/tools/art-prep/src/board.ts index 2cb76d0..e038dba 100644 --- a/tools/art-prep/src/board.ts +++ b/tools/art-prep/src/board.ts @@ -3,7 +3,7 @@ * art/STYLE.md (docs/ART.md §3). `pnpm art:board` writes it next to the board page and * refreshes art/placeholders/; Claude publishes the folder as the art board artifact. */ -import { checkManifest, type Asset, type Background, type Manifest } from './manifest.js'; +import { checkManifest, expandLayers, type Asset, type Background, type Manifest } from './manifest.js'; import { attachments, cellPromptFor, cellSize, promptFor } from './prompt.js'; import { reviewPoints, stylePrompt } from './style.js'; @@ -31,6 +31,8 @@ export interface BoardAsset { readonly prompt: string; readonly grid?: { readonly cols: number; readonly rows: number }; readonly cells?: readonly BoardCell[]; + /** A layer: the guide it is painted over. Made whole, never one picture at a time (STYLE.md §3b). */ + readonly over?: string; } export interface BoardData { @@ -40,11 +42,12 @@ export interface BoardData { } /** The board's data, or the manifest's problems. Nothing half-checked reaches the board. */ -export function boardData(m: Manifest, styleMarkdown: string): BoardData { +export function boardData(raw: Manifest, styleMarkdown: string): BoardData { const style = stylePrompt(styleMarkdown); const checklist = reviewPoints(styleMarkdown); - const problems = checkManifest(m, checklist.length); + const problems = checkManifest(raw, checklist.length); if (problems.length > 0) throw new Error(`art/manifest.json:\n ${problems.join('\n ')}`); + const m = expandLayers(raw); const assets = m.assets.map((a): BoardAsset => { const base = { @@ -57,9 +60,11 @@ export function boardData(m: Manifest, styleMarkdown: string): BoardData { return { ...base, grid: a.grid, + // A layer's pictures have no prompts of their own: made one at a time, they would not line up. cells: (a.cells ?? []).map((c) => ({ - id: c.id, type: 'pose', width, height, background: a.background, prompt: cellPromptFor(a, c, m, style) - })) + id: c.id, type: 'pose', width, height, background: a.background, prompt: a.over ? '' : cellPromptFor(a, c, m, style) + })), + ...(a.over ? { over: a.over } : {}) }; }); return { generatedFrom: 'art/manifest.json, art/STYLE.md §1 and §7', checklist, assets }; diff --git a/tools/art-prep/src/cli-accept.ts b/tools/art-prep/src/cli-accept.ts index 8f320f7..551ed8e 100644 --- a/tools/art-prep/src/cli-accept.ts +++ b/tools/art-prep/src/cli-accept.ts @@ -1,13 +1,14 @@ /** * `pnpm art:accept ` — moves a picture Mark accepted on the art board into * art/final/ as WebP (docs/ART.md §3, step 6). For a sprite sheet, `` is the sheet - * and every cell is written; for one cell made on its own, `` is the cell. + * and every cell is written; for one cell made on its own, `` is the cell. A layer + * (STYLE.md §3b) is checked against its guide's cells, which must already be in art/final/. */ -import { mkdirSync, readFileSync, writeFileSync } from 'node:fs'; +import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'; import { join, relative } from 'node:path'; import { fileURLToPath } from 'node:url'; -import { Refused, acceptPicture } from './accept.js'; -import type { Manifest } from './manifest.js'; +import { Refused, acceptPicture, findTarget } from './accept.js'; +import { expandLayers, type Manifest } from './manifest.js'; const root = fileURLToPath(new URL('../../../', import.meta.url)); const [id, file] = process.argv.slice(2); @@ -16,10 +17,16 @@ if (!id || !file) { process.exit(2); } -const manifest = JSON.parse(readFileSync(join(root, 'art/manifest.json'), 'utf8')) as Manifest; +const manifest = expandLayers(JSON.parse(readFileSync(join(root, 'art/manifest.json'), 'utf8')) as Manifest); +const dir = join(root, 'art/final'); try { - const { files, notes } = await acceptPicture(readFileSync(file), id, manifest); - const dir = join(root, 'art/final'); + const over = findTarget(manifest, id).asset.over; + const guide = new Map(); + for (const c of manifest.assets.find((a) => a.id === over)?.cells ?? []) { + const path = join(dir, `${c.id}.webp`); + if (existsSync(path)) guide.set(c.id, readFileSync(path)); + } + const { files, notes } = await acceptPicture(readFileSync(file), id, manifest, over ? guide : undefined); mkdirSync(dir, { recursive: true }); for (const f of files) { const path = join(dir, `${f.id}.webp`); diff --git a/tools/art-prep/src/manifest.ts b/tools/art-prep/src/manifest.ts index c3f8634..f150e5d 100644 --- a/tools/art-prep/src/manifest.ts +++ b/tools/art-prep/src/manifest.ts @@ -40,6 +40,42 @@ export interface Asset { readonly allow?: readonly string[]; /** Indices into STYLE.md §7, the review points shown on its card. */ readonly checks: readonly number[]; + /** + * A layer of a layered character: the sprite sheet it is painted over, in register (STYLE.md §3b). + * Its grid and cells are the guide's; it is made whole over the guide, never one picture at a time. + */ + readonly over?: string; + /** For a layer: which part it is, and its place in the stack (0 at the back). */ + readonly part?: { readonly name: string; readonly stack: number }; +} + +/** One part of a layered character: one layer sheet for each combination of its axes' values. */ +export interface LayerPart { + readonly part: string; + /** The choices (gardener.schema.json fields) this part is painted for, in id order. */ + readonly axes: readonly string[]; + /** Values that need no picture (no hat). */ + readonly skip?: readonly string[]; + /** The subject, with {axis} replaced by the words for each value. */ + readonly subject: string; +} + +/** A character drawn as stacked layers, all painted over one guide (STYLE.md §3b). */ +export interface Layered { + readonly character: string; + /** The guide: a sprite sheet of the whole first look in every pose, never shipped. */ + readonly over: string; + readonly phase: number; + /** The words each value stands for in a prompt, per axis. */ + readonly words: Readonly>>>; + /** The first looks: their layers come first, so a whole first look can be judged early. */ + readonly first: readonly Readonly>[]; + /** Back to front. */ + readonly parts: readonly LayerPart[]; + readonly include: readonly string[]; + readonly avoid: readonly string[]; + readonly allow?: readonly string[]; + readonly checks: readonly number[]; } export interface Character { @@ -52,6 +88,58 @@ export interface Manifest { /** What no picture may show, appended to every prompt (STYLE.md §4). */ readonly avoid: readonly string[]; readonly assets: readonly Asset[]; + /** Characters drawn as layers; expandLayers writes each out as ordinary sprite sheets. */ + readonly layers?: readonly Layered[]; +} + +/** Every combination of the axes' values, in the order the words list them. */ +function combinations(l: Layered, part: LayerPart): Record[] { + let out: Record[] = [{}]; + for (const axis of part.axes) { + const values = Object.keys(l.words[axis] ?? {}).filter((v) => !(part.skip ?? []).includes(v)); + out = out.flatMap((c) => values.map((v) => ({ ...c, [axis]: v }))); + } + return out; +} + +/** The id of a layer sheet: the character, the part, then each value (gardener-hair-braids-brown). */ +export const layerId = (character: string, part: string, values: readonly string[]): string => [character, part, ...values].join('-'); + +/** + * The manifest with every layered character written out as ordinary sprite sheets, placed right + * after their guide: the first looks' layers first, then the rest. Expanding twice changes nothing. + */ +export function expandLayers(m: Manifest): Manifest { + if (!m.layers) return m; + const assets = [...m.assets]; + for (const l of m.layers) { + const guide = assets.find((a) => a.id === l.over); + if (!guide) continue; // checkManifest names it + const firsts: Asset[] = [], rest: Asset[] = []; + l.parts.forEach((part, stack) => { + for (const values of combinations(l, part)) { + const id = layerId(l.character, part.part, part.axes.map((a) => values[a] ?? '')); + const subject = part.subject.replace(/\{(\w+)\}/g, (whole, axis: string) => l.words[axis]?.[values[axis] ?? ''] ?? whole); + const isFirst = l.first.some((f) => part.axes.every((a) => f[a] === values[a])); + const pose = (cell: string): string => cell.replace(`${l.character}-`, ''); + const asset: Asset = { + id, type: 'spritesheet', phase: l.phase, width: guide.width, height: guide.height, background: 'transparent', + shipped: true, smallest: guide.smallest, character: l.character, + usedBy: [`The ${l.character}'s ${part.part}, layer ${stack + 1} of ${l.parts.length} from the back, stacked with the others in the scene (STYLE.md §3b).`], + purpose: `One layer of the ${l.character} (${part.part}${part.axes.length ? `: ${part.axes.map((a) => values[a]).join(', ')}` : ''}), in every pose of ${l.over}.`, + subject, angle: guide.angle ?? '', grid: guide.grid ?? { cols: 1, rows: 1 }, + cells: (guide.cells ?? []).map((c) => ({ id: `${id}-${pose(c.id)}`, does: c.does })), + include: l.include, avoid: l.avoid, checks: l.checks, over: l.over, + part: { name: part.part, stack }, + ...(l.allow ? { allow: l.allow } : {}) + }; + (isFirst ? firsts : rest).push(asset); + } + }); + assets.splice(assets.indexOf(guide) + 1, 0, ...firsts, ...rest); + } + const { layers: _expanded, ...plain } = m; + return { ...plain, assets }; } /** The canvases image generators offer (STYLE.md §5). Anything else gets resized by the tool, unasked. */ @@ -77,8 +165,25 @@ function textsOf(a: Asset): string[] { * Problems with the manifest, each naming the asset. An empty list is a pass. * `checklistLength` is the number of review points in STYLE.md §7. */ -export function checkManifest(m: Manifest, checklistLength: number): string[] { +export function checkManifest(raw: Manifest, checklistLength: number): string[] { const problems: string[] = []; + for (const l of raw.layers ?? []) { + const where = `layers of ${l.character}`; + const guide = raw.assets.find((a) => a.id === l.over); + if (!guide) problems.push(`${where}: the guide "${l.over}" is not in the manifest`); + else if (guide.type !== 'spritesheet') problems.push(`${where}: the guide "${l.over}" is a ${guide.type}, not a sprite sheet`); + else if (guide.shipped) problems.push(`${where}: the guide "${l.over}" is shipped; the app stacks the layers, so the guide never appears`); + for (const part of l.parts) { + for (const axis of part.axes) if (!l.words[axis]) problems.push(`${where}: part ${part.part} needs words for "${axis}"`); + for (const [, axis = ''] of part.subject.matchAll(/\{(\w+)\}/g)) { + if (!part.axes.includes(axis)) problems.push(`${where}: part ${part.part} says {${axis}} but is not painted per ${axis}`); + } + } + for (const text of [...Object.values(l.words).flatMap((w) => Object.values(w)), ...l.parts.map((p) => p.subject)]) { + for (const hit of findForbidden(text)) problems.push(`${where}: "${hit.term}" (${hit.category}) may not appear in a prompt`); + } + } + const m = expandLayers(raw); const seen = new Set(); const claim = (id: string, where: string): void => { if (!ID.test(id)) problems.push(`${where}: id "${id}" must be lower-case words joined by hyphens`); diff --git a/tools/art-prep/src/placeholders.ts b/tools/art-prep/src/placeholders.ts index 72b672f..b72c957 100644 --- a/tools/art-prep/src/placeholders.ts +++ b/tools/art-prep/src/placeholders.ts @@ -3,7 +3,7 @@ * layout until a real picture is accepted. They are deliberately simple. A stand-in that * looked finished would hide that the real picture is still missing. */ -import type { Asset, Manifest } from './manifest.js'; +import { expandLayers, type Asset, type Manifest } from './manifest.js'; import { cellBoxes, cellSize } from './prompt.js'; const C = { @@ -334,28 +334,103 @@ function planet(W: number, H: number, id: string): string { type Pose = 'stand' | 'walk' | 'pour' | 'pull' | 'sweep' | 'carry' | 'reach' | 'sit'; -/** The gardener's stand-in in a 120 × 200 box, feet on the bottom edge, facing right (STYLE.md §3b). */ -function gardener(pose: Pose, boy = false): string { - const skin = '#cf9a72', hair = '#7a4b2e', cloth = C.leaf, apron = '#efe4d2'; +/** A gardener's look for a stand-in: the player's choices (gardener.schema.json), as colours and shapes. */ +interface StandLook { + readonly boy: boolean; + readonly skin: string; + readonly hair: string; + readonly hairColour: string; + readonly clothes: string; + readonly hat: string; +} + +/** The first look, the girl (STYLE.md §3b), in the colours the app's code drawing uses. */ +const FIRST: StandLook = { boy: false, skin: '#cf9a72', hair: 'braids', hairColour: '#7a4b2e', clothes: C.leaf, hat: 'straw-hat' }; +const APRON = '#efe4d2'; +/** The boy's first look: short hair, the same colours. */ +const BOY: StandLook = { ...FIRST, boy: true, hair: 'short' }; + +/** The parts a layered gardener is stacked from, back to front (STYLE.md §3b). */ +type Part = 'body' | 'clothes' | 'apron' | 'hair' | 'hat'; + +/** Hair in each style, in one colour; drawn round a head at (61, 66), r 20. */ +function hairOf(style: string, c: string): string { + const cap = ``; + const strand = (d: string, w = 7): string => ``; + switch (style) { + case 'curly': return [44, 52, 61, 70, 78].map((x, i) => ``).join(''); + case 'ponytail': return `${cap}${strand('M42 58 q -14 8 -10 30', 9)}`; + case 'braids': return `${cap}${strand('M44 58 v 30')}${strand('M78 58 v 30')}`; + case 'bob': return `${cap}${strand('M42 56 v 22', 9)}${strand('M80 56 v 22', 9)}`; + case 'bun': return `${cap}`; + default: return cap; + } +} + +/** + * The gardener's stand-in in a 120 × 200 box, feet on the bottom edge, facing right (STYLE.md §3b). + * With `only`, just that part, in the same place, so the parts' stand-ins stack into the whole figure. + */ +function gardener(pose: Pose, look: StandLook = FIRST, only?: Part): string { + const draw = (part: Part, svg: string): string => (only === undefined || only === part ? svg : ''); + const { skin, clothes: cloth, boy } = look; const lean = { stand: 0, walk: 4, pour: 10, pull: 28, sweep: 18, carry: 6, reach: 14, sit: 0 }[pose]; const arm = { stand: 8, walk: -12, pour: -70, pull: -150, sweep: -40, carry: -80, reach: -95, sit: -30 }[pose]; - const legs = pose === 'sit' - ? `` - : ``; - const body = boy + const legs = (colour: string, width: number): string => pose === 'sit' + ? `` + : ``; + const shirt = boy ? `` : ``; - const held = pose === 'pour' ? `` - : pose === 'carry' ? Array.from({ length: 4 }, (_, i) => ``).join('') : ''; - const braids = boy ? '' : ``; - return `${legs} - ${body} - - ${held} - ${braids} - - - `; + const hat = look.hat === 'cap' + ? `` + : look.hat === 'straw-hat' ? `` : ''; + return draw('body', legs(skin, 10)) + draw('clothes', boy ? legs(cloth, 14) : '') + + draw('apron', ``) + + `` + + draw('body', ` + + + `) + + draw('clothes', shirt) + + draw('apron', ``) + + draw('hair', hairOf(look.hair, look.hairColour)) + + draw('hat', hat) + + ''; +} + +/** The first colour code in a prompt's words (the manifest names each colour once, for prompts and stand-ins). */ +const hexIn = (words: string | undefined, fallback: string): string => /#[0-9A-Fa-f]{6}/.exec(words ?? '')?.[0].toLowerCase() ?? fallback; + +/** A layer sheet's stand-in look: the first look, changed by the values in its id. */ +function layerLook(a: Asset, m: Manifest): StandLook { + const l = m.layers?.find((x) => x.over === a.over); + const words = l?.words ?? {}; + const has = (axis: string): string | undefined => Object.keys(words[axis] ?? {}).find((v) => a.id.includes(`-${v}`)); + const presentation = has('presentation'); + const hair = ['curly', 'ponytail', 'braids', 'bob', 'bun', 'short'].find((s) => a.id.startsWith(`${a.character ?? ''}-hair-${s}-`)); + return { + boy: presentation === 'boy', + skin: hexIn(words['skin']?.[has('skin') ?? ''], FIRST.skin), + hair: hair ?? FIRST.hair, + hairColour: hexIn(words['hairColour']?.[a.id.slice(`${a.character ?? ''}-hair-${hair ?? ''}-`.length)], FIRST.hairColour), + clothes: hexIn(words['clothes']?.[has('clothes') ?? ''], FIRST.clothes), + hat: a.id.endsWith('-cap') ? 'cap' : 'straw-hat' + }; +} + +/** A layer sheet's stand-in: only its part, in every pose of the guide, where the guide has it. */ +function layerSheet(a: Asset, m: Manifest): string { + const g = a.grid ?? { cols: 1, rows: 1 }; + const look = layerLook(a, m); + const part = (a.part?.name ?? 'body') as Part; + return cellBoxes(a.width, a.height, g.cols, g.rows) + .map((b, i) => { + const pose = (a.cells?.[i]?.id ?? '').split('-').at(-1) as Pose; + const w = b.x1 - b.x0, h = b.y1 - b.y0; + return `${fit(gardener(pose, look, part), 120, 200, w, h)}`; + }) + .join(''); } const GARDENER_POSES: Record = { @@ -404,7 +479,7 @@ function single(a: Asset): string { if (a.character === 'gardener') { // The girl along the top, the boy along the bottom; the side and back views are flipped stand-ins. const row = (boy: boolean, y: number): string => - [0, 1, 2, 3].map((i) => `${gardener('stand', boy)}`).join(''); + [0, 1, 2, 3].map((i) => `${gardener('stand', boy ? BOY : FIRST)}`).join(''); return `${row(false, 40)}${row(true, 560)}`; } if (a.character === 'fox') { @@ -497,10 +572,17 @@ const wrap = (id: string, W: number, H: number, body: string): string => ` \n` + ` ${body.replace(/\s*\n\s*/g, ' ')}\n\n`; -/** Every stand-in the board and the app may show: one per asset and one per sprite-sheet cell. */ -export function placeholders(m: Manifest): Map { +/** + * Every stand-in the board and the app may show: one per asset and one per sprite-sheet cell. A + * layer (STYLE.md §3b) has one for its sheet only: its pictures are never made or shown alone. + */ +export function placeholders(raw: Manifest): Map { const out = new Map(); - for (const a of m.assets) { + for (const a of expandLayers(raw).assets) { + if (a.over) { + out.set(a.id, wrap(a.id, a.width, a.height, layerSheet(a, raw))); + continue; + } out.set(a.id, wrap(a.id, a.width, a.height, single(a))); if (a.type === 'spritesheet') { const { width, height } = cellSize(a); diff --git a/tools/art-prep/src/prompt.ts b/tools/art-prep/src/prompt.ts index 5938b00..6097423 100644 --- a/tools/art-prep/src/prompt.ts +++ b/tools/art-prep/src/prompt.ts @@ -87,7 +87,8 @@ function characterOf(a: Asset, m: Manifest): { name: string; sheet: string; desc /** The reference pictures to attach when making `a`. */ export function attachments(a: Asset, m: Manifest): string[] { const c = characterOf(a, m); - return c && c.sheet !== a.id ? [c.sheet] : []; + const sheet = c && c.sheet !== a.id ? [c.sheet] : []; + return a.over ? [...sheet, a.over] : sheet; } /** "Reference: …", for a picture of a character made after its sheet. */ @@ -125,7 +126,34 @@ export function promptFor(a: Asset, m: Manifest, style: string): string { return lines.join('\n'); } +/** + * One layer of a layered character (STYLE.md §3b): only its part, painted over the guide in + * register, so the app can stack the layers into any look the player chose. + */ +function layerPrompt(a: Asset, m: Manifest, style: string): string { + const g = a.grid ?? { cols: 1, rows: 1 }; + const cells = a.cells ?? []; + const c = characterOf(a, m); + return [ + style, + '', + `Make: one layer of a layered sprite sheet: only one part of the ${c?.name ?? 'figure'}, in ${cells.length} poses, painted over a guide in exact register so the parts can be stacked into one figure.`, + ...referenceLines(a, m), + `Guide: attach the image ${a.over ?? ''} and paint over it. Keep its canvas and its grid. In every picture, paint only the part named below, exactly where it sits on the guide's figure, at exactly the same size, pose and position; then leave out the guide itself, so that everything except this part is fully transparent.`, + `Part: ${a.subject ?? ''}`, + `Drawn alike: ${a.angle ?? ''}`, + `Layout: the guide's ${g.cols} × ${g.rows} cells, read left to right, top row first; nothing moved, nothing scaled.`, + `Canvas: ${a.width} × ${a.height} px, transparent everywhere except the part; no ground and no cast shadows.`, + 'The poses under the part, as in the guide:', + ...cells.map((cell, i) => `${i + 1}. ${cell.does}`), + `Include: ${list(a.include)}`, + `Avoid: ${list([...a.avoid, ...SHEET_AVOID, ...shared(a, m)])}`, + board(a.id) + ].join('\n'); +} + function sheetPrompt(a: Asset, m: Manifest, style: string): string { + if (a.over) return layerPrompt(a, m, style); const g = a.grid ?? { cols: 1, rows: 1 }; const cells = a.cells ?? []; const many = (n: number, word: string): string => `${n} ${word}${n === 1 ? '' : 's'}`; diff --git a/tools/art-prep/test/board.test.ts b/tools/art-prep/test/board.test.ts index 8e2ba9e..1abc6f4 100644 --- a/tools/art-prep/test/board.test.ts +++ b/tools/art-prep/test/board.test.ts @@ -1,6 +1,7 @@ import { readFileSync, readdirSync } from 'node:fs'; import { describe, expect, it } from 'vitest'; import { boardData } from '../src/board.js'; +import { expandLayers } from '../src/manifest.js'; import { placeholders } from '../src/placeholders.js'; import { clone, readManifest, readStyle, root } from './fixtures.js'; @@ -19,7 +20,7 @@ describe('the board data', () => { for (const c of a.cells ?? []) expect(c).toMatchObject({ id: expect.any(String), width: expect.any(Number), height: expect.any(Number), prompt: expect.any(String) }); } } - expect(data.checklist).toHaveLength(12); + expect(data.checklist).toHaveLength(13); expect(data.assets.every((a) => Number.isInteger(a.phase))).toBe(true); }); @@ -44,10 +45,12 @@ describe('the board data', () => { }); describe('the stand-ins', () => { - it('one for every picture and every cell, at its own size', () => { - const ids = manifest.assets.flatMap((a) => [a.id, ...(a.cells ?? []).map((c) => c.id)]); + it('one for every picture and every cell, at its own size; a layer has one for its sheet only', () => { + const all = expandLayers(manifest).assets; + const ids = all.flatMap((a) => (a.over ? [a.id] : [a.id, ...(a.cells ?? []).map((c) => c.id)])); expect([...stand.keys()].sort()).toEqual([...ids].sort()); - for (const a of manifest.assets) expect(stand.get(a.id)).toContain(`viewBox="0 0 ${a.width} ${a.height}"`); + expect(stand.has('gardener-hair-braids-brown-pour')).toBe(false); + for (const a of all) expect(stand.get(a.id)).toContain(`viewBox="0 0 ${a.width} ${a.height}"`); expect(stand.get('rose-bud')).toContain('viewBox="0 0 384 1024"'); expect(stand.get('watering-can')).toContain('viewBox="0 0 512 512"'); }); diff --git a/tools/art-prep/test/layers.test.ts b/tools/art-prep/test/layers.test.ts new file mode 100644 index 0000000..5c8cd5d --- /dev/null +++ b/tools/art-prep/test/layers.test.ts @@ -0,0 +1,175 @@ +import { readFileSync } from 'node:fs'; +import { GARDENER_OPTIONS } from '@rosea/schema'; +import sharp from 'sharp'; +import { describe, expect, it } from 'vitest'; +import { Refused, acceptPicture, type Guide } from '../src/accept.js'; +import { boardData } from '../src/board.js'; +import { checkManifest, expandLayers, layerId, type Layered, type Manifest } from '../src/manifest.js'; +import { placeholders } from '../src/placeholders.js'; +import { reviewPoints } from '../src/style.js'; +import { clone, readManifest, readStyle, root } from './fixtures.js'; + +const raw = readManifest(); +const m = expandLayers(raw); +const POINTS = reviewPoints(readStyle()).length; +const layers = m.assets.filter((a) => a.over === 'gardener-poses-sheet'); +const ids = new Set(layers.map((a) => a.id)); + +describe('the gardener in layered parts (STYLE.md §3b, decided by Mark 2026-11-17)', () => { + it('every look the player can choose can be stacked: a layer for every value of every choice', () => { + for (const skin of GARDENER_OPTIONS.skin) expect(ids.has(layerId('gardener', 'body', [skin])), skin).toBe(true); + for (const p of GARDENER_OPTIONS.presentation) { + for (const c of GARDENER_OPTIONS.clothes) expect(ids.has(layerId('gardener', 'clothes', [p, c])), `${p} ${c}`).toBe(true); + } + expect(ids.has('gardener-apron')).toBe(true); + for (const h of GARDENER_OPTIONS.hair) { + for (const c of GARDENER_OPTIONS.hairColour) expect(ids.has(layerId('gardener', 'hair', [h, c])), `${h} ${c}`).toBe(true); + } + for (const hat of GARDENER_OPTIONS.hat) expect(ids.has(layerId('gardener', 'hat', [hat]))).toBe(hat !== 'none'); + expect(layers).toHaveLength(6 + 10 + 1 + 36 + 2); + }); + + it("the words name no value the app does not offer, so no layer is painted for nothing", () => { + const words = raw.layers?.[0]?.words ?? {}; + for (const [axis, values] of Object.entries(words)) { + expect(Object.keys(values).sort(), axis).toEqual([...(GARDENER_OPTIONS[axis as keyof typeof GARDENER_OPTIONS] ?? [])].sort()); + } + }); + + it("the colours in the prompts are the app's own (Gardener.svelte), so a painted look matches the one chosen", () => { + const svelte = readFileSync(`${root}packages/ui/src/scene/Gardener.svelte`, 'utf8'); + const words = raw.layers?.[0]?.words ?? {}; + for (const axis of ['skin', 'hairColour', 'clothes']) { + for (const [value, text] of Object.entries(words[axis] ?? {})) { + const hex = /#[0-9A-F]{6}/i.exec(text)?.[0].toLowerCase(); + expect(svelte, `${axis} ${value}`).toMatch(new RegExp(`'?${value}'?: '${hex}'`)); + } + } + }); + + it('come right after the guide, the seven of the two first looks first, then back to front', () => { + const at = m.assets.findIndex((a) => a.id === 'gardener-poses-sheet'); + expect(m.assets.slice(at + 1, at + 8).map((a) => a.id)).toEqual([ + 'gardener-body-skin-3', 'gardener-clothes-girl-sage', 'gardener-clothes-boy-sage', 'gardener-apron', + 'gardener-hair-short-brown', 'gardener-hair-braids-brown', 'gardener-hat-straw-hat' + ]); + const back = (from: number): number[] => layers.slice(from).map((a) => a.part?.stack ?? -1); + for (const run of [back(0).slice(0, 7), back(7)]) expect(run).toEqual([...run].sort((x, y) => x - y)); + expect(layers.find((a) => a.id === 'gardener-hat-cap')?.part).toEqual({ name: 'hat', stack: 4 }); + }); + + it("have the guide's grid and poses, each picture named after its pose; the guide is never shipped", () => { + const guide = m.assets.find((a) => a.id === 'gardener-poses-sheet'); + expect(guide?.shipped).toBe(false); + const hair = m.assets.find((a) => a.id === 'gardener-hair-curly-red'); + expect(hair?.grid).toEqual(guide?.grid); + expect(hair?.cells?.map((c) => c.id)).toEqual((guide?.cells ?? []).map((c) => c.id.replace('gardener-', 'gardener-hair-curly-red-'))); + expect(hair?.cells?.map((c) => c.does)).toEqual(guide?.cells?.map((c) => c.does)); + }); + + it('expanding twice changes nothing', () => { + expect(expandLayers(m)).toEqual(m); + }); + + it("a layer's prompt attaches the character sheet and the guide, names only its part, and has no one-at-a-time prompts", () => { + const board = boardData(raw, readStyle()); + const hair = board.assets.find((a) => a.id === 'gardener-hair-bun-auburn'); + expect(hair?.attach).toEqual(['gardener-sheet', 'gardener-poses-sheet']); + expect(hair?.over).toBe('gardener-poses-sheet'); + expect(hair?.prompt).toContain('Guide: attach the image gardener-poses-sheet and paint over it.'); + expect(hair?.prompt).toContain("Part: only the gardener's hair: hair in a small round bun at the back of the head, auburn (#9A4A2A)"); + expect(hair?.prompt).toContain('Avoid: any part of the gardener other than the one named'); + // The character's whole first look would contradict a part: it is not in a layer's prompt. + expect(hair?.prompt).not.toContain('two braids, a wide straw hat'); + expect(hair?.cells?.every((c) => c.prompt === '')).toBe(true); + expect(board.assets.find((a) => a.id === 'gardener-poses-sheet')?.cells?.every((c) => c.prompt !== '')).toBe(true); + }); + + it("each layer's stand-in draws its part only, in its own colour", () => { + const stand = placeholders(raw); + expect(stand.get('gardener-body-skin-6')).toContain('#553422'); + expect(stand.get('gardener-body-skin-6')).not.toContain('#e6c98a'); // no straw hat in the body + expect(stand.get('gardener-hair-short-fair')).toContain('#d9b26a'); + expect(stand.get('gardener-hair-short-fair')).not.toContain('#cf9a72'); // no skin in the hair + expect(stand.get('gardener-clothes-boy-dusk')).toContain('#5b6fa6'); + expect(stand.get('gardener-hat-straw-hat')).toContain('#e6c98a'); + }); +}); + +describe('checkManifest refuses layers that cannot work', () => { + const broken = (change: (l: { -readonly [K in keyof Layered]: Layered[K] }, m: Manifest) => void): string => { + const copy = clone(raw); + change((copy.layers as Layered[])[0] as never, copy); + return checkManifest(copy, POINTS).join('\n'); + }; + + it('a shipped guide: the app stacks the layers, so the guide must never appear', () => { + expect(broken((_, c) => { (c.assets.find((a) => a.id === 'gardener-poses-sheet') as { shipped: boolean }).shipped = true; })).toMatch(/guide "gardener-poses-sheet" is shipped/); + }); + + it('a guide that is missing or not a sprite sheet', () => { + expect(broken((l) => { l.over = 'nowhere'; })).toMatch(/guide "nowhere" is not in the manifest/); + expect(broken((l) => { l.over = 'gardener-sheet'; })).toMatch(/guide "gardener-sheet" is a sheet, not a sprite sheet/); + }); + + it('a part that names a choice it is not painted for, or a choice with no words', () => { + expect(broken((l) => { (l.parts[2] as { subject: string }).subject = 'only the apron, in {clothes}'; })).toMatch(/part apron says \{clothes\} but is not painted per clothes/); + expect(broken((l) => { delete (l.words as Record)['hat']; })).toMatch(/part hat needs words for "hat"/); + }); + + it("a forbidden word in a layer's words", () => { + expect(broken((l) => { ((l.words as Record>)['hat'] ?? {})['cap'] = 'a cap to heal the heart'; })).toMatch(/"heal" \(medical\)/); + }); +}); + +describe('art:accept and a layer (in register with the guide)', () => { + const W = 1536, H = 1024, COLS = 4, ROWS = 2; + const cw = W / COLS, ch = H / ROWS; + /** One rectangle per cell, at the given share of the cell: a figure, or a part of one. */ + async function sheet(box: { x: number; y: number; w: number; h: number }): Promise { + const rects = Array.from({ length: COLS * ROWS }, (_, i) => + ``).join(''); + const svg = `${rects}`; + return sharp({ create: { width: W, height: H, channels: 4, background: { r: 0, g: 0, b: 0, alpha: 0 } } }).composite([{ input: Buffer.from(svg) }]).png().toBuffer(); + } + const FIGURE = { x: 0.3, y: 0.15, w: 0.4, h: 0.7 }; + let guide: Guide | undefined; + async function theGuide(): Promise { + if (!guide) { + const { files } = await acceptPicture(await sheet(FIGURE), 'gardener-poses-sheet', m); + guide = new Map(files.map((f) => [f.id, f.data])); + } + return guide; + } + const refusal = async (p: Promise): Promise => { + try { + await p; + } catch (e) { + if (e instanceof Refused) return e.message; + throw e; + } + throw new Error('expected a refusal'); + }; + + it('a part lying on the guide\'s figure is accepted and cut into its eight pictures', async () => { + const { files } = await acceptPicture(await sheet({ x: 0.33, y: 0.15, w: 0.34, h: 0.2 }), 'gardener-hair-braids-brown', m, await theGuide()); + expect(files.map((f) => f.id)).toEqual((m.assets.find((a) => a.id === 'gardener-hair-braids-brown')?.cells ?? []).map((c) => c.id)); + }); + + it('a part a little fuller than the guide (a wide hat) is still in register', async () => { + await acceptPicture(await sheet({ x: 0.25, y: 0.12, w: 0.5, h: 0.12 }), 'gardener-hat-straw-hat', m, await theGuide()); + }); + + it('a part painted somewhere else is refused, naming the pictures', async () => { + const message = await refusal(acceptPicture(await sheet({ x: 0.75, y: 0.15, w: 0.2, h: 0.2 }), 'gardener-hair-braids-brown', m, await theGuide())); + expect(message).toMatch(/not in register with gardener-poses-sheet in gardener-hair-braids-brown-stand \(\d+ % of the cell/); + }); + + it('before the guide is accepted, a layer is refused', async () => { + expect(await refusal(acceptPicture(await sheet(FIGURE), 'gardener-apron', m))).toMatch(/guide gardener-poses-sheet is not in art\/final\/ yet/); + }); + + it('one picture of a layer, made on its own, is refused: it would not line up', async () => { + expect(await refusal(acceptPicture(await sheet(FIGURE), 'gardener-apron-pour', m, await theGuide()))).toMatch(/never one picture at a time/); + }); +}); diff --git a/tools/art-prep/test/prompt.test.ts b/tools/art-prep/test/prompt.test.ts index 9a370ce..30f66fd 100644 --- a/tools/art-prep/test/prompt.test.ts +++ b/tools/art-prep/test/prompt.test.ts @@ -1,13 +1,15 @@ import { describe, expect, it } from 'vitest'; import { findForbidden } from '@rosea/content'; import { boardData } from '../src/board.js'; +import { expandLayers } from '../src/manifest.js'; import { cellBoxes, cutLines, soloCanvas } from '../src/prompt.js'; import { reviewPoints, stylePrompt } from '../src/style.js'; import { clone, readManifest, readStyle } from './fixtures.js'; const style = stylePrompt(readStyle()); const data = boardData(readManifest(), readStyle()); -const allPrompts = data.assets.flatMap((a) => [a.prompt, ...(a.cells ?? []).map((c) => c.prompt)]); +// A layer's pictures have no prompts of their own (STYLE.md §3b): their prompt is ''. +const allPrompts = data.assets.flatMap((a) => [a.prompt, ...(a.cells ?? []).map((c) => c.prompt)]).filter((p) => p !== ''); describe('STYLE.md', () => { it('§1 is the quoted system prompt, line breaks kept and the markers gone', () => { @@ -23,9 +25,10 @@ describe('STYLE.md', () => { } }); - it('§7 has the twelve review points, a point split over two lines read as one', () => { + it('§7 has the thirteen review points, a point split over two lines read as one', () => { const points = reviewPoints(readStyle()); - expect(points).toHaveLength(12); + expect(points).toHaveLength(13); + expect(points[12]).toBe('A gardener layer holds only its part, in register with the guide: stacked with the other layers of a look, it makes one child, with nothing doubled, missing or shifted.'); expect(points[8]).toBe("It reads as one young red-orange fox with a cream mask and a ringed tail, shy and gentle, and nothing like the book's sandy, long-eared fox."); expect(points[3]).toBe('Nothing from the book: no glass dome, screen, tiny planet, desert, child or scarf, and no look of its drawings.'); }); @@ -37,18 +40,19 @@ describe('STYLE.md', () => { }); describe('the prompts', () => { - it('every one starts with STYLE.md §1 word for word, then says what to make: 40 cards and 74 one-at-a-time prompts', () => { - expect(allPrompts).toHaveLength(40 + 74); + it('every one starts with STYLE.md §1 word for word, then says what to make: 95 cards (55 of them gardener layers) and 74 one-at-a-time prompts', () => { + expect(data.assets.filter((a) => a.over)).toHaveLength(55); + expect(allPrompts).toHaveLength(95 + 74); for (const p of allPrompts) expect(p.startsWith(style + '\n\nMake: ')).toBe(true); }); it('every one ends with the shared avoid list and its board id', () => { - const m = readManifest(); + const m = expandLayers(readManifest()); for (const a of data.assets) { const allowed = m.assets.find((x) => x.id === a.id)?.allow ?? []; expect(a.prompt).toContain(m.avoid.filter((l) => !allowed.includes(l)).join('; ')); expect(a.prompt.endsWith(`\nBoard id: ${a.id}`)).toBe(true); - for (const c of a.cells ?? []) expect(c.prompt.endsWith(`\nBoard id: ${c.id} (one picture of ${a.id})`)).toBe(true); + for (const c of (a.cells ?? []).filter((x) => x.prompt !== '')) expect(c.prompt.endsWith(`\nBoard id: ${c.id} (one picture of ${a.id})`)).toBe(true); } });