Add a place for friends
- Start with the places design: the registry, capabilities, floor geometry and weather behind window panes.
- Every place shares the app's friends and activities.
- A place's artwork and capabilities describe where the friends stand.
- Add one entry to
src/content/worlds.json.- Choose a stable
id. Changing it later sends saved choices back to the hillside garden. - Add its
labelandaboutactivity-note keys to all four page string tables.
- Choose a stable
- Set
geometry.fieldTopto the back edge of the walkable floor, as a fraction of the image height.- Leave enough open foreground for the full cast and the tools.
- Where the picture shows walkable ground reaching back past that line (a path, a gate, a dock), add
geometry.edge(see Traced edge).
- For a fishing place, set the water and the standing position.
geometry.laketakesfrom,to,centerandradius: fractions that describe the same raster water people click.geometry.fishingSpottakes normalizedxandy: a separate standing position on the floor.- The fishing spot follows the same image transform as the water.
- Set each capability on purpose:
sky,weather,soil,wildlife,fishing,seasonalEffectsandambient.- An indoor place usually turns off outdoor activities.
- For weather through windows, enable
weatherand definewindowPanesas normalizedx,y,widthandheightrectangles over the glass. - Rain, snow and overcast shading share the background crop and stay inside those panes.
- Do not enable fishing to make an activity button work when the image has no usable water.
- Put generated or illustrated images in
assets/art/environments/and runpnpm run assets:webpfor the copies insrc/art/environments/. Keep earlier source assets.environmentLooklights each time of day with its own gentle filter and tint, so one picture per season serves the whole day.
- Set
fitto keep the image's proportions as the window changes shape."cover-floor"anchors the image's floor togeometry.fieldTop."cover-bottom"aligns the image's bottom edge instead of its floor line.environmentFrameshares this transform with pond geometry, window weather and seasonal lights.- Before enabling fishing, check the visible water and the automatic fishing endpoints after cropping.
- Add lighting to
environmentLookwhen the new material or lamp light needs it.- Look at the actual image at every time of day.
- A warm room at night needs readable walls and floor, and a clearly nighttime view through its window.
- Give the place's atmosphere its own
chatterstring-table key, with casual idle lines in all four languages.- Indoor places need their own lines, so friends in one room do not talk about outdoor stars or another room's lamps.
- Enabling
ambientcurrently selects the woodland mix. - A café or city sound palette needs its own implementation and tests.
- Add capability, geometry, asset and translation checks to
tests/worlds.test.mjs. Change a test before you change its rule. - Add real visual fixtures through
scripts/visual-audit.mjs: day, night, full size, 500×350, 320×240 and a wide short window. - Check that switching worlds ends fishing and games and keeps friends and collections.
- The existing modules read registry data with no extra entry-point wiring.
loadContent()loads the registry.setupSky()builds the Place select from its entries, saves the chosen id and applies the new scene.- An unknown saved id falls back to the hillside garden.
- Before adding a place, run the repository's normal checks: Node and Rust tests, lint, the site build for documentation changes and the real-app E2E for the selector flow.
- Isolated fixtures make the result reviewable, but they do not replace native interaction checks.
Traced edge
geometry.edgeis a polyline of picture[x, y]points, fractions of the image, ordered left to right.- Straight lines join the points. At
x, the field's top ismin(fieldTop, edge(x)): the edge only raises the field, never lowers it. - Left of the first point, right of the last, and wherever the edge lies below
fieldTop, thefieldTopline holds. - A friend's saved
ystays 0 to 1 at everyx: 0 is the field's top there, 1 its front edge. Saves do not change when an edge is added or moved. - The edge shares the picture's transform (
environmentFrame), so it follows the crop in wide, narrow and mini windows. yard/field.jsreads it:topAt(px)gives the field's top at a yard x,hasEdge()says whether the place has one as shown now.- It is not used on the painted fallback land or in a
cover-bottomroom.
| Field | Meaning |
|---|---|
fieldTop | The flat back line of the walkable floor |
edge | [[x, y], …] from x 0 to 1; each y is where walkable ground ends at that x |
far | Optional, for ground reaching far back (a meadow, not a path): the picture y a friend is drawn smallest at, usually the edge's highest point |
depthFar | How small a friend at the back is drawn (default 0.84) |
safe | [x0, y0, x1, y1]: the part of the picture always in view, at most 0.88 wide and 0.84 tall |
- Without
far, a friend's size follows its savedy: one at the top of a raised path is as small as one at the line beside it. - With
far, its size follows its height on the screen, alike at everyx, fromdepthFaratfarto its own size at the field's foot. The Wild garden usesfar0.48 anddepthFar0.68.
safe decides how the picture is framed (environment.js environmentFrame):
- From 4:3 to 16:9 the picture covers the window and the whole rect shows. 0.88 is the width a 4:3 window shows, 0.84 the height a 16:9 one shows.
- Wider, the picture shrinks to the rect's height. Its own edge, mirrored, blurred and shaded, fills each side. Without canvas filters (Safari before 18) a side is drawn from a copy shrunk to a sixteenth instead.
- The sides are not floor: across, the field spans the picture (
field.js field,leftandright), so a saved x of 0 to 1 stands on it, and nothing walks, is planted or is dug in the blur. - Narrower, an outdoor picture shrinks to the rect's width and stands on the window's bottom; the yard's sky fills the top, and the picture's top edge fades into it. Friends shrink as much as the picture does from a 4:3 window as tall, down to 0.6 (
field.js zoomFor). Acover-bottomroom keeps covering its height and crops its sides, keeping the rect's middle. - From 2.4 times as wide as tall the picture eases toward covering the window, and from 3 times (a strip) it covers it and crops, keeping as much of the rect as fits (
environment.js stripShare); friends' size eases with it. - A place without
safe(an imported background) covers the window and crops. - Put the house, the big tree and the windows inside it, and leave out the corners' flowers and the empty sky.
To trace one:
- Open the summer picture at full size (1536 × 1024).
- Walk the boundary between walkable ground and what is behind it (water, hedges, walls, the sky), left to right.
- Put a point at each corner, every 1–3% of the width where the boundary bends; divide pixels by 1536 and 1024.
- Keep the edge on the near side of the pond: it stays below
geometry.lake's near shore (center + radiusat its middle). - Check the other seasons; they share the camera, but snow and blossom can move the visible edge.
- Check the place in a wide strip, a narrow window and the mini window: friends, plants and gifts on the raised ground stay on the ground.
Workspaces for coding agents
- A place can give a coding agent's friend somewhere to go for each state (agent workspaces). The garden workshop is the built-in one.
- All of these live under
geometryin source-image fractions and share the picture's transform (environmentFrame).
| Field | What it is |
|---|---|
stations.desks | One {x, y} per seat: where a working friend's feet stand |
stations.approval | Where a waiting friend stands; others line up beside it |
stations.rest | The corner a friend rests in once its agent is done |
blocks | {x, y, rx, ry} ellipses a stroll does not end on and a gift is not set down on (furniture) |
fronts | {x, y, width, height, foot, shape}: a piece cut from the picture and drawn over friends whose feet are above foot |
depthFar | How small a friend at the back is drawn (default 0.84; about 0.6 for a deep room) |
- Measure each front on the picture. Start its
shapeat the tabletop, not at a lamp or a pot on it: anything above the top covers a seated friend's face. - Ask for only flat things on a table in front of a seat (books, paper, seed packets): a laptop or a tall pot there sits in front of a face.
- A seated friend's name tag goes down to its feet, on the desk's front, so its face stays in view.
- Set the
soilcapability tofalsefor a paved floor: flowers stand in pots and nothing is dug. - Use
"fit": "cover-bottom"so a short window keeps the front of the room. - Draw the furniture at the friends' size for a window 850px tall: in a room, friends grow with the picture in larger windows (up to twice), so that size holds at full screen. With
cover-bottom, the field follows the picture's floor line in a window wider than the picture. - Gifts and flowers in a room are furniture: they keep the picture's scale in every window (
field.js propZoom), while friends stop shrinking at a readable size. - A room whose glass shows the live sky takes the outdoor light: name its picture under
seasonArt(the same id for every season is fine). Its panes are not washed over again in rain. - A station the window crops away is not used: a waiting friend comes to the front of the yard, and a working or resting friend stays where it stands.
- Put a station where the friend standing there reads clearly: beside a narrow post, not behind it.
- Check the room with every friend working, at day and night, in rain, and in a short wide window.
Portable backgrounds
- Get a creation kit from the background studio. It includes a starting layout, a guide, a complete request and a portable skill.
- Generate the art, review the composition and package it in the selected AI workspace, not in a browser image editor.
render-layoutcreates a PNG guide.pack-backgroundchecks the final images and config and writes v1 JSON.
- Import it from the scene menu. The app keeps it in the data folder's
backgrounds/, one file per background (before 1.4.0, in the webview's IndexedDB, from which it moves at the first start of 1.4.0). - Keep the JSON as a backup if you want the exact file you made.
Layout:
- Each package declares a normalized floor, an optional water ellipse, a fishing stance and up to twelve window rectangles.
- Adjust the kit's layout JSON to match the actual artwork. Positions vary by background.
- The stance stays on the walkable floor, and the water stays above it.
- Optional window masks keep indoor weather inside the windows.
- Review large and small window crops, narrow windows included, with the app's floor-anchored transform (
environmentFrame). - A stance that is cropped out falls back to the visible shore.
- The website does not reopen, inspect or convert packages.
Images and limits:
| Item | Rule |
|---|---|
| Images | Embedded PNG data URLs, each 1536 × 1024, up to 6 MB |
| Package | Up to 32 MB of JSON |
| Validator | Rejects external addresses, unsupported versions and invalid geometry |
| Importer | Also decodes every image before saving |
| Base image | Required |
| Season images | Optional; missing seasons use the base image |
- All four seasons enable seasonal particles.
- Custom backgrounds do not inherit the built-in festival light locations.
- An outdoor live sky needs real alpha in the sky. A solid painted sky hides the dynamic one.
- The current format has no obstacle map. Keep the whole floor clear, including the margins that wandering friends reach.
Ids:
- The built-in hillside keeps the
woodlandid for saved selections. seasonArtmaps the shared season names (spring,green,autumn,winter) to each place's artwork.- A retired id opens the place that replaced it (
REPLACEDinsrc/yard/worlds.js): a savedstudio, the former living room, opens the garden workshop.
What changes with the scene
Built-in places:
- The courtyard, hillside garden and lakeside each have four seasonal images.
- The renderer adds time-of-day lighting, a dynamic sky and weather.
- Season and weather are separate: snow falls over the selected season's artwork.
- The garden workshop (
workshop) has one picture. Its glass shows the live sky and weather, and the renderer lights it for the time of day. - A room without a sky, such as a background of your own, shows rain and snow only inside its window panes;
tests/indoor-environment.test.mjschecks it with a fixture room. - Indoor places hide outdoor creatures, fishing and seasonal particles, and keep friends and collections.
Version 1 imported packages:
- Seasonal images are accepted.
- Separate morning, day, evening and night images are not. The app tints by time of day at runtime instead.
- Use daytime source images without painted rain or snow, so the app adds weather only once.
- A package can turn off weather and the woodland sound.
- A package has no custom flower, fish, insect, sound or prop assets. Those stay shared app content.
Art and floor:
- The art and the configured floor do different jobs.
- The visible floor can show furniture behind its walkable boundary.
- Every point below the boundary has to be safe for a friend to stand on.
- Check tall sprites and accessories, not only the feet.
- A small window crops more of the room and the lake. Check the transformed water and standing position instead of assuming they stay visible.
Festival lights:
- Built-in outdoor places can define
lightAnchorsfor festival strands. - Each
{from, to, y, sag}uses normalized source-image coordinates. - The renderer shares the image crop and leaves out bulbs outside the viewport.
- Place anchors on visible branches instead of copying another scene's positions.
- Custom version 1 packages do not expose this field and do not inherit built-in strands.