Log inGet started
World

Goshawk Books — a bookshop, cross-play, hawks

Branchmain
Branchesmain
Commitfadc49c20b

README.md

main — Goshawk Books

The shop, written as code. Everything in this scene is placed by build.luau, and editing that file rebuilds the scene in place: an entity keeps the id it had, so the spawn, the camera and the hawks survive a rebuild with their references intact.

What it holds

the roomfloor, ceiling, three walls and a storefront — piers, a display window with mullions and a transom, and a door standing open on its hinge
the stockten oak cases (four on the back wall, two per side wall), each filled by shelfUnit from a seeded run: matched sets of volumes, gaps where books have been bought away, the odd book leaning into its neighbour
the shopcounter with a brass till and a bell, a display table of stacked books, a reading nook with a rug, a side table and a floor lamp, a window ledge of new arrivals
the streetpavement, kerb, road, the buildings opposite, two street lamps and a bench
the hawksfive birds riding circles over the road, flown by HawkFlight
the playera PlayerPrototype with the humanoid avatar and an orbital_follow camera, plus one PlayerSpawn inside the shop near the door

Changing it

  • shelfUnit(parent, name, x, z, yawDeg, width, seed) — one case and its books. boards is the shelf list; the gap probability and the run lengths decide how the stock reads.
  • bookStack(...) — a stack lying flat, used on the counter, the display table, the ledge and the side table.
  • hawkSpecs — one line per bird: its circle's centre and radius, its period, its bank, its height. Add a line for another hawk.
  • pendant(...) — cord, shade, glowing bulb and the light it casts.
  • Materials are resolved by name, literally, in resolveAll(): a scene that states what it is made of can be carried into another world with its dependencies intact.

Gotchas worth keeping

Two faces at the same depth flicker, and a lit frame never shows it. Where two parts meet — a book on a shelf board, a wall on a floor, a rug on the boards — one of them is given a couple of millimetres of air, or overlaps the other by a centimetre. Wall height is ROOM.H + 0.04 for exactly that reason, and shelfUnit lifts every book 2 mm off its board.

A component keeps no table of its own. HawkFlap carries five birds, and a module-level table (or anything keyed on an id) is ONE value shared by every instance — which reads as four birds frozen and one flapping, because the last one to collect the children won. Per-instance state goes in private, or is rebuilt from the entity each frame.

Round-tripping through play can drop a rebuild. A build.luau write places its entities live, but they are only pending until something accepts them; leaving play by discarding changes throws that rebuild away, and the live scene then disagrees with scene.json. After a build, either accept the changes or scene.reload before the next play round trip.