Exact source used by this build. SHA-256: b5bfc09f8504bc2be0aefbcb8b0ceeb1790f4f7d385764be571027e274e5d290.
1 # Animals and buildings — implementation report
2
3 ## Integration into main
4
5 See [the integration-2 report](../../../../../docs/w3-integration2-report.md)
6 for current validation and the full file audit. The branch report below is
7 historical. Animals now use the authored farm building-area POI and town shops
8 with scheduled villager keepers. Empty interiors use real area removal; the old
9 tombstone limitation no longer applies. Egg/milk production feeds real dairy
10 recipes, grass seeds are checked against growable soil, product outcomes remain
11 durable, and care/wandering remain on one calendar-tick path. The remote carpenter
12 plan preserves area scoping and confirms against live farm occupancy.
13
14 Implemented the six-species MVP and all 11 requested building definitions. Buildings, animals, care, grass, hay, the pet and horse belong to the shared farm. Purchase materials and inventory belong to the acting player; wallet charges follow the existing shared/separate wallet setting.
15
16 ## Delivered behavior
17
18 - Carpenter service: coop/big/deluxe coop, barn/big/deluxe barn, silo, well, shed, stable and fish pond; configured costs/materials, 2–3 mornings of construction, upgrades, placement validation, relocation and demolition. Capacities are 4/8/12. Collision checks protect warps, services, entrances, crops, objects and occupants.
19 - Generated interiors: feeding positions, hay hopper, heater and auto-grabber slots, and incubators in upgraded coops. Interior upgrades preserve animals and products. Occupied buildings cannot be demolished. The fish pond has the requested stub interior.
20 - Ranch service: six numbered species, purchase eligibility, naming, shared care, friendship/mood, age and production cycles, large/alternate products, quality rolls, sale prices and farming/foraging experience. The ranch sells hay, tools, equipment and grass starter through the existing shops system.
21 - Care: once-per-day petting, inventory/silo feeding, troughs, grass grazing and growth, silo capacity, scythe hay collection, doors, weather, 5 PM return, 7 PM sleep, neglect penalties, winter heaters, deluxe auto-feeding, auto-grabbers and incubation. Milking and shearing use the tools system's new item extension hook; eggs and truffles are collected by hand.
22 - Companions: one free shared cat/dog choice, name, bowl and friendship; stable horse with exclusive riding and faster authoritative/client movement. Horses dismount on disconnect and return overnight.
23 - Client: farm controls, carpenter placement grid with valid/invalid tiles, move/demolish, ranch purchase/naming, animal hearts and mood, interior actions, pet choice and horse controls. All new visuals are procedural colored placeholders with manifest keys.
24
25 ## Files changed
26
27 `+` denotes a new file; `~` denotes an existing file changed.
28
29 ```text
30 apps/
31 client/
32 public/assets/CREDITS.md ~
33 src/core/registry.test.ts ~
34 src/systems/
35 index.ts ~
36 movement/index.ts ~
37 animals/
38 index.ts +
39 model.ts +
40 rendering.ts +
41 ui.ts +
42 test/animals-model.test.ts +
43 server/test/animals-loop.test.ts +
44 packages/
45 content/
46 data/animals/animals.json +
47 data/items/animals.json +
48 src/domains/
49 index.ts ~
50 animals/index.ts +
51 animals/schema.ts +
52 test/
53 animals-content.test.ts +
54 domains.test.ts ~
55 items.test.ts ~
56 sim/
57 src/systems/
58 index.ts ~
59 registry.ts ~
60 movement/index.ts ~
61 shops/index.ts ~
62 tools/index.ts ~
63 animals/
64 index.ts +
65 types.ts +
66 buildings.ts +
67 lifecycle.ts +
68 REPORT.md +
69 test/
70 animals-system.test.ts +
71 animals-formula.test.ts +
72 animals-extensions.test.ts +
73 ```
74
75 ## Shared changes and reasons
76
77 | File(s) | Change and reason |
78 | --- | --- |
79 | Three system/domain indexes | Register the animals domain and simulation/client systems; export the public simulation helpers. Animals runs immediately before weather. |
80 | Sim `registry.ts` | Generic item-tool and movement-speed hooks let a feature own its behavior without adding animal-specific branches to core systems. |
81 | Sim `tools/index.ts` | Validate inventory ownership, reach and availability before dispatching item tools; offer contextual existing-tool uses and watering-can helpers while keeping tool state owned by tools. |
82 | Sim and client movement modules | Apply the same registered horse speed multiplier to prediction, server speed validation and movement time-budget charging. |
83 | Sim `shops/index.ts` | Include feature-domain shops alongside the original shops so carpenter/ranch access and purchases use existing hours, reach and wallet logic. |
84 | Content/client registration tests | Extend exact expected registration lists. |
85 | Content `items.test.ts` | Count the original numbered forage set by its ID prefix; animal truffles legitimately add another item to the forage category. |
86 | Asset `CREDITS.md` | Credit the new original CC0 procedural placeholders. |
87
88 No production server, protocol, inventory, skills or existing maps were changed. Shared feature changes are limited to the integration points listed above. No dependency was added.
89
90 ## Validation
91
92 Final acceptance commands and results:
93
94 ```text
95 $ bun run check
96 All four workspace TypeScript checks passed.
97 164 pass
98 0 fail
99 2204 expect() calls
100 Ran 164 tests across 32 files. [46.56s]
101 Validated 13 content domains: 12 crops, 76 items, and 8 Tiled areas.
102
103 $ bun run --cwd apps/client build
104 217 modules transformed.
105 dist/assets/index-CJWUcJOK.js 1,816.51 kB | gzip: 449.49 kB
106 Built successfully in 502ms. Exit 0.
107 Warning: some chunks exceed 500 kB after minification.
108
109 $ bun test apps/server/test/animals-loop.test.ts
110 2 pass, 0 fail, 75 assertions.
111 Both scenarios also passed in the final full check above.
112
113 $ bun test apps/server/test/server.test.ts
114 2 pass, 0 fail, 646 assertions.
115 Both existing workerd scenarios also passed in the final full check.
116
117 $ git diff --check
118 Passed; no whitespace errors.
119 ```
120
121 An intermediate full run lost a WebSocket when Wrangler hot-reloaded during concurrent source edits. The server log confirmed the reload and abnormal socket closure. The standalone server suite and both subsequent full runs passed with edits frozen; no timeout relaxation or harness workaround was made.
122
123 The final grass correction adds guaranteed daily growth, separate extra growth/spread checks, 1–2-tuft propagation, winter hay probability and 40 spring growth/spread passes after the daily baseline in year 2 onward. Three deterministic simulation tests cover seasonal behavior, seeded propagation and immutability; content tests validate the configured ranges.
124
125 The two-client test uses two TCP WebSocket connections and the production `FarmWorld` authority, authentication, dispatch, patch/snapshot handling, SQLite journal and checkpoints. Cloudflare socket/storage adapters and elapsed time are substituted to run the scenario headlessly. The existing workerd suite separately checks Worker fetch/WebSocketPair behavior.
126
127 For both wallet modes, player A pays for a coop, waits for construction, and buys two daily layers. Player B enters the generated interior, pets and feeds both animals through maturation, then collects their morning products. Assertions cover shared state on both clients, buyer-only materials and separate-wallet charges, collector-only inventory, interior area scoping and SQL persistence. Each overnight checks animal state and RNG against deterministic replay; separate formula tests independently check quality tier boundaries, large products and sale prices.
128
129 Phone layout checks used the actual client panels in 852×393 and 393×852 viewports. Placement, ranch, animal info and initial pet choice fit their viewports and had zero measured buttons smaller than 44×44 px. The placement grid scrolls and centers the selected footprint. These are layout checks, not a fully automated browser gameplay test. The Playwright launcher could not start Chrome in this sandbox, so visual checks used the connected Chrome app.
130
131 ## Parity decisions and known gaps
132
133 - `docs/content-targets.md` requires a strict mood-150 quality/large-product gate; this implementation follows that local specification. Current Stardew documentation also describes probabilistic eligibility below 150 and a related cycle retry; those are deliberately absent under the project's stricter rule.
134 - Daily luck is a content parameter currently set to zero, pending a shared luck system.
135 - Species-specific mood gains/drains use values within the documented ranges. The exact drain assignment for five of the six species could not be independently verified; treat those as tuning assumptions, not verified exact parity.
136 - The source mentions a closed-door mood bonus without specifying its magnitude. Its content setting is zero rather than an invented bonus.
137 - Wandering uses deterministic ten-minute simulation ticks and simple obstacle avoidance. It is not continuous pathfinding. Layouts and fixture locations are original placeholders.
138 - Horse speed uses a 1.28 multiplier derived from the documented movement increase; it has not been benchmarked against the original game's animations. The requested faster riding behavior is implemented.
139 - Fish pond production/fish management is intentionally outside this stub. The six MVP species omit the additional full-content animal roster. Pet gifts, blue grass and later-game animal equipment beyond the requested set are not included.
140 - Demolished generated interiors are emptied and sealed as tombstones because the current area persistence/patch format does not support deletion. This prevents saved interiors from reappearing on reload without a protocol change.
141 - Pet-bowl rain handling previews the following weather roll without consuming RNG. Keep animals immediately before weather in deterministic hook order.
142 - Vite reports a large-bundle warning; the build succeeds. No code-splitting work was included in this feature.
143
144 Mechanics research references are recorded in `packages/content/data/animals/animals.json`. Principal references: [animal care and quality](https://stardewvalleywiki.com/Animals), [construction](https://stardewvalleywiki.com/Carpenter%27s_Shop), [grass](https://stardewvalleywiki.com/Grass), and the six species pages linked in the JSON. These inform numerical mechanics only; no original-game names, artwork, dialogue, maps or code were imported.
145
146 ## Content slots and repository state
147
148 The domain contains 11 buildings, 6 species, 19 new items, 2 shops and 61 visual manifest keys. Species IDs are `animal_01`–`animal_06`; product IDs are `animal_product_01`–`animal_product_10`. Creative names/descriptions, shop names, building names, pet/horse defaults and generated interior names remain `TBD`. Plain materials and tool terms remain descriptive. Player-entered animal/pet names are stored as player choices. No dialogue or lore was written.
149
150 Changes remain uncommitted under the project instruction not to commit without an explicit request. No deployment, credential access, remote push or history rewrite was performed.
151
152 Ignored artifacts: client build about 1.8 MB, reusable phone-preview fixtures about 8 KB, generated item manifests about 20 KB, and existing/shared Wrangler test persistence about 107 MB. The persistence directory predated this task and was reused by validation; it was not deleted because its prior files are not owned by this task. Generated manifests and all build/test artifacts remain ignored. The temporary preview server was stopped after validation.
153