castle-web-cli 0.4.231 → 0.4.233

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (368) hide show
  1. package/dist/agent-failures.d.ts +8 -0
  2. package/dist/agent-failures.js +19 -2
  3. package/dist/agent-prompts.d.ts +1 -1
  4. package/dist/agent-prompts.js +10 -3
  5. package/dist/agent.d.ts +64 -3
  6. package/dist/agent.js +170 -81
  7. package/dist/castle-host/host.d.ts +1 -0
  8. package/dist/castle-host/host.js +51 -3
  9. package/dist/castleJson.d.ts +4 -2
  10. package/dist/castleJson.js +2 -0
  11. package/dist/check.d.ts +3 -1
  12. package/dist/check.js +11 -1
  13. package/dist/devSessionStorage.js +47 -1
  14. package/dist/importPinMismatch.d.ts +22 -0
  15. package/dist/importPinMismatch.js +77 -0
  16. package/dist/importRegression.js +3 -15
  17. package/dist/imports.d.ts +10 -3
  18. package/dist/imports.js +88 -20
  19. package/dist/index.js +5 -4
  20. package/dist/init.js +1 -1
  21. package/dist/platformDoc.js +22 -0
  22. package/dist/routerFences.d.ts +5 -0
  23. package/dist/routerFences.js +12 -2
  24. package/dist/save-deck.d.ts +5 -0
  25. package/dist/save-deck.js +37 -4
  26. package/dist/serve.js +3 -0
  27. package/dist/serverBundle.js +5 -3
  28. package/dist/shell/assets/{index-D2tWM896.js → index-BjOxR-lW.js} +4 -4
  29. package/dist/shell/assets/index-MVLfNYd9.css +1 -0
  30. package/dist/shell/index.html +2 -2
  31. package/dist/taskSteer.d.ts +13 -0
  32. package/dist/taskSteer.js +22 -2
  33. package/kits/base/castle.json +1 -1
  34. package/kits/base/package-lock.json +1 -1
  35. package/kits/base/sdk/README.md +79 -2
  36. package/kits/base/sdk/avatar.d.ts +6 -2
  37. package/kits/base/sdk/avatar.js +12 -4
  38. package/kits/base/sdk/castle.d.ts +1 -1
  39. package/kits/base/sdk/commands.d.ts +14 -0
  40. package/kits/base/sdk/hub.d.ts +6 -2
  41. package/kits/base/sdk/hub.js +13 -0
  42. package/kits/base/sdk/multiplayer.js +17 -1
  43. package/kits/base/sdk/save.js +2 -1
  44. package/kits/base/sdk/server/hub.d.ts +87 -0
  45. package/kits/base/sdk/server/hub.js +70 -0
  46. package/kits/base/sdk/server/platformHandle.d.ts +31 -1
  47. package/kits/base/sdk/server/storage.d.ts +13 -0
  48. package/kits/base/sdk/server/storage.js +46 -0
  49. package/kits/base/sdk/server/wrapper.d.ts +36 -5
  50. package/kits/base/sdk/server/wrapper.js +83 -8
  51. package/kits/hub-game/CLAUDE.md +352 -12
  52. package/kits/hub-game/blueprints/avatar-10.scene +28 -0
  53. package/kits/hub-game/blueprints/avatar-11.scene +28 -0
  54. package/kits/hub-game/blueprints/avatar-12.scene +28 -0
  55. package/kits/hub-game/blueprints/avatar-13.scene +28 -0
  56. package/kits/hub-game/blueprints/avatar-14.scene +28 -0
  57. package/kits/hub-game/blueprints/avatar-15.scene +28 -0
  58. package/kits/hub-game/blueprints/avatar-4.scene +28 -0
  59. package/kits/hub-game/blueprints/avatar-5.scene +28 -0
  60. package/kits/hub-game/blueprints/avatar-6.scene +28 -0
  61. package/kits/hub-game/blueprints/avatar-7.scene +28 -0
  62. package/kits/hub-game/blueprints/avatar-8.scene +28 -0
  63. package/kits/hub-game/blueprints/avatar-9.scene +28 -0
  64. package/kits/hub-game/code/client/actorBudget.js +47 -0
  65. package/kits/hub-game/code/client/attention.js +11 -2
  66. package/kits/hub-game/code/client/avatar.js +345 -32
  67. package/kits/hub-game/code/client/avatarCap.js +228 -0
  68. package/kits/hub-game/code/client/avatarColors.js +70 -0
  69. package/kits/hub-game/code/client/avatarFaces.js +21 -0
  70. package/kits/hub-game/code/client/avatarShare.js +251 -0
  71. package/kits/hub-game/code/client/ballot.js +467 -0
  72. package/kits/hub-game/code/client/build.js +22 -0
  73. package/kits/hub-game/code/client/chat.js +12 -0
  74. package/kits/hub-game/code/client/chrome.js +1334 -50
  75. package/kits/hub-game/code/client/companion.js +716 -0
  76. package/kits/hub-game/code/client/companionDress.js +99 -0
  77. package/kits/hub-game/code/client/decor.js +509 -0
  78. package/kits/hub-game/code/client/earned.js +131 -0
  79. package/kits/hub-game/code/client/emoteBubble.js +75 -0
  80. package/kits/hub-game/code/client/grab.js +363 -20
  81. package/kits/hub-game/code/client/hats.js +26 -0
  82. package/kits/hub-game/code/client/hookLayer.js +328 -15
  83. package/kits/hub-game/code/client/hudClear.js +126 -0
  84. package/kits/hub-game/code/client/idle.js +163 -22
  85. package/kits/hub-game/code/client/interestCap.js +81 -0
  86. package/kits/hub-game/code/client/keys.js +36 -0
  87. package/kits/hub-game/code/client/labelsNear.js +205 -0
  88. package/kits/hub-game/code/client/menuIcons.js +34 -0
  89. package/kits/hub-game/code/client/pack.js +6 -2
  90. package/kits/hub-game/code/client/packFormat.js +3 -3
  91. package/kits/hub-game/code/client/rehello.js +167 -0
  92. package/kits/hub-game/code/client/shot.js +92 -0
  93. package/kits/hub-game/code/client/sound.js +63 -8
  94. package/kits/hub-game/code/client/soundscape.js +1151 -0
  95. package/kits/hub-game/code/client/soundscapeActions.js +99 -0
  96. package/kits/hub-game/code/client/soundscapeAmbience.js +453 -0
  97. package/kits/hub-game/code/client/soundscapeBaked.js +143 -0
  98. package/kits/hub-game/code/client/soundscapeBusker.js +217 -0
  99. package/kits/hub-game/code/client/soundscapeCourt.js +200 -0
  100. package/kits/hub-game/code/client/soundscapeCrowd.js +331 -0
  101. package/kits/hub-game/code/client/soundscapeCues.js +362 -0
  102. package/kits/hub-game/code/client/soundscapeMap.js +181 -0
  103. package/kits/hub-game/code/client/soundscapeMarket.js +176 -0
  104. package/kits/hub-game/code/client/soundscapeMusic.js +126 -0
  105. package/kits/hub-game/code/client/soundscapeMusicEngine.js +460 -0
  106. package/kits/hub-game/code/client/soundscapeSimlish.js +737 -0
  107. package/kits/hub-game/code/client/soundscapeSongs.js +127 -0
  108. package/kits/hub-game/code/client/soundscapeSongsRound3.js +63 -0
  109. package/kits/hub-game/code/client/soundscapeSynthesis.js +168 -0
  110. package/kits/hub-game/code/client/soundscapeUi.js +211 -0
  111. package/kits/hub-game/code/client/soundscapeVoice.js +1209 -0
  112. package/kits/hub-game/code/client/soundscapeWaves.js +206 -0
  113. package/kits/hub-game/code/client/spin.js +101 -0
  114. package/kits/hub-game/code/client/state.js +131 -1
  115. package/kits/hub-game/code/client/stuck.js +259 -0
  116. package/kits/hub-game/code/client/talk.js +538 -47
  117. package/kits/hub-game/code/client/tiers.js +541 -27
  118. package/kits/hub-game/code/client/toastBand.js +37 -0
  119. package/kits/hub-game/code/client/together.js +98 -1
  120. package/kits/hub-game/code/client/visibility.js +43 -0
  121. package/kits/hub-game/code/client/wear.js +470 -97
  122. package/kits/hub-game/code/client/yours.js +199 -0
  123. package/kits/hub-game/code/companionSpec.js +45 -0
  124. package/kits/hub-game/code/privateText.js +7 -0
  125. package/kits/hub-game/code/server/actions.js +133 -0
  126. package/kits/hub-game/code/server/actors.js +14 -1
  127. package/kits/hub-game/code/server/ask.js +155 -0
  128. package/kits/hub-game/code/server/ballot.js +539 -0
  129. package/kits/hub-game/code/server/cells.js +100 -0
  130. package/kits/hub-game/code/server/companion.js +82 -0
  131. package/kits/hub-game/code/server/cues.js +70 -0
  132. package/kits/hub-game/code/server/decor.js +269 -0
  133. package/kits/hub-game/code/server/earned.js +461 -0
  134. package/kits/hub-game/code/server/friendBests.js +166 -0
  135. package/kits/hub-game/code/server/friendsAmong.js +232 -0
  136. package/kits/hub-game/code/server/grab.js +296 -11
  137. package/kits/hub-game/code/server/history.js +5 -0
  138. package/kits/hub-game/code/server/hub.js +1317 -52
  139. package/kits/hub-game/code/server/idle.js +30 -11
  140. package/kits/hub-game/code/server/index.js +2 -2
  141. package/kits/hub-game/code/server/labels.js +28 -2
  142. package/kits/hub-game/code/server/manifest.js +424 -8
  143. package/kits/hub-game/code/server/menu.js +133 -0
  144. package/kits/hub-game/code/server/npcs.js +830 -80
  145. package/kits/hub-game/code/server/party.js +13 -2
  146. package/kits/hub-game/code/server/players.js +22 -0
  147. package/kits/hub-game/code/server/say.js +8 -2
  148. package/kits/hub-game/code/server/shot.js +110 -0
  149. package/kits/hub-game/code/server/standing.js +124 -0
  150. package/kits/hub-game/code/server/vis.js +113 -0
  151. package/kits/hub-game/code/server/wear.js +128 -11
  152. package/kits/hub-game/code/server/yours.js +59 -0
  153. package/kits/hub-game/code/shared/cues.js +9 -0
  154. package/kits/hub-game/code/shared/decor.js +41 -0
  155. package/kits/hub-game/code/shared/shot.js +19 -0
  156. package/kits/hub-game/code/shared/spin.js +57 -0
  157. package/kits/hub-game/code/systems/hub.js +1083 -85
  158. package/kits/hub-game/docs/content-pack.md +1 -1
  159. package/kits/hub-game/docs/contract.md +2440 -61
  160. package/kits/hub-game/docs/home-pieces.md +64 -0
  161. package/kits/hub-game/models/avatar-10.pxmodel +28 -0
  162. package/kits/hub-game/models/avatar-11.pxmodel +28 -0
  163. package/kits/hub-game/models/avatar-12.pxmodel +27 -0
  164. package/kits/hub-game/models/avatar-13.pxmodel +24 -0
  165. package/kits/hub-game/models/avatar-14.pxmodel +29 -0
  166. package/kits/hub-game/models/avatar-15.pxmodel +24 -0
  167. package/kits/hub-game/models/avatar-4.pxmodel +29 -0
  168. package/kits/hub-game/models/avatar-5.pxmodel +27 -0
  169. package/kits/hub-game/models/avatar-6.pxmodel +26 -0
  170. package/kits/hub-game/models/avatar-7.pxmodel +25 -0
  171. package/kits/hub-game/models/avatar-8.pxmodel +24 -0
  172. package/kits/hub-game/models/avatar-9.pxmodel +30 -0
  173. package/kits/hub-game/models/earned/badge-round.pxmodel +100 -0
  174. package/kits/hub-game/models/earned/badge-shield.pxmodel +117 -0
  175. package/kits/hub-game/models/earned/badge-star.pxmodel +87 -0
  176. package/kits/hub-game/models/earned/belt-plain.pxmodel +72 -0
  177. package/kits/hub-game/models/earned/held-ball.pxmodel +43 -0
  178. package/kits/hub-game/models/earned/held-lantern.pxmodel +85 -0
  179. package/kits/hub-game/models/earned/held-net.pxmodel +57 -0
  180. package/kits/hub-game/models/earned/held-trophy.pxmodel +109 -0
  181. package/kits/hub-game/models/earned/pin-round.pxmodel +62 -0
  182. package/kits/hub-game/models/earned/sash-plain.pxmodel +66 -0
  183. package/kits/hub-game/models/earned/square/belt-plain.pxmodel +104 -0
  184. package/kits/hub-game/models/earned/square/sash-plain.pxmodel +98 -0
  185. package/kits/hub-game/models/hats/bat-clip.pxmodel +206 -0
  186. package/kits/hub-game/models/hats/beekeeper.pxmodel +149 -0
  187. package/kits/hub-game/models/hats/cap.pxmodel +162 -0
  188. package/kits/hub-game/models/hats/captain.pxmodel +178 -0
  189. package/kits/hub-game/models/hats/crooked-top.pxmodel +172 -0
  190. package/kits/hub-game/models/hats/flower-crown.pxmodel +451 -0
  191. package/kits/hub-game/models/hats/foam-crown.pxmodel +179 -0
  192. package/kits/hub-game/models/hats/lantern.pxmodel +230 -0
  193. package/kits/hub-game/models/hats/laurel.pxmodel +533 -0
  194. package/kits/hub-game/models/hats/lighthouse.pxmodel +96 -0
  195. package/kits/hub-game/models/hats/sailor.pxmodel +141 -0
  196. package/kits/hub-game/models/hats/souwester.pxmodel +131 -0
  197. package/kits/hub-game/models/hats/straw.pxmodel +139 -0
  198. package/kits/hub-game/models/hats/sunflower.pxmodel +406 -0
  199. package/kits/hub-game/models/hats/sweatband.pxmodel +112 -0
  200. package/kits/hub-game/models/hats/witch.pxmodel +147 -0
  201. package/kits/hub-game/package-lock.json +2 -0
  202. package/kits/hub-game/package.json +2 -1
  203. package/kits/hub-game/scripts/check.mjs +78 -11
  204. package/kits/hub-game/scripts/companion-follower-wire.json +1 -0
  205. package/kits/hub-game/scripts/fixtures/decor-keyless-draw.json +121 -0
  206. package/kits/hub-game/scripts/fixtures/decor-keyless.json +293 -0
  207. package/kits/hub-game/scripts/fixtures/engine-models-stub.mjs +23 -0
  208. package/kits/hub-game/scripts/fixtures/fake-dom.mjs +107 -0
  209. package/kits/hub-game/scripts/fixtures/interest-legacy.json +385 -0
  210. package/kits/hub-game/scripts/fixtures/npc-notes-v1.77.jsonl +4 -0
  211. package/kits/hub-game/scripts/fixtures/vis-shared-wire.json +1 -0
  212. package/kits/hub-game/scripts/gen-avatars.mjs +933 -16
  213. package/kits/hub-game/scripts/gen-earned.mjs +285 -0
  214. package/kits/hub-game/scripts/gen-hats.mjs +827 -0
  215. package/kits/hub-game/scripts/grab.before-orbit.mjs +400 -0
  216. package/kits/hub-game/scripts/soundscape-wave-analysis.mjs +125 -0
  217. package/kits/hub-game/scripts/test-actions-client.mjs +488 -0
  218. package/kits/hub-game/scripts/test-actions.mjs +298 -0
  219. package/kits/hub-game/scripts/test-actor-budget.mjs +44 -0
  220. package/kits/hub-game/scripts/test-actors.mjs +19 -17
  221. package/kits/hub-game/scripts/test-ask-client.mjs +358 -0
  222. package/kits/hub-game/scripts/test-ask.mjs +269 -0
  223. package/kits/hub-game/scripts/test-attention.mjs +10 -1
  224. package/kits/hub-game/scripts/test-avatar-cap.mjs +379 -0
  225. package/kits/hub-game/scripts/test-avatar-colors.mjs +72 -0
  226. package/kits/hub-game/scripts/test-avatar-models.mjs +181 -0
  227. package/kits/hub-game/scripts/test-avatar-share.mjs +318 -0
  228. package/kits/hub-game/scripts/test-avatar-wire.mjs +753 -0
  229. package/kits/hub-game/scripts/test-avatar.mjs +540 -7
  230. package/kits/hub-game/scripts/test-ballot.mjs +1001 -0
  231. package/kits/hub-game/scripts/test-build.mjs +31 -0
  232. package/kits/hub-game/scripts/test-cells.mjs +71 -0
  233. package/kits/hub-game/scripts/test-chat.mjs +694 -0
  234. package/kits/hub-game/scripts/test-classic.mjs +2 -0
  235. package/kits/hub-game/scripts/test-companion-chat.mjs +198 -0
  236. package/kits/hub-game/scripts/test-companion-client.mjs +1167 -0
  237. package/kits/hub-game/scripts/test-companion.mjs +259 -0
  238. package/kits/hub-game/scripts/test-decor-client.mjs +303 -0
  239. package/kits/hub-game/scripts/test-decor.mjs +457 -0
  240. package/kits/hub-game/scripts/test-earned-client.mjs +459 -0
  241. package/kits/hub-game/scripts/test-earned.mjs +1194 -0
  242. package/kits/hub-game/scripts/test-emote-bubble.mjs +110 -0
  243. package/kits/hub-game/scripts/test-friend-bests.mjs +435 -0
  244. package/kits/hub-game/scripts/test-grab-client.mjs +186 -3
  245. package/kits/hub-game/scripts/test-grab-orbit.mjs +918 -0
  246. package/kits/hub-game/scripts/test-grab.mjs +864 -3
  247. package/kits/hub-game/scripts/test-hats.mjs +483 -0
  248. package/kits/hub-game/scripts/test-hub-leaving.mjs +203 -0
  249. package/kits/hub-game/scripts/test-hub-ops.mjs +439 -2
  250. package/kits/hub-game/scripts/test-hub-trip.mjs +1228 -1
  251. package/kits/hub-game/scripts/test-hud-clear.mjs +1000 -0
  252. package/kits/hub-game/scripts/test-idle.mjs +361 -1
  253. package/kits/hub-game/scripts/test-interest-cap.mjs +36 -0
  254. package/kits/hub-game/scripts/test-interest-cells.mjs +493 -0
  255. package/kits/hub-game/scripts/test-interest-client.mjs +118 -0
  256. package/kits/hub-game/scripts/test-keys.mjs +46 -1
  257. package/kits/hub-game/scripts/test-labels.mjs +596 -0
  258. package/kits/hub-game/scripts/test-manifest.mjs +282 -0
  259. package/kits/hub-game/scripts/test-menu-client.mjs +480 -0
  260. package/kits/hub-game/scripts/test-menu.mjs +296 -0
  261. package/kits/hub-game/scripts/test-npcs.mjs +1718 -12
  262. package/kits/hub-game/scripts/test-object-entry.mjs +76 -0
  263. package/kits/hub-game/scripts/test-pack.mjs +7 -0
  264. package/kits/hub-game/scripts/test-party.mjs +22 -1
  265. package/kits/hub-game/scripts/test-picker.mjs +314 -0
  266. package/kits/hub-game/scripts/test-rehello.mjs +1039 -0
  267. package/kits/hub-game/scripts/test-relations-among.mjs +222 -0
  268. package/kits/hub-game/scripts/test-relations-refresh.mjs +188 -0
  269. package/kits/hub-game/scripts/test-say.mjs +59 -2
  270. package/kits/hub-game/scripts/test-shot.mjs +756 -0
  271. package/kits/hub-game/scripts/test-soundscape.mjs +5432 -0
  272. package/kits/hub-game/scripts/test-spin.mjs +314 -0
  273. package/kits/hub-game/scripts/test-standing.mjs +416 -0
  274. package/kits/hub-game/scripts/test-stuck.mjs +1903 -0
  275. package/kits/hub-game/scripts/test-tier-cells.mjs +706 -0
  276. package/kits/hub-game/scripts/test-tiers-render.mjs +339 -0
  277. package/kits/hub-game/scripts/test-tiers.mjs +666 -3
  278. package/kits/hub-game/scripts/test-toast-band.mjs +61 -0
  279. package/kits/hub-game/scripts/test-try-on.mjs +940 -0
  280. package/kits/hub-game/scripts/test-vis.mjs +343 -0
  281. package/kits/hub-game/scripts/test-visibility.mjs +134 -0
  282. package/kits/hub-game/scripts/test-yours-chrome.mjs +166 -0
  283. package/kits/hub-game/scripts/test-yours.mjs +372 -0
  284. package/kits/multiplayer-3d/CLAUDE.md +50 -0
  285. package/kits/multiplayer-3d/castle.json +5 -5
  286. package/kits/multiplayer-3d/code/client/avatars.js +7 -0
  287. package/kits/multiplayer-3d/code/client/gait.js +65 -0
  288. package/kits/multiplayer-3d/code/client/nameTags.js +59 -4
  289. package/kits/multiplayer-3d/code/options.js +5 -0
  290. package/kits/multiplayer-3d/code/server/ownership.js +10 -2
  291. package/kits/multiplayer-3d/code/server/sceneBodies.js +12 -0
  292. package/kits/multiplayer-3d/code/server/world.js +7 -0
  293. package/kits/multiplayer-3d/code/systems/multiplayer.js +74 -4
  294. package/kits/multiplayer-3d/package.json +2 -1
  295. package/kits/multiplayer-3d/scripts/fixtures/README.md +11 -0
  296. package/kits/multiplayer-3d/scripts/fixtures/ownership-legacy.json +2 -0
  297. package/kits/multiplayer-3d/scripts/ownership-harness.mjs +102 -0
  298. package/kits/multiplayer-3d/scripts/ownership-loader.mjs +46 -0
  299. package/kits/multiplayer-3d/scripts/ownership-worker.mjs +15 -0
  300. package/kits/multiplayer-3d/scripts/record-ownership-session.mjs +98 -0
  301. package/kits/multiplayer-3d/scripts/test-eligible-claims.mjs +167 -0
  302. package/kits/multiplayer-3d/scripts/test-own-name-tag.mjs +247 -0
  303. package/kits/physics-2d/CLAUDE.md +9 -0
  304. package/kits/physics-2d/castle.json +2 -2
  305. package/kits/physics-2d/engine/scene.js +288 -1
  306. package/kits/physics-2d/engine/skyKey.js +129 -0
  307. package/kits/physics-2d/engine/stillClock.js +106 -0
  308. package/kits/physics-2d/engine/updateBudget.js +21 -0
  309. package/kits/physics-2d/scripts/test-skip-unchanged.mjs +370 -1
  310. package/kits/physics-3d/CLAUDE.md +1391 -0
  311. package/kits/physics-3d/behaviors/Player.jsx +921 -3
  312. package/kits/physics-3d/castle.json +3 -3
  313. package/kits/physics-3d/docs/pxmodel-format.md +12 -0
  314. package/kits/physics-3d/engine3d/Scene3DPlayer.jsx +98 -10
  315. package/kits/physics-3d/engine3d/actornode.js +86 -0
  316. package/kits/physics-3d/engine3d/animationBudget.js +23 -0
  317. package/kits/physics-3d/engine3d/editorWorld.js +6 -0
  318. package/kits/physics-3d/engine3d/emptynodes.js +232 -0
  319. package/kits/physics-3d/engine3d/framecap.js +96 -0
  320. package/kits/physics-3d/engine3d/gait.js +118 -0
  321. package/kits/physics-3d/engine3d/kithooks.js +47 -0
  322. package/kits/physics-3d/engine3d/look.js +507 -48
  323. package/kits/physics-3d/engine3d/lookbake.js +208 -0
  324. package/kits/physics-3d/engine3d/materialpresets.js +2 -0
  325. package/kits/physics-3d/engine3d/motion.js +39 -10
  326. package/kits/physics-3d/engine3d/nearshadows.js +37 -19
  327. package/kits/physics-3d/engine3d/optimize.js +58 -5
  328. package/kits/physics-3d/engine3d/orbitinput.js +755 -0
  329. package/kits/physics-3d/engine3d/orbitlens.js +48 -0
  330. package/kits/physics-3d/engine3d/ownmodel.js +213 -0
  331. package/kits/physics-3d/engine3d/pxmodel.js +42 -11
  332. package/kits/physics-3d/engine3d/shadowfade.js +882 -0
  333. package/kits/physics-3d/engine3d/sky.js +547 -0
  334. package/kits/physics-3d/engine3d/skylife.js +306 -0
  335. package/kits/physics-3d/engine3d/unchanged.js +11 -0
  336. package/kits/physics-3d/engine3d/viewrange.js +52 -0
  337. package/kits/physics-3d/engine3d/world3d.js +870 -87
  338. package/kits/physics-3d/main.jsx +5 -0
  339. package/kits/physics-3d/package.json +1 -1
  340. package/kits/physics-3d/scripts/Player.before-orbit.mjs +310 -0
  341. package/kits/physics-3d/scripts/Scene3DPlayer.before-orbit.jsx +337 -0
  342. package/kits/physics-3d/scripts/look-baseline.mjs +155 -0
  343. package/kits/physics-3d/scripts/test-camera-follow.mjs +12 -2
  344. package/kits/physics-3d/scripts/test-camera-orbit.mjs +4588 -0
  345. package/kits/physics-3d/scripts/test-drop-empty-parts.mjs +787 -0
  346. package/kits/physics-3d/scripts/test-frame-cap-bob.mjs +435 -0
  347. package/kits/physics-3d/scripts/test-frame-cap.mjs +452 -0
  348. package/kits/physics-3d/scripts/test-gait.mjs +387 -0
  349. package/kits/physics-3d/scripts/test-look-bake.mjs +1056 -0
  350. package/kits/physics-3d/scripts/test-model-parse-cache.mjs +92 -0
  351. package/kits/physics-3d/scripts/test-near-shadows.mjs +3 -0
  352. package/kits/physics-3d/scripts/test-orbit-shadow-fade.mjs +1920 -0
  353. package/kits/physics-3d/scripts/test-orbit-shift-lock.mjs +545 -0
  354. package/kits/physics-3d/scripts/test-orbit-shot.mjs +583 -0
  355. package/kits/physics-3d/scripts/test-orbit-view.mjs +230 -0
  356. package/kits/physics-3d/scripts/test-skip-empty-nodes.mjs +845 -0
  357. package/kits/physics-3d/scripts/test-sky.mjs +2470 -0
  358. package/kits/physics-3d/scripts/test-static-actors.mjs +13 -1
  359. package/kits/physics-3d/scripts/test-static-passes.mjs +1 -1
  360. package/kits/physics-3d/scripts/test-static-scenery.mjs +2171 -0
  361. package/kits/physics-3d/scripts/test-steady-hover.mjs +635 -0
  362. package/kits/physics-3d/scripts/test-view-range.mjs +260 -0
  363. package/kits/physics-3d/systems/physics3d.js +474 -12
  364. package/kits/real-time/castle.json +2 -2
  365. package/kits/real-time/code/server/gameHooks.js +7 -0
  366. package/kits/real-time/code/server/session.js +97 -19
  367. package/package.json +2 -2
  368. package/dist/shell/assets/index-Cf61cNfT.css +0 -1
@@ -1,6 +1,6 @@
1
1
  # The hub-game contract
2
2
 
3
- **Version 1.22** (2026-10-04; v1 plus the optional additions under "Changes in
3
+ **Version 1.91** (2026-10-08; v1 plus the optional additions under "Changes in
4
4
  v1", each marked with the minor version that added it). Kit: `castle.hub-game` (`kits/hub-game`). Design:
5
5
  `cauldron-game-server` `docs/HUB.md` (decision 3: a hub game is a kit plus a
6
6
  contract). Inputs: the M0 report's Tier 0 gaps 1-9 (card
@@ -58,14 +58,48 @@ curation where it cannot:
58
58
  "sign": { "model": "models/sign.pxmodel", "board": "score" }, // optional
59
59
  "npcs": { "route": "town", "slot": "square", "turnsPerMinute": 6 }, // optional; §13
60
60
  "fallY": -10, // optional (v1.1); below this a player has fallen (§5)
61
+ "house": { "devOwner": "first" }, // optional (v1.67); first arrival owns a dev house (§4)
62
+ "actions": true, // optional (v1.74); private action chips (§9)
63
+ "resume": { "keep": true }, // optional (v1.89), retain a short-drop visit; true keeps v1.72 leave/re-arrive (§12)
64
+ "menu": true, // optional (v1.79); private place menu (§9)
65
+ "ask": true, // optional (v1.75); private text prompt (§9)
66
+ "decor": { "grid": { "origin": "floor", "w": 8, "d": 7, "cell": 1 }, "layers": ["rug", "floor"] }, // optional (v1.67); §10
61
67
  "grab": true, // optional (v1.3); players pick up loose objects and throw them (§6)
62
68
  "idle": { "emotes": true, "seats": true, "sounds": ["sounds/jukebox.mp3"] }, // optional (v1.6); emotes, seats, the place's sounds (§6)
69
+ "hud": { "clear": true }, // optional (v1.26); a shorter HUD, and labels kept out from under it (§9)
70
+ "ballot": { "lines": [ // optional (v1.68); the choice card and the deck's fixed lines (§6)
71
+ { "id": "boat", "text": "I saw them by the boat", "about": "face" },
72
+ { "id": "not-me", "text": "Not me!", "about": "self" }
73
+ ] },
74
+ "interest": "cells", // optional (v1.65); body-cell interest, scene-authored visibility (§12)
63
75
  "nearestPlayers": 30, // optional; 1..100, how many other players each client is sent (§12)
64
76
  "tiers": true, // optional (v1.21); a cheaper picture on a slow device, client only
77
+ "cues": true, // optional (v1.23); a town says more about the friends and party a player came with
78
+ "stuck": true, // optional (v1.33); a town offers a player who walks and gets nowhere the way back to its arrival (§5)
79
+ "labels": "near", // optional (v1.43); a town's labels near the player only, never overlapping, three at most (§10)
80
+ "soundscape": true, // optional (v1.42, v1.49); babble, footsteps, opt-in zone beds/music, surface maps and UI cues, client only (§6)
81
+ "unlocks": [ // optional (v1.53, v1.70/v1.73); at most 8 wearable + 6 furniture/deed + 16 pet items (§11)
82
+ { "id": "cove-3-wins", "class": "badge", "shape": "badge-round", "name": "Cove Ace", "deed": "win 3 races in Cove", "color": "#3aa0d8" },
83
+ { "id": "farm-planter", "class": "furniture", "piece": "planter", "name": "Crate Planter", "deed": "buy at the Willowbank stand for 300 coins", "color": "#8a5a2b" },
84
+ { "id": "farm-yard", "class": "deed", "piece": "yard", "name": "Yard Deed", "deed": "buy at the Willowbank stand for 800 coins", "color": "#5aa04a" }
85
+ ],
65
86
  "places": { } // optional; more places in the same deck (§3)
66
87
  }
67
88
  ```
68
89
 
90
+ A deck may declare up to 8 wearable earned items (badge, pin, belt, sash,
91
+ held), up to 6 furniture or deed items, and separately up to 16 pet items,
92
+ with ids unique across all three groups. A home entry is exactly
93
+ `{ id, class, piece, name, deed, color }`;
94
+ `piece` matches `[a-z][a-z0-9-]{0,23}`; a pet species matches
95
+ `pet-[a-z][a-z0-9-]{0,19}` and never `pet-walk-*`. A `shape` on a home entry
96
+ or `piece` on a wearable is an error. The check warns about an unlisted piece and keeps it.
97
+
98
+ A malformed `unlocks` (more than 8 wearable, 6 furniture/deed or 16 pet items,
99
+ an entry out of the rules of §11, an id twice) is a manifest error like any other here: the kit refuses to load
100
+ the place, and `castle-web check` / save-deck's check catches it first. Ghost,
101
+ reading the saved deck, treats the same list as no unlocks at all.
102
+
69
103
  | field | type | rule |
70
104
  | --- | --- | --- |
71
105
  | `contract` | integer | `1`. A deck naming a version the kit does not know is refused (check fails; the server logs and runs nothing). |
@@ -81,10 +115,23 @@ curation where it cannot:
81
115
  | `places` | object | §3. |
82
116
  | `npcs` | object | §13. |
83
117
  | `fallY` | number | v1.1. -25 to 50 metres; below it a player has fallen (§5). Default: none, or -20 in a scene with no ground. |
84
- | `grab` | boolean or object | v1.3. `true`, or `{ throwSpeed, holdDistance, holdHeight }`: 1-14 m/s (default 10), 0.8-3 m (default 1.4), 0-2.5 m (default 1.2); any left out takes its default. v1.22 adds two, each optional: `reach`, 1.6-3 m, how far (flat, from the object's near side) an object is offered, and `steady`, true or false, an offer that holds through a moment at its edge (§6). Left out (or `steady: false`), neither is sent to the client nor changes anything: the place is offered, sent and drawn exactly what it was. `false` or absent: no grabbing (§6). |
118
+ | `grab` | boolean or object | v1.3. `true`, or `{ throwSpeed, holdDistance, holdHeight }`: 1-14 m/s (default 10), 0.8-3 m (default 1.4), 0-2.5 m (default 1.2); any left out takes its default. v1.22 adds two, each optional: `reach`, 1.6-3 m, how far (flat, from the object's near side) an object is offered, and `steady`, true or false, an offer that holds through a moment at its edge (§6). Left out (or `steady: false`), neither is sent to the client nor changes anything: the place is offered, sent and drawn exactly what it was. v1.25 adds `keepHeld`, true or false: a held object stays its holder's, whoever stands nearer (§6); left out or `false`, a place is sent, simulated and drawn exactly as it was. `false` or absent: no grabbing (§6). |
85
119
  | `idle` | boolean or object | v1.6. `true` (emotes and seats), or `{ emotes, seats, sounds }`: `emotes` and `seats` true or false (default false), `sounds` up to 16 different `.mp3`/`.wav`/`.m4a` paths (lower-case extensions, as the engine bundles them) of this deck that `hub.sound` may play (each at most 256 KB, 1 MB in all, checked at publish). `false`, absent or all off: none of it (§6). |
120
+ | `hud` | object | v1.26. `{ clear }`, `clear` true or false (default false; `false` and `{}` are the same as leaving `hud` out). `true`: the place's HUD is laid out to stay short and what the hub draws over the world is kept out from under it (§9, "A clear HUD"). Client only: the server reads it, tells the client, and does nothing else by it. A place without it is sent and drawn exactly what it was. |
121
+ | `actions` | boolean | v1.74, a place's (`hub.actions` or `hub.places.<id>.actions`): `true` enables private action chips (§9). Any value other than `true` or an absent key is a manifest error. Absent: no API, action hook lookup, private state, chrome, message or snapshot key; existing wire bytes stay identical. |
122
+ | `companion` | boolean or object | v1.71, a place's (`hub.companion` or `hub.places.<id>.companion`): `true` enables the private companion (§9); `{ "chat": { "character": "companion", "name": "Chirp" } }` also enables owner-only NPC chat (§13). Chat needs `npcs` configured; unknown keys at either nesting level are errors. `character` names an id in the deck's `characterBundle` (non-blank, up to 100 characters / 128 UTF-8 bytes, no NUL); `name` is non-blank, 1..24 code points with no control characters. Leave the key out to disable it. Absent: no API, private state, drawer, message or `hubGlow`; existing wire bytes stay identical. |
123
+ | `visibility` | boolean | v1.91, per place: `true` enables the client visibility signal and server `visibility` hook (§12). Any other value is an error. Absent: no listener, signal, hook dispatch, state or wire field. |
124
+ | `resume` | true or object | v1.72, a place's (`hub.resume` or `hub.places.<id>.resume`), valid only on a place with `result`: `true` says the place's game handles a player's return within a round, so a player the platform let go and who comes back under the same player id is arrived again once (§12, `hub-hello`). The visit goes on: one result per visit (a second `hub.result` is refused, a result reported in `leave` included), one deadline from the first arrival, the end sent again to an ended visit, and the first door kept. v1.89 also accepts exactly `{ keep: true }`: retain the player entry for a same-id reconnect within 60 seconds of observed absence, with no `leave` or `arrive`; see §12. Other values, extra object keys, or the key on a place without `result` are manifest errors. Absent: a game takes no same-id re-hello and no late greet (unchanged), with no extra state, message, field or listener; existing wire bytes stay identical. |
125
+ | `menu` | boolean | v1.79, a place's (`hub.menu` or `hub.places.<id>.menu`): only `true` enables a private place menu (§9). Any other value is a manifest error. Absent: no API, menu hook lookup, private state, chrome, message, snapshot or delta key; existing wire bytes stay identical. |
126
+ | `ask` | boolean | v1.75, a place's (`hub.ask` or `hub.places.<id>.ask`): only `true` enables a private text prompt (§9). Any other value is a manifest error. Absent: no API, answer hook lookup, private state, chrome, message, snapshot or delta key; existing behavior and wire bytes stay identical. |
127
+ | `ballot` | boolean or object | v1.68, a place's (the main block or a place under `places`). `true` (the card with no lines: faces and options only), or `{ lines }`: at most 32 lines, each `{ id, text, about }` -- `id` `[a-z0-9-]`, 1-24 characters, never twice; `text` 1-40 characters on one line (trimmed); `about` `"face"` (said about a player whose face is tapped first: "I saw them by the boat") or `"self"` (said by the speaker alone: "Not me!"). Any other key, here or in a line, is a manifest error. These lines are the only words a player can send through the card (§6, "The choice card"). `false` or absent: no card, no message, no snapshot field, no chrome; the place is sent and drawn exactly what it was. The client is told the lines in `hubPlace.ballot`. |
86
128
  | `nearestPlayers` | integer | 1-100, default 30. Each client is sent the poses of only this many other players, the nearest (§12). |
87
- | `tiers` | boolean | v1.21, the deck's (not a place's). `true`: each client draws a cheaper picture where the device is slow -- a weak phone GPU or 2 GB or less of memory, or frames slower than 40 ms (the median of the first 5 s after arrival, or of any 10 s after), remembered on the device for 7 days. Low has no sun shadow (the render resolution is unchanged), no decorative actors (only `Transform`/`Shape`/`Model`), and no scenery (those plus `Solid`/`Lookable`) past 30 m or NPC bodies past 20 m; doors, pads, players and anything else with gameplay are always drawn, and in a game reached through a door only the shadow changes. The Character card gains Graphics: Auto / Low / High, kept on the device; Low or High wins. Nothing changes on the wire or for other players. `false` or absent: none of it. |
129
+ | `tiers` | boolean | v1.21, the deck's (not a place's). `true`: each client draws a cheaper picture where the device is slow -- a weak phone GPU or 2 GB or less of memory, or frames slower than 40 ms (the median of the first 5 s after arrival, or of any 10 s after), remembered on the device for 7 days. Low has no sun shadow (the render resolution is unchanged), no decorative actors (only `Transform`/`Shape`/`Model`), and no scenery (those plus `Solid`/`Lookable`) past 30 m or NPC bodies past 20 m; doors, pads, players and anything else with gameplay are always drawn, and in a game reached through a door only the shadow changes (v1.69: and its kit sky is not drawn on Low). v1.30: an actor in a scene file may carry `"tier": "keep"` -- a field of the actor beside `id` and `components`, not a component -- and is then drawn on every tier at any distance, whatever its components; a place's ground (paving, grass, merged dressing: plain `Transform`/`Shape`/`Model`) needs it, or Low draws the place standing on nothing. The mark is read from the scene file, so it says nothing of an actor spawned while playing (those were never hidden); v1.63: `"tier": "near"` instead treats a non-NPC actor as scenery on Low, whatever its components: its node is taken out beyond 30 m of its bounds (the same sized test as static scenery) and put back within that distance. High never hides it; NPCs retain their own 20 m rule, and `keep` wins (the field carries one mark). v1.69: `"tier": "low"` draws an authored actor only on Low, at any distance, without the decoration/scenery/NPC distance rules; High removes its node from the scene graph, and switching back to Low restores its original parent. On High the node is drawn in the one frame that built it (a scene load, or the actor's rebuild): the tier rules run before the engine builds nodes. The place's per-viewer hiding and visibility cells still apply on Low. Low also draws no `engine.sky` dome at all (no drawing, zone stepping or texture uploads), in whatever scene plays, the frame of a scene load included; High draws the zone skies as authored. Both change on the frame after Graphics or the auto judge changes tier. A scene may therefore provide the kit sky for High and a cheap sky actor marked `"tier": "low"` for Low. No physics-3d change: while Low, hub-game puts an own `sky` of null on the scene runtime, over the getter the engine reads each frame, and deletes it on leaving Low; a device that is never Low has no such property. A scene with no low mark draws on High exactly as before, and a scene without the sky key draws on Low exactly as before. Labels, colliders and server state are untouched. Any other value, or none, is an actor as before. The scene editor has no control for it (it is written in the file) and keeps it through a save, and a duplicated actor carries it. The Character card gains Graphics: Auto / Low / High, kept on the device; Low or High wins. Nothing changes on the wire or for other players. `false` or absent: none of it. v1.64: a scene file may carry a top-level `cells` key beside `engine` and `actors` -- `{ version: 1, eyeMax, hysteresis, cells: [{ id, outline: [[x, z], ...], sees: [ids], why? }] }`, outlines partitioning the ground (x east, z south), `sees` the cells visible from somewhere in that one -- and an actor a `cell` field beside `id` (`"n-plaza"`, or a list for one spanning several). On Low only, an eye outside every outline or at a non-finite place has no cell, whatever the hysteresis; otherwise the camera's cell is the one its x, z is in, kept while the eye is inside it or within `hysteresis` m of it. An authored, tagged actor none of whose cells that cell sees is not drawn, `"tier": "keep"` and `"tier": "near"` included: keep exempts distance, not what is in the way (a list is drawn when any of its cells is seen). Only an inert actor is ever out for its cell: every component it has now is one of `Transform`, `Shape`, `Model`, `Solid`, `Lookable`, `RouteAnchor`, `WalkSurface` (`CELL_INERT`; a Lookable's words are read from the scene data either way) and none is in the backstop `CELL_PROTECTED` (`HubDoor`, `HubPad`, `HubNpc`, `Body`, `Player`, `Ball`, `HubSpin`, `TownHats`, `TownStamp`, `TownHatMat`, `TownWardrobeMat`, `TownWardrobeItem`, `TownWardrobe`). Anything that reacts to a player or the server or that something moves (a seat, a sign, a court piece, a statue, any other `Hub*`/`Town*` or unknown component), or an actor with no components, is never out for its cell, whatever its `cell` or `tier` says, and the other Low rules apply to it as before. This is decided from the actor's current components on every look, never remembered: an actor replaced under the same id, or given a component while playing, is decided again on the next look. An eye above `eyeMax` or with no cell, or a game through a door: the cells hide nothing. A malformed table (another version, a cell without a string id, an outline of three or more finite pairs or a `sees` of known ids that includes its own, a duplicate id, a non-finite `eyeMax`/`hysteresis`) is no table; a `cell` that is empty, not strings, or names an unknown id is no cell. `?hubcells=1` shows an overlay (the cell, what is out and why, the last change). Nothing on the wire; a scene without the key is drawn exactly as before. `false` or absent: none of it. |
130
+ | `yourGames` | boolean | v1.54, the deck's (not a place's). `true`: signed-in players in towns get private hearted/recent door rows, account hearts and an arrival offer (§5). `false` or absent: no command, message, UI or storage read; the deck draws exactly what it did. |
131
+ | `cues` | boolean | v1.23, the deck's (not a place's). `true`, in a town (a place with no `result`): (a) while someone in the roster with a known user id is not named by the host as a friend, the host is asked for the player's friends again a few times in the ~16 s after they were first seen (at about 1, 3, 9 and 15 s -- v1.32; 1, 5, 10, 16 in v1.31; 2, 6, 11 and 17 s before, when the host learned who is in a town only on its heartbeat; those here when the player came in count from then), because the host names a friend only once it knows both are in the town (within a few seconds in the same layer, on its heartbeat across layers) -- never while an ask is out, at most two such asks in any 8 s and 2 s apart however many come in (one in 4 s before v1.32), stopping when the host names them or they leave, the ordinary 20 s ask after that, and a friend already here when the player came in is announced as one who arrives later is ("amy is here · People to join", pointed to), once per friend per session and not where "You're next to amy" said it; (b) the chat field's placeholder says who reads a line ("To your follows…"; the whole sentence is its accessible label) or, disabled, "Friends only" with one sentence as its note and label whatever the reason, so neither tells which it is (v1.29: "Typed chat is for friends who follow each other. Emotes work with everyone."; before v1.29 "No follows here" / "Chat not available" and the longer notes), and the host is asked for chat peers within about a second of someone coming in; (c) "Let's play…" names the door of the speaker's open party proposal before the door they stand by; (d) a party that gains a member says so ("You joined amy's party", "bo joined your party"); (e) v1.29: a player back from a game through one of the town's doors is asked, for 20 s and after any invitation or party proposal, "Play <door> again?" -- Play again is the Doors list's Go for that door (onto its pad; in a party, and for a door that is not `solo`, "Play <door> again together?" / Go together, which proposes it to the party), Not now puts it away. Who is a friend is only what `Hub.friends` already says, and a party is the place's own; chat's rules are ghost's, unchanged. `false` or absent: none of it -- the deck is sent and draws exactly what it did. |
132
+ | `stuck` | boolean | v1.33, the deck's (not a place's). `true`, in a town (a place with no `result`): a player who has given 3 s of walk input within the last 8 s (v1.39: counted across the breaks; 3 s without a break before) while their body got less than 1 m from anywhere it was in that stretch (v1.39; within 0.3 m of where it began before) is offered a chip, "Stuck? Tap to go to the square", and the Doors list gains a "Stuck?" row over its doors; a tap on either has the place put that player back at its arrival, or (v1.39) at the spot its `unstick` hook picks for them (§5 "Stuck?": once in 5 s, never a held player). Nobody is moved without their tap. The chip names the arrival by the place's own `where` word for that spot without its first word ("in the square" → "the square"), and reads "Stuck? Tap to go back to the start" where the place has none. Never in a game (a place with a `result`), whatever the deck says. `false` or absent: none of it -- no chip, no row, no message, and the deck is sent and draws exactly what it did. |
133
+ | `labels` | `"near"` | v1.43, the deck's (not a place's) and the client's alone, like `tiers`: the server reads nothing of it and `hubPlace` does not carry it. In a town (a place with no `result`) the labels `hub.label` puts over scene actors are kept near the player and apart (§10 "Labels kept near"). Any other value is refused; a deck without it draws every label exactly as it did |
134
+ | `soundscape` | boolean or object | v1.42, the deck's (not a place's): synthesis belongs to the client; only the optional v1.50 `cues` part is read by the server and sends named cue messages. `true`, or `{ babble, steps }`, each true or false and on when left out (`{}` is `true`; `false` is the same as leaving the key out). In every place of the deck: NPC lines are voiced as babble, footsteps sound under the player and those near them, and the chrome has a sound control (mute, volume) that also scales the place's own `hub.sound` files (§6, "The soundscape"). v1.49 adds optional `zones` (a scene component name), `ambience: { beds, default, spots, music }`, object `steps: { default, zones, paths }` and boolean `ui` (§6). These fields alone opt into ambience, music, mapped surfaces and UI cues; `true` enables only babble and street steps, including the lighter v1.50 footfall body. v1.50 adds explicit boolean `cues` for named place cues and client-observed actions; it is independent of `ui` and never implied by `true`. Unknown keys, bed or surface names and wrong types are check failures. Without the key nothing of it exists: no audio context, no listener, no storage read, no control, and the place's sounds play exactly as they did. |
88
135
 
89
136
  Unknown keys are a check failure, not ignored: a typo in a contract field must
90
137
  not publish as "no such rule".
@@ -139,25 +186,43 @@ of any of these. Every hook gets `hub`, the place's context, first:
139
186
  | hook | when |
140
187
  | --- | --- |
141
188
  | `ready(hub)` | the world is built, before the first tick |
142
- | `arrive(hub, group)` | players with bodies who arrived together this tick: `[{ playerId, username, userId, from, fromDeckId, near, carry }]` (`userId` v1.2: a signed-in player's user id, null for an anonymous one). `from` is the door they came in by; `near` the user id of the friend they jumped to (Join), or null; `carry.result` what they bring back from a game (§7). The kit has already placed them at the arrival (§5), and a player who jumped to a friend in this session beside that friend, facing them; a hook may place them elsewhere |
189
+ | `arrive(hub, group)` | players with bodies who arrived together this tick: `[{ playerId, username, userId, from, fromDeckId, near, carry }]` (`userId` v1.2: a signed-in player's user id, null for an anonymous one). `from` is the door they came in by; `near` the user id of the friend they jumped to (Join), or null; `carry.result` what they bring back from a game (§7). The kit has already placed them at the arrival (§5), and a player who jumped to a friend in this session beside that friend, facing them; a hook may place them elsewhere (v1.40: wherever the hook leaves them is where they are kept for the first 0.6 s, as after a jump: the body is put back each tick a late move report pulls it off the spot) |
190
+ | `resume(hub, { playerId })` | v1.89, optional: an already-arrived player sent a fresh or resume hello under their retained id. Called after that step's private-channel replay sends, once per id per step. First arrivals, genuine re-arrivals and avatar-change (`again: true`) hellos do not call it. Restore deck-owned HUD or pointer state here; this is neither `arrive` nor `leave`. Hook presence opts in, including in towns without a `resume` manifest key. See §12. |
143
191
  | `step(hub, dt)` | after each physics step; `dt` seconds |
144
192
  | `fall(hub, playerId)` | v1.1: a player fell below the place's `fallY` (§5); place them somewhere, or the kit puts them back at the arrival |
145
193
  | `carry(hub, playerId, carry)` | where the host has hub ops: what an already-arrived player brings back, when ghost's read came after the arrival window (§7) |
146
- | `leave(hub, playerId, { userId, username })` | a player left (Back, the host's Back, a closed tab). Runs while the player is still known (v1.2): `hub.result` takes their result for the visit here, and `userId` names their storage (§14) |
194
+ | `leave(hub, playerId, { userId, username })` | a player left (Back, the host's Back, a closed tab). v1.89 `{ resume: { keep: true } }` delays an unexplained absence up to 60 s (§12); a short resume runs neither leave nor arrive. Runs while the player is still known (v1.2): `hub.result` takes their result for the visit here, and `userId` names their storage (§14) |
147
195
  | `shutdown(hub)` | v1.2: the session is stopping. Anyone still here has had `leave` first; return a promise to finish writing (awaited up to 1.5 s, inside the host's own grace) |
148
196
  | `grab(hub, playerId, actorId, op)` | v1.3, a place with `grab`: a player grabbed (`op` `"grab"`) or threw (`"throw"`) a loose object (§6). Return `false` to a grab to refuse it (the player lets go at once); a throw is only told. A hook that throws refuses the grab |
149
197
  | `emote(hub, playerId, id)` | v1.6, a place with `idle.emotes`: a player asked to play emote `id` (§6). Return `false` to refuse it (nobody sees it); a hook that throws refuses it |
198
+ | `npcReact(hub, npc, playerId, { emote })` | v1.47: a nearby free NPC may answer this player's emote (§6, §13). Return `false` to leave it alone, null or undefined for its props and the kit's defaults, or `{ emote, line }` to replace either. `emote` is a kit id or null for no motion; `line` is public speech, cut to 80 characters, or null for none. Errors are logged once and use the defaults. Async results are unsupported and ignored; rejected promises are caught with fixed log text. No model is called |
150
199
  | `sit(hub, playerId, seatId)` | v1.6, a place with `idle.seats`: a player asked to sit on seat actor `seatId` (§6). Return `false` to refuse; a hook that throws refuses |
200
+ | `action(hub, playerId, id)` | v1.74, a place with `actions: true`: an arrived, connected player pressed an id in their current offer, carrying a safe-integer `n` equal to that offer's current version (§9). Stale, removed, another player's, malformed or over-budget presses are silently dropped. Six presses/s with a burst of eight per player; dropped or refused presses spend tokens too. The return is ignored; throws and rejections are contained and logged once. Async hooks are neither serialised nor cancelled when the player leaves. |
201
+ | `menu(hub, playerId, id)` | v1.79, only with `menu: true`: an arrived, connected player picked an item in their current, last-sent menu with its safe-integer `n`, or closed the sheet (`id: "close"`). Stale, unknown, malformed and over-budget picks are dropped; readOnly refuses item picks but still delivers close. Six attempts/s, burst eight per player, including dropped presses. Return ignored; throws/rejections contained and logged once. Async hooks are neither serialised nor cancelled on leave. |
202
+ | `answer(hub, playerId, id, text)` | v1.75, only in a place with `ask: true`: that arrived, connected player answered their last-sent and still-current prompt; `text` is the exact string they typed, or `null` for Cancel (§9). The prompt is consumed and its close queued before the hook runs. Refused text on a current id/version consumes the prompt and calls the hook with null; it is never passed on. Two attempts/s, burst four per player; stale, malformed, oversized and dropped messages spend tokens too. Return ignored; throws and rejections contained and logged once without the text or error details. A place must never show what a player typed to another player. |
203
+ | `decor(hub, playerId, op)` | v1.67, a place with `decor`: an offered button or an open catalogue's validated edit (§10 Decorating). The deck checks ownership, stock and collisions and applies the edit; the kit moves or spawns nothing |
204
+ | `ballot(hub, playerId, { face, line, option, mode })` | v1.68, a place with `ballot`: a player tapped the choice card (§6). `face` a player id on their card or null, `line` a manifest line id or null, `option` an option id of the card or null, `mode` the card's mode then. The kit has already checked it against the card that player was last sent and limited it; the hook decides what it means (a line for the card's `feed`, a vote to count). Its return is ignored; a hook that throws is logged |
151
205
  | `message(hub, player, data)` | a client message that is not the kit's own. Tier 0 games have no client code, so this is for bots and tests |
206
+ | `unstick(hub, playerId, from)` | v1.39, a town of a deck with `hub.stuck`: where to put a player who is stuck at `from` (`{ x, y, z }`, their body) and asked to be moved (§5 "Stuck?"): `{ x, z, y?, facing?, to? }` -- a spot inside the world box, `facing` in degrees, `to` the place's name for it in at most 40 characters ("the street") -- or null for the arrival. It answers at once (a promise is the arrival). Asked when the player taps, and also when their client is about to offer the tap, to word it: it must change nothing. A place without it lands its players at the arrival |
152
207
  | `where(hub, at)` | v1.9, a town: what the place calls the spot `at` (`{ x, y, z }`), for the People list (§5): a string of at most 40 characters ("in the square", "on Race Row"), or null. Asked only for a spot that is not on a door's pad or beside a door, which the kit words itself |
153
- | `npcLine(hub, npc, playerId, { why, text })` | an authored line for an NPC to say to a player when its mind is not answering (§13); return a string, or null for the kit's |
208
+ | `npcLine(hub, npc, playerId, { why, text, conversation })` | an authored line for an NPC to say to a player when its mind is not answering (§13); return a string, or null for the kit's. v1.47: an authored say receives the conversation number captured at admission, matching `npcOpening`'s `info.conversation` |
154
209
  | `npcContext(hub, npc, playerId)` | v1.8: what an NPC's mind should know right now while `playerId` talks to it (§13 notes): a string of at most 700 characters, or null for none. Read when the conversation opens and every second while it lasts |
155
- | `npcHeard(hub, npc, playerId, { text })` | v1.8: a turn to an NPC's mind was admitted; `text` is the player's own words (§13), for place state a conversation may change |
210
+ | `npcAsks(hub, npc, playerId)` | v1.80: questions the place keeps on offer while this player talks to the NPC's mind (§13): `{ persistentAsks: string[] }` or null. Re-read with each notes check; up to two strings, trimmed and cut to 40 characters, deduplicated after cutting. Private to that player in `hub-npc-notes`; lead the three-chip refill row and may return after being sent while still offered. Null clears them. Synchronous; async results are ignored and rejected promises caught; errors log once with fixed words. Absent: no new message key or refill behavior |
211
+ | `npcHeard(hub, npc, playerId, { text, conversation })` | v1.8: a turn to an NPC's mind was admitted; `text` is the player's own words (§13), for place state a conversation may change. v1.47: `conversation` is captured at admission and matches `npcOpening`'s; after the send settles, the hook runs only if that conversation still belongs to the same account and body |
212
+ | `npcOpening(hub, npc, playerId, { met, greeting, conversation })` | v1.37: what an NPC says first when `playerId` opens its chat, and what they might ask it (§13): `{ text, asks, more }`, a string (the words alone), or null. `text` is cut at 240 characters; `asks` is up to three questions of at most 40 characters each (longer ones are cut, repeats and extras dropped). v1.46: `more` is up to nine later questions with the same cut, deduped against `asks`; sent only when non-empty. Shown in that player's panel at once, to them alone, with no model called. A tap on a question sends it as the player's own words by the ordinary path (range, budget and age rules unchanged); after a reply the chips return (§13). `met`: this player has said something to this NPC since the place's server started (by account; a place that remembers longer keeps its own record); kept only where the hook exists. With a mind and `npcContext`, the opening is added to that conversation's notes so the mind knows what it said. An NPC with no mind and an opening says no `npcLine` hello as well. v1.46: no hook or no usable text gives a mind the kit's default opening; a body without a mind keeps its hello line. A hook's text and questions are its own, with no defaults added. v1.47: `conversation` is an integer increasing with every open of this NPC, so a place can match later words to its opening. `greeting` is this speaker's cached next greeting or null; when present it replaces the opening text, keeping the place's asks and more (§13). Async results are unsupported and ignored; rejected promises are caught and logged once with fixed text |
213
+ | `npcTools(hub, npc, playerId)` | v1.66: what an NPC's mind may look up while it answers this player (§13 tools): up to 8 `{ name, description, input_schema }`, read when a turn is admitted and sent with it. `name` matches `^[A-Za-z][A-Za-z0-9_]{0,31}$` and is not `perform_action` or `capture_claim`; `description` is 1-300 characters; `input_schema` a JSON-schema object of at most 1 KiB; the list at most 6 KiB. A bad entry is dropped, never the turn; a hook that throws or returns no entries leaves the turn as it was. Without it a turn is sent exactly as before |
214
+ | `npcTool(hub, npc, playerId, name, input)` | v1.66: the mind's one lookup for a turn this place admitted (§13 tools): `name` is one the turn declared, `input` the mind's object. Return a string or a JSON value (or a promise of one), at most 1 KiB once serialized; it goes to the mind alone. Answered within 1.5 s or the mind answers without it. Must never carry player-typed text. Called at most once per turn, and only for that turn's speaker |
156
215
 
157
216
  `hub` carries the session, so a tick can send (M0 gap 5):
158
217
 
159
218
  | member | what |
160
219
  | --- | --- |
220
+ | `hub.owner` | v1.67: the platform owner user id string on an owner door instance, null otherwise; dev-only `hub.house.devOwner: "first"` keeps the first arrival as owner for the session (below) |
221
+ | `hub.actions(playerId, items \| null)` | v1.74, present only in a place with `actions: true`: privately offer 0..3 `{ id, label }` chips. Unique ids match `[a-z][a-z0-9_-]{0,23}`; labels are strings of 1..16 characters (code points), no control, direction or zero-width characters, and cannot be only whitespace. Items must be plain objects with own `id` and `label` properties; each is read once, validated and copied; unknown keys are refused. `null` or `[]` clears. Invalid calls throw `TypeError` before changing state. Unknown, disconnected or not-arrived players return false; otherwise true. Calls record the newest list; a changed recorded list advances that player's safe-integer version `n`, including a change to null. The tick coalesces ordinary deliveries to at most four offers a second per player (250 ms apart), newest wins; equal last-sent and current lists send nothing. Leave drops chips; the session's counter is kept. A fresh hello immediately replays the current offer once (or null), with its current `n`. |
222
+ | `hub.companion(playerId, spec \| null)` | v1.71, present only with either companion manifest form: one private follower per arrived player. `spec` is a plain object with only own `look` (required, `"lantern"` or `"bird"`), optional `say` (string, 1..80 code points, at most 240 UTF-16 units, non-blank, no control, bidi, zero-width characters or newlines), optional `dress` (v1.78, bird only; enum slots and defaults in §9), optional `pose` (v1.78, bird only; only `"show"`), and optional `at` (scene actor id string, 1..64 characters; unknown ids are ignored by the client). Fields are read once, validated and copied. Invalid calls throw `TypeError` before changing state; an absent or not-arrived player returns false, otherwise true. `null` clears; equal specs change and send nothing. Ordinary tick sends coalesce to at most four/s per player, newest wins; a spec changed back to the last-sent one keeps that version. Fresh hello replays the current spec; leave forgets it, retaining the place session's version counter. The place authors every line; nothing a player typed may be passed to `say`. The line is never shown to anyone else. |
223
+ | `hub.menu(playerId, spec \| null)` | v1.79, present only with `menu: true`: privately offer the sheet described in §9. Null closes it. Validate and copy before changing state; invalid calls throw TypeError. Unknown, disconnected or not-arrived players return false; otherwise true. Every changed spec advances that player's safe-integer version `n`; equal re-sends send nothing. Tick coalesces to four ordinary offers/s; a fresh hello replays an open menu or a pending close once, and sends nothing for an unused menu or an already delivered close. Leave forgets the menu, retaining the counter to prevent reused versions. |
224
+ | `hub.ask(playerId, spec \| null)` | v1.75, present only with `ask: true`: one private prompt per player, replaced by a new spec. A plain object has exactly own `id`, `title`, `max`; each field is read once, validated and copied. Ids match `[a-z][a-z0-9_-]{0,23}`; titles are 1..32 code points, not whitespace-only, with no control, Bidi_Control or zero-width characters; `max` is a safe integer 1..32 code points. `null` closes. Invalid calls throw `TypeError` before changing state; unknown, disconnected or not-arrived players return false, otherwise true. Every changed recorded prompt, including null, advances safe-integer `n` from one session counter. Tick deliveries coalesce to at most four/s per player, newest wins, equal last-sent/current content and version suppressed. Leave forgets; a fresh hello replays the current prompt or null once with its `n`. Accepted answers consume and queue the close before calling the hook; it shares the tick delivery budget. |
225
+ | `hub.decor` | v1.67, present only in a place declaring `decor`: private `button`, `open`, `close` and `update` (§10 Decorating) |
161
226
  | `hub.session`, `hub.sim` | the Castle session and the multiplayer-3d simulation |
162
227
  | `hub.place` | `{ id, title, scene, manifest }` |
163
228
  | `hub.now` | simulation milliseconds |
@@ -166,7 +231,7 @@ of any of these. Every hook gets `hub`, the place's context, first:
166
231
  | `hub.placeAt(playerId, at, facingDeg?)` | move a player's body; reaches the client as a clamp |
167
232
  | `hub.hold(playerId, at?, facingDeg?)` / `hub.release(playerId)` | hold a player still (§8) |
168
233
  | `hub.setHud(spec, playerId?)` | the declared HUD, for everyone or one player (§9) |
169
- | `hub.hide(actorId)` / `hub.show(actorId)` | server-declared actor visibility (§10) |
234
+ | `hub.hide(actorId, options?)` / `hub.show(actorId, options?)` | server-declared actor visibility (§10); v1.62 `{ to: [playerIds], clear?: boolean }` overrides visibility for those connected viewers only. `clear: true` restores their shared view. True when taken; invalid actor/options or more than 256 overrides per player warn once and return false, changing nothing. Without options, the shared operation is unchanged |
170
235
  | `hub.move(actorId, { x, y, z, rotationY }, { overMs }?)` | move a kinematic scene actor, at once or in a straight line over `overMs`; any subset of the fields (§10, v1.1) |
171
236
  | `hub.tint(actorId, color)` | paint a Shape actor `#rrggbb` for everyone; `null` puts back its authored colour (§10, v1.1) |
172
237
  | `hub.pose(actorId)` | where an actor's body is now: `{ x, y, z, rotationY, velocity, owner }` (`owner` the player whose client simulates a loose object, or null), or null (§10, v1.3) |
@@ -174,11 +239,24 @@ of any of these. Every hook gets `hub`, the place's context, first:
174
239
  | `hub.spawn(fromActorId, { x, y, z, rotationY }?)` / `hub.despawn(id)` | a copy of a scene actor for everyone, returning its id (§10, v1.2) |
175
240
  | `hub.tune(playerId, { speed, jump })` | one player's own walk controller, as multipliers of the preset (§6, v1.2); `null` puts the preset back |
176
241
  | `hub.drop(playerId?)` / `hub.holding(playerId)` | v1.3: whoever holds an object lets go (default: everyone; a goal, a whistle), returning how many were told; the actor id a player holds, or null (§6) |
242
+ | `hub.keepFor(actorId, playerId \| null)` | v1.27: keep a loose (dynamic) object of a place with `grab` for one player: nobody else is offered it or may grab it, and the `grab` hook is not asked about their tries; `null` makes it anyone's again. Returns whether it is now kept as asked: an actor that is not a dynamic one of the scene, a player who is not here, or a place without `grab` is warned about once, returns `false` and changes nothing (§6) |
177
243
  | `hub.emote(playerId, id)` | v1.6, a place with `idle.emotes`: play a kit emote (`"wave"`, `"dance"`, `"cheer"`, `"bow"`, `"spin"`) on a player's avatar for everyone, without the hook or the rate a player's own request has; true when it took (§6) |
178
244
  | `hub.seat(playerId)` | v1.6: the seat actor id a player sits on, or null (§6) |
179
245
  | `hub.sound(actorId, file, { loop, volume, radius }?)` | v1.6, a place with `idle.sounds`: play one of them at a scene actor for everyone, `volume` 0-1 (default 1), silent `radius` metres away (1-60, default 20); a loop plays until `hub.sound(actorId, null)`; true when it took (§6) |
246
+ | `hub.cue({ player } or { actor, radius? }, name)` | v1.50, a deck with `soundscape.cues: true`: a named synthesised cue for one connected player or near a scene actor, radius 1–60 m (default 12); true when sent, otherwise false and warn once. Six cues/s with burst six per player, or shared per place for actor broadcasts; closed `CUE_NAMES`, no files (§6). v1.60 `busker-jig`/`busker-waltz` loop at an actor within radius under a 25 s re-send lease, one loop per client, or play one full-gain pass to a player. |
247
+ | `hub.shot(playerId, shot \| null)` | v1.61: send one connected player an orbit-camera moment shot `{ look: { x, y, z }, distance, pitch, yaw }`. Look coordinates, distance and angles must be finite, distance > 0 (metres); angles are degrees, pitch capped at ±89. Invalid shots warn once and act as `null` (clear). True when sent, otherwise false and warn once. Four changed shots/s per player, burst four; equal poses suppressed for 1 s, repeated clears suppressed, clears bypass the budget. The place scene needs the orbit key (`cameraControl: "orbit"`); without it the client does nothing and stores nothing for later. The orbit camera blends to the pose and holds until changed or cleared; the shot pose is not collided. The client clears on travel, leave, scene load/place change and disconnect, preserving any shot subsequently assigned by deck client code. A held pose is privately renewed every 2 s of simulation time and immediately on a fresh join, without spending the rate budget or equal-send refusal. Each accepted pose message refreshes a 5 s client lease; equal renewals keep the same shot object and do not restart the blend. Renewals restore a shot lost to a disconnect, but never re-create one the client dropped for a scene load, travel, round end or a deck's own `orbitShot`; only a fresh `hub.shot` call does that. Successful travel and round end stop server renewals while preserving the rate budget. A shot not renewed for 5 s is cleared on the first watcher run, including after a background-tab pause, so it cannot outlive its server or connection. A clear stops renewals. No manifest opt-in or storage/frame work when unused. |
248
+ | `hub.ballot(playerIds \| null, spec \| null)` | v1.68, a deck that declares `ballot` in some place (absent otherwise), in a place with it: show, change or take down the choice card (§6). `null` for everyone here (later joiners too); a list for those connected players (unknown or disconnected ids are ignored), whose card then replaces the shared one for them, as `setHud` does. `spec` null clears: for a list, those players fall back to the shared card; for everyone, every card goes, players' own included. `spec` is `{ title, text, until, mode, faces, options, lines, feed, picked }`, all optional: `title` ≤ 40 and `text` ≤ 120 characters on one line; `until` a simulation time (`hub.now`) the card counts down to; `mode` `"talk"` (default), `"vote"` or `"reveal"`; `faces` up to 24 `{ playerId, note?, off?, votes?, mark? }` (different players; `note` ≤ 24 characters, `off: true` greyed and not tappable, `votes` 0-99 shown as a tally, `mark` `'#rrggbb'`); `options` up to 6 `{ id, text }` (`id` as a line's, `text` ≤ 32: "Skip"); `lines` the manifest line ids offered now (default all); `feed` up to 6 `{ from, to, line }` the card's recent said lines (`to` a player for a `face` line, null or absent for a `self` one); `picked` `{ face }` or `{ option }` (one of the card's), what this viewer has locked in. True when taken; an invalid spec, a bad list or a place of the deck without `ballot` warns once and returns false, changing nothing. Other keys are refused. |
180
249
  | `hub.mark(playerId, { text, color })` | a coloured tag over a player's avatar for everyone: a team, who is it; `null` clears it (§11, v1.1) |
181
- | `hub.wear(playerId, { kind, color, rarity })` | put a wearable on a player's avatar, kept on their account in every hub place where the host runs the hub: `kind` `"halo"`, `"aura"` or `"orbit"`, `color` `#rrggbb`, `rarity` 0-9; `null` takes it off; true when taken (§11, v1.4) |
250
+ | `hub.wear(playerId, { kind, color, rarity })` | put a wearable on a player's avatar, kept on their account in every hub place where the host runs the hub: `kind` `"halo"`, `"aura"`, `"orbit"` or, v1.24, a hat `"hat-<id>"`, `color` `#rrggbb`, `rarity` 0-9; `null` takes it off; true when taken (§11, v1.4) |
251
+ | `hub.friendsAmong(playerId, userIds)` | v1.36: `Promise<string[]>`, the subset of candidate decimal user-id strings that are this connected, signed-in player's friends. Deduped, capped at 100; ghost applies mutual follows, age, blocks and the hub gate. Every refusal (including an unknown op), absent hub ops or failure resolves `[]`. Empty answers cached per player for 40 s, non-empty answers for 10 min; requests within that window intersect the cached answer with their candidates, and never send another op inside 25 s. On by use, no manifest key |
252
+ | `hub.friendBests(key, { better: 'higher' or 'lower' })` | v1.57: a helper with `report(playerId, best): Promise<void>` and `friendFor(playerId): Promise<{ userId, username, best } or null>`. Signed-in players only, finite numbers. `report` keeps each user's best in a top-100 deck-storage index `fb:<key>` of `{ userId, username, best, at }` (20-character username, `at` wall-clock milliseconds), through one serialized writer per key per layer. Cross-layer lost updates are acceptable. Index reads cache for 60 s; `friendFor` caches empty membership for 40 s and non-empty membership for 10 min per player per visit, and selects the best friend from the index. Leaving clears the visit cache. Both methods swallow failures. Keys are 1–60 letters, digits, `_`, `.`, `:`, `-`; use one direction per key. No manifest key, reads or writes until used |
253
+ | `hub.leaving(playerId, text)` | v1.52: the line this player reads when leaving this place; a string, trimmed and cut at 120 characters, `null` or empty clears it. The latest call wins; true when taken, otherwise false and warn once. Sent to this player alone, only on change; never in a snapshot (§5) |
254
+ | `hub.tryOn(playerId, { kind, color, rarity } \| null)` | v1.28: show a wearable on a player in this place only, instead of the one they own, until `null`, their leaving or the place's end. Never saved: nothing goes to ghost, the wearable on the account is neither read nor changed, and no other place hears of it. The same shape and refusals as `hub.wear`; true when taken (§11) |
255
+ | `hub.wearing(playerId)` | v1.41: the wearable a player here owns, `{ kind, color, rarity }` (a copy), as this place last knew it (a `hub.wear`, or ghost's on the arrival read), or null: none, or a player not here. A try-on shown over it does not change it. For a place to say what someone is wearing (§11) |
256
+ | `hub.unlock(playerId, itemId)` | v1.53: give a player one of this deck's declared earned items (`hub.unlocks`), for the deed it states. A promise of `{ isNew, earned, saved }` (`earned` what the player now shows, an EarnedItem, or null -- never a home item (v1.70); `saved` false when it is kept in this session only -- a guest, the dev serve -- so `isNew` is true on every visit there and a game need not announce it), or of null when refused: never rejects, and each refusal is logged once and changes nothing. Ghost keeps it for a signed-in player in a curated place; a guest's, and any on the dev serve, lasts the session (§11) |
257
+ | `hub.wearEarned(playerId, { deckId, id } \| null)` | v1.53: the town's choice of which owned earned item a player shows; `null` shows none. Ghost takes it only from the town. Home items resolve null and log `CAULDRON_HUB_EARNED_NOT_WEARABLE` locally when known, without calling the host. A promise of `{ earned, saved }` (`saved` as for `hub.unlock`), or of null when refused (logged once) (§11) |
258
+ | `hub.unlocksOf(userIds)` | v1.53: always a promise: of the earned items players here own, `{ players: { [userId]: { owned: EarnedItem[] } } }` (ghost answers only for connected players); v1.70 includes home items with `class` and `piece`, which the wardrobe filters out. Or of null where the host has no such read or refuses it (logged once) (§11) |
259
+ | `hub.earned(playerId)` | v1.53: the EarnedItem `{ deckId, id, class, shape, name, deed, color }` a player here shows, as this place last knew it (a `hub.unlock` or `hub.wearEarned` answer, or ghost's on the arrival read), a copy, or null. `hub.wearing` is unchanged by it (§11) |
182
260
  | `hub.label(actorId, text, { style, ttlMs, to }?)` | words over a scene actor for everyone, or with `to: [playerIds]` for those players only (theirs replace everyone's until cleared the same way): `style` `"tag"` (a pad's count), `"speech"` (an NPC's line) or `"sign"` (a street's or a building's name, drawn at any distance in a town), ≤ 64 chars; `null` clears it (§10). An NPC body's own `say` (§13) runs to 240 chars and its bubble is kept on screen |
183
261
  | `hub.npc(actorId)`, `hub.npcs()` | the place's NPC bodies (§13) |
184
262
  | `hub.results(playerId)` | ghost's record of a player's hub results: `{ recent, records, readAt }` -- their newest results across places and their record per place -- or null (dev serve, anonymous). Read at arrival and once a minute for everyone here (§7, v1.5) |
@@ -263,8 +341,91 @@ id, or null when nobody went. Only a public layer of a deck's main place has
263
341
  that place's minds (§13), so a place whose NPCs have minds is reached by a
264
342
  layer door. On the dev serve the door is a `deck:<name>` door like any other.
265
343
 
344
+ **Friends and bests (v1.36, v1.57).** The kit has no age data. The bounded
345
+ `friendBests` index keeps user id, username and best for every signed-in player
346
+ who reports a best, just like the game's own board/results and its per-player
347
+ record keys. It is shown to no one except through `friendsAmong`: ghost requires
348
+ a mutual follow, no block and both players answered over 13. An under-13 player
349
+ is never shown and never sees anyone. The client flag may make their client ask
350
+ `Hub.friends`; ghost answers with nothing, so no data flows from that ask.
351
+ Each successful write advances a local index generation; a read begun before
352
+ that write completed cannot replace its cache. Reports read-modify-write from
353
+ the freshest cache or a storage read begun after the last write. Cross-layer
354
+ lost updates remain acceptable.
355
+
356
+ When a place first calls `friendsAmong` for a connected signed-in player, only
357
+ that player receives `{ k: 'hub-friends-wanted' }`, latched for the visit and
358
+ resent on a fresh hello. It is never in a snapshot. The client in a game asks
359
+ `castleSdk.Hub.friends()` on receipt (the next idle tick), again 20 s later,
360
+ then every 90 s while joined, outside a trip; `UNKNOWN_COMMAND` disables asks as in the town.
361
+ A place that never calls it sends no flag and its game clients make no ask.
362
+ Ghost answers only when that player's own client asked within the last 120 s;
363
+ the handoff writes no marker. In pad/exact sessions, ghost also needs the
364
+ player in its heartbeat roster (up to about 15 s late). Empty arrival lookups
365
+ expire after 40 s so a result-screen or leaving-line lookup can succeed later.
366
+ The seven games wait for a successfully loaded signed-in record before asking;
367
+ guests, players still loading and unsaved players send no friends request or
368
+ flag. Under-13 players and every refusal show no comparison.
369
+
370
+ On the local dev serve only, `CASTLE_DEV_HUB_FRIENDS=all` in the serve process
371
+ environment treats every valid candidate as a friend. Without it, absent hub
372
+ ops resolve `[]`. The fixture requires a dev session and no platform hub ops;
373
+ it cannot override ghost in production. It writes no friend list.
374
+
375
+ **Owner instances (v1.67).** `hub.owner` reads the non-empty string
376
+ `session.hub.owner` supplied by the platform, never a client's message. It is
377
+ the owner account's user id on an owner door instance, and null on other
378
+ instances. The owner need not have arrived when `ready` reads it. A deck's
379
+ optional `hub.house: { devOwner: "first" }` stands in on the dev serve only
380
+ (`dev` / `dev:*`, with no platform hub): immediately before the first `arrive`
381
+ hook, the first player in arrival order becomes the owner by their `userId`
382
+ (dev guest subjects count). That choice remains for the session after the
383
+ owner leaves; an arrival with no user id keeps null. The key has no effect in
384
+ production and is not sent to clients. Leaving it out keeps dev ownership null.
385
+
266
386
  ## 5. Arrival and exit
267
387
 
388
+ **Your games (v1.54, `hub.yourGames: true`).** Only in a town (no `result`),
389
+ for signed-in players. The kit uses the results reads it already makes: account
390
+ `hearts` on each read player, `hub.results(playerId).recent` and `records`, and
391
+ this place's doors and boards. Hearted doors come first in heart order, then
392
+ recent games mapped by destination deck to this town's doors, with no
393
+ duplicates and at most five rows. Each line names their best with the board's
394
+ unit from the record for the destination place, or their last result in that
395
+ deck, plus when they played (today, yesterday, 3 days ago), formatted by the
396
+ client using the player's local calendar date. The server sends the result
397
+ wording in `line` and the last play time in `lastAt` (epoch ms, or `null`).
398
+ A door with no record may have an empty line. Hidden doors, cabinets and closed
399
+ event gates are excluded before the five-row cap, using the Doors list's filter.
400
+ `{ k: 'hub-yours', rows: [{ door, title, line, lastAt, hearted }],
401
+ hearts }` is latched to that player alone when it changes; a player with nothing
402
+ gets no initial message. A later empty answer clears rows previously sent.
403
+ Fresh client hellos resend private rows; ordinary history refreshes update them.
404
+
405
+ The Doors list draws Your games above All doors, three rows on a narrow stage
406
+ and five with the chrome's desktop breakpoint (fine pointer and width ≥700px).
407
+ Go uses the existing jump onto that door's pad, including party and solo rules.
408
+ Every row can carry ♡ / ♥; ★ still means featured today. The kit asks
409
+ `Hub.hearts()` once per town visit after signed-in identity is known. Hearts are
410
+ hidden for guests, unavailable hosts and `UNKNOWN_COMMAND`. Taps update
411
+ optimistically and serialize `Hub.setHearts(doorIds)` writes: new hearts go last,
412
+ the oldest drops beyond eight. A failed write rolls that toggle back with a short
413
+ toast, preserving later taps. Each write reads the account's hearts first and applies
414
+ the toggle to them; two tabs or devices of one account that toggle in the same
415
+ read-to-write moment can lose one of the two hearts (accepted: ghost replaces the list,
416
+ there is no atomic toggle). Hearts live on the account, never in browser storage;
417
+ the dev serve keeps them per account in memory for its lifetime.
418
+
419
+ An outside arrival with rows is offered `♥ <title>`, its personal line, Go and
420
+ Not now once for about 15 s from its first display. It waits up to 60 s for
421
+ signed-in identity and arrival data. Returning from a game offers the door just played
422
+ instead, with a heart toggle where supported. If it is outside the five private
423
+ rows, its carried last result supplies the line until a read can name it.
424
+ This replaces cues' Play again chip when `yourGames` is enabled. Both use the same ask slot and door jump:
425
+ Go together for a party and a non-solo door, Go for solo. No chip over an
426
+ invitation or party proposal, in a game, during a trip or while other chrome is
427
+ suppressed. The chip fits within 94vw and its personal line ellipsizes.
428
+
268
429
  - Players sent together by one `hub.go` arrive together: the kit holds a group's
269
430
  first arrival still, up to 1.5 s, for the rest, places them in a row at
270
431
  `arrival.actor` spaced by `arrival.spread`, and calls `arrive` once with all
@@ -274,6 +435,19 @@ layer door. On the dev serve the door is a `deck:<name>` door like any other.
274
435
  - **Arrival facing is contract data**, not scene metadata (M0 gap 9): the body
275
436
  faces `arrival.face`, and the client's camera starts behind it.
276
437
  - A late joiner arrives the same way, alone.
438
+ - **A line on leaving (v1.52).** `hub.leaving(playerId, text)` says what is waiting
439
+ next visit: on Back, a game's end or a door out of the place (not a classic
440
+ cabinet), the latest line is captured under the trip cover's title and,
441
+ if the cover lifts sooner, kept as a toast until 2.8 s after the trip started,
442
+ combined with "Back from <result>" on a return. Retries keep the first trip's
443
+ captured line and deadline; newer toast feedback supersedes it. The leaving
444
+ toast wraps within the screen width and restores the ordinary toast styles
445
+ afterward. Toasts sit under the HUD and top cards on a phone, or above
446
+ the bottom controls on a desktop, with a gap and their box kept in view.
447
+ A fresh hello replays the latched line to that player alone. It never slows the trip,
448
+ clears on leaving, and a place that never calls it sends and draws exactly
449
+ what it did before. Set it during the visit, before `hub.go` or `hub.end`,
450
+ rather than in `leave`, which runs after the player has gone.
277
451
  - **Jumping to a door.** In a town (a place with no `result`) the chrome's Doors
278
452
  button lists the place's doors; Go puts the player on that door's pad (the
279
453
  `HubPad` actor naming it, v1.10: inside its radius, so the pad counts them;
@@ -282,6 +456,96 @@ layer door. On the dev serve the door is a `deck:<name>` door like any other.
282
456
  most room), facing the door, or 7 m in front of a door with no pad, in the
283
457
  door's own frame (at most once a second; never a held player). It is a walk, not a trip: the player stays in this session. A game
284
458
  has no list.
459
+ - **Stuck? (v1.33).** In a deck with `hub.stuck`, a town offers the way back
460
+ to its arrival to a player who walks and gets nowhere. The client watches
461
+ its own player only: walk input -- whatever the Player behavior walks the
462
+ body on, by its own rule under each camera (W/S and up/down; the drag stick
463
+ pushed 0.15 or more of its length with any push up or down, or under the
464
+ orbit camera any push at all; A/D under the orbit camera, where they walk
465
+ sideways; never input that only turns, and never Space). The rule
466
+ (v1.39): look back from now over the shortest stretch that holds 3 s of
467
+ walk input seen, never further than 8 s; the chip shows when there is such
468
+ a stretch and, over it, the box round every position the body was seen at
469
+ is under 1 m from corner to corner on the ground (a jump on the spot is
470
+ not a way out). The input need not be without a break: a player who walks
471
+ in bursts, pushing and letting go, is counted across the breaks, and one
472
+ who walks less than 3 s in 8 is not offered it. "Nowhere" is the net of
473
+ the stretch, not its path: pacing 0.9 m back and forth against a wall is
474
+ stuck; pacing across 3 m, or circling a prop, is not; and a free walker
475
+ covers some 17 m in 3 s of walking (about 6 m at 10 frames a second, the
476
+ body moving 33 ms of walking a frame), so nothing that moves is near it.
477
+ (v1.33's rule was 3 s without a break of 250 ms within 0.3 m of where the
478
+ count began: a player walking in bursts never saw the chip.) The 3 s are
479
+ of frames drawn, each counted for its own length up to 100 ms, so a phone
480
+ at 10 frames a second is offered it as soon as a fast one. A frame over
481
+ 250 ms is a hitch and counts for nothing, with nothing forgotten; 1 s
482
+ between two frames, a clock that went backwards, or a hidden page starts
483
+ everything over and takes the chip down. Then a chip shows at the bottom centre, "Stuck? Tap to go to
484
+ the square". It is kept out from under the HUD and a question (an
485
+ invitation, a party's door, "Play <door> again?") as a clear HUD keeps
486
+ labels out from under itself (§9), in any place: moved to just under them
487
+ on a view short enough that they reach it (a phone on its side), and not
488
+ drawn where that would put it over another control, a cabinet's card or
489
+ the ribbon (where a clear HUD has put them, §9), or off the view: the chip
490
+ is placed last in a frame and is the one that yields. A label, speech or a
491
+ pointer is not in its way: those pass under the chip, as under every
492
+ button of the chrome. It only offers: a player leaning on a wall is not
493
+ stuck, and nobody is moved without their tap. Once up it stays
494
+ while the last 8 s still hold 2.5 s of walk input (the stretch looked over
495
+ is then the one holding that much), so a player whose input sits right at
496
+ 3 s in 8 does not see it come and go. It goes the moment that
497
+ box is 1 m across, when the place changes, while a list or
498
+ card of the chrome is open or there is no room for it, and 3 s after the player last gave walk input (not at once:
499
+ on a phone the thumb that walks is the thumb that taps); pushing on again
500
+ keeps it, or brings it back. The Doors list has the same thing as its first
501
+ row, "Stuck?" over "Back to the square", whenever the list is shown (a town
502
+ with no door has no list, and only the chip). A tap on either sends
503
+ `hub-unstick` (§12) and the place puts that one player where the fall rule
504
+ would -- `arrival`'s actor, facing as an arrival does -- then says
505
+ `hub-jumped`, as for a jump to a door. The place answers once in 5 s per
506
+ player; it counts as a jump (not within a second of one, and a sitter gets
507
+ up first); never for a held player, one who has not arrived or one whose
508
+ visit has ended; and never in a game (a place with a `result`), where the
509
+ way back to the start is the game's to give or keep -- a free one would be
510
+ a way out of a trap, a tag or a lost position. **The place's own spot
511
+ (v1.39).** The arrival is not always a way out: a player whose straight
512
+ line from it ran into the obstacle walks back into it. A place with the
513
+ `unstick(hub, playerId, from)` hook (§4) is asked, at the tap and after
514
+ every check above, where to put the player whose body is at `from`
515
+ (`{ x, y, z }`), and answers `{ x, z }` -- with `y` (default standing
516
+ height at that spot when proved clear and no higher than 1.2, else 1.2,
517
+ as an arrival's; v1.48), `facing` (degrees, as `hub.hold` takes them; default:
518
+ as the body faces) and `to` (its name for the spot, at most 40 characters,
519
+ "the street") where it has them -- or null for the arrival. The kit puts the
520
+ player there and says `hub-jumped` with that facing, so the camera turns
521
+ to it. An answer that is not a spot (`x`, `z` and any `y` or `facing` not
522
+ finite numbers, or a point outside the world box, |x|, |z| ≤ 200,
523
+ -30 ≤ y ≤ 80) or a hook that throws is the arrival, with a warning in the
524
+ log; the kit does not check that the spot is clear. The hook answers at
525
+ once: a promise (anything with a `then`) is not a spot and is the arrival
526
+ too, whatever it would have resolved to. Nothing a place returns or throws
527
+ there stops a tap from landing somewhere valid and being answered. In such a place the
528
+ snapshot's `hubStuck` carries `hook: true`, the Doors row reads "Get
529
+ unstuck", and the chip's words are the place's: as the chip comes up the
530
+ client asks what a tap would do (`{ k: 'hub-unstick', ask: true }`, §12)
531
+ and the place asks its hook and answers (`hub-unstick-to`) without moving
532
+ anyone -- so the hook is a question, asked more often than players are
533
+ moved, and must change nothing -- at most once a second per player, and
534
+ not for one it would not move. The chip reads "Stuck? Tap to go to the
535
+ street" for a spot with a name, "Stuck? Tap to get unstuck" for one
536
+ without (and until the answer comes), and the arrival's own words where
537
+ the hook answered null. The `hub-jumped` that follows a tap there carries
538
+ `stuck: { spot, to }`, which the client says once the player has landed
539
+ ("Back to the street"). A place without the hook is asked nothing, is sent
540
+ nothing more and lands its players at the arrival as before. A place that takes it says
541
+ so in its snapshot (`hubStuck: { to }`), and a client offers nothing where
542
+ it has not: `to` is the place's name for its arrival, the `where` hook's
543
+ words for that spot when they begin "in ", "on " or "at ", without that
544
+ word ("in the square" → "the square"; the kit's own words for a pad or a
545
+ door are not used), else null and the chip reads "Stuck? Tap to go back to
546
+ the start". Without `hub.stuck` none of this exists: `hub-unstick` is a
547
+ message the kit does not know and goes to the place's `message` hook like
548
+ any other.
285
549
  - **Where a player came from** is ghost's arrival where the host has hub ops
286
550
  (the door row the player was placed by, `fromDeckId` and `doorId`); the
287
551
  client's hello names it only in dev.
@@ -424,7 +688,9 @@ layer door. On the dev serve the door is a `deck:<name>` door like any other.
424
688
  - **Exit** is always through the door the player came in by: the hub-drawn Back
425
689
  control, `hub.end`, `maxDurationSec`, a crash or a republish. The game cannot
426
690
  name the destination; the client's return ticket does (ghost's, once it
427
- exists). Returning players come out at that door, facing the square.
691
+ exists). Returning players come out at that door, where and facing the way
692
+ the place puts them (the town: in front of it with their back to it, so the
693
+ follow camera, which starts behind them, stands over the street).
428
694
 
429
695
  ## 6. Controller presets
430
696
 
@@ -512,6 +778,74 @@ as it always has, and the client still sends a grab only for an object that
512
778
  is its own at that moment. A place that sets neither runs the offer it always
513
779
  did, and is sent and drawn exactly what it was.
514
780
 
781
+ **A held object kept (v1.25).** The multiplayer kit hands a loose object to
782
+ whichever player is nearer, a held one included: a player standing close to
783
+ someone carrying something takes it out of their hands, and the hold ends. A
784
+ place that sets `keepHeld: true` in `grab` keeps a held object its holder's:
785
+ from the grab the server accepts until the hold ends, nobody else is granted
786
+ the object, however near they stand, so it cannot be taken, pushed or
787
+ grabbed by another player. The hold ends as it always has -- a throw,
788
+ `hub.drop`, a refused grab, the place hiding the object, `hub.reset`, the
789
+ player held still (§8), leaving, the game's end for them, the object handed
790
+ back to the server (the holder's reports stopped for 1.5 s, or one moved it
791
+ too fast) -- and on each of those the object is at once anyone's again; a
792
+ reset object keeps the reset's own half second first. While it holds, the
793
+ holder's client says so once a second (`hub-grab` with `op: "hold"`, §12),
794
+ and the server keeps the object for 2.5 s past the last word: a client that
795
+ let go by itself (a trip, the talk panel) or one from before v1.25 says
796
+ nothing, and the object is anyone's again within that time, as it was before
797
+ v1.25. The word renews only a hold still in force: one the server accepted
798
+ (the `grab` hook included) and has not since ended or refused, by a player
799
+ who has arrived, is not held and whose game has not ended, of an object that
800
+ is theirs to simulate and within 6 m of their body by the server's own
801
+ poses. Past that distance the hold is over, at the next tick or word. What the
802
+ place's `grab` hook does while it is asked stands: if it drops that player,
803
+ hides or resets the object or holds the player still, even undoing it before
804
+ it returns, the grab is refused (`hub-grab-deny`) rather than held. The grab
805
+ is also checked again after the hook, as it was before it, and refused the
806
+ same way if the hook ended the player's game, moved them out of reach or
807
+ took the object from them. Taking a held object from its holder is the place's to do
808
+ (`hub.drop`, the `grab` hook). A place without `keepHeld` hands a held object
809
+ to a nearer player exactly as before, and is sent nothing new.
810
+
811
+ **An object kept for one player (v1.27).** The Grab button offers the nearest
812
+ loose object, and where a place gives each player one of their own (a pillow,
813
+ a ball) the nearest is often someone else's: the place's hook refuses it, and
814
+ the player's own, a step farther, is never offered. `hub.keepFor(actorId,
815
+ playerId)` keeps a loose object for one player:
816
+
817
+ - **The offer.** Every client is told whose it is (`hubKept`, §12), and no
818
+ other player is offered it: it is passed over, so the nearest object a
819
+ player may take is the one offered, their own included when another's lies
820
+ nearer. With `grab.steady` it does not hold the offer either: an object
821
+ that becomes someone else's while it is offered gives the button up at
822
+ once, grace and waiting press included.
823
+ - **The server.** A grab of it by anyone else is refused (`hub-grab-deny`)
824
+ after the checks every grab passes and **before the place's `grab` hook,
825
+ which is not called for it**. The keeper's grab is checked, put to the hook
826
+ and held exactly as any grab is. Someone else holding the object when it is
827
+ kept lets go (`hub-drop`, as `hub.drop` tells them). A hook that keeps the
828
+ object for another player while it is asked about a grab refuses that grab.
829
+ - **How long.** Until `hub.keepFor(actorId, null)`, until the place hides the
830
+ object (`hub.hide`; shown again it is anyone's), and until its player
831
+ leaves. It outlives `hub.reset`, a throw and a hold. A place that wants it
832
+ kept across a hide calls `keepFor` again after `hub.show`.
833
+ - **What it takes.** A place with `grab`, a dynamic actor of its scene (hidden
834
+ or not), and a player who is in the place (from their `arrive`). Anything
835
+ else is warned about once in the server log, returns `false` and leaves the
836
+ mark as it was; `null` for an object kept for nobody is fine.
837
+
838
+ It decides who may **grab** an object, not who simulates it. The multiplayer
839
+ kit still hands a loose object to the nearest player in reach, and a client
840
+ is offered only an object that is its own to simulate, so a keeper is offered
841
+ their object when they are the nearest player to it, and not while another
842
+ player stands nearer (that player is not offered it, and may still push it
843
+ by walking into it). A place that needs more puts the object beside its
844
+ keeper (`hub.reset(actorId, at)`). Like every refusal here it binds the hub
845
+ client: see the next paragraph. A place that never calls `hub.keepFor` is
846
+ offered, asked and sent exactly what it was: `hubKept` is not sent until
847
+ something is kept.
848
+
515
849
  A refusal and `hub.drop` bind the hub client, which is the only client a hub
516
850
  place has; they do not take the object from its owner on the server. A
517
851
  modified client can carry a loose object it owns whatever the place says,
@@ -525,28 +859,49 @@ hub draws an emote picker, Sit and Stand, and the place's sounds. A place
525
859
  without it draws nothing new and is sent exactly what it was.
526
860
 
527
861
  - **Emotes** (`idle.emotes`). An emote button (☺, bottom right, above Grab)
528
- opens the kit's emotes: `wave` 👋 (a side-to-side sway, 2 s), `dance` 💃
529
- (bounce, sway and twist, 2.4 s), `cheer` 🎉 (three hops, 1.6 s), `bow` 🙇 (a
530
- bow forward, 1.6 s) and `spin` 🌀 (a full turn, 1.2 s). Everyone sees it on
531
- that player's avatar, with the emoji rising over their head. It is drawn
862
+ opens the kit's emotes: `wave` 👋 (a side-to-side sway, 2.8 s), `dance` 💃
863
+ (bounce, sway and twist, 3.2 s), `cheer` 🎉 (three hops, 2.4 s), `bow` 🙇 (a
864
+ bow forward, 2.4 s) and `spin` 🌀 (a full turn, 2 s). Everyone sees it on
865
+ that player's avatar, with the emoji rising from the top of their drawn
866
+ model's head; where that is off the view's top or under the top chrome (the
867
+ HUD's box, a question card, Back, the sound button: a portrait phone), it is
868
+ drawn beside the head on its open side, and never under the top chrome
869
+ (2026-10-06; before, 2, 2.4, 1.6, 1.6 and 1.2 s, a smaller emoji and a
870
+ gentler motion, 2.25 m over the body, often under the HUD). It is drawn
532
871
  only: the avatar's model moves inside its drawn node, never its body, its
533
872
  network pose or what anyone simulates. The server takes one emote per
534
873
  player every 2 s, refuses an id the kit does not have and a player who has
535
874
  not arrived, and asks the place's `emote` hook, which may refuse it.
536
875
  `hub.emote(playerId, id)` plays one on a player from the place itself (an
537
876
  NPC's greeting, a goal) and is neither rate-limited nor offered to the hook.
877
+ v1.47: when a player's emote starts, up to three nearest free `HubNpc`
878
+ bodies within 6 flat metres face them and emote back. Wave, dance, cheer
879
+ and bow answer with the same emote; spin answers with cheer. About one in
880
+ three also says a short public line (§13). One player's emotes can start
881
+ reactions once every 4 s, and each NPC reacts once every 8 s; the player's
882
+ emote still plays as before. A conversation, follow, authored walk, place
883
+ move or hold, or a line still being spoken keeps that body busy. The place
884
+ can refuse others with `npcReact`. No model is called. A player without a
885
+ body here or who has not arrived triggers none; an NPC's emote triggers none.
538
886
  - **Seats** (`idle.seats`). A scene actor carrying `HubSeat` (`{ face,
539
- height }`, both optional) is a seat. A seat stays where it was authored: one
887
+ height, pose }`, all optional) is a seat. `pose` is `"sit"` (the default)
888
+ or `"lie"`; any other value or unknown HubSeat key is refused by the check. A seat stays where it was authored: one
540
889
  with a `"dynamic"` or `"kinematic"` `Body` is refused by the check and
541
890
  ignored by the hub. A player standing within about 1.5 m of
542
- a free one is offered Sit (bottom centre). The server checks the seat is one,
891
+ a free one is offered Sit (bottom centre), or Lie down for `pose: "lie"`. The server checks the seat is one,
543
892
  shown and free (one player per seat), the player is here, not held by the
544
893
  place and within 2.5 m, and asks the place's `sit` hook; then it holds them
545
894
  on the seat (§8): over its centre, `height` metres above its Transform
546
895
  (default: the top of its Shape plus a standing body's 0.85 m, so a sitter on
547
896
  a solid seat rests on it), facing `face` degrees (default the seat's own
548
897
  `rotationY`). Everyone draws a sitter lowered 0.45 m and tipped back a
549
- little. Stand, any walk, turn or jump input (a tap on touch included), or a
898
+ little. A lie seat instead rotates the model -90 degrees about local X
899
+ (face up, head toward the back / local -Z, feet toward its facing / +Z),
900
+ offsets it +0.7 m along local Z to centre its length, cancels its standing
901
+ model Y offset and places its origin 0.6 m below the held body centre.
902
+ On the house bed (top about 0.55 m), the back rests about 0.56 m high.
903
+ Absent `pose` or `"sit"` preserves the previous pose and wire byte-identically.
904
+ Stand, any walk, turn or jump input (a tap on touch included), or a
550
905
  jump to a door gets them up where they are. A seat is a hold: a held player cannot sit, and the
551
906
  place's own `hub.hold` or `hub.release` of a sitter, a game's end, leaving,
552
907
  or the place hiding the seat stands them. `hub.seat(playerId)` says where a
@@ -567,6 +922,363 @@ without it draws nothing new and is sent exactly what it was.
567
922
  place plays only its own content's files, never a same-named file of the
568
923
  town's.
569
924
 
925
+ **The soundscape (v1.42, v1.49, v1.50, v1.56).** A deck with `soundscape` in its manifest (§1) has
926
+ the kit make sounds of its own, in every one of its places. All of it is
927
+ synthesised in the client (WebAudio); none of it is a file, none of it is
928
+ speech, and no word of a line can be made out. Synthesis belongs to the client:
929
+ the place's server hears none of it; only explicit `hub.cue` calls (v1.50) send
930
+ named cue messages, in a deck with `soundscape.cues: true`.
931
+
932
+ - **Babble** (`babble`, on unless `false`). v1.56 uses all four original
933
+ round-6 audition options as voice types: glottal pulses through four
934
+ formants, consonant noise, breath gated on the glottal open phase before
935
+ the formants, and pitch jitter; no samples, TTS or real words. Text supplies
936
+ word lengths (one to three made-up syllables per word), punctuation and a
937
+ deterministic seed; the spoken words are made up, not the displayed text.
938
+ `HubNpc.voice.type` selects a stable name from the exported `VOICE_TYPES`:
939
+
940
+ | type | audition and roles | parameters |
941
+ | --- | --- | --- |
942
+ | `townsfolk` | option 1; everyday townsfolk, shop/stall keepers | Rosenberg source, open quotient 0.6, speed quotient 2.5, rate 3.3, source gain 0.86 |
943
+ | `lively` | option 2; barkers, kids, couriers, excitable roles | same as townsfolk, rate 4.6 |
944
+ | `gruff` | option 3; older/gruff roles | LF source, Rd 1.2, rate 3.3, formant gains [11, 12, 9, 6] dB, source gain 1.158 |
945
+ | `gentle` | option 4; caring roles | Rosenberg source as townsfolk, rate 3.3, formant gains [11, 12, 9, 6] dB, jitter 0.7, breath 0.75, jitter low-pass 120 Hz, source gain 1.047 |
946
+
947
+ All four start at pitch 240 Hz, mouth 1.08, pace 1.3 and breath low-pass
948
+ 2400 Hz; other parameters keep the audition defaults. Each type keeps its
949
+ own source gain: the audition matched their voice RMS within 0.1%, preserving
950
+ the fixed `BABBLE_LEVEL` calibration pending browser re-measurement.
951
+ A valid explicit type wins. Otherwise the lower-case text
952
+ `${role} ${character} ${name}` from `HubNpc` is matched as whole words in
953
+ fixed precedence (gruff, gentle, lively); `role` is the place's own key,
954
+ `character` its characterBundle id, and `name` its name. Invalid type names
955
+ use the same default selection. `Innes` does not match `inn`.
956
+
957
+ | precedence/type | default keywords |
958
+ | --- | --- |
959
+ | 1 / `gruff` | harbourmaster, harbour master, innkeeper, inn, fisher, captain, smith, guard, elder, grandpa, old |
960
+ | 2 / `gentle` | nursery, clinic, nurse, nana, granny, gardener, healer, vet, teacher, carer |
961
+ | 3 / `lively` | kid, child, barker, crier, hawker, postie, courier, runner, coach, announcer, busker |
962
+ | fallback / `townsfolk` | no keyword matched |
963
+
964
+ The actor id and `HubNpc.name` hash still seeds each NPC's made-up words
965
+ and variation: pitch `240 * 2^(u * 0.9 - 0.4)` Hz (about 182–339), mouth
966
+ from 1.0 to 1.16 rising with pitch, and its type's rate multiplied by
967
+ 0.9–1.1. The type replaces only the old seeded style choice; variation
968
+ keeps its existing random draws. The same NPC sounds the same to everyone
969
+ on every visit, in public speech and private panel lines.
970
+ A body may override it with
971
+ `"voice": { "type": "gentle", "pitch": 220, "rate": 7, "timbre": "square" }`.
972
+ Each field is optional: pitch stays Hz clamped to 80–500 (mouth follows
973
+ the clamped pitch); the legacy rate field stays clamped to 4–10 and maps
974
+ linearly to the synthesiser's 2.5–6 range:
975
+ `2.5 + (clamp(rate, 4, 10) - 4) * 3.5 / 6` (7 maps to 4.25).
976
+ Legacy `sawtooth`, `square` and `triangle` timbre names are accepted and
977
+ ignored. Invalid/nonfinite overrides use the character's defaults.
978
+ A line lasts no more than 3 s, including its 50 ms fade/tail, and no more
979
+ than 30 syllables. Long lines stop at the last complete word that fits.
980
+ Each line has 22 synthesis nodes plus its distance gain; all three sources
981
+ stop and every node disconnects on natural end or a quick cut (20 ms fade,
982
+ sources stopped within 30 ms), without timers. `BABBLE_LEVEL` (about 0.248)
983
+ matches the old babble's median active RMS (about −25.6 dBFS at volume 0.7),
984
+ measured offline in Chromium through the whole chain.
985
+ Moving formants, breath and the limiter await browser re-measurement.
986
+ The text is drawn all at once, so babble starts as it appears.
987
+ A line in a player's open talk panel is heard by that player alone, at
988
+ full voice. Speech drawn over an NPC (`npc.say`, an
989
+ authored line) is heard by whoever is sent it, louder the nearer they stand
990
+ and silent 12 m away. A line that is both is voiced once. At most two NPCs
991
+ are voiced at once, the nearest; a new line from an NPC cuts its old one.
992
+ Only `HubNpc` bodies babble: never a player's reaction, phrase or chat.
993
+ - **Steps** (`steps`, on unless `false`). A footfall for each stride the
994
+ player's body covers on the ground (0.65 m at a walk, longer at a run, so
995
+ about four a second at any speed, and none standing still), a small sound as
996
+ they jump and a heavier one as they land. The same, at half the level, with
997
+ no jump, for the other players and the NPCs within 10 m, quieter the
998
+ farther off, four at once at most. A body that is put somewhere (a door
999
+ jump, "Stuck?", a hold) takes no step, and nor does one the place hid.
1000
+ v1.50 high-passes each footfall body at 150–220 Hz, including landings,
1001
+ and lowers the thump by 40%, decaying in 55 ms instead of 90 ms.
1002
+ Boolean `steps: true` keeps street everywhere. v1.49 also
1003
+ accepts `steps: { default, zones, paths }`: `default` is a surface name
1004
+ (street when omitted), `zones` maps zone actor ids to surfaces, and `paths`
1005
+ names a scene component. Surfaces are `street`, `grass`, `wood`, `stone`,
1006
+ `sand` and `cobble`; grass is soft (low-passed at 2.5 kHz), and every
1007
+ surface's step is about as loud as the others (v1.56). A path component carries `points` (a polyline of
1008
+ `[x,z]` pairs or `{x,z}` objects), `half` (half its width in metres) and
1009
+ `surface`. A foot within `half` of any segment uses that surface before
1010
+ the zone or default. The player's zone keeps the same exit margin as
1011
+ ambience; nearby bodies use their own positions and zone history.
1012
+ - **Zones** (`zones`, v1.49, absent by default). The shared component name
1013
+ for ambience and mapped steps. Actors carrying it have numeric finite
1014
+ `x0,z0,x1,z1` bounds. The client reads these actors once for a scene and
1015
+ chooses by the local player's body, never the camera. A body enters from
1016
+ the exact edge and remains in the zone until more than 0.75 m outside;
1017
+ a point in no zone uses the default. An `ambience.beds` or `steps.zones`
1018
+ map requires this component name.
1019
+ - **Ambience** (`ambience`, v1.49, absent means none). An object with optional
1020
+ `beds` (zone actor id → bed), `default` (bed outside mapped zones),
1021
+ `spots` (component name → bed) and `music` (boolean, off by default).
1022
+ No default bed is added when `default` is omitted. The closed bed list is:
1023
+
1024
+ | Bed | Sound |
1025
+ | --- | --- |
1026
+ | `square` | Soft breeze and faint distant town air |
1027
+ | `meadow` | Breeze with birds at random intervals |
1028
+ | `night` | Low wind and an occasional owl |
1029
+ | `harbour` | Harbour A-rolled: balanced alternating swells, foam/backwash, distant sea, gulls and rope creaks |
1030
+ | `crowd` | Stadium crowd A: individual wordless voices, applause and clap-along swells with stadium echoes |
1031
+ | `market` | Stalls A / Haggling B: distant Simlish-like speakers, consonants/vowels, no real words or TTS |
1032
+
1033
+ Zone beds cross-fade over 1.5 s at approximately equal power. At most two
1034
+ zone beds live during a fade; the outgoing bed's sources stop and its
1035
+ nodes disconnect at the end. Noise buffers are shared, each bed's graph
1036
+ stays small, and at most one animal call lives per bed. Spots layer one
1037
+ bed at a lower level: the nearest actor carrying any named component,
1038
+ full within 4 m and falling linearly to silence at 14 m. Spots play no
1039
+ music.
1040
+
1041
+ Stadium, market (including spots) and harbour beds render once per page
1042
+ context offline from the same seeded generators into seamless 40/60/48 s
1043
+ loops, so phones play one buffer instead of the live graph; music stays
1044
+ live. Beds stay silent until ready and fade in, with the original live
1045
+ generator as fallback when offline rendering is unavailable or fails.
1046
+ After activation while sound is allowed, only referenced heavy beds
1047
+ prewarm one at a time with the current zone first, scheduling each
1048
+ complete seeded plan before offline rendering without suspends.
1049
+ Crowd and market use 24 kHz; harbour retains the live context's sample
1050
+ rate to preserve wash RMS, using about 8.5/9.2 MB of mono loop memory at
1051
+ 44.1/48 kHz (8.1/8.8 MiB).
1052
+
1053
+ `music: true` selects original built-in music (v1.50 rounds 2–3):
1054
+
1055
+ | Zone | Songs | Music nodes |
1056
+ | --- | --- | --- |
1057
+ | `square` | Stroll (SQUARE_A, 116 BPM, G major) / Bounce (SQUARE_B, 126 BPM, D major) | 37 / 42 |
1058
+ | `meadow` | Garden walk (SUNNY_A, 112 BPM, C major) / Meadow jig (SUNNY_B, 92 dotted beats/min, F major, 6/8) | 37 / 27 |
1059
+ | `night` | Original D3 minor-pentatonic sine notes, 1.8 s apart, with warm pad A / breathing pad B | 11 / 15 for pads, plus two shared sine/envelope nodes |
1060
+ | `harbour` | Drift (HARBOUR_B, 100 BPM, G major pentatonic, 3/4) / Harbour jig (HARBOUR_C, 76 dotted beats/min, C mixolydian, 6/8) | 37 / 37 |
1061
+ | `crowd` | Victory lap (STADIUM_1, 126 BPM, G mixolydian) / Arena bounce (STADIUM_3, 132 BPM, A mixolydian) | 38 / 35 |
1062
+ | `market` | Original seeded triangle melody, at the common music target | 2 |
1063
+
1064
+ Square, meadow, night, harbour and stadium alternate their two songs.
1065
+ The session seed chooses the first; each runs for 3–5 minutes in whole bars, reaches silence exactly
1066
+ on a boundary with a 25 ms exit ramp, waits 4–8 seconds, then changes.
1067
+ Crossing zones uses the same bed fade; a returning bed restarts its
1068
+ seeded song. The notes, track
1069
+ timbres, envelopes and tempos are the chosen audition generators'.
1070
+ Hollow retains its original bassy sine and adds a pad 3 dB below it.
1071
+ New tonal voices use shared band-limited PeriodicWaves or sines. Both
1072
+ A/B pools are built with the bed, so alternation makes no nodes; frames
1073
+ only automate parameters, looking 0.3 s ahead (the old night sine remains
1074
+ at most one bar ahead). Inactive pools are silent, and both stop and
1075
+ disconnect when the bed fades out or the soundscape quiets. Market keeps
1076
+ its original seeded melody, root and triangle, at the common music target.
1077
+
1078
+ Harbour A-rolled uses two alternating wash channels and fixed sea, gull
1079
+ and creak voices. Two shared 3.5 kHz low-passes (Q 0) roll off the wash
1080
+ paths; foam is high-passed at 1.6 kHz. Both channels use identical gains.
1081
+ The random size draw stays 0.6–1 and opens the filter as before, with
1082
+ the same RNG sequence. Only size-dependent body/foam amplitudes use
1083
+ `0.6 + (size - 0.6) * 0.25` (0.6–0.7), retaining envelope timing and shape.
1084
+ Sea, gull and creak bypass the wash roll-off.
1085
+ The whole generator is calibrated to the original −41 dBFS bed target
1086
+ before the ambience bus raises it 8 dB to about −33 dBFS, using
1087
+ the audition's active-RMS rule (2048-sample windows within 20 dB of the
1088
+ loudest). A 300 s pure-JS offline model compares the previous and
1089
+ compressed graphs; the previous unit RMS of 0.08952332884 anchors the
1090
+ absolute level. Whole-bed gain rises from 0.316048 to 0.367716
1091
+ (+1.315 dB) to preserve model RMS, pending a measured correction.
1092
+ `HARBOUR_WAVE_RMS` retains the calibration, checked
1093
+ by `scripts/soundscape-wave-analysis.mjs` through the soundscape tests.
1094
+
1095
+ The stadium source generator retains all 12 voices and eight clappers,
1096
+ 87 fixed generator nodes. The live market fallback alternates A/B in
1097
+ seeded 3–5 minute runs, letting reserved
1098
+ lines end before changing the four/five speakers and distance filter.
1099
+ Its consonants, vowel formants, pitches, pacing and envelopes are the
1100
+ audition's, using two reusable 19-node Simlish graphs and three damped
1101
+ room delays. Oscillator/noise phase continues between pooled lines;
1102
+ each line's envelope closes fully. Zone and spot use the same generator;
1103
+ spots retain the 0.45 mix and no music. Once ready, frames allocate no
1104
+ audio nodes.
1105
+
1106
+ | Zone | Bed nodes without / with music |
1107
+ | --- | --- |
1108
+ | `square` | 7 / 87 |
1109
+ | `meadow` | 7 / 72 (plus two during a bird call) |
1110
+ | `night` | 7 / 36 (plus two during an owl call) |
1111
+ | `harbour` | 4 / 79 (live fallback: 24 / 99) |
1112
+ | `crowd` | 4 / 78 (live fallback: 89 / 163) |
1113
+ | `market` | 4 / 7; a market spot adds 4 (live fallback: 54 / 57; spot adds 55) |
1114
+
1115
+ Counts are for ready beds, include mix/air and, with music, its duck gain
1116
+ and both pools;
1117
+ the shared master/buses are separate. All sources, pooled voices and
1118
+ delay loops stop and disconnect on fade-out, hidden tab, trip, mute or
1119
+ disposal. Missed frames drop past calls. No timers or audio files are used.
1120
+ An audibly playing loop from this client's `hub.sound` takes priority:
1121
+ music ducks to zero and ambience to about 35% over 0.6 s, then restores
1122
+ when the loop stops or becomes quiet by distance. Priority uses the loop's
1123
+ place volume times distance falloff, before user volume: it enters at
1124
+ 0.06 or above and leaves at 0.03 or below, keeping its state between those
1125
+ levels so walking at the edge does not switch it back and forth. One-shots do not
1126
+ duck. Everything goes through the existing ambience bus and master.
1127
+ At default user volume 0.7, all six zone beds target about −33 dBFS
1128
+ active RMS (up 8 dB, about 8 dB under a footstep). Music rises 9 dB from
1129
+ its old −47 dBFS calibration target, sitting roughly level with the beds,
1130
+ including stadium and the original market melody.
1131
+ `AMBIENCE_LEVELS` in `code/client/soundscapeAmbience.js` holds the gains
1132
+ and intended pre-bus music RMS; `SONG_RMS` normalises the selected
1133
+ generators from retained audition PCM and the pads' harmonic/filter
1134
+ model. The opt-in master compressor protects the sum with babble and
1135
+ footsteps. Night's 4.1 kHz cricket pulses remain removed, with wind/owl.
1136
+
1137
+ For example, the deck's `hub` block may contain:
1138
+
1139
+ ```json
1140
+ "soundscape": {
1141
+ "ui": true,
1142
+ "zones": "TownDistrict",
1143
+ "ambience": {
1144
+ "beds": { "district-sunny": "meadow", "district-harbour": "harbour" },
1145
+ "default": "square",
1146
+ "spots": { "TownStamp": "market", "TownHats": "market" },
1147
+ "music": true
1148
+ },
1149
+ "steps": {
1150
+ "default": "street",
1151
+ "zones": { "district-sunny": "grass", "district-harbour": "wood" },
1152
+ "paths": "TownAlley"
1153
+ }
1154
+ }
1155
+ ```
1156
+
1157
+ - **UI cues** (`ui`, v1.49, only explicit `true`; absent or `false` means
1158
+ none). Quiet original one-shots through the UI bus: a 120 ms rising noise
1159
+ whoosh when this player's door trip starts, a 320 ms two-note chime on
1160
+ their arrival or return to town, a 180 ms rising tone when their private
1161
+ town HUD timer starts or changes, and a 65 ms tick for a quick reaction,
1162
+ phrase, emote, talk reply chip or Doors list Go. The departure starts
1163
+ before the trip gate and alone may finish into the trip; sound never
1164
+ delays or changes the trip. No other cue starts during it. Hiding the
1165
+ page, muting or setting volume to zero stops even that tail immediately.
1166
+ Arrival alone waits for the first settled live frame, and is dropped if
1167
+ more than 3 s late or interrupted. Before the first gesture it is dropped.
1168
+ Other cues never wait. Two UI voices at most and four starts per rolling
1169
+ second; extras are dropped, and ended graphs are stopped and disconnected.
1170
+ Each cue uses two nodes, or three for the noise whoosh; idle frames
1171
+ allocate no nodes. `soundscape: true` does not enable any UI cue.
1172
+
1173
+ Activity uses only the existing private HUD's finite `timer.since` or
1174
+ `timer.until` (§9), such as the town trial clock. The first frame's timer
1175
+ state is a baseline; shared HUDs and game clocks are ignored, and timers received
1176
+ while quiet are consumed without replay. A hold does not identify an
1177
+ activity, so stall and cabinet holds make no activity cue. Town token
1178
+ balances reach the client only as authored HUD text, so UI does not infer
1179
+ a token cue; a place may explicitly send `hub.cue({ player }, 'token')`.
1180
+ UI cues parse no text and add no message or snapshot field.
1181
+
1182
+ - **Named cues and observed actions** (`cues`, v1.50, v1.60, only explicit `true`).
1183
+ A place calls `hub.cue({ player: playerId }, name)` for that player alone,
1184
+ or `hub.cue({ actor: actorId, radius: 12 }, name)` for everyone near that
1185
+ scene actor (spawned copies included), fading linearly to silence at the
1186
+ radius (1–60 m, default 12). It returns true when sent, or false with a
1187
+ warning logged once for a disabled deck, unknown name, invalid target,
1188
+ disconnected player, invalid radius or spent budget. Private targets each
1189
+ have a six-token bucket replenished at six per second; actor broadcasts
1190
+ share one bucket per place. No sound file or `idle.sounds` declaration is
1191
+ needed. Names are the closed, exported `CUE_NAMES` list:
1192
+
1193
+ `kick`, `goal`, `cast`, `nibble`, `bite`, `catch`, `token`, `hat-bought`,
1194
+ `hat-on`, `lantern`, `stamp`, `trial-start`, `trial-gate`, `trial-finish`,
1195
+ `pad-tick`, `pad-go`, `court-chime`, `court-bell`, `court-splash`,
1196
+ `court-flutter`, `busker-jig`, `busker-waltz`.
1197
+
1198
+ Court voices are chime A (one stone per call, fixed stone 0 at 587.33 Hz),
1199
+ brass bell A (its full 2.6 s ring), fountain splash A and flutter B.
1200
+ There is no pitch-step argument or new API. Their pitches, envelopes,
1201
+ noise seed and offsets are retained in `code/client/soundscapeCourt.js`.
1202
+ They use the same delivery, falloff, caps, gates and cleanup as other cues.
1203
+
1204
+ **Busker tunes (v1.60).** A place sends
1205
+ `hub.cue({ actor: buskerId, radius }, "busker-jig")` (or `"busker-waltz"`)
1206
+ and re-sends it every 10 s or less while the busker should play. Each client
1207
+ that receives it loops that tune positioned at that actor while the local
1208
+ player is within radius of the actor (the same linear `distanceGain` as
1209
+ `soundscapeActions.js`), the actor exists and is not hidden, sound is live,
1210
+ and less than 25 s have passed since the last send for that actor. This is
1211
+ a lease: when the place stops re-sending, the loop fades out; a late joiner
1212
+ starts on the next re-send. Leaving the radius fades it out; coming back
1213
+ while the lease holds resumes it (restarting the phrase is fine). At most
1214
+ ONE busker loop plays per client: the loudest (nearest) one; a second actor
1215
+ or a name change switches with a short fade (about 0.3 s). A `{ player }`
1216
+ target with a busker name plays one pass of the tune to that player at full
1217
+ gain, no loop, also through the busker layer.
1218
+
1219
+ `code/client/soundscapeBusker.js` synthesises two original 8–12 s
1220
+ placeholder melodies: a lively 6/8 pluck jig and a gentle 3/4 waltz with
1221
+ quiet root/fifth bass on beat one. Each phrase player uses four pooled
1222
+ oscillators and gains, one 3 kHz low-pass and one distance gain: ten nodes
1223
+ for its entire life, no allocation per note. The frame clock schedules
1224
+ at most 0.3 s ahead and skips missed notes after a stall; exact beat-length
1225
+ phrases loop seamlessly. The separate layer uses the existing UI bus and
1226
+ master without the short cues' 3 s or two-voice cap; neither layer evicts
1227
+ the other. One private phrase slot is bounded independently. Fade completion,
1228
+ teardown, hide and scene change stop and disconnect every node. All cue
1229
+ opt-in, sound gates and volume rules apply; without `soundscape.cues: true`
1230
+ no busker layer is made or driven. The exported `BUSKER_LEVEL` targets
1231
+ about −40 dBFS active RMS at the actor at volume 0.7 (about 7 dB under the
1232
+ beds), pending calibration in Chromium.
1233
+
1234
+ The chosen original audition voices are in frozen `CUE_VOICES` in
1235
+ `code/client/soundscapeCues.js`: kick A, catch C and the chosen single
1236
+ voices for the other short names. The wire is `{ k: 'hub-cue', cue: name }`,
1237
+ with `actor` and `radius` only for broadcasts. The client queues at most
1238
+ eight events when enabled and live. Missing voices, malformed, distant or
1239
+ quiet events are dropped. Parts keep the audition's pitches, envelopes,
1240
+ noise seed and scheduled times, and are built 75 ms ahead by the frame;
1241
+ ended sources stop and all nodes disconnect. A stalled frame drops missed
1242
+ parts instead of starting them late.
1243
+
1244
+ The same opt-in also voices existing client state changes: wave B,
1245
+ dance C, cheer, bow and spin emotes, sitting, and this player's NPC talk
1246
+ panel opening. The local player's emote and sit play at full cue level;
1247
+ another player's falls off to zero at 12 m. Initial state is a silent
1248
+ baseline, and repeated, expired, distant or blocked state never replays.
1249
+ Client observation adds no messages or snapshot fields and parses no text.
1250
+ There is no structured pad countdown or departure state on this client,
1251
+ so pads use explicit `hub.cue` calls rather than guessed label text.
1252
+
1253
+ Short cues use the existing UI bus and master, sharing `ui`'s cap of two voices
1254
+ and four starts in any rolling second. Local cues take priority over
1255
+ nearby players and actor broadcasts; they may replace a lower-priority
1256
+ voice, and extra starts are dropped. First gesture, settling, trip,
1257
+ hidden tab, mute and volume apply to every cue; only the legacy UI door
1258
+ departure tail may finish into a trip. `ui` and `cues` are separate flags:
1259
+ cues alone adds no chip callback or legacy timer cue, and `soundscape:
1260
+ true` enables neither. Without `cues` no action observer is made.
1261
+
1262
+ - **The control.** A speaker button in the top right corner opens Mute and a
1263
+ volume slider, kept on the device (`localStorage`
1264
+ `castle.hub.soundscape.v1`). It sets the level of everything above and of
1265
+ the place's own sounds (`hub.sound`, v1.6), which without the key play at
1266
+ the volume the place gave them.
1267
+
1268
+ Nothing sounds before the player's first tap or key, and nothing waits for
1269
+ it: a sound that could not play when it happened is dropped, and a line that
1270
+ came up meanwhile is never said late. In such a deck that holds for the
1271
+ place's own `hub.sound` files too: none is started before the gesture (a
1272
+ one-shot before it is dropped; a loop starts after it, where everyone else is
1273
+ in it), where without the key the engine starts a waiting loop on the first
1274
+ tap as it always has. During a trip through a door only the already-started
1275
+ UI departure tail may finish; everything is silent while the page is hidden,
1276
+ and a line that arrived then is not said on return.
1277
+ Ambience and music follow the same first-gesture, trip, hidden-tab, mute and
1278
+ volume rules. An interruption stops their sources and scheduled notes;
1279
+ returning waits for two consecutive completed live frames before beds start
1280
+ again. No bed or animal voice is built before the gesture or while blocked.
1281
+
570
1282
  **Quick reactions and phrases (v1.11).** In every hub place the chrome has a
571
1283
  speech button (💬, bottom right, above the emote button) that opens a row of
572
1284
  emoji (👍 😂 ❤️ 😮 👋 🎉) over the place's canned phrases: in a town "Over
@@ -605,6 +1317,116 @@ player's line in the feed offers Report (`Hub.reportChat`). What was said
605
1317
  before a player arrived is not shown to them. On a host or SDK without the
606
1318
  commands nothing is drawn and nothing is asked. A deck changes nothing.
607
1319
 
1320
+ **The choice card (v1.68).** A place whose manifest declares `ballot` (§1)
1321
+ may put a card of players' faces in front of its players -- a meeting, a vote,
1322
+ a reveal -- with `hub.ballot` (§4). Two rules hold on every path, client and
1323
+ server (`code/server/ballot.js` states them at its top):
1324
+
1325
+ - **(A) The version rule.** Each player's card has a version `v`, an
1326
+ opaque string: this server's own epoch (its start time and a random part)
1327
+ and a counter, so a version from an earlier server for the same layer (a
1328
+ replacement restarts its counter) never equals one of this server's. The
1329
+ client echoes it as it came and never compares or computes with it beyond
1330
+ equality. A `hub.ballot` call gives a player's card a new version exactly
1331
+ when it changes what that player can tap, compared with
1332
+ the card they have now: the mode, the faces offered and which are `off`,
1333
+ the lines offered, the option ids, or `picked`. A call that changes only
1334
+ the title, text, `until`, notes, votes, marks, option words or the feed
1335
+ keeps the version, so a game that refreshes its feed as lines are said
1336
+ never refuses a tap made meanwhile. Clearing a player's own card is such a
1337
+ call too: back on the shared card, they keep their version if it allows the
1338
+ same taps as the card they had, and get a new one otherwise. A tap carries the `v` of the card it
1339
+ was made on, and is taken only if that `v` is the version last delivered
1340
+ to the player AND the version of their current card, and its ids are on
1341
+ that card and allowed by it. The same version allows the same taps, so a
1342
+ card whose taps changed since, or not yet delivered, has another version,
1343
+ and a lock the hook just set holds at once. The client starts its
1344
+ selection afresh on a new version.
1345
+ - **(B) Keys absent means no ballot code path runs at all**: no allocation,
1346
+ no per-frame call, no disposal work, no listener, client or server. A
1347
+ place without `ballot` only reads the key and finds it missing; a deck
1348
+ that declares it in none of its places has no `hub.ballot`. On the
1349
+ client everything enters through one gate, the `hub-ballot-card` message:
1350
+ while the place is not yet known (the server's first tick sends a card
1351
+ ahead of the WORLD snapshot) one card is held; in a place known to be
1352
+ keyless the card is dropped before anything is made; otherwise it is held
1353
+ with its connection. While a card is held, every WORLD snapshot rechecks
1354
+ it: one naming a place without `ballot` lets it go, pending or not (a
1355
+ recovery that keeps the connection but lands somewhere keyless). Nothing
1356
+ else on the client touches the card until the gate holds one, and the hub
1357
+ system reads the gate again after letting go of another connection's card,
1358
+ before it makes or draws anything.
1359
+
1360
+ The kit draws it as a bottom sheet over
1361
+ the world (the world stays in view above it; up to 60% of the view's height,
1362
+ which an ordinary HUD never reaches, and under a clear HUD's box, scrolling
1363
+ inside itself): the title, a countdown to `until`, the
1364
+ text, the last of the card's `feed` lines, a grid of faces (each player's
1365
+ avatar face and username, "You" for the viewer, the deck's `note` under it,
1366
+ greyed when `off`, a tally when `votes` is set, a dot and border in `mark`),
1367
+ and chips for the offered lines and the options. Phone first: chips at least
1368
+ 40 px tall, text at least 15 px (the ✓ on a picked face is a mark, not text), white on dark; a phone on its side puts the
1369
+ faces left and the chips right, each scrolling alone. While a card is up the
1370
+ chrome it would cover waits (the emote, Sit, speech and Character buttons,
1371
+ the Doors and People dock and the said-lines feed); a place without the key
1372
+ is drawn exactly as before.
1373
+
1374
+ - **Talk** (`mode: "talk"`): a tap on a face selects it (a ring), and the
1375
+ `face` lines are offered only then; a tap on one sends `{ face, line }`. A
1376
+ `self` line sends `{ line }` at once; an option sends `{ option }` at once.
1377
+ - **Vote**: a tap on a face or an option selects it, and a Vote button sends
1378
+ `{ face }` or `{ option }`. Once the place sets `picked` for that player the
1379
+ card shows it locked in and takes no more votes -- from the moment
1380
+ `hub.ballot` is called, so a vote replayed before the next tick is refused
1381
+ too.
1382
+ - **Reveal**: read only (the tallies, who it was).
1383
+
1384
+ A tap is `{ k: 'hub-ballot', v, face?, line?, option? }` and nothing else.
1385
+ By rule A the server takes it only on the version delivered and current, and
1386
+ checks its ids against that card (another version, no card, a
1387
+ reveal, an unknown or `off` face, a line not offered now, a `face` line
1388
+ without a face or a `self` line with one, a line in a vote, a vote once
1389
+ `picked`, an option the card has not, any other key: dropped without a word),
1390
+ limits a player to a burst of three and then one every 1.5 s (as quick
1391
+ phrases are), and hands it to the place's `ballot` hook. The kit says nothing
1392
+ for the place: what was said reaches others only through the `feed` the
1393
+ place puts on its next card, and votes are counted by the place.
1394
+
1395
+ **No free text:** a player cannot put a word of their own on the card. A tap
1396
+ carries ids only, and every word the card shows is the deck's (its manifest's
1397
+ lines, its server's title, text, notes and options -- never a player's) or
1398
+ the kit's (usernames, "You", "Vote for amy", "Locked in"). Feed lines are
1399
+ worded on each client from ids: "bo → amy: I saw them by the boat", "bo: Not
1400
+ me!". A deck must never pass anything a player typed into `title`, `text`,
1401
+ `note` or an option.
1402
+
1403
+ Names and faces are the kit's: the card names a face by player id, and the
1404
+ server adds that player's username and avatar from the session. Each
1405
+ player's card is a pure function of the card and of who is connected now,
1406
+ worked out again on every send: a face, or a feed row from or to a player
1407
+ who is not here now, is left off for every viewer, and nothing about a
1408
+ player is remembered once they leave. A block (§12, "Blocks") holds: a player a block hides from
1409
+ the viewer is not on their card (no face, no feed row from or to them), and
1410
+ their name is taken out of every word the card shows them: the title, text,
1411
+ notes and options, and the manifest's lines too (in the chips and the feed:
1412
+ "cy: someone did it" for a line "bo did it"; the server sends the redacted
1413
+ words of those lines in the card's `words`). A lock (`picked`) on a face the
1414
+ viewer is not shown -- one a block hides, or a player gone -- stays a lock
1415
+ and names nobody: `picked: {}`, drawn "Locked in ✓". Blocks are the
1416
+ session's pairs among the players here (`session.hub.hiddenPair` says
1417
+ nothing about a player who has left), so name redaction covers players
1418
+ present now: a departed player's name in the deck's own words (title, text,
1419
+ notes, options, or a manifest line that happens to contain it) is not
1420
+ redacted -- the same limit the HUD and labels have. Their rows and face are
1421
+ gone for every viewer by then. Each player is sent their own
1422
+ whole card privately when it changes (`hub-ballot-card`, §12) and again after
1423
+ a fresh join; a leaving player's own card goes with them, and so does
1424
+ anything kept for a connection that left before saying hello. A deck that
1425
+ declares `ballot` in none of its places has no `hub.ballot` (the member is
1426
+ absent; in a deck that declares it elsewhere, a place without it is refused
1427
+ as above). Ids are looked up as own properties only (`who`, `words`), so an
1428
+ id such as `constructor` names nothing it should not.
1429
+
608
1430
  **Player contact is not in v1.** Other players are kinematic capsules on every
609
1431
  client, so nobody can be shoved (M0 gap 4). That is an engine rule, not a
610
1432
  contract field; a game that needs it waits for it.
@@ -682,6 +1504,305 @@ hub.setHud({ text: 'you are it!' }, playerId); // one player's override; null c
682
1504
  Longer strings are cut, other keys dropped. A per-player spec replaces the
683
1505
  shared one for that player.
684
1506
 
1507
+ **A clear HUD (v1.26).** The HUD hangs from the top middle of the screen, and
1508
+ on a phone that is where much of what the hub draws over the world lands too:
1509
+ with a title, a 56 px big line and a text line the box is over 100 px tall, the
1510
+ text line is the part pushed farthest down, and a label, a goal chip or a
1511
+ speech bubble near the top is drawn across it. A place whose manifest sets
1512
+ `hud: { clear: true }` (§1) is drawn by these rules instead
1513
+ (`code/client/hudClear.js`):
1514
+
1515
+ - **A smaller big line over a text line.** When the HUD shows both a big line
1516
+ (`big`, or the timer standing in for it) and `text`, the big line is 32 px
1517
+ (28 px on a short view, below), on one line. One too wide for its row (the
1518
+ HUD's 70% of the view's width, less the Back button's side where one is
1519
+ shown, never under half the view) shrinks to fit, never below 18 px; past
1520
+ that it is cut with an ellipsis rather than wrapped. A big line with no text
1521
+ under it keeps its 56 px and wraps as it always did.
1522
+ - **Nothing under the HUD.** Whatever the hub chrome places over the world
1523
+ whose box would lie over the HUD's box as drawn (measured, so it follows the
1524
+ HUD's content) is moved straight down to 6 px under it: actor labels and
1525
+ signs, speech bubbles (an NPC's line, a player's phrase, chat), a player's
1526
+ mark, an emote, a seat's or object's prompt, the pointers to goals (v1.13)
1527
+ and friends, a cabinet's card and the result ribbon. Nothing is hidden,
1528
+ moved sideways or moved up; what is beside the HUD or already under it stays
1529
+ where it was. Nothing is moved off the bottom of the view: a thing too tall
1530
+ to lie both under the HUD and whole on screen (an open cabinet board on a
1531
+ phone on its side) moves only as far as keeps its bottom edge in view, and
1532
+ the HUD is left over its top. Two things moved under it may overlap each
1533
+ other. While no HUD is drawn nothing moves.
1534
+ - **A short view.** On a view 480 px tall or less that is wider than it is
1535
+ tall (a phone on its side) the text line keeps to two lines (cut with an
1536
+ ellipsis) and the box to 40% of the view's height. A portrait view is never
1537
+ short, however small (the web player's card on a 360 px phone is about
1538
+ 475 px tall).
1539
+
1540
+ A choice card (v1.68, §6) takes at most 60% of the view's height, below where
1541
+ an ordinary HUD ends; under a clear HUD its height is also kept to the room
1542
+ below the HUD's measured box (never under 160 px), so the HUD stays in view
1543
+ over it.
1544
+
1545
+ The option is the place's: a game behind a town's door is drawn by the town's
1546
+ client, which is told by the game's server (`hubPlace.hud`), so the game's own
1547
+ manifest decides either way it is opened, and the town's own HUD is not
1548
+ changed by a game that asks. A town running a kit older than v1.26 draws the
1549
+ game as before. Fixed chrome (the Back button, an invitation card, the
1550
+ buttons) is not moved.
1551
+
1552
+ ### Action chips (v1.74)
1553
+
1554
+ A place with `actions: true` may offer each player up to three buttons with
1555
+ `hub.actions(playerId, [{ id: 'start', label: 'Start' }])`. They stack upward
1556
+ at the bottom-right, with targets at least 44 px tall, above Character, Grab,
1557
+ emotes, speech and the decor button. When that column is full, they move left
1558
+ of the measured left edges of the round-control column, with a 12 px gap,
1559
+ above any controls sharing the new span. Sound and its open card,
1560
+ the HUD, the ask card and Back are upper bounds; other controls sharing the
1561
+ chips' column push the stack up wherever they sit in the view. Chips keep
1562
+ 12 px view margins and gaps above controls, and trim from the top when the
1563
+ second position is full, retrying both positions after each trim and preserving
1564
+ the first (bottom) chip whenever it fits.
1565
+ They yield to open panels, decorating, the choice card and travel.
1566
+ Pointer presses do not focus chips; clicks blur them, and
1567
+ a chip focused by other means contains its keydown/keyup events. Identical
1568
+ received items and `n` keep the existing buttons.
1569
+
1570
+ A tap sends `{ k: 'hub-action', id, n }`. It reaches `action` only if `n` is a
1571
+ safe integer equal to that player's current offer version **and** `id` is in
1572
+ that current list, and that offer is the one the player was last sent (a list
1573
+ recorded and not yet sent cannot be pressed). An id reused by a changed offer
1574
+ cannot take a stale press.
1575
+ Async hooks are neither serialised nor cancelled when the player leaves.
1576
+
1577
+ `hub.actions` records, rather than sends, the newest list. Each change from
1578
+ the last recorded list takes a new version, including clearing to null, from
1579
+ one counter for the place's session (no offer shares a version with an
1580
+ earlier one, whoever it was for); a list changed back to the one the player
1581
+ was last sent, with nothing sent between, keeps that offer's version, so what
1582
+ the player sees can always be pressed. The tick sends at most four ordinary offers a second per player,
1583
+ 250 ms apart, and sends nothing when the last-sent items equal the current
1584
+ items. Intermediate recordings still advance `n` even when the final list
1585
+ returns to the last-sent list; earlier presses remain superseded. A fresh
1586
+ hello immediately replays the current offer once with its current `n`, and
1587
+ is an exception to the ordinary delivery budget. Offers are private, never
1588
+ snapshot state. Before WORLD the client buffers an offer but draws nothing
1589
+ until the place is known to opt in; a keyless WORLD drops it. The client
1590
+ drops its chips when reconnect re-hello marks private state stale; the server
1591
+ restores its current offer.
1592
+
1593
+ An action the player chooses is a button (hub.actions); standing somewhere only moves the player. Stand-on pads stay for go doors and race starts.
1594
+
1595
+ ### The companion (v1.71, dress and pose v1.78)
1596
+
1597
+ A place with `companion: true` may give each arrived player a floating
1598
+ companion with `hub.companion(playerId, { look: 'lantern', say: 'Follow me',
1599
+ at: 'gate' })`. The whole spec is private to its owner. **The place authors
1600
+ every line; nothing a player typed may be passed to `say`. The line is never
1601
+ shown to anyone else.** With the object manifest form, the existing NPC talk protocol also opens a private chat (§13).
1602
+
1603
+ The lantern or folded paper bird floats 0.55 m right and 0.35 m behind the
1604
+ player, or 0.9 m toward the target actor, 1.45 m above the feet (the avatar
1605
+ origin is 0.7 m above its feet, as for wearables). It bobs 0.06 m at 0.5 Hz,
1606
+ eases with a 0.25 s time constant and snaps when over 6 m away. The bird
1607
+ faces its travel or pointing direction and flaps at about 2 Hz. After 1.5 s
1608
+ under 0.2 m/s with no point target it rests 0.28 m to the avatar's right,
1609
+ 1.25 m over the feet, facing with the player, without bobbing, wings folded
1610
+ down at a fixed angle. Motion or a point target resumes flight. A changed
1611
+ version with `say` shows the owner's existing speech bubble for 3500 ms plus
1612
+ 55 ms per code point, capped at 9000 ms; text only, no input or focus.
1613
+ The current line is shown again, once, when the owner's connection comes
1614
+ back or their frames stopped for ten seconds (a hidden page), whatever the
1615
+ version: a reconnect says it again. No wire change.
1616
+ Other players see only a tiny warm glow parented at the avatar's shoulder.
1617
+ The owner's public id draws no second glow. Bodies rebuilt or removed take
1618
+ their glows with them; travel hides both follower and glows.
1619
+
1620
+ v1.78 adds optional own `dress`, a plain object with only optional own
1621
+ `species`, `wear`, and `tint`. Species ids are `songbird` (the default),
1622
+ `owl`, `parrot`, and `hummingbird`; wear ids are `tophat`, `sunhat`, `bow`,
1623
+ `scarf`, `stampcap`, and `flowercrown`; tint ids are `rose`, `mint`,
1624
+ `midnight`, and `gold`. Wear and tint default to absent. Unknown keys or
1625
+ values throw; a lantern rejects any dress, even an empty one. An empty or
1626
+ all-default dress is omitted, preserving exactly the v1.71 spec bytes.
1627
+
1628
+ v1.78 also accepts optional own `pose: 'show'`, only for birds; every other
1629
+ value and any lantern pose throw. Absent pose preserves existing spec bytes.
1630
+ The show-off bird flies close to the camera, in front of the player. Its
1631
+ paper-and-wear projected box is centred at 27% of view width and 40% of view
1632
+ height on portrait phones (35% width and 45% height in landscape), with at
1633
+ least a 4% screen inset.
1634
+ In portrait the whole box stays left of the projected player centre by at
1635
+ least 2% of view width, including while the held pose springs to its target.
1636
+ Its built paper bounding-box height at normal scale seeds the distance; the
1637
+ transformed paper and worn vertices, including the hat anchor and wing flutter,
1638
+ then fit about 33% of the vertical view, reduced as needed for width clearance.
1639
+ At 412×870 with the town's 70-degree lens, the upright pose keeps at least 28%
1640
+ of the view height throughout its turn.
1641
+ The glow is excluded from fitting. Hats use each species' head dimensions and
1642
+ attachment point; a tophat is about one third of its body length tall, with a
1643
+ brim only a little wider than its head. Bow and scarf attach at the neck.
1644
+ These accessory proportions apply to the ordinary follow pose too.
1645
+ Framing uses the scene's active render lens, including the orbit lens and
1646
+ camera zoom, with camera near-plane clearance and room before the player.
1647
+ A normal-scale origin-centred bounding sphere includes the transformed geometry
1648
+ and worn item; the nearest model point stays at least `near + 0.15` away in
1649
+ camera depth. The show flight reaches its current camera target in 0.7 seconds
1650
+ regardless of starting distance, then holds with the short spring and enforces
1651
+ the whole box's screen inset. An extreme zoom with no room prioritises camera
1652
+ clearance. The model's up axis stays upright in the camera's view plane at any
1653
+ orbit elevation. The orientation uses the camera's world right/up/toward-camera
1654
+ basis, a shallow 8-degree turn about camera up, then a 30-degree tilt about
1655
+ camera right. A gentle four-second turn varies that side angle by ±2 degrees,
1656
+ with raised, lightly fluttering wings; the shallower turn keeps the bird large
1657
+ in the portrait slot. From the first approach frame it uses full normal
1658
+ scale, opaque paper and worn materials. The additive glow uses 20% of its normal opacity while showing,
1659
+ restored afterwards. Show suppresses leading, quieting, stamp twirls and
1660
+ temporary hat try-on while keeping the worn item visible. Clearing the pose
1661
+ flies back to normal follow.
1662
+ Dress and pose are owner-only, never in `hubGlow`, snapshots or deltas; the
1663
+ public glow remains presence only. The opted-in server API exposes
1664
+ `hub.companionDress === true` for dress and the separate
1665
+ `hub.companionPose === true` for pose. A kit with dress support may lack pose
1666
+ support; places must gate each field on its own capability. These server-only
1667
+ flags send no wire bytes.
1668
+
1669
+ Every species uses the same wing rig, head anchor, lead, perch, twirl and
1670
+ quiet-follow scaling/opacity. Hummingbird wings flutter faster. Tint paints
1671
+ the main body and wing paper, leaving glow, beak and eyes unchanged. A worn
1672
+ accessory hides during the temporary hat-stall try-on and returns afterwards.
1673
+ Changing dress disposes the old geometry and materials and rebuilds the bird.
1674
+
1675
+ These unlit primitives use no textures, lights or shadows: 30 triangles for
1676
+ the lantern, sixteen for the songbird, 40 for the owl, 31 for the parrot,
1677
+ 30 for the hummingbird (including their glows), eight for a public glow. The paper bird is
1678
+ about 0.5 m across, with orange undersides (`#f2a65a`) for its folds and a soft glow behind it. They are nodes,
1679
+ never scene actors, so tier rules neither count nor cull them on Low.
1680
+ Private state arriving before WORLD is held until the place's opt-in is
1681
+ known; a keyless WORLD drops it. Reconnect re-hello drops stale private state
1682
+ and replays the current companion, including its line. Ordinary sends are
1683
+ 250 ms apart per player; a fresh hello is an exception. A place without the
1684
+ key creates no companion state or drawer and keeps its existing wire bytes.
1685
+
1686
+ ### Private text prompt (v1.75)
1687
+
1688
+ A place with `ask: true` may call
1689
+ `hub.ask(playerId, { id: 'pet-name', title: 'Only you will see this name', max: 16 })`.
1690
+ Only that player sees the card: its title, one single-line input, OK and Cancel.
1691
+ Enter submits; OK stays disabled unless the field passes the same text rules
1692
+ as the server. IME confirmation (including keyCode 229) does not submit. The
1693
+ card stays above the phone keyboard and suspends walking and orbit input
1694
+ while open. Sending closes it
1695
+ immediately, and the same `n` cannot reopen it. Null, a newer version,
1696
+ re-hello, leaving the place and scene teardown remove the card, wipe its field
1697
+ and release the input lock. Movement and look input are suppressed before
1698
+ player behaviors run, and a gesture shield keeps drags off the canvas.
1699
+ A pending prompt waits while a ballot card or NPC conversation is open; an
1700
+ NPC opening or ballot arriving while the prompt is open cancels it once,
1701
+ without taking focus back. A close or newer version replaces a pending
1702
+ prompt. A fresh hello can replay the current prompt.
1703
+
1704
+ An answer is `{ k: 'hub-menu-pick', id, n }` (v1.79, §9: exactly these keys; current and last-sent version, known item id or reserved `close`, six/s burst eight including dropped presses; readOnly allows close only);
1705
+ `{ k: 'hub-answer', id, n, text }`, with exactly those keys.
1706
+ It is accepted only from the arrived, connected player whose last-sent prompt
1707
+ has that id, with a safe-integer `n` equal to both the sent and current
1708
+ versions. A changed, closed or recorded-but-unsent prompt cannot be answered.
1709
+ Cancel is `text: null`. A string is first bounded cheaply to `4 * max` UTF-16
1710
+ units, then checked for 1..max code points, not whitespace-only, and no control,
1711
+ Bidi_Control or zero-width characters. The kit never trims or normalises it.
1712
+ Stale ids/versions and malformed envelopes are silently dropped. Once id
1713
+ and version match the prompt in force, refused text (wrong type, oversized,
1714
+ empty, whitespace-only or refused characters) consumes the prompt as Cancel
1715
+ and calls `answer` with `null`; the refused text never reaches the hook.
1716
+ Accepted answers consume the prompt, advance its version and queue the
1717
+ close before `answer` runs; closes share
1718
+ the tick delivery budget. Equality suppresses delivery only when both
1719
+ content and `n` equal the last sent prompt: reopening the same spec after an
1720
+ answer or cancel sends its new version even if the queued close was coalesced.
1721
+ Throwing getters and Proxies are contained without logging their errors.
1722
+
1723
+ **Privacy:** typed text goes only from the typing client to the place server
1724
+ hook. The kit never sends it to any client, including the sender, puts it in a
1725
+ snapshot, delta, label, log or error, or stores it after the hook returns.
1726
+ A place must never show what a player typed to another player. A place without
1727
+ `ask` has no API, hook lookup, private state, chrome or wire additions.
1728
+
1729
+ **A place menu (v1.79).** Only a place with `menu: true` can call
1730
+ `hub.menu(playerId, spec | null)`. It offers one sheet privately to that player:
1731
+
1732
+ ```js
1733
+ hub.menu(playerId, {
1734
+ title: 'Your colours', note: 'Choose a colour', readOnly: false,
1735
+ sections: [{ title: 'Colours', items: [
1736
+ { id: 'blue', label: 'Blue', color: '#3aa0d8', icon: 'badge-round', on: true },
1737
+ ] }],
1738
+ });
1739
+ ```
1740
+
1741
+ Spec, sections and items are plain objects with own required properties;
1742
+ optional properties must also be own. Each is read once, validated and copied;
1743
+ unknown keys (including hidden or symbol keys) are refused. Required: spec
1744
+ `title` and `sections`, section `title` and `items`, item `id` and `label`.
1745
+ Optional: spec `note`, `readOnly` and `face` (v1.85), item `color`, `icon`, `on`.
1746
+ Title: 1..32 code points; note, when present: 1..80; 0..8 sections with titles
1747
+ 1..24 code points; 0..48 total items (a section may be empty); labels 1..16
1748
+ code points. All text uses actions' hygiene: no control, direction or
1749
+ zero-width characters, never whitespace-only. Item ids match
1750
+ `[a-z][a-z0-9_-]{0,31}`, unique across the menu; `close` is reserved and refused
1751
+ as an item id. Color is `#rrggbb` (hex digits case-insensitive). Icons are
1752
+ exact earned shape ids from `code/client/earned.js` `EARNED_SHAPES`, or bare
1753
+ hat ids from `code/client/hats.js` `HATS`; unknown icons are refused. `on`
1754
+ and `readOnly`, when present, are booleans. A missing color uses the chrome's
1755
+ text color. Invalid calls throw TypeError before changing state.
1756
+
1757
+ `face`, when present, is a finite number in degrees, normalised into
1758
+ [-180, 180). It uses `hub.placeAt`'s facing convention: the avatar looks
1759
+ along `(sin f, cos f)` in x/z (f in radians); 0° faces +z, 90° faces +x.
1760
+ While this sheet is shown under orbit camera control, the player's own
1761
+ client holds its local avatar at that facing; normal move reports carry it
1762
+ to other players. Held and seated players keep their hold or seat facing,
1763
+ which takes precedence. Follow-camera places ignore `face`; it never
1764
+ changes the camera's chosen yaw (`camAngle`). A held orbit shot uses the
1765
+ same orbit-control gate. Close, replacement without `face`, leave or a
1766
+ higher-priority UI releases the override immediately. The avatar keeps its
1767
+ last facing until the player moves. Older menu clients retain the spec and
1768
+ read only known display keys, so they ignore `face`.
1769
+ Without `face`, client control and the offer's wire bytes are unchanged.
1770
+ With `face`, the sheet is capped at 40% of the view height (40vh, or 40dvh where supported) to leave room for the avatar close-up, with its tile area scrolling as before; without `face`, the existing 55vh/55dvh cap and styles are unchanged (v1.86).
1771
+
1772
+ Every change, including null or a change back before delivery, increments a
1773
+ safe-integer counter for that player. Equal specs change nothing. Ordinary
1774
+ tick offers coalesce to at most four/s per player, at least 250 ms apart;
1775
+ newest wins. Fresh hello replays an open menu or a still-undelivered null once immediately,
1776
+ with its current version. An unused menu or an already delivered null sends nothing; leave forgets menu and press budget, retaining only
1777
+ the counter so returning players cannot reuse versions. Menus never appear
1778
+ in snapshots or deltas. Before WORLD, offers buffer but draw nothing until
1779
+ an opted-in place is known; a keyless WORLD discards them. Reconnect clears
1780
+ private client state before the hello replay.
1781
+
1782
+ The sheet is phone-first, at most 55% of the viewport height, with an internal
1783
+ scroll and the avatar visible above it. A title row has Close (×), then the
1784
+ optional note and section titles with square tiles of at least 64 px: 3–4
1785
+ columns on portrait phones, more on wide screens. Each tile shows a color
1786
+ swatch or an icon silhouette in that color, with its label underneath;
1787
+ `on` shows a ring and check. Pointer presses do not take canvas focus; tiles
1788
+ show immediate pressed feedback, but only the next spec changes selection.
1789
+ Reduced motion suppresses the pressed scale. ReadOnly tiles cannot be tapped
1790
+ and have no hover/press affordance; a note such as "Only <owner> can change
1791
+ this" is the place's responsibility. Walking and orbit input are held as for
1792
+ ask while open. Close, Escape, browser Back or the host's Back closes locally
1793
+ and sends `{ k: 'hub-menu-pick', id: 'close', n }`. The place decides whether
1794
+ to call null (including any distance-based close); the kit does not consume
1795
+ a menu on a pick or close. A newer spec replaces all old tiles, and null
1796
+ removes the sheet. Ask, conversations, the choice card, decorating and travel
1797
+ have priority over this sheet.
1798
+
1799
+ A tile sends `{ k: 'hub-menu-pick', id, n }`. The server requires the player's
1800
+ CURRENT menu and its last-sent version, drops stale/unknown picks, and refuses
1801
+ all item picks while readOnly; close still reaches `menu(hub, playerId, id)`.
1802
+ Six attempts/s with burst eight per player, including dropped presses.
1803
+ Async hooks are neither serialised nor cancelled on leave. Absent `menu`:
1804
+ no API, hook lookup, state, chrome, messages or wire additions.
1805
+
685
1806
  ## 10. Actor visibility
686
1807
 
687
1808
  `hub.hide(actorId)` removes a scene actor for everyone: its server body is
@@ -691,6 +1812,33 @@ disabled now, and every client (including later joiners) removes it.
691
1812
  below the ground with its collider rather than despawned, so it is meant for
692
1813
  actors that do not move by physics.
693
1814
 
1815
+ **Per-viewer visibility (v1.62).** `hub.hide(actorId, { to: [playerIds] })`
1816
+ and `hub.show(actorId, { to: [playerIds] })` replace the shared visibility for
1817
+ those connected players until cleared. For example, two baked Model actors
1818
+ at one spot can show a lit trophy to its owner and a dark silhouette to
1819
+ others; Models are supported without tinting. Either operation with
1820
+ `{ to: [playerIds], clear: true }` drops the override, restoring the current
1821
+ shared state. Shared hide/show calls leave private overrides in place.
1822
+ Unknown or disconnected player ids are ignored; `to` must be an array of
1823
+ strings and `clear`, when supplied, a boolean. Empty target lists are accepted.
1824
+ Actor validation is the same as shared hide (scene actors and spawned copies).
1825
+ There are at most 256 actor overrides per player; replacing or clearing an
1826
+ existing override is allowed at the cap. A call that would exceed it for any
1827
+ recipient is refused for all recipients. Private calls return true when taken;
1828
+ invalid actor/options or the cap warn once per refusal kind and return false
1829
+ without changing anything. Leaving drops that player's overrides, including
1830
+ ones set before their first hello.
1831
+
1832
+ Only the client's view changes: server logic that reads `h.hidden` (pads,
1833
+ labels, doors and idle) continues to use the shared state. Server bodies and
1834
+ grab ownership are unchanged by private calls; a privately shown actor whose
1835
+ shared body is disabled still has a disabled server body. The client merges
1836
+ visibility as `(shared hidden - private show) + private hide`, used by its
1837
+ existing drawing, pads, idle and soundscape readers. Overrides clear on the
1838
+ same scene/place changes and leave paths that clear shared client visibility.
1839
+ A place that never supplies options sends byte-identical snapshots, deltas
1840
+ and messages; no new snapshot key is added.
1841
+
694
1842
  `hub.label` puts words over a scene actor, drawn by the hub chrome like the
695
1843
  HUD: a pad's "3 of 6", an NPC's line, the hill's king.
696
1844
 
@@ -702,6 +1850,23 @@ the way to it, with the distance in metres beyond 6 m (the follow camera looks
702
1850
  down, so a far sign is rarely in view). A goal is one player's own: with no
703
1851
  `to` it is a `"sign"`. The two nearest are drawn; `null` clears one like any
704
1852
  label. A town on an engine from before v1.13 draws it as a tag.
1853
+ v1.39: the distance shown is the player's straight line to the actor unless
1854
+ the goal says which to show -- `{ distanceM: n }` is the number of metres
1855
+ shown in its place (finite and 0 or more, kept to the whole metre; the walk
1856
+ to the end of a route whose next corner the pointer aims at), shown like the
1857
+ measured one only beyond 6 m, and `{ distance: false }` shows none. Any other
1858
+ value of either is ignored and the measured distance is shown; neither means
1859
+ anything on a label that is not a goal. Set again with a new number (a place
1860
+ may do so about once a second) only the chip's words change; a label's
1861
+ expiry (`ttlMs`, from each time it is set) is as it was.
1862
+
1863
+ v1.81: `{ edge: false }` makes a goal a hint: the same pointer and distance
1864
+ label over its actor while it projects on screen, nothing when off screen or
1865
+ behind the camera. The two nearest goals that will actually be drawn are
1866
+ chosen, so a hidden hint never displaces an edge-drawn goal. Only exactly
1867
+ `false` on a goal with `to` is stored and sent; any other value or style ignores
1868
+ it. With the key absent, goals are stored, sent and drawn byte-identically.
1869
+ This applies only to hub places; no editor, classic or other Cauldron deck changes.
705
1870
 
706
1871
  **Labels in a town.** In a place with no `result` (a town, not a game) the
707
1872
  client draws a label only when its actor is near the player: the nearest
@@ -715,6 +1880,51 @@ statue, board, pad and NPC -- and all of it at once was a wall of text from
715
1880
  the arrival spot; the words are there when the player walks over. A game
716
1881
  place draws every label it sets, as before.
717
1882
 
1883
+ **Labels kept near (v1.43).** A deck whose `hub` block says `"labels":
1884
+ "near"` has its towns draw less still, for a world too wide for names seen
1885
+ from anywhere. The world labels are the ones `hub.label` puts over scene
1886
+ actors as a plate (plain or `"tag"`), an NPC's line (`"speech"`) or a
1887
+ `"sign"`:
1888
+
1889
+ - a plate and an NPC's line are picked as above (the nearest within 4 m, the
1890
+ nearest within 9 m, one of each);
1891
+ - a `"sign"` is drawn only near the player: it comes on within 12 m of them
1892
+ on the ground and is kept until 14 m, thinning over the last metre, so
1893
+ nothing is drawn at 14 m or past it. The distance is the player's, not the
1894
+ camera's: zooming out brings no sign in;
1895
+ - no two world labels overlap. They are taken in order -- the plate stood
1896
+ by, the NPC's line, then signs by how near (one already drawn counts
1897
+ 0.75 m nearer, so two equally near do not swap; of two equally near, one
1898
+ said to this player alone before one said to everyone) -- and one whose
1899
+ box touches a label already taken is not drawn. One taken down this way
1900
+ comes back only when it clears the others by 8 px and no sooner than two
1901
+ seconds later, so no label goes, comes and goes inside two seconds; while
1902
+ it waits it keeps its place among the three, so the next one down the
1903
+ order does not flash up for that moment;
1904
+ - at most three world labels are drawn at once;
1905
+ - a label comes and goes over a quarter second. Every label drawn in a
1906
+ frame, at any opacity, is held to the same rule: the ones going are taken
1907
+ after the ones chosen, in the same order, and one that would touch a label
1908
+ already taken (or be a fourth) goes at once instead of fading;
1909
+ - a label is judged where it is drawn, and drawn where it was judged: one
1910
+ box is worked out for it (its size for the words it has this frame, an
1911
+ NPC's line kept on the screen sideways, and in a place with a clear HUD
1912
+ -- `hud.clear`, §9 -- its move out from under the HUD), the rule is given
1913
+ that box and the chrome draws the label in it. So two signs moved onto one
1914
+ spot are one sign, and an NPC's reply that changes length by the screen's
1915
+ edge is placed by its new words;
1916
+ - what is held down, in reach or half faded belongs to one visit: another
1917
+ scene, the scene loaded again, a reconnect or a trip through a door starts
1918
+ the rule again.
1919
+
1920
+ Not world labels, and drawn, counted and placed exactly as without the key:
1921
+ goal pointers (`style: "goal"`) and friend pointers, players' own speech
1922
+ bubbles, reactions, emotes and marks, name tags, a cabinet's card, the result
1923
+ ribbon and the "Stuck?" chip. Nothing is tested for being behind a building.
1924
+ The key changes nothing a place's server calls or is told: a place that wants
1925
+ a far thing found says so with a goal. A game place draws every label it
1926
+ sets, with the key or without.
1927
+
718
1928
  **Moving an actor (v1.1).** `hub.move(actorId, to, { overMs })` moves a scene
719
1929
  actor whose `Body` is `"kinematic"`: a moving platform, a sweeper, a gate that
720
1930
  slides open. `to` is any of `x`, `y`, `z` (metres) and `rotationY` (degrees);
@@ -770,6 +1980,16 @@ alive at once and 10 spawns a second with bursts of 40; past either, `spawn`
770
1980
  returns null and logs once, and a game tries again later. A copy a client
771
1981
  reports gone (the multiplayer kit's pickup rule) is gone for the game too.
772
1982
 
1983
+ **Scenery a scene marks static.** A place's scene may mark actors
1984
+ `"static": true` and set `"engine": { "staticActors": true }` (physics-3d
1985
+ `CLAUDE.md`): the engine then leaves a marked actor alone until it is told the
1986
+ actor is being changed. Nothing in this contract changes for such a scene. The
1987
+ client tells the engine before it applies `hub.hide`, `hub.show`, `hub.tint`
1988
+ or `hub.move` to an actor and before it swings a door, so a place may do any
1989
+ of those to a marked actor; the actor is then an ordinary one until the scene
1990
+ is loaded again. A place whose own client code writes a marked actor's
1991
+ components calls `scene.touch(id)` first.
1992
+
773
1993
  **Recolouring an actor (v1.1).** `hub.tint(actorId, '#rrggbb')` paints a scene
774
1994
  actor drawn by a `Shape` for everyone, later joiners included; a Shape that
775
1995
  glows (`emissive`) glows in the new colour. `hub.tint(actorId, null)` puts its
@@ -782,14 +2002,159 @@ cannot be painted (every client would rebuild the model), nor one with a
782
2002
  dynamic `Body` (a client rebuilds a body whose Shape changes, stopping it
783
2003
  dead). A textured face takes the colour as its tint.
784
2004
 
2005
+ **Turning displays (v1.55).** A scene actor may carry `"HubSpin": { "rate":
2006
+ 45 }` among its components: every client turns it about its vertical axis at
2007
+ `rate` degrees a second (negative turns the other way), from the scene data
2008
+ alone -- a hat on a stand, a trophy, a sign. Nothing goes over the wire:
2009
+ there is no op, no snapshot field and no body; the server never turns it
2010
+ (`actorsWith`'s `t` keeps the authored rotationY), and two
2011
+ players' displays need not face the same way at the same moment. The turn is
2012
+ written to the actor's Transform each frame, rate times the frame's time, so
2013
+ it is as fast on a slow phone as on a fast one, and is drawn with everything
2014
+ under the actor's node (a `Model` riding on its `Shape`). `rate` is a finite
2015
+ number, not 0, from -720 to 720; `HubSpin` has no other key. The check
2016
+ refuses it (as the engine merges the actor with its blueprint) on an actor
2017
+ with a `"dynamic"` or `"kinematic"` `Body` -- its pose is its simulation's or
2018
+ the server's (`hub.move`) -- on a solid one (`Solid`, or `Shape.solid`),
2019
+ whose collider would turn on every client and stand still on the server,
2020
+ and on a `Player`, `HubDoor`, `HubNpc`, `HubSeat` or `Pickup`, whose facing
2021
+ is already owned; a client turns none of those either. Put the turning part on
2022
+ an actor of its own (the hat, not the stand). With the rest of §10: a hidden
2023
+ actor waits unturned and turns on when shown; `hub.tint` paints a turning one;
2024
+ a copy `hub.spawn` makes of a template carrying `HubSpin` turns too, from the
2025
+ `rotationY` it was put at (a hidden prototype costs next to nothing); a scene with
2026
+ `staticActors` is told before each turn (`scene.touch`). `HubSpin` is a `Hub`
2027
+ component, so device tiers (v1.21) draw the actor on every tier. A scene
2028
+ with no `HubSpin` is looked through once when it loads and nothing more:
2029
+ nothing is registered, turned or touched. A shop that turns its hats lets a
2030
+ player try one on with `hub.tryOn` (v1.28), never saved.
2031
+
2032
+ ### Decorating (v1.67)
2033
+
2034
+ A place opts in with `hub.decor` (or `hub.places.<id>.decor`):
2035
+
2036
+ ```json
2037
+ "decor": {
2038
+ "grid": { "origin": "floor", "w": 8, "d": 7, "cell": 1 },
2039
+ "layers": ["rug", "floor"]
2040
+ }
2041
+ ```
2042
+
2043
+ The origin is a scene actor with a finite Transform: its x,z is the grid's
2044
+ minimum corner, y the floor height. Axes stay world x,z; the actor's rotation
2045
+ is not applied. Width and depth are integers 1..16, cell size 0.5..2 metres.
2046
+ There are 1..3 unique layer ids. Catalogue, tab, swatch and layer ids match
2047
+ `[a-z][a-z0-9_-]{0,23}`; actor ids are non-empty strings of at most 128 chars.
2048
+ The publish check refuses an invalid declaration or missing origin actor.
2049
+
2050
+ The server receives `hub.decor` only in a place with that key:
2051
+
2052
+ | call | what it does |
2053
+ | --- | --- |
2054
+ | `hub.decor.has(key)` | Whether a spawned piece still exists; use before including its key in a catalogue or restoring it |
2055
+ | `hub.decor.button(playerId, label \| null)` | Offers this player a chrome button at bottom-right. Label 1..16 characters; null removes it. A tap is `{ op: 'button' }` to the hook, with no catalogue required |
2056
+ | `hub.decor.open(playerId, spec)` | Opens the private catalogue below and a local floor grid/placement preview |
2057
+ | `hub.decor.close(playerId)` | Closes the catalogue and clears its preview, retaining the offered button |
2058
+ | `hub.decor.update(playerId, partialSpec)` | Replaces named spec fields (whole arrays), retaining the rest, and validates the resulting spec. Requires an open catalogue |
2059
+
2060
+ The player-targeted calls need a connected player. Invalid calls throw `TypeError` before
2061
+ changing state. Specifications contain only these fields:
2062
+
2063
+ ```js
2064
+ {
2065
+ title: 'Only you can change your house', // optional, at most 40 characters
2066
+ tabs: [{ id: 'furniture', label: 'Furniture' }],
2067
+ items: [{
2068
+ id: 'chair', tab: 'furniture', label: 'Chair', template: 'chair-template',
2069
+ w: 1, d: 1, layer: 'floor', count: 2,
2070
+ // locked: { price: '120 ▲' },
2071
+ }],
2072
+ // swatches: [{ id: 'sage', tab: 'walls', label: 'Sage', color: '#779977' }],
2073
+ placed: [{ key: 'chair-template-1', item: 'chair', x: 2, z: 3, rot: 0, layer: 'floor' }],
2074
+ }
2075
+ ```
2076
+
2077
+ Tabs: 1..6 unique ids, labels 1..16 characters. Items: at most 64, unique
2078
+ ids, a declared tab/layer, label 1..16 characters, integer w,d 1..4 cells,
2079
+ count a non-negative safe integer. Count means spare copies; it shows a ×n
2080
+ chip above one, and ×0 for placed-out stock. Locked items show a lock and
2081
+ price (1..12 characters) and cannot be picked. The template must be a
2082
+ spawnable scene actor (`hub.spawn`'s Shape/Transform rules). It supplies both
2083
+ the offscreen thumbnail and local ghost, including Models; a hidden template
2084
+ is allowed. Swatches: at most 24 unique ids, declared tabs, labels 1..16
2085
+ characters, `#rrggbb` colours. Placed: at most 64 unique keys naming live
2086
+ spawned actors, item/layer matching the catalogue, integer x,z inside the
2087
+ grid, rot 0..3; the rotated footprint must fit. All arrays except swatches
2088
+ are required, including empty items/placed arrays. Unknown keys are refused.
2089
+
2090
+ `decor(hub, playerId, op)` receives one of:
2091
+
2092
+ ```js
2093
+ { op: 'button' }
2094
+ { op: 'place', item, x, z, rot }
2095
+ { op: 'move', key, x, z, rot }
2096
+ { op: 'stash', key }
2097
+ { op: 'swatch', swatch }
2098
+ { op: 'close' }
2099
+ ```
2100
+
2101
+ Only arrived, connected players receive routing. A button must be offered;
2102
+ every other op requires that player's own open catalogue. Items must be
2103
+ pickable with spare stock; keys and swatches must belong to that catalogue.
2104
+ Cells are integers inside the grid, rot 0..3; unknown fields/ops are dropped.
2105
+ The server routes at most six ops/s per player with a burst of eight; a hook
2106
+ refusal spends its token too. Throws/rejections are logged and contained.
2107
+ **The deck decides ownership, collision, stock consumption and saving.** The
2108
+ kit changes no actor for an op, and does not close on a close request: the
2109
+ hook calls `hub.decor.close`, or accepts an edit with `hub.spawn/move/despawn`
2110
+ and `hub.decor.update`. Colour choices use `hub.tint` as before.
2111
+
2112
+ The kit draws “Decorating” plus the optional subtitle, a floor grid, and a
2113
+ bottom tray of horizontally scrollable tabs, thumbnail tiles and swatches.
2114
+ Touch or mouse on a placed actor lifts a translucent copy slightly; tap/drag
2115
+ the floor sets its corner cell, Rotate turns it by 90 degrees, Put away asks
2116
+ to stash it, and ✓ asks to move it. Picking stock starts a new ghost at a
2117
+ free cell nearest the player; ✓ then asks to place it. A new ghost has Cancel.
2118
+ Green/red footprints preview overlap on the same layer and leaving the grid;
2119
+ red cannot be confirmed. The server remains authoritative. Done ✓ asks to
2120
+ close even when nothing is lifted. Walking and orbit input are suspended
2121
+ using the existing input lock while open; Back remains accessible. Preview
2122
+ nodes and private chrome are cleared on close, scene/travel/disconnect and
2123
+ teardown. Thumbnails are cached per scene and rendered at most one new image
2124
+ per frame; closing hides the tray without affecting other players' views.
2125
+
2126
+ Decor places refuse client GONE reports; the server owns actor removal. Leaving
2127
+ for a place without decor disposes its DOM, listeners and thumbnail renderer.
2128
+
2129
+ In a decor place with `idle.seats`, a spawned `HubSeat` copy is offered to guests, fixed or
2130
+ kinematic; a kinematic copy uses the pose `hub.move` last set, and an explicit
2131
+ `HubSeat.face` turns with the copy relative to its template. Copies also inherit
2132
+ `HubSeat.pose`, including Lie down and the lying draw pose. Moving, hiding
2133
+ or despawning its seat stands the sitter. Authored movable seats remain
2134
+ unusable; a decor scene may hold a kinematic seat as a hidden spawn template.
2135
+ Keyless places keep their previous seat behavior.
2136
+
2137
+ Wire (§12): `{ k: 'decor', ...op }` from client, and private
2138
+ `{ k: 'hub-decor', button: label | null, spec: spec | null, grid? }` from
2139
+ server. When open, grid is resolved to `{ x,y,z,w,d,cell }`. Every API call
2140
+ sends that player's whole current state; a fresh hello replays it, an avatar
2141
+ change does not. Leaving forgets it. No state enters a shared snapshot or
2142
+ delta, and a place without `decor` never sends it, draws the tray, creates
2143
+ preview/thumbnail resources, or intercepts the new client message. The
2144
+ manifest/wire major remains `hub.contract: 1`.
2145
+
2146
+ A saved town draws door games with its own client. A town on a kit before
2147
+ v1.67 ignores the private decor message; update and save that town before
2148
+ offering a house with decorating through its doors.
2149
+
785
2150
  ## 11. The platform avatar seam
786
2151
 
787
2152
  A hub game never draws a player. The kit draws everyone, the local player
788
2153
  included, as their **avatar**: an id from the kit's set
789
- (`imports/castle.hub-game/blueprints/avatar-<id>.scene`, v1: `0`-`3`). The
790
- client says which in its hello; the server broadcasts every player's choice; a
791
- change says hello again and respawns that player's body (M0 gap 8). Games never
792
- see any of it.
2154
+ (`imports/castle.hub-game/blueprints/avatar-<id>.scene`, v1: `0`-`3`; v1.51:
2155
+ `0`-`15`, below). The client says which in its hello; the server broadcasts
2156
+ every player's choice; a change says hello again and respawns that player's
2157
+ body (M0 gap 8). Games never see any of it.
793
2158
 
794
2159
  Where the choice comes from is one function, `Avatar.current()` in the kit's
795
2160
  client:
@@ -800,13 +2165,16 @@ client:
800
2165
  chrome's picker calls. Only a curated hub place (an enabled door leads into
801
2166
  or out of it) may change it; the host names the place, and anywhere else a
802
2167
  pick stays the runtime's own. A player who never chose wears a default fixed
803
- by their user id. Anonymous accounts may choose: a template index carries no
804
- text to moderate and nothing of value, and an anonymous account keeps its
805
- user id when it signs up.
2168
+ by their user id. Ghost uses a user-id cutoff: existing accounts below it
2169
+ keep `userId % 4` (`0`-`3`); new accounts from it on use `userId % 16`
2170
+ (`0`-`15`). Stored choices stay unchanged. Anonymous accounts may choose: a template
2171
+ index carries no text to moderate and nothing of value, and an anonymous
2172
+ account keeps its user id when it signs up.
806
2173
  - **A stand-in pick** kept in `scene.persistent`, where there is no platform
807
2174
  avatar: a signed-out visitor, a host or SDK from before avatars, a deck that
808
2175
  is not a curated place (the dev serve). It lasts for the runtime, across
809
- doors.
2176
+ doors. With no stored local choice, it is a random one of `0`-`15`,
2177
+ also used until the platform answers. A stored local choice stays unchanged.
810
2178
 
811
2179
  The hello never waits for the avatar: it goes out with what the kit has, and
812
2180
  says hello again when that changes. Picks are written one at a time; one ghost
@@ -820,7 +2188,132 @@ replaces the hello's choice unless a later hello changes it. Elsewhere (the dev
820
2188
  serve) the server takes each client's hello, which can only change how that
821
2189
  player looks.
822
2190
 
823
- **Avatar sets.** The kit has more than one drawing of the four avatars:
2191
+ **Avatar colours (v1.87, dormant).** Each toon character offers six colours:
2192
+ `0` is the model as drawn; `1`–`5` recolour its named main/shade parts, leaving
2193
+ faces and other parts unchanged. One colour per account, cleared when the
2194
+ character changes. `Avatar.currentColor(scene)` reads it; `colorsAvailable()`
2195
+ is true on the platform path only after the host's `Avatar.get()` answer
2196
+ carries a `color` field and the deck's `castle.base` SDK carries
2197
+ `Avatar.colors === true` (a base republished from main at or after this change).
2198
+ On the stand-in path, support already confirmed by the platform remains
2199
+ available; otherwise the deck's `castle.json` opts in with `hub.avatarColors: true`.
2200
+ `hub.avatarColors` must be a boolean; absent or `false` preserves the stored
2201
+ manifest, and without host hub ops preserves wire bytes and behavior. Only
2202
+ exactly `true` is stored in the manifest. It applies to all of the deck's
2203
+ places, like `hub.yourGames`.
2204
+ `choose(scene, index)` keeps `Avatar.set(index)`
2205
+ without options; `chooseColor(scene, color)` calls `Avatar.set(current,
2206
+ { color })` and confirms or undoes it like the character. Stand-in colours
2207
+ live in `scene.persistent.hubAvatarColor` and clear on a character change
2208
+ only while colours are available; otherwise the stored colour is ignored
2209
+ and colour picks do nothing. A stand-in runtime alone does not enable them.
2210
+ The picker offers six click-only dots below the character grid only when
2211
+ colours are available, the viewer uses toon and the character has a palette.
2212
+
2213
+ The hello adds `color` only while colours are available and for a non-zero
2214
+ integer. The server accepts a hello colour where the host has hub ops or with
2215
+ `hub.avatarColors: true`, provisionally like the hello's avatar. It takes ghost's
2216
+ `hubResultsRead` `players[userId].avatarColor` where the host has hub ops,
2217
+ by the same revision rule as its avatar, regardless of the manifest opt-in;
2218
+ elsewhere it takes the opted-in hello. With no ghost colour and no opt-in,
2219
+ there is no hello `color`, no `hubAvC` and no colour row in the picker.
2220
+ Anything other than an integer `0`–`15` becomes `0`; changing character with
2221
+ no new colour clears it. `hubAvC: { playerId: color }` is a latched whole block
2222
+ listing only non-zero colours, hidden by the same blocked-pair rule as
2223
+ `hubAv`/`hubAv2`, with each permitted viewer's own block in `hub-av`.
2224
+ Snapshots omit an empty block; deltas send `{}` once to clear a block already
2225
+ sent. Old clients ignore `hubAvC`; `hubAv` and `hubAv2` are unchanged.
2226
+ Without colours, client/server behavior and wire bytes remain identical.
2227
+
2228
+ Only toon recolours known palettes. Kit-only live `.colors/` model and
2229
+ blueprint files are cached once per character/colour pair; colour zero, other
2230
+ styles and missing files keep the existing paths. Local bodies use the same
2231
+ variants. Items, hats, fits and heights keep the same character index.
2232
+ The avatar cap counts character/colour pairs and first drops colour before
2233
+ falling back to a stand-in character; nearby players and the local player
2234
+ keep their own appearance.
2235
+
2236
+ **Sixteen avatars (v1.51).** The ids are `0`-`15`: the Castle mascot, Petal,
2237
+ Beat and Star (`0`-`3`, as before), then Biscuit (a puppy), Mochi (a cat), Hop
2238
+ (a bunny), Pip (a penguin), Ribbit (a frog), Ember (a dragon), Bolt (a robot),
2239
+ Gloop (an alien), Cap (a mushroom), Toast, Scoop (an ice cream) and Zest (an
2240
+ orange). The picker shows all sixteen by face and name
2241
+ (`code/client/avatarFaces.js`, written with the models by
2242
+ `scripts/gen-avatars.mjs`). An avatar is still one integer in the hello, and
2243
+ where nobody wears one of the twelve nothing new is sent.
2244
+
2245
+ - **New defaults span all sixteen.** A guest with no stored local choice
2246
+ may be given any of `0`-`15`. Ghost gives an account that never picked
2247
+ `userId % 16` from its user-id cutoff on; an existing account below it
2248
+ keeps `userId % 4`, one of the first four. The cutoff is ghost's rule,
2249
+ not the kit's. Stored choices are kept. Compatibility still uses four:
2250
+ `hubAv` carries `avatar % 4`, and an index this kit lacks folds into
2251
+ `0`-`3`. Server messages are unchanged for the same avatar inputs.
2252
+ - **The other sets do not have them.** `4`-`15` are toon's alone. A viewer in
2253
+ `blocky`, `bean` or `pixel` sees a player who wears one as its toon model,
2254
+ beside the set's own drawings of `0`-`3`, at toon's height and hat fit
2255
+ (`Avatar.drawn`, `top`, `hatFit`).
2256
+ - **A viewer may draw fewer different characters at once**
2257
+ (`code/client/avatarCap.js`). By default the limit is all sixteen, so
2258
+ everyone is drawn as what they wear; with `?hubAvDistinct=N`, at most N
2259
+ different characters, the local player's own included: beyond that
2260
+ the farthest players who wear one of `4`-`15` are drawn as their stand-in,
2261
+ `avatar % 4`, hats fitted to it (the stand-ins count toward N, so
2262
+ the total never passes it unless the first four worn here and the local
2263
+ player's alone do), and nearer players win, with hysteresis
2264
+ (a player drawn as their own counts 3 m nearer; a change holds 2 s).
2265
+ Nobody within 8 m is a stand-in, even past N: a player who walks up is
2266
+ drawn as their own at once and stays so out to 11 m. It is
2267
+ this viewer's drawing alone: the wire, what is saved, the picker and what
2268
+ a place hears are unchanged, and the local player always draws their own.
2269
+ Different characters also draw from shared materials
2270
+ (`code/client/avatarShare.js`); nothing on screen changes for it.
2271
+ `?hubAvDistinct=N` sets the limit and `?hubAvShare=0` turns the sharing
2272
+ off, `?hubAvShare=sort` adds a draw order by geometry, for measuring.
2273
+ - **On the wire, `hubAv` still only names `0`-`3`** (§12). A client from
2274
+ before v1.51 has no blueprint for another avatar and would not draw the
2275
+ player at all, so a v1.51 place lists a player who wears `4`-`15` in
2276
+ `hubAv` as a stand-in, `avatar % 4`, and says what they really wear in a
2277
+ second block, `hubAv2`. A v1.51 client draws `hubAv2`'s avatar where it
2278
+ names a player `hubAv` lists, and `hubAv`'s otherwise; a client from before
2279
+ it never reads `hubAv2`. The block is there only while someone in the place
2280
+ wears one of the twelve: a place where nobody does sends the bytes it sent
2281
+ before v1.51 (`scripts/test-avatar-wire.mjs` holds them to a hash of what
2282
+ the kit wrote then).
2283
+ - **A v1.51 client in a place on an older kit** (its server takes `0`-`3`):
2284
+ a hello that says `4`-`15` is taken as `0`, and ghost's read of `4`-`15` is
2285
+ not taken, so the hello's `0` stands. Everyone else there sees that player
2286
+ as the Castle mascot, hats fitted to the mascot. The player's own client
2287
+ draws its own body from its own pick, so they see the character they
2288
+ chose. Nothing throws; it ends when the place is saved again on v1.51.
2289
+ - **A client from before v1.51 in a v1.51 place** (a town saved before it
2290
+ draws every place a player reaches through its doors): a player who wears
2291
+ `4`-`15` is drawn as the stand-in, one of the first four, with their name
2292
+ tag and a hat fitted to the stand-in. Always somebody, never nobody, and
2293
+ the same somebody a v1.51 client would fall back to. Such a client treats
2294
+ its own account's `4`-`15` as no platform avatar: it wears a random
2295
+ stand-in from `0`-`3` and says so in its hello, but where the host runs the
2296
+ hub ghost's `4`-`15` replaces that hello, so others on v1.51 see the
2297
+ character the account chose (and others on an older client its `% 4`)
2298
+ while the player sees their own stand-in. A pick they make there is the
2299
+ runtime's own and wins from then on, for everyone.
2300
+ - **A page left open across the save.** A page that loaded the town before
2301
+ it was saved on v1.51 keeps the client it loaded. In the session it is in,
2302
+ the place is the kit it started on, and a newer client who joins it and
2303
+ wears `4`-`15` is the case above this one's: the mascot to everyone else.
2304
+ Once that page joins a session of a v1.51 place (a door, a reconnect), it
2305
+ is the case just above: stand-ins. In neither is anyone left undrawn.
2306
+ - **A later kit's avatar** (an id of 16 or more, in `hubAv2` from a place on
2307
+ a kit after this one): a v1.51 client draws that player as `id % 4`, which
2308
+ is also what that place's `hubAv` says, and fits hats to that
2309
+ (`Avatar.known`). Its own account's id of 16 or more is no platform avatar
2310
+ here (the stand-in is worn). A later kit that adds avatars keeps `hubAv`
2311
+ within `0`-`3` and may send any id in `hubAv2`.
2312
+ - Each of the twelve is at most 1,500 triangles with its outline pass and 8
2313
+ draw calls, as the first four are (`scripts/test-avatar-models.mjs` counts
2314
+ them with the engine's `modelCost`).
2315
+
2316
+ **Avatar sets.** The kit has more than one drawing of the first four avatars:
824
2317
  `toon` (the default, `blueprints/avatar-<id>.scene`) and `blocky`, `bean` and
825
2318
  `pixel` (`blueprints/<style>/avatar-<id>.scene`, models in `models/<style>/`,
826
2319
  art in `drawings/<style>/`). Which set is drawn is the **viewer's** own:
@@ -830,7 +2323,8 @@ calls `experimentsReady` once before the first read and draws toon until the
830
2323
  host answers), and a viewer in a set sees every player in it, themselves
831
2324
  included, by the same avatar id. Anything else, an SDK without experiments or
832
2325
  a set the engine's files do not have, is toon, so nothing changes until an
833
- experiment assigns a set. On a page served from `localhost` or `127.0.0.1`,
2326
+ experiment assigns a set (and an avatar a set does not draw, `4`-`15`, is
2327
+ toon's, above). On a page served from `localhost` or `127.0.0.1`,
834
2328
  `?hubStyle=<style>` overrides it. Nothing about the set is on the wire and the
835
2329
  avatar id means what it did, so this is not a contract change: a game never
836
2330
  sees it, and the town's engine lays every set over a game's content pack as it
@@ -861,11 +2355,33 @@ back to every hub place on the arrival read (`players[userId].wearable` of
861
2355
  The latest call wins; `hub.wear(playerId, null)` takes it off everywhere.
862
2356
 
863
2357
  - `kind` is a lowercase id (`/^[a-z][a-z0-9-]{0,23}$/`). The kit draws
864
- `"halo"` (a thin glowing disc over the head), `"aura"` (a glowing disc at the
865
- feet) and `"orbit"` (small sparks circling the head, one more for every three
866
- rarity); a kind it does not know is kept but not drawn, so a later kit may
2358
+ `"halo"` (a glowing ring with an open middle over the head, as wide as the
2359
+ head; v1.41, before it a thin disc), `"aura"` (a glowing ring at the feet
2360
+ round a faint disc; v1.41, before it a disc) and `"orbit"` (small sparks
2361
+ circling the head, one more for every three rarity); a kind it does not know is kept but not drawn, so a later kit may
867
2362
  draw more. `color` is `#rrggbb`; `rarity` an integer 0-9, which grows the
868
2363
  pieces and their glow a little.
2364
+ - **Hats (v1.24).** A `kind` of `hat-<id>` is a hat the kit draws on the
2365
+ avatar's head, turning with it: `sweatband`, `cap`, `foam-crown`, `laurel`,
2366
+ `bat-clip`, `witch`, `lantern`, `crooked-top`, `straw`, `flower-crown`,
2367
+ `beekeeper`, `sunflower`, `sailor`, `souwester`, `captain`, `lighthouse`
2368
+ (`hub.wear(playerId, { kind: 'hat-straw', color: '#e8c96a', rarity: 0 })`).
2369
+ A place's server reads the list from the kit, `HATS` (and `HAT_SETS`, the
2370
+ same ids four to a set) in
2371
+ `@imports/castle.hub-game/code/client/hats.js`, so it offers only hats
2372
+ every client draws. Since v1.41 a hat is the kit's model of it
2373
+ (`models/hats/<id>.pxmodel`, drawn with the avatars' outline look) in its
2374
+ own colours; `color` is still sent and checked, and a place sends the hat's
2375
+ main colour. `rarity` is kept and changes nothing: a hat is one size,
2376
+ fitted to each avatar in each set, and does not glow. A hat is drawn for the
2377
+ players a client is sent (`nearestPlayers`, §1) at every device tier, as the
2378
+ other wearables are. Every wearable is drawn under its avatar's own node,
2379
+ so it moves, turns and is hidden with the avatar: under the orbit camera
2380
+ (physics-3d) a player's own wearable is left out of the frames their own
2381
+ body is, when the camera is pressed against it. A town's engine draws the
2382
+ hats of a game behind a door from its own kit (a pack carries none). A `hat-` id not in the list is a
2383
+ kind the kit does not know: kept, not drawn. Still one wearable per account:
2384
+ a hat replaces a halo and a halo a hat.
869
2385
  - Ghost takes a wearable only from a curated hub place (an enabled door leads
870
2386
  into or out of it, the avatar's rule), only for a signed-in player, and at
871
2387
  most 30 changes a minute per player; the host checks the shape first.
@@ -880,21 +2396,266 @@ The latest call wins; `hub.wear(playerId, null)` takes it off everywhere.
880
2396
  A prize from a roll, a crown for the day's champion: the reason a game is
881
2397
  worth playing elsewhere.
882
2398
 
2399
+ **Trying one on (v1.28).** `hub.wear` saves: it replaces the one wearable the
2400
+ account keeps, so a place that only wants to dress a player for a while (a hat
2401
+ on a shop's mat before it is bought, a costume for one visit) would take away
2402
+ the hat they paid for, and has no way to read it first to put it back.
2403
+ `hub.tryOn(playerId, { kind: 'hat-witch', color: '#3a2a4a', rarity: 0 })`
2404
+ shows a wearable on the player **in this place only, without saving it**:
2405
+
2406
+ - **What is drawn.** While it is up, every client in the place draws it on
2407
+ the player instead of the wearable they own (the player included, over
2408
+ their own body), the same pieces `hub.wear` would draw. One per player: the
2409
+ latest call wins. A kind the kit does not draw is kept and draws nothing, so
2410
+ the player is bare-headed until it clears.
2411
+ - **What is not touched.** Nothing goes to ghost and nothing is read from it:
2412
+ the wearable on the account, and this place's copy of it (`hubWear`), are
2413
+ what they were throughout. No other place is told, the town included.
2414
+ - **How long.** Until `hub.tryOn(playerId, null)`, until the player leaves
2415
+ the place (theirs goes with them, as a mark does) or until the place ends.
2416
+ Then the wearable they own is drawn again, or nothing if they own none. A
2417
+ place holds at most one per player who is in it. As `hub.wear` does, it
2418
+ takes a player who has a body and whose client has not said hello yet: the
2419
+ try-on is shown from their hello, and goes with them if they leave before it.
2420
+ - **Every tick is fine.** Asking for the wearable a player already has on
2421
+ sends nothing: a shop may call it from `step` for whoever stands on a mat.
2422
+ A guest is dressed like anyone else; no account is involved.
2423
+ - **With `hub.wear`.** The two do not meet. A `hub.wear` made while a try-on
2424
+ is up saves exactly as it does without one (to ghost, into `hubWear`) and is
2425
+ not what is drawn until the try-on clears, when it shows; `hub.wear(playerId,
2426
+ null)` under a try-on takes the saved one off and leaves the try-on up. To
2427
+ sell the hat a player has on, `hub.wear` it and clear the try-on.
2428
+ - **Refused, and logged once**, as `hub.wear` refuses: a player who is not
2429
+ here, or a wearable that is not exactly `{ kind, color, rarity }` in range
2430
+ (`null`, or no second argument, clears). A refused call changes nothing.
2431
+ - **Old kits.** It is on by use: a place that never calls it is sent and
2432
+ drawn exactly what it was. A game that must run on a kit before v1.28 asks
2433
+ first (`typeof hub.tryOn === 'function'`). A place reached through a door
2434
+ is drawn by the client of the deck the player started in, so a town saved
2435
+ before v1.28 ignores `hubTry` and goes on drawing what the player owns:
2436
+ nothing breaks, the try-on is simply not seen there until that deck is
2437
+ saved again.
2438
+
2439
+ **The Earned slot (v1.53).** A player has two wearable slots. The **Look**
2440
+ (`hub.wear`, above: hats, halos, auras, anything with a rarity) is the town's
2441
+ and, later, the shop's. The **Earned** slot holds one small thing a game gave
2442
+ for a stated deed, drawn beside whatever the Look puts on the head, so a win
2443
+ never takes a hat off:
2444
+
2445
+ - **Classes.** `badge` or `pin` (on the chest, front, upper left), `belt`
2446
+ (round the waist), `sash` (across the torso, right shoulder to left hip) or
2447
+ `held` (in the right hand, at the side). No hats, halos, auras, orbits,
2448
+ capes or outfits: those are the Look's. An earned item has **no rarity**;
2449
+ its look is fixed per item.
2450
+ - **Declared.** A deck lists wearable items in `hub.unlocks` (§1): at most 8,
2451
+ each `{ id, class, shape, name, deed, color }`, `id` and `shape` matching
2452
+ `[a-z][a-z0-9-]{0,23}`, `name` 1-24 characters, `deed` 1-80 (what the town
2453
+ shows: "win 3 races in Cove"), both trimmed before they are measured, as
2454
+ ghost trims them, `color` `#rrggbb`. Ghost reads it from the
2455
+ saved deck and refuses an id it does not declare. The kit's check refuses a
2456
+ declaration out of these rules and warns of a shape it does not draw for
2457
+ that class.
2458
+ - **Shapes.** `badge-round` (the glow badge: its face glows in its colour),
2459
+ `badge-star`, `badge-shield`, `pin-round`, `belt-plain`, `sash-plain`,
2460
+ `held-lantern`, `held-trophy`, `held-net`, `held-ball`
2461
+ (`code/client/earned.js` `EARNED_SHAPES`, which a place's server may read;
2462
+ `models/earned/<shape>.pxmodel`, `scripts/gen-earned.mjs`). The item's
2463
+ `color` is its main material's; trims keep theirs. A badge's shape may be
2464
+ worn as a pin and a pin's as a badge. A shape the kit does not draw, or one
2465
+ of another class, is kept and not drawn. Each sits at its class's anchor
2466
+ fitted to every avatar (`avatar.js` `earnedFit`, measured against the
2467
+ models), under the avatar's own node like a hat, hidden with the player's
2468
+ own body, and never over the face: a badge, drawn 2.6 times its model
2469
+ (about 38 cm across, to be seen across a street as the halos it replaces
2470
+ were) with a soft glow in its colour behind it, or a pin, drawn 2.1 times,
2471
+ on the chest under the face and any head (Castle's, under its eye, 0.75 as
2472
+ big); a belt round the outside of the waist;
2473
+ a sash round the outside of the torso from the right shoulder to the left
2474
+ hip, 45 degrees where a head stands over the body and 36-40 on a one-piece
2475
+ body, so it passes under the face; a held thing, drawn 1.2 times its
2476
+ model, gripped in the right hand. On the boxy sets (blocky, and pixel but
2477
+ for its round Castle) a belt and sash are square
2478
+ (`models/earned/square/<shape>.pxmodel`), so they lie flat on a box. A town's engine draws them from its own kit, as it does hats (a
2479
+ mounted pack is given the engine's earned models).
2480
+ - **Never random, tradeable or paid.** A game gives an item only by
2481
+ `hub.unlock`, for its stated deed, the same for everyone: no rolls or
2482
+ chance, no selling it for money or bricks, no giving it to another player,
2483
+ no taking it back (owned is only raised).
2484
+ - **Given.** `hub.unlock(playerId, id)`: ghost checks the place is curated,
2485
+ the player signed in, the id declared by this deck, the class an earned
2486
+ one, and a rate limit, then keeps it per account. A first unlock is shown.
2487
+ A refusal resolves null and is logged once (`CAULDRON_HUB_UNLOCK_*`,
2488
+ `CAULDRON_HUB_INVALID_ARGUMENT`); nothing here changes. A guest's unlock,
2489
+ and any where the host has no unlock (the dev serve, a runtime without it:
2490
+ `CAULDRON_HUB_UNAVAILABLE`), is this session's alone, from the deck's own
2491
+ declaration: drawn here, never saved, as a guest's wearable is.
2492
+ - **The town alone chooses.** `hub.wearEarned(playerId, { deckId, id } |
2493
+ null)` changes which owned item a player shows, everywhere; ghost refuses it
2494
+ from any place but the town (`CAULDRON_HUB_EARNED_NOT_A_ROOT`) and for an
2495
+ item the player does not own (`_NOT_OWNED`). `hub.unlocksOf(userIds)` reads
2496
+ what players here own, for a wardrobe.
2497
+ - **Read on arrival.** Ghost's arrival read carries `earned` only for a player
2498
+ who shows one; the place keeps it (`hub.earned`). An unlock or choice made
2499
+ after a read began wins over that read, as `hub.wear` does; a refused one
2500
+ changes nothing and lets the read land.
2501
+ - **Nothing for a place where nobody has one.** `hubEarned` and `hub-earned`
2502
+ (§12) go only once someone here shows an item; `hub.wearing` and `hubWear`
2503
+ are what they were. A client older than v1.53 ignores both and draws the
2504
+ Look alone.
2505
+
2506
+ ### Home unlocks (v1.70/v1.73)
2507
+
2508
+ A game may also give a player something for their house. It is never worn or drawn on
2509
+ the avatar, and it is not shown in the wardrobe. The player's house reads it and offers
2510
+ it in the decor tray, Rooms tab or pet book according to its class.
2511
+
2512
+ - **Classes.**
2513
+ - `furniture`: one catalogue piece. The house shows it in the decor tray, unlocked,
2514
+ and the player places, moves and stashes it like any other piece. Owning it once
2515
+ lets the player place one copy.
2516
+ - `deed`: one area of the house (a yard, kitchen, upstairs, pond or attic). The house
2517
+ shows it on its Rooms tab, where the owner builds it.
2518
+ - `pet` (v1.73): one species of pet the player has adopted. The house shows it
2519
+ in its pet book; `piece` is `pet-<species>`. A deck may declare up to 16 pet
2520
+ items, counted apart from the 6 furniture/deed items and the 8 wearables.
2521
+ - **Declared.** Each entry is `{ id, class, piece, name, deed, color }`:
2522
+ - `piece` names what the house shows, from the house's published list (below), and
2523
+ matches `[a-z][a-z0-9-]{0,23}`. For `pet`, it must also match
2524
+ `pet-[a-z][a-z0-9-]{0,19}`. `pet-walk-*` is the house pet's stage, not a
2525
+ species: pet entries cannot use it. Furniture/deed piece rules are unchanged,
2526
+ including existing `pet-walk-1..3`, `pet-collar` and other `pet-*` furniture.
2527
+ - Ghost must accept the `pet` class before a deck declares one. An older ghost
2528
+ refuses that deck's whole unlocks list, including its furniture and wearables.
2529
+ - It has no `shape`. The kit's check refuses a `shape` on a home entry and a `piece`
2530
+ on a wearable one.
2531
+ - `id`, `name`, `deed` and `color` follow the earned rules: `deed` says how the
2532
+ player gets it ("buy at the Willowbank stand for 300 coins", "catch all 12 fish in
2533
+ Amberwake").
2534
+ - The check warns about a `piece` that is not in the list, and keeps the entry. An
2535
+ unknown piece is owned but not offered.
2536
+ - **The list of pieces** is the house deck's, published in this contract:
2537
+ - `kits/hub-game/docs/home-pieces.md`: id, footprint and which game gives it.
2538
+ - The house adds a piece to its catalogue before any game declares it.
2539
+ - A game claims a piece id by naming it on its card and in that file. Two games
2540
+ never give the same piece.
2541
+ - **Never random, tradeable or paid.** The earned rule applies unchanged:
2542
+ - The game gives it only by `hub.unlock`, for its stated deed, the same for everyone.
2543
+ - It may be sold for **the game's own coins**, earned by playing. It is never sold
2544
+ for money or bricks, never in a random box, never given to another player, and
2545
+ never taken back.
2546
+ - A coin price is the game's own: its coin shop, its pad, its save.
2547
+ - **Given.** `hub.unlock(playerId, id)` works the same way and answers
2548
+ `{ isNew, earned, saved }`:
2549
+ - `earned` is what the player now shows, a wearable EarnedItem or null, never
2550
+ the home item given. Home items use `piece` in place of `shape` in owned reads.
2551
+ - A first unlock is announced with "Sent to your house". It is never shown
2552
+ on the avatar. A harbour boat deed, a home item whose `piece` (or id, when it
2553
+ has none) starts with `boat-`, is announced with "Sent to your boat at the
2554
+ Harbour" instead (v1.77).
2555
+ - A guest's unlock, and any unlock on the dev serve, lasts the session.
2556
+ - **Never worn.**
2557
+ - `hub.wearEarned` resolves null and logs once
2558
+ (`CAULDRON_HUB_EARNED_NOT_WEARABLE`), locally without calling the host
2559
+ when the item is known from this deck's declaration, an unlock or an owned read.
2560
+ - The arrival read's `earned` and `hub.earned` never carry one.
2561
+ - The town's wardrobe filters all home classes out of `hub.unlocksOf`.
2562
+ - **Read by the house.** `hub.unlocksOf([owner])` returns home items among `owned`,
2563
+ answered for connected players as before:
2564
+ - The house reads it when the owner arrives, and again when the decor tray opens.
2565
+ - It unlocks a catalogue piece whose id is a `furniture` item's `piece`, and an
2566
+ area whose id is a `deed` item's `piece`. A `pet` item's `piece` names the
2567
+ adopted species in its pet book.
2568
+ - Guests never need the read: what the owner placed is in the house's own save.
2569
+ - **Nothing changes where nobody declares one.** A deck without a pet entry and a
2570
+ player without a pet sends and receives exactly the bytes it did before v1.73,
2571
+ including decks with furniture or deeds. A deck without any home entry, and a
2572
+ player without one, sends and receives the same bytes as before. An older client
2573
+ draws nothing for a home item, which is already correct.
2574
+
883
2575
  ## 12. Wire (kit-internal, listed so a host or bot can speak it)
884
2576
 
2577
+ ### Page visibility (v1.91, opt-in)
2578
+
2579
+ A place declaring `visibility: true` is sent `hubPlace.visibility: true`. Its
2580
+ client listens for `document.visibilitychange` and sends
2581
+ `{ k: 'hub-visibility', visible: boolean, at: number }`, where `at` is the
2582
+ client's Unix timestamp in milliseconds. Repeated events with the same state
2583
+ are coalesced. A hidden page sends immediately, without waiting for an animation
2584
+ frame. A change while disconnected is sent when the connection can send again;
2585
+ a newly mounted client reports its initial hidden or visible state. Leaving an opted-in place
2586
+ removes its listener. A place without the key installs no listener and keeps
2587
+ its original wire fields and behavior.
2588
+
2589
+ A signal received after hello but before arrival is kept and delivered after
2590
+ the deck's arrival hook. The kit calls the optional server hook
2591
+ `visibility(hub, { playerId, visible, at })` only for an arrived, present sender.
2592
+ The sender identity comes from the session; a payload cannot name another player.
2593
+ Malformed, duplicate-state and older-timestamp messages are ignored. `at` is
2594
+ untrusted metadata, never server simulation time or proof of elapsed time.
2595
+ A place may pause its own guidance clocks while hidden and restore its UI on
2596
+ visible. This does not itself reconnect, arrive, leave or change progression;
2597
+ the existing `resume` hook remains independent.
2598
+
2599
+
2600
+ A first home unlock (v1.70, §11) sends private `{ k: 'hub-home-unlock' }`
2601
+ to its player only, announcing "Sent to your house". It carries no item and
2602
+ never changes WORLD, deltas, `hubEarned` or `hub-earned`. No such message is
2603
+ sent when there is no home unlock. A harbour boat deed's (a `boat-` piece,
2604
+ v1.77) is `{ k: 'hub-home-unlock', to: 'boat' }`, announcing "Sent to your boat
2605
+ at the Harbour"; every other home item's keeps exactly the bytes above. An
2606
+ older client ignores `to` and says "Sent to your house".
2607
+
2608
+ Decorating (v1.67, §10) adds client `{ k: 'decor', ...op }` only in a
2609
+ `decor` place, and server `{ k: 'hub-decor', button, spec, grid? }` to the
2610
+ concerned player only. These private states never enter WORLD or deltas.
2611
+
2612
+
885
2613
  Client → server: `{ k: 'hub-hello', avatar, from, party, carry }` once per session join
886
- (and again with `again: true` when only the avatar changed, v1.7);
2614
+ (and again with `again: true` when only the avatar changed, v1.7; and again,
2615
+ fresh, with `resume: true`, `party: 1` and no `carry` or `near`, when the
2616
+ session gives this connection a body again after a drop (a second WORLD on the
2617
+ same connection, or a new player id on it, which also clears what the client
2618
+ held privately from the old session): every place but a game (one with
2619
+ `result`), so a player the place let go during a phone's app switch is arrived
2620
+ again without waiting for the place's own greet 3 s later. Whichever comes
2621
+ first arrives them, once, and marks stale what their client still holds; a
2622
+ hello from a player still arrived does not replay the arrival. v1.88: a fresh
2623
+ hello under a retained player id replays that player's current private HUD,
2624
+ labels, tune and avatar overrides once on the next tick, sending nothing for
2625
+ a channel never set or whose last sent value was empty (a `resume: true` hello,
2626
+ whose client may have missed a clear, is re-sent empty ones too), with no new
2627
+ wire keys.
2628
+ A game takes neither under the same player id; under a new one its client
2629
+ says an ordinary first hello, a party of one. v1.72: a game whose place says `resume: true`
2630
+ takes both under the same player id, as any place does (`hubPlace.resume:
2631
+ true` tells its client): a player its `leave` let go is arrived again, the
2632
+ `arrive` hook running once whichever of the two comes first, and the visit
2633
+ goes on. Its invariants: (I1) exactly one result per visit whatever the
2634
+ order of leave, report and resume (a result the `leave` hook reports is
2635
+ kept, and a second `hub.result` is refused); (I2) the visit's
2636
+ `maxDurationSec` deadline is set once, at its first arrival, so drops never
2637
+ extend it; (I3) restored state with a packet is sent again on resume: an
2638
+ ended visit hears `{ k: 'hub-end', why, again: true }` once arrived (a
2639
+ client already ending keeps its pause), and the HUD, labels, tune, avatars,
2640
+ visibility, party and the place's own shot and card go again; (I4)
2641
+ provenance is written once per visit: `from` and `fromDeckId` stay the
2642
+ visit's first (the platform's door then, else none). One still arrived is
2643
+ not arrived again, and is re-sent all of the above);
887
2644
  `{ k: 'hub-dev-classic', on? }` (v1.7; the dev serve's stand-in for classic boards, §4, ignored by any session that is not a dev one);
888
2645
  `{ k: 'hub-door-jump', door }` (a town's Doors list, §5);
2646
+ `{ k: 'hub-unstick' }` (v1.33, §5 "Stuck?": only a deck with `hub.stuck` knows it, and only its towns answer, once in 5 s; v1.39, with `ask: true` it moves nobody and asks what the tap would do, answered only by a place with the `unstick` hook, once a second);
889
2647
  `{ k: 'hub-say', r }` or `{ k: 'hub-say', p }` (v1.11, §6);
2648
+ `{ k: 'hub-answer', id, n, text }` (v1.75, §9: exactly these keys; text is a string or null for Cancel, checked against the sender's last-sent and current prompt and limited to two/s, burst four, including dropped attempts; refused text on a current id/version becomes a cancel with null; routed only with `ask: true`, never echoed);
2649
+ `{ k: 'hub-action', id, n }` (v1.74, §9: only `k`, a string `id` and a safe-integer `n`; `n` must equal the sender's current offer version and `id` must be in that current list; routed to `action` only in a place with `actions: true`);
2650
+ `{ k: 'hub-ballot', v, face?, line?, option? }` (v1.68, §6: `v` the version string of the card tapped, echoed as received, and ids only; only a place with `ballot` knows it, and in any other place it goes on to the place's `message` hook as before);
890
2651
  `{ k: 'hub-party', op, player?, door? }` (v1.10, §5: `op` `"invite"` with `player`, `"accept"` and `"decline"` with `from` (the inviter), `"leave"`, `"go"` with `door`, `"go-yes"` and `"go-no"` with `id` (the proposal's));
891
2652
  `{ k: 'hub-where', ids }` (v1.9: where up to 12 players of this session are, at most once per 700 ms) and `{ k: 'hub-goto', player }` (v1.9: Join, §5);
892
- `{ k: 'hub-grab', actor, op }` (v1.3, `op` `"grab"` or `"throw"`, §6);
2653
+ `{ k: 'hub-grab', actor, op }` (v1.3, `op` `"grab"` or `"throw"`, §6; v1.25, `"hold"` once a second while holding, only in a place with `grab.keepHeld`, dropped unheard by any other);
893
2654
  `{ k: 'hub-emote', id }`, `{ k: 'hub-sit', seat }`, `{ k: 'hub-stand' }` (v1.6, §6);
894
- `{ k: 'hub-npc-open', npc }`, `{ k: 'hub-npc-say', npc, text }` (authored mode
2655
+ `{ k: 'hub-npc-open', npc }`, `{ k: 'hub-npc-say', npc, text, rid? }` (authored mode
895
2656
  only), `{ k: 'hub-npc-end', npc }` (§13).
896
2657
  Server → client, in deltas and the WORLD snapshot: `hubPlace` (the place's
897
- public manifest, with the `fallY` the session catches at, and `grab` (v1.3) only where the place sets it), `hubAv`, `hud`, `hidden`, `held`, `labels`, `tints` (v1.1,
2658
+ public manifest, with the `fallY` the session catches at, and `grab` (v1.3) only where the place sets it), `hubAv` (player id → avatar; v1.51: always one of `0`-`3`, `avatar % 4` for a player who wears another), `hubAv2` (v1.51, §11: player id → the avatar really worn, for the players who wear `4` or more and by `hubAv`'s rule of who is listed; in the snapshot only while there is such a player, in deltas from the first one on and `{}` once when the last is gone, never sent by a place where nobody has worn one), `hud`, `hidden`, `held`, `labels`, `tints` (v1.1,
898
2659
  actor id → `#rrggbb`), `marks` (v1.1, player id → `{ text, color }`), `hubDoors` (a town's `[{ id, title }]`, each with `featured: true`, `solo: true` or `need: n` where they apply (v1.14),
899
2660
  §5), `spawned` (v1.2, copy id → `{ from, x, y, z, rotationY }`) with
900
2661
  `spawnTemplates` (each template in use → its authored components), `hubWear`
@@ -902,29 +2663,92 @@ actor id → `#rrggbb`), `marks` (v1.1, player id → `{ text, color }`), `hubDo
902
2663
  has worn one, and like `hubAv` without the players in a hidden pair), and in a
903
2664
  place with `idle` (v1.6) only the parts it turns on: `hubEmotes` (player id →
904
2665
  `{ id, at, until }`, simulation ms), `hubSeated` (player id → seat actor id),
905
- `hubSounds` (actor id → `{ file, volume, radius, since }`, the loops playing).
2666
+ `hubSounds` (actor id → `{ file, volume, radius, since }`, the loops playing);
2667
+ v1.47 adds `hubNpcEmotes` (NPC actor id → `{ id, at, until }`, simulation ms)
2668
+ only after an NPC has emoted back, then latched when it changes, including
2669
+ `{}` at expiry. A place where no NPC has emoted sends exactly what it did;
2670
+ and `hubKept` (v1.27, actor id → the player id it is kept for, §6; only once
2671
+ the place has kept an object with `hub.keepFor`, then whenever it changes,
2672
+ `{}` once when the last is gone, and in the snapshot only while something is
2673
+ kept); and `hubTry` (v1.28, player id → `{ kind, color, rarity }`, the
2674
+ wearable the place shows on that player instead of their own, §11; the same
2675
+ rule: only once the place has called `hub.tryOn`, then whenever it changes,
2676
+ `{}` once when the last is gone, in the snapshot only while one is shown, and
2677
+ like `hubWear` without the players in a hidden pair). A client lays it over
2678
+ `hubWear`; one that does not know it draws `hubWear` alone. `hubEarned` (v1.53,
2679
+ player id → `{ class, shape, color, name }`, the earned item each shows, §11;
2680
+ latched as `hubWear` is: only once someone in the place shows one, then
2681
+ whenever it changes, `{}` once when the last is gone, in the snapshot only
2682
+ while one is shown, without the players in a hidden pair). In the snapshot
2683
+ only, `hubStuck` (v1.33, `{ to }`: this place answers `hub-unstick`, and `to`
2684
+ is its name for its arrival or null, §5; only a town of a deck with
2685
+ `hub.stuck`; v1.39, with `hook: true` in a place that has the `unstick`
2686
+ hook, and no such key in any other).
2687
+ `hubGlow` (v1.71, §9) is a sorted array of the helloed, arrived player ids
2688
+ with a non-null companion, and nothing else: no look, words or target. Only
2689
+ an opted-in place carries it, in snapshots once anyone in this session has
2690
+ had a companion (including `[]` after the last clears or leaves), and in
2691
+ deltas only when that whole array changes, latched as `hubWear` is.
906
2692
  Server → every client: `{ k: 'hub-sound', actor, file, volume, radius }` (v1.6,
907
2693
  a one-shot); `{ k: 'hub-went', players, door }` (v1.15, a town: to each player staying, who of the players they may see went through `door`); `{ k: 'hub-said', player, r }` or `{ k: 'hub-said', player, p, door? }` (v1.11, §6: to each client a block does not hide the speaker from). Server → one
908
2694
  client: `{ k: 'hub-go', door, key, place, scene, title, party }` (in production `key` is null and `pad` names the fired pad; a cabinet's, v1.7, has `classic: true`, no `key` and no `pad`, and `dev: true` on the dev serve),
909
2695
  `{ k: 'hub-cabinet', actor, door, card }` (v1.7: a cabinet's card for the door actor `actor`, `{ title, label, cover, top: [{ username, score, photo, frame }] }`, or `card: null` when it is gone),
910
- `{ k: 'hub-arrived', facing }`, `{ k: 'hub-jumped', facing }` (after a jump to a door or, with `to` the player, to a player, §5),
2696
+ `{ k: 'hub-arrived', facing }`, `{ k: 'hub-jumped', facing }` (after a jump to a door or, with `to` the player, to a player, §5; v1.33, after `hub-unstick` too; v1.39, from a place with the `unstick` hook that one carries `stuck: { spot, to }`, whether the player was put at the hook's spot and the name of where they were put, or null),
2697
+ `{ k: 'hub-unstick-to', spot, to }` (v1.39: the answer to `hub-unstick` with `ask: true`, the same two words for what a tap would do now),
911
2698
  `{ k: 'hub-party', members, away, invite, proposal }` (v1.10, on change: the other members here as player ids or null for no party, how many are away, `{ from, username }` or null, `{ id, door, by, username, asked }` or null, told only to the proposer and the members asked),
912
2699
  `{ k: 'hub-where', at }` (v1.9: player id → `{ x, z, where, door, on? }`, the ground spot to 0.1 m, the place's words or null, the door those words name or null, `on` true on its pad), `{ k: 'hub-hud', hud }` (that player's
913
2700
  override), `{ k: 'hub-tune', tune }` (v1.2, that player's `{ speed, jump }` or null), `{ k: 'hub-labels', labels }` (that player's own labels),
914
- `{ k: 'hub-result', result }`, `{ k: 'hub-end', why }`,
2701
+ `{ k: 'hub-companion', c, n }` (v1.71, §9: to its owner alone, the whole private spec or `null`, with version `n` from one counter for the place session; ordinary sends coalesce to four/s per player, equal specs send nothing, fresh hello replays once, leave forgets and absent players are pruned; never in a snapshot or delta);
2702
+ `{ k: 'hub-actions', items, n }` (v1.74, §9: that player's whole private list of `{ id, label }`, or `null` to clear, with its safe-integer version `n`; changed recorded lists advance `n`, ordinary sends coalesce to at most four offers a second per player, and a fresh hello replays the current offer once with its current `n`; offers are forgotten on leave, never in snapshots or deltas; `hubPlace.actions: true` is carried only by an opted-in place);
2703
+ `{ k: 'hub-menu', spec, n }` (v1.79, §9: spec or null to that player alone; never snapshots/deltas, four ordinary offers/s, hello replays once; `hubPlace.menu: true` carried only by an opted-in place);
2704
+ `{ k: 'hub-ask', id, title, max, n }` or `{ k: 'hub-ask', id: null, n }` (v1.75, §9: private prompt or close to that player alone; never in snapshots or deltas; ordinary deliveries coalesce to four/s and fresh hello replays once; `hubPlace.ask: true` is carried only by an opted-in place);
2705
+ `{ k: 'hub-ballot-card', card }` (v1.68, §6: that player's whole choice card,
2706
+ or null when it is taken down; sent on change and again after a fresh
2707
+ `hub-hello` without `again`. `card` is `{ v, mode, title?, text?, until?, faces:
2708
+ [{ id, note?, off?, votes?, mark? }], options: [{ id, text }], lines: [ids],
2709
+ feed: [{ from, to?, line }], picked?, words?, who: { playerId: { name, avatar? } } }`,
2710
+ `v` the card's version, an opaque string echoed as it came (§6 rule A: this
2711
+ server's epoch and a counter; it moves only when the mode, the faces
2712
+ offered or their `off`, the lines offered, the option ids or `picked` change
2713
+ for that player); `who` the username and avatar index of every player the faces and feed name;
2714
+ `picked` `{ face }`, `{ option }` or `{}` (locked on a face not shown);
2715
+ `words` (only for a viewer a block hides someone from) line id → that
2716
+ manifest line with the hidden names taken out, for each line it changes.
2717
+ Never in snapshots or deltas, never sent by a place without `ballot`, which
2718
+ also sends no `hubPlace.ballot`),
2719
+ `{ k: 'hub-vis', hide: [actorIds], show: [actorIds] }` (v1.62, §10: the
2720
+ viewer's whole private visibility override, replacing their previous lists;
2721
+ empty lists restore shared visibility. Sent privately on a changed override
2722
+ set and replayed on a fresh `hub-hello` without `again` while overrides exist.
2723
+ Never in snapshots or deltas, never sent by a place that uses only shared
2724
+ hide/show),
2725
+ `{ k: 'hub-leaving', text }` (v1.52, one player's latest leaving line or null,
2726
+ on change and replayed on a fresh `hub-hello` without `again` when a line is latched;
2727
+ never in a snapshot), `{ k: 'hub-result', result }`, `{ k: 'hub-end', why }` (v1.72: with `again: true` when a resume place says it again, I3),
915
2728
  `{ k: 'hub-grab-deny', actor }` (v1.3: a grab refused; let go), `{ k: 'hub-drop', actor }` (v1.3: `hub.drop`),
916
2729
  `{ k: 'hub-npc', npc, open, mind?, character?, name?, disclosure?, hearRange?, why? }` (since v1.17 `disclosure` is always `"participants"` and `hearRange` always 0: a client from before it named the players in that range as a turn's listeners),
917
- `{ k: 'hub-npc-line', npc, text, why }` (`why` v1.8, as `npcLine`'s), `{ k: 'hub-npc-notes', npc, prefix }` (v1.8, §13), `{ k: 'hub-av', hubAv }` (avatars of players in a
918
- hidden pair that this player may see, laid over the shared `hubAv`), `{ k: 'hub-wear', hubWear }`
919
- (v1.4, their wearables, laid over the shared `hubWear` the same way).
2730
+ `{ k: 'hub-npc', npc, open, ... }` gains `opening: { text, asks, more? }` where the place's `npcOpening` gave one (v1.37), or a mind gets the kit's default (v1.46; `more` only when non-empty), `{ k: 'hub-npc-line', npc, text, why, op?, rid? }` (`why` v1.8, as `npcLine`'s; v1.46 `op` is the refused mind turn's operation id, absent for other lines; `rid` echoes an authored send's request id, a string of at most 64 characters, only when given), `{ k: 'hub-npc-notes', npc, prefix, persistentAsks? }` (v1.8, §13; v1.80 `persistentAsks` only where the place defines `npcAsks`, up to two private chips, an empty array clears), `{ k: 'hub-npc-opening', npc, text }` (v1.47, a late inspect's greeting for an open panel whose player has not yet sent words, §13), `{ k: 'hub-npc-hooks', hooks: [{ npc, character }] }` (v1.76, due greeting body/character ids for that signed-in player alone, no text, §13), `{ k: 'hub-av', hubAv }` (avatars of players in a
2731
+ hidden pair that this player may see, laid over the shared `hubAv`; v1.51: stand-ins as `hubAv`'s are, with `hubAv2` beside it in the same message when one of them wears `4` or more, laid over the shared `hubAv2`; the message is whole, so one without `hubAv2` says none of them does), `{ k: 'hub-wear', hubWear }`
2732
+ (v1.4, their wearables, laid over the shared `hubWear` the same way),
2733
+ `{ k: 'hub-earned', hubEarned }` (v1.53, the earned items of players in a
2734
+ hidden pair this player may see, laid over the shared `hubEarned` as
2735
+ `hub-wear` is over `hubWear`; only in a place where someone shows one. There
2736
+ a client that joins afresh -- a `hub-hello` without `again` -- is sent the
2737
+ map as it is, empty or not),
2738
+ `{ k: 'hub-try', hubTry }` (v1.28, their try-ons, laid over the shared
2739
+ `hubTry`; only in a place that has called `hub.tryOn` with a hidden pair in
2740
+ it. Once a place has sent one, a client that joins afresh -- a `hub-hello`
2741
+ without `again` -- is sent the map as it is, empty or not, so one that comes
2742
+ back holds neither a try-on that came off while it was away nor misses one
2743
+ that is up; a client keeps it across a snapshot).
920
2744
  Version-tagged by `hubPlace.contract`.
921
2745
 
922
2746
  Blocks: two players a block hides from each other (either one blocked the
923
2747
  other; the host answers `session.hub.hiddenPair`, and the block lists never
924
2748
  reach the kit) are taken out of each other's interest sets whatever the
925
2749
  session's size, so neither is sent the other's pose rows or `in`; the shared
926
- `hubAv` leaves out every player in such a pair, whose avatars go by `hub-av`
927
- to each player who may see them. Words can name a player too: the shared `hud`
2750
+ `hubAv` (and `hubAv2`, v1.51) leaves out every player in such a pair, whose
2751
+ avatars go by `hub-av` to each player who may see them. Words can name a player too: the shared `hud`
928
2752
  and `labels` carry no such player's username (it reads "someone") and no NPC
929
2753
  line about them, and each player gets the words they may read by `hub-hud` and
930
2754
  `hub-labels`, so nobody is sent a hidden partner's name, a late joiner's
@@ -969,6 +2793,61 @@ behind by. Everything else -- objects, `hubAv` (but for Blocks, above),
969
2793
  drawing is filtered, and the server's simulation has every player. A
970
2794
  session no bigger than the set is sent one broadcast, as before.
971
2795
 
2796
+ ### Keeping a visit through a short drop (v1.89)
2797
+
2798
+ A result place may set `hub.resume: { keep: true }` (also valid on a named
2799
+ place). This extends the v1.72 opt-in; `resume: true` keeps its existing
2800
+ immediate leave/re-arrive behavior, and an absent key changes nothing.
2801
+
2802
+ The kit keeps an arrived player's entry for **60 wall-clock seconds** from
2803
+ the first tick observing their absence. A replacement body seen without an
2804
+ absent tick uses the last tick with the old body as its deadline origin.
2805
+ A same-id return strictly inside this window restores the last server pose
2806
+ and facing, `arrivedAt`, hold, tune, first-door provenance, and result state.
2807
+ It runs neither `leave` nor `arrive`; the ordinary private-channel replay
2808
+ restores the HUD, labels and tune. `hub.result`, `hub.tune` and `hub.unlock`
2809
+ remain usable once the body returns, with one result per retained visit.
2810
+ The original duration deadline continues through the drop, and fall handling
2811
+ continues on return. A short settling period rejects stale movement reports.
2812
+
2813
+ At or after 60 s the old visit leaves exactly once. A same-id return after
2814
+ expiry is a fresh arrive, with fresh result eligibility, placement and timing;
2815
+ a new player id is always a separate arrival. Shutdown drains retained players
2816
+ once. A kit-issued travel command bypasses retention once that player disappears.
2817
+ The transport does not expose whether other departures were socket drops,
2818
+ Back or closed tabs, so those departures wait for the same expiry; no claim
2819
+ is made that a host keeps the session process alive throughout the window.
2820
+ Absent bodies are not listed by `hub.players()` and cannot interact as bodies.
2821
+
2822
+ This mode uses the existing `hubPlace.resume: true` and `hub-hello` fields;
2823
+ there are no new wire keys. Retention state is allocated only for this object
2824
+ form. No other deck's behavior, state or wire bytes change.
2825
+
2826
+ ### A deck's retained-hello signal (v1.89)
2827
+
2828
+ A deck may export `resume(hub, { playerId })` alongside its other hooks. Hook
2829
+ presence is the opt-in; it works in towns as well as result places, without
2830
+ requiring a `resume` manifest key. A non-`again` hello for an already-arrived,
2831
+ retained player queues the signal. Fresh clients reloading under that retained
2832
+ id and clients sending `resume: true` both qualify. First arrivals and genuine
2833
+ re-arrivals do not. The keep mode's server-generated silent-return hello also
2834
+ qualifies, so a short drop can restore a deck's current tutorial HUD or pointer.
2835
+
2836
+ The hook runs at the end of the next server step, after the private HUD,
2837
+ labels, tune and avatar replay sends. This orders server sends; it does not
2838
+ wait for client acknowledgement. Repeated qualifying hellos for one id in a
2839
+ step coalesce into one callback. A keep-mode silent-return signal and its
2840
+ late client resume hello share one callback. The player must still be arrived with a
2841
+ connected body when dispatched; leaving and kit-issued travel cancel pending
2842
+ work. A trip reported shut allows later resumes again. An avatar-change
2843
+ hello alone does not queue it. A hook may update the private HUD and labels,
2844
+ which their normal sends deliver on the following step. Returns are ignored;
2845
+ throws and rejected promises are contained. Async work is not awaited or
2846
+ cancelled, so a deck should restore its current state synchronously.
2847
+
2848
+ A deck without this hook allocates no pending-signal state and receives no
2849
+ callback. No new packets, wire keys or manifest fields are added.
2850
+
972
2851
  ## 13. NPCs
973
2852
 
974
2853
  HUB.md decision 7: an NPC's **body** is an actor in the place's session and its
@@ -977,22 +2856,104 @@ HUB.md decision 7: an NPC's **body** is an actor in the place's session and its
977
2856
 
978
2857
  ```jsonc
979
2858
  "HubNpc": {
980
- "name": "Rowan, the greeter", // shown on the Talk button, the panel and before every line
2859
+ "name": "Rowan, the greeter", // shown on the Chat or Talk button, the panel and before every line
981
2860
  "character": "greeter", // optional: the castle.json characterBundle character that is its mind
982
2861
  "follow": "greeterFollow", // optional: the gameplay object whose holder the body follows
983
- "talkRange": 3.5 // optional, metres (≤ 8)
2862
+ "talkRange": 3.5, // optional, metres (≤ 8)
2863
+ "turnsAtOnce": 3, // optional (v1.83), integer 1-3; overrides hub.npcs.turnsAtOnce
2864
+ "voice": { "type": "townsfolk", "pitch": 220 }, // optional, heard in a deck with `soundscape` (§6): its babble voice (§6, v1.56)
2865
+ "reactions": { // optional (v1.47), per kit emote
2866
+ "wave": { "emote": "bow", "lines": ["Welcome back!"] }
2867
+ }
984
2868
  // any other keys are the place's own (the town's `role`)
985
2869
  }
986
2870
  ```
987
2871
 
988
- **What the kit does with a body.** Near one, a player gets a Talk button (hub
989
- chrome). Opening a conversation is the place server's decision: one player per
990
- body at a time; another player gets the place's `busy` line. While a
991
- conversation is open the body faces its speaker and holds still, through the
992
- gaps between turns, until the player taps Done, walks more than 8 m away, leaves,
993
- or says nothing for 90 s. Otherwise it walks where the place sends it, follows,
994
- or faces what it was told to, in that order. Walking is a straight line at
995
- 2.6 m/s with no navigation: put NPCs where a straight walk crosses nothing solid.
2872
+ `HubNpc.voice` is client-only and used only when `soundscape.babble` is on.
2873
+ In v1.56, optional `type` selects `townsfolk`, `lively`, `gruff` or `gentle`
2874
+ before the role/character/name keyword default (§6); invalid types fall back.
2875
+ `pitch` remains 80–500 Hz; legacy `rate` 4–10 maps linearly to
2876
+ synthesis rate 2.5–6 (7 → 4.25). Waveform `timbre` names are accepted and
2877
+ ignored. Omitted or invalid fields keep the deterministic character voice;
2878
+ §6 describes the four round-6 types, keyword table, per-NPC variation and limits.
2879
+
2880
+ **Reacting to emotes (v1.47).** A free body answers nearby player emotes as
2881
+ §6 describes, with the same motion and emoji every client draws for a
2882
+ player. `HubNpc.reactions` replaces defaults per emote: `emote` is a kit id
2883
+ or null for none; `lines` is up to six strings, each cut to 80 characters.
2884
+ An empty list means no speech. Missing fields keep their defaults. The kit's
2885
+ public lines are wave: "Hello there!", "Hi!", "Hey, hi!"; dance: "Nice
2886
+ moves!", "Ooh, let me try!"; cheer: "Woo!", "Yay!"; bow: "Likewise!", "Oh,
2887
+ how polite!"; spin: "Whee!", "Dizzy yet?". About one in three reactions
2888
+ chooses a line, deterministically per body and tick. These are authored
2889
+ words, drawn through the public `npcLine` speech path, never a mind's reply.
2890
+ `npcReact` can refuse a busy character the kit cannot tell is busy, or
2891
+ replace its emote or line. The hook's line is spoken whenever supplied;
2892
+ null removes speech. Invalid emote ids keep the default or props choice.
2893
+ `npcReact` and `npcOpening` are synchronous hooks. A promise or thenable
2894
+ is ignored; a rejection is caught and logged once with fixed words, never
2895
+ the error's text. A shorter later line does not shorten another listener's
2896
+ active speech deadline; reactions wait for the longest one.
2897
+
2898
+ ### A preferred talk target and movement hold (v1.90)
2899
+
2900
+ `hub.preferNpc(playerId, npcId | null)` sets one player's preferred physical
2901
+ NPC for the Chat button; null clears it. Returns false for a missing player or
2902
+ NPC, otherwise true. While that NPC is within its normal talk range, the button
2903
+ chooses it; outside range or when absent, the nearest NPC wins as before.
2904
+ This is a private hint, not chat admission: all server chat checks still apply.
2905
+ The preference lasts until cleared or the player leaves, and is replayed on a
2906
+ retained hello. The kit sends `hub-npc-preferred` only to that player, only after
2907
+ opt-in; decks that never call it keep their existing wire bytes and behavior.
2908
+
2909
+ `hub.npc(npcId).holdMovement(boolean)` optionally holds a physical NPC at its
2910
+ current position until cleared with false. Engaging the hold cancels its current
2911
+ walk/follow and any already queued physics translation. While held, `walkTo`,
2912
+ `home`, `follow` and asynchronous follow-token reads cannot start movement;
2913
+ the kit also checks the hold before each movement tick. Releasing it allows new
2914
+ walks and token reads to move the body again; cancelled walks are not replayed.
2915
+ The place owns when to engage and clear this server-only flag. It emits no wire
2916
+ message, does nothing on a virtual companion, and is absent by default, preserving
2917
+ existing movement behavior in decks that never call it.
2918
+
2919
+ **What the kit does with a body.** Near one, a player gets a Chat with button
2920
+ when the actor names a character, otherwise Talk to (hub chrome, v1.46).
2921
+ Opening a conversation is the place server's decision. In v1.83 a body has
2922
+ `turnsAtOnce` conversation slots (integer 1-3, default 1): the body's
2923
+ `HubNpc.turnsAtOnce` overrides `hub.npcs.turnsAtOnce`. A new speaker gets the
2924
+ place's `busy` line only when all slots are occupied; an existing speaker can
2925
+ continue, with at most one unanswered turn per speaker. Each speaker has their
2926
+ own opening, notes and pending turn. The `turnsPerMinute` window remains shared
2927
+ by the body, so more slots do not increase its budget. A speaker tapping Done,
2928
+ walking more than 8 m away, leaving, or saying nothing for 90 s closes only
2929
+ their conversation and frees one slot. `open` refuses with `why: "busy"` and a
2930
+ turn from another player when slots are full refuses with `HUB_NPC_BUSY`.
2931
+
2932
+ In v1.84 a connection returning under the same player id with its talk panel
2933
+ still open re-attaches through the existing `hub-npc-open` request. The visible
2934
+ transcript stays; the server opens a new conversation and issues fresh notes,
2935
+ while the mind keeps its per-player memory. A pending question waits for that
2936
+ open. A turn refused with `HUB_NPC_NOT_TALKING` can also re-attach and retry
2937
+ once; no question retries re-attachment twice, and an admitted turn is never
2938
+ replayed merely because the connection returned. A refused re-attach shows
2939
+ the place's supplied busy/unavailable line, otherwise "Lost the thread there.
2940
+ Tap to talk again.", before closing; unsent words return to the input when
2941
+ that body is next opened. Owner companions use the same recovery. A new player
2942
+ id still clears the old panel and drafts. No wire key changes, no traffic
2943
+ changes without reconnect or a stale-panel refusal, and no player's words
2944
+ reach another player or an ambient line.
2945
+
2946
+ With one slot an open conversation holds the body still facing its speaker,
2947
+ through the gaps between turns, exactly as before. With multiple slots opening
2948
+ or continuing a conversation never interrupts or holds a place `walkTo` or a
2949
+ follow; the body faces a speaker only while neither walking nor following.
2950
+ Otherwise it walks where the place sends it, follows, or faces what it was told
2951
+ to, in that order. With both new keys absent, stored manifest, messages, handle
2952
+ behavior and timing are byte-identical to before (apart from the handle-only
2953
+ `talkingWith` and `turnsAtOnce` properties). An explicit 1 adds no stored
2954
+ manifest or wire key.
2955
+ Walking is a straight line at 2.6 m/s with no navigation: put NPCs where a
2956
+ straight walk crosses nothing solid.
996
2957
 
997
2958
  ```js
998
2959
  const npc = hub.npc('greeter'); // or hub.npcs()
@@ -1002,10 +2963,78 @@ npc.walkTo({ x, z }, { stopAt: 0.4, then: () => … });
1002
2963
  npc.home(then?); // back where the scene put it, facing as it did
1003
2964
  npc.follow(playerId); // or null
1004
2965
  npc.stop(); // no walk, no follow
1005
- npc.end(); // end its conversation
1006
- npc.at; npc.talkingTo; npc.following; npc.walking; npc.busy; npc.props;
2966
+ npc.end(); // end all its open conversations
2967
+ npc.at; npc.talkingTo; npc.talkingWith; npc.turnsAtOnce; npc.following; npc.walking; npc.busy; npc.props;
2968
+ ```
2969
+
2970
+ `talkingTo` is the earliest still-open speaker, or null; with one conversation
2971
+ its meaning is unchanged. `talkingWith` is the array of player ids in open
2972
+ order, empty when none, on every handle (never a wire field). `busy` with one
2973
+ slot remains talking-or-walking-or-following; with multiple slots it means
2974
+ all conversation slots occupied, or walking, or following. In v1.83 the
2975
+ handle-only `turnsAtOnce` exposes the body's effective capacity: its
2976
+ `HubNpc.turnsAtOnce` override, else `hub.npcs.turnsAtOnce`, else 1. Virtual
2977
+ companions always have 1. The property exists even when both keys are absent;
2978
+ it changes no stored object, wire bytes, or existing handle behavior.
2979
+
2980
+ **Privacy with concurrent speakers (v1.83).** A reply, notes, opening,
2981
+ `persistentAsks`, and anything derived from what a player typed belong only to
2982
+ that speaker. Panel events go only to them; speech with those words uses
2983
+ `say(text, { to: [speaker] })`. A second player's open, close, leave, notes or
2984
+ reply never changes the first player's panel. Ambient authored, busy and budget
2985
+ lines may be spoken over the body for everyone, but must never contain player
2986
+ input or a mind's reply to another player. Place hooks must preserve this rule;
2987
+ the kit targets multi-slot authored answers that receive player input only to
2988
+ that player. Ghost admits up to six simultaneous turns per place-mind character,
2989
+ ordered per speaker; its busy/budget error mapping is unchanged.
2990
+
2991
+ **Companion chat (v1.71).** A place can declare a follower and owner-only
2992
+ chat together:
2993
+
2994
+ ```json
2995
+ "companion": { "chat": { "character": "companion", "name": "Chirp" } },
2996
+ "npcs": { "slot": "main" }
1007
2997
  ```
1008
2998
 
2999
+ Both manifest forms normalise to `place.companion === true`. The object
3000
+ form also has `place.companionChat = { character, name }`; the public place
3001
+ carries `companion: true` and `companionChat: { name }` only, never the
3002
+ character id. Chat requires the place's `npcs` mind slot and a character id
3003
+ in the deck's bundle. Unknown keys in `companion` or `chat` are errors.
3004
+
3005
+ The kit lazily creates one **virtual NPC record** when an arrived owner
3006
+ opens `companion:<playerId>`. Only that sender's own id is accepted, without
3007
+ a distance check (virtual distance is zero). Malformed ids, someone else's
3008
+ id, not-arrived players, and places without chat get the ordinary unknown
3009
+ NPC response. The record is removed on leave, forget or absent-owner pruning.
3010
+ It is never a scene actor, body, snapshot entry or member of `hub.npcs()`;
3011
+ it never moves, faces, follows, reacts, speaks ambient lines or greets.
3012
+
3013
+ Conversation hooks (`npcOpening`, `npcContext`, `npcAsks`, `npcLine`, `npcHeard`,
3014
+ `npcTools`, `npcTool`) receive the usual `hub.npc(id)` handle with
3015
+ `id: "companion:<playerId>"`, `owner: playerId`,
3016
+ `props: { role: "companion", name, character }`, `at` equal to the owner's
3017
+ current position, and `busy: false`. `say`, `face`, `walkTo`, `home`,
3018
+ `follow` and `stop` are safe no-ops; `end` closes the conversation.
3019
+
3020
+ **Every companion line is owner-only**, including authored openings,
3021
+ scripted answers and busy/budget/unavailable refusals. These use the owner's
3022
+ existing panel messages, never a public or private scene label or bubble.
3023
+ Mind replies are read through the owner's existing status path and shown in
3024
+ that panel alone. Nothing the owner typed and nothing the companion says
3025
+ may be sent to another player, stored in a snapshot/delta, or passed into
3026
+ another player's notes. Place code must preserve this rule in its hooks.
3027
+ The record keeps the usual one unanswered turn, per-record
3028
+ `turnsPerMinute` budget, one tool lookup per reply, speaker-gone end and
3029
+ 90 s idle end. Ghost's speaker gate remains unchanged.
3030
+
3031
+ When the local player has a follower, the existing Chat with button offers
3032
+ its manifest name if no physical NPC is in talk range (a body wins). A
3033
+ 44 px hit area over the projected follower also opens it, using local
3034
+ chrome pointer handling. The existing panel uses the manifest name and the
3035
+ same questions, typing gate and reply drawing. `companion: true` alone
3036
+ creates no chat state or entry point and keeps its existing wire bytes.
3037
+
1009
3038
  **Minds.** A place's minds live in a persistent world that carries the deck's
1010
3039
  shared characters (`docs/internal/shared-character-world-v1.md` in
1011
3040
  castle-experimental-web): `npcs.route` names one of `server.destinations`
@@ -1035,7 +3064,8 @@ door that names its own session.
1035
3064
  | --- | --- |
1036
3065
  | `route` | optional; a `server.destinations` route with `characters: "shared"`, joined only on SDKs without place characters. Without a route the minds are the place's alone: every layer addresses ghost's one place mind |
1037
3066
  | `slot` | 1-64 of `[A-Za-z0-9_.-]`; default `"main"`; the fallback route's world. A world keeps the character definitions it was created with: after changing the bundle's characters, name a new slot (ghost refuses turns in the old world with `CAULDRON_SHARED_CHARACTER_CONFLICT`) |
1038
- | `turnsPerMinute` | 1-30, default 6: the conversation budget of each character's body, so per layer |
3067
+ | `turnsPerMinute` | 1-30, default 6: the conversation budget of each character's body, so per layer; shared by all its speakers |
3068
+ | `turnsAtOnce` | v1.83, integer 1-3, default 1: open conversations per body; `HubNpc.turnsAtOnce` overrides it. Only values above 1 enter the stored manifest; absent/1 adds no wire key |
1039
3069
  | `disclosure` | `"participants"` or `"world"`: read, and since v1.17 not acted on. A player's conversation with a character is theirs alone (below) |
1040
3070
  | `followSec` | 10-600, default 120: how long a body follows before it goes home |
1041
3071
 
@@ -1047,6 +3077,127 @@ instead, so a crowd degrades to authored lines rather than a queue. The reply
1047
3077
  is ghost's text, shown in the speaker's panel and over the body for the
1048
3078
  speaker alone.
1049
3079
 
3080
+ **Opening a chat (v1.37, v1.46).** The place's `npcOpening` gives the first
3081
+ words and up to three questions, with up to nine more to offer later. A hook
3082
+ that gives text keeps exactly its own words and questions; text with no asks
3083
+ gets no default questions. Without the hook, or when it gives no usable text,
3084
+ a mind opens with "Hi, I'm <first name>! Ask me anything." (the name up to the
3085
+ first comma), and "Who are you?", "What do you do here?", "Tell me a secret!".
3086
+ Its later questions are "What's your favourite thing here?", "What should I
3087
+ try first?", "Do you have any friends here?", "What's the funniest thing
3088
+ you've seen?", "What do you dream about?", "What makes you laugh?". The
3089
+ default opening enters that conversation's notes just like a place opening,
3090
+ only where the place defines `npcContext`. A body without a mind gets no
3091
+ default opening and keeps its `npcLine` hello.
3092
+
3093
+ v1.47: every open gets an integer sequence number increasing per NPC for
3094
+ this server's lifetime. `npcOpening` receives it as `info.conversation`;
3095
+ `npcHeard` and `npcLine` for an authored say receive the number captured
3096
+ when those words were admitted, before any await. A place can match the
3097
+ words to the opening it gave. After an awaited send settles, the kit checks
3098
+ that the same conversation is still open with the same bound account key
3099
+ and exact player body before calling a place hook with the player's words.
3100
+ The kit never hands a place words from a conversation that has ended or
3101
+ changed hands, including a close and reopen by the same player or a player
3102
+ id reused by another account; dropped words never enter a log.
3103
+
3104
+ v1.47: the speaker's own `inspect` may carry each character's
3105
+ `privateState.nextGreeting: { text, at }`. The server keeps the text for
3106
+ that authenticated account, player body and character until the player
3107
+ leaves, removing control characters, trimming it and cutting it to 240
3108
+ characters. Older bundles
3109
+ without it keep the opening above. When present it replaces the opening's
3110
+ text; the place's asks and more stay its own, or the v1.46 defaults apply
3111
+ where no place opening was given. `npcOpening` receives `info.greeting`,
3112
+ the string or null, along with `met`, so it can use the memory in its own
3113
+ opening choices. The greeting enters the conversation's notes under the
3114
+ same rule as any opening. It reaches only that player's open or opening
3115
+ update messages and notes (and the v1.76 private bubble below), never a
3116
+ public bubble, snapshot, log line or another player.
3117
+ Guests have no greeting cache. The account and exact body are checked
3118
+ again before using a cached greeting; replacing either invalidates it.
3119
+ An inspect read that finishes after departure or a change of account or
3120
+ body cannot fill the cache for the new visitor.
3121
+ The conversation's opening and notes carry the same account and body
3122
+ binding. Before admitting a turn or sending either, the server checks it
3123
+ again; a mismatch ends the conversation and clears both, without sending
3124
+ the old words, even when a turn asks for its notes to be sent again.
3125
+
3126
+ If inspect finishes while the panel is already open, before that player has
3127
+ said anything in the conversation, `{ k: 'hub-npc-opening', npc, text }`
3128
+ replaces the NPC's first line for that player alone. Questions stay as they
3129
+ were, and the opening and its private notes are updated together. Once the
3130
+ player has sent words, or the panel has closed, no line is replaced. Older
3131
+ clients ignore the unknown message.
3132
+
3133
+ #### Personalised walk-up bubble (v1.76)
3134
+
3135
+ After a signed-in speaker's successful inspect, the server privately sends
3136
+ `{ k: 'hub-npc-hooks', hooks: [{ npc, character }] }` for each physical NPC
3137
+ body with a mind whose character has a due greeting for that speaker.
3138
+ The message carries ids only, never text. Guests, virtual companions and
3139
+ owner records get no hooks; no message is sent when the list is empty.
3140
+ Older clients ignore it.
3141
+
3142
+ The client keeps these ids on that net until a session switch or reset.
3143
+ When idle within that body's Chat prompt range and with no panel open or
3144
+ opening, it drops the character's hooks and sends one read:
3145
+ `{ type: 'status', operationId: 'greeting:' + character }`. A failed read
3146
+ logs once without error details and never retries. Duplicate hook messages
3147
+ and other bodies sharing that character do not read it again in the session.
3148
+ Opening that character's chat first drops its hooks without reading, even
3149
+ when inspect finishes after the panel opens.
3150
+
3151
+ Ghost returns `{ characterId, greeting: { text, at } | null }` only once
3152
+ per due hook, marking it shown in the same transaction; later reads return
3153
+ null. The kit keeps `status` as the read type for the current host.
3154
+ `greeting:` is reserved: such an operation id is refused for a turn and its
3155
+ status can never look up or deliver a turn.
3156
+
3157
+ Before showing a result, the server rechecks the signed-in account and exact
3158
+ speaker body captured before the read, the returned character id and a
3159
+ non-empty line cleaned and capped as above. It picks the nearest physical
3160
+ body with that mind, excluding owner records and bodies talking with another
3161
+ player, within that body's Chat range plus 2 flat metres (5.5 m by default).
3162
+ The ordinary 7 s speech label is sent with `to: [speaker]` and
3163
+ `about: speaker`. No text enters a public label, snapshot, log or place hook.
3164
+ A null or stale result says nothing. The cached greeting stays: the next
3165
+ chat still opens with it so that player can answer. Places without minds or
3166
+ due greetings keep their existing lines and messages. No place opt-out is
3167
+ added.
3168
+
3169
+ For a mind, the client reads `inspect` when the Chat prompt first shows
3170
+ (v1.47), before the panel opens. Pending reads are shared; a success is
3171
+ remembered on that net. While it is pending, or if ghost refuses it, only the
3172
+ opening is shown: no text box or chips. A refusal is logged once and retried
3173
+ on the next open; a success is remembered for later opens. Ghost still decides
3174
+ who may speak; the kit changes no gate. A player who may type sees "Ask <first
3175
+ name> anything…" at the bottom, with chips below it under "or try:". The field
3176
+ gets focus on a desktop with a fine pointer and no touch, never on a touch
3177
+ screen. While a mind answers, a three-dot bubble appears on its side of the
3178
+ log (a static "…" with reduced motion); a reply or scripted line removes it.
3179
+ After a reply or scripted line, up to three chips return: a status result's
3180
+ `suggestions` (or `response.suggestions`) array of strings first, otherwise
3181
+ unused questions from `asks` then `more`. v1.80: the latest `persistentAsks`
3182
+ from the place's notes lead either source, deduplicated into the same
3183
+ three-chip row. Changed offers refresh the row with its current suggestions,
3184
+ keeping chips hidden while a turn is pending. Withdrawn offers stay out of
3185
+ both sources until the place offers them again, even if never sent.
3186
+ A question the player already sent
3187
+ is never offered again in that conversation, except while the place keeps
3188
+ it in `persistentAsks`; when none remain there are no
3189
+ chips. The log keeps its height and scrolls a new reply to its first word
3190
+ (v1.35), leaving a player reading earlier words where they are. A body without
3191
+ a mind keeps its authored-message path, text box and questions. An authored
3192
+ send waits for its reply or 1.2 s before the chips return; only a reply marks
3193
+ the question used, so a dropped send can be retried. Each send carries a fresh
3194
+ `rid`, echoed by its reply: only a matching id acknowledges the pending
3195
+ question. A reply without `rid` keeps the older-server behaviour. Sends inside
3196
+ the server's
3197
+ 900 ms cooldown are held back even when its reply came at once. A scripted
3198
+ refusal of a mind turn carries its operation id: only a matching line ends
3199
+ that turn's poll; a late or untagged line leaves a newer turn alone.
3200
+
1050
3201
  **A player's conversation is theirs alone (v1.17).** What a player types to a
1051
3202
  character, and what the character answers, reaches no other player: not as a
1052
3203
  bubble, not through the character's memory, not in another layer or a later
@@ -1084,22 +3235,80 @@ newest. A client can therefore leave its own words, but never the place's
1084
3235
  notes, out of true. The notes are part of the turn's input: ghost keeps them
1085
3236
  with the player's words as that player's conversation, so they should be facts
1086
3237
  about this player and this place, never another player's private state. The
1087
- player's panel shows only their words. After a turn is admitted the kit calls
1088
- `npcHeard(hub, npc, playerId, { text })` with the words alone. Without
3238
+ player's panel shows only their words. After an admitted turn's send settles,
3239
+ if its conversation and bound speaker are still current,
3240
+ the kit calls `npcHeard(hub, npc, playerId, { text, conversation })` with the
3241
+ words alone and the conversation number captured at admission. Without
1089
3242
  `npcContext` a turn is the words alone, as before.
1090
3243
 
3244
+ **Questions kept on offer (v1.80).** A place may define the synchronous
3245
+ `npcAsks(hub, npc, playerId) -> { persistentAsks: string[] } | null` to keep
3246
+ an action available after a reply, such as "I brought you something!" while
3247
+ the player carries a gift. The kit calls it with the speaker's notes when
3248
+ the conversation opens, every second while it lasts, and when issuing fresh
3249
+ notes for a refused turn. It keeps at most two non-empty strings, each
3250
+ trimmed and cut to 40 characters, deduplicated after cutting; other values
3251
+ are dropped. A throw is caught and logged once with fixed words, never the
3252
+ hook's words or error text. Promises and thenables are ignored; rejected
3253
+ ones are caught and logged once with fixed words.
3254
+
3255
+ Where the hook exists, `hub-npc-notes` carries `persistentAsks`, an array
3256
+ that is empty for null or no usable questions. A changed offer issues notes
3257
+ even when `prefix` has not changed; a non-empty offer can also issue notes
3258
+ with a null prefix where there is no `npcContext`. The kit rechecks the same
3259
+ conversation, account and player body before sending, and sends only to
3260
+ that talking player, never in public labels, snapshots or deltas. Chips do
3261
+ not become mind notes or change the turn's input. Each client refill puts
3262
+ the latest offer before status suggestions or unused opening questions,
3263
+ deduplicated into the existing three-chip row. These questions may return
3264
+ after being sent while the place keeps offering them. Changed offers refresh
3265
+ the row with its current suggestions, unless a turn is pending, when chips
3266
+ stay hidden. A question removed from the offer stays out of suggestions and
3267
+ unused opening questions until the place offers it again, even if never sent.
3268
+ Latest notes with no offer withdraw all previous offers. A new
3269
+ conversation starts with no previous offer or withdrawals. Without `npcAsks`, no message
3270
+ has a `persistentAsks` key and the client uses its existing refill path;
3271
+ notes messages stay byte-identical. Older clients ignore the new key.
3272
+
1091
3273
  Several bodies may share one character (one mind for every barker): a turn
1092
3274
  goes to the body its speaker is talking to.
1093
3275
 
3276
+ **Tools (v1.66).** Notes are paid for on every turn; a place that knows a lot
3277
+ (a town's every door) can instead let a mind look things up. `npcTools` declares
3278
+ what it may ask; the kit sends the declarations with a newly admitted turn (a
3279
+ replay keeps the first admission's), and the mind may make **one** lookup per
3280
+ reply: the platform asks the place's server, the kit checks the call is for a
3281
+ turn it admitted, for that turn's speaker and character, of a declared name,
3282
+ and not yet used, then calls `npcTool(hub, npc, playerId, name, input)`. Its
3283
+ answer goes to the mind and nowhere else; after 1.5 s (or on any error) the mind
3284
+ is told the lookup is unavailable and answers without it. A reply then takes
3285
+ two model calls instead of one, from the same per-turn allowance.
3286
+
3287
+ The same rules as notes hold for results: never `npcHeard` or `npcLine` text,
3288
+ never another player's typing or private state (a player's name is the only
3289
+ player-made text a result may carry). A lookup is read-only, except actions a
3290
+ place lists and checks itself (the town's `pointTo`: a pointer only the asker
3291
+ sees). Nothing a lookup returns is shown to any other player. Who may talk to
3292
+ an NPC is unchanged. The kit logs a lookup's name and duration, never its input
3293
+ or answer. Without `npcTools` a turn is sent as before; without `npcTool` the
3294
+ kit does not listen for lookups at all.
3295
+
1094
3296
  **Authored lines.** Where a body has no mind -- no `npcs`, no `character`, or a
1095
3297
  session the host brokers no characters into (the dev serve; a host without
1096
3298
  place characters; on an older SDK, an account the route is not open to; the
1097
3299
  shared-character pilot is admin-gated) -- conversations still
1098
3300
  open and the place answers every turn from `npcLine(hub, npc, playerId, { why,
1099
- text })`, with no model call. `why` is `"hello"` (a conversation opened),
1100
- `"authored"` (the player said `text`), `"busy"`, `"budget"` or
1101
- `"unavailable"`. Authored lines are the place's own words and go over the body
1102
- for everyone. Where a body has a mind, `busy`, `budget` and `unavailable` lines
3301
+ text, conversation })`, with no model call. `why` is `"hello"` (a conversation
3302
+ opened), `"authored"` (the player said `text`; v1.47 `conversation` matches the
3303
+ opening), `"busy"`, `"budget"` or
3304
+ `"unavailable"`. Ambient authored lines are the place's own words and go over
3305
+ the body for everyone. In v1.83 a multi-slot body's `"authored"` answer to
3306
+ player input is sent over the body only to that speaker, as well as in their
3307
+ own panel; even if authored, a response may derive from that player's words.
3308
+ Hello, busy, budget and unavailable lines remain ambient and must carry no
3309
+ player input. A one-slot body retains the existing authored line bytes, so its
3310
+ place hooks must keep all those public words free of player input.
3311
+ Where a body has a mind, `busy`, `budget` and `unavailable` lines
1103
3312
  answer in its place: the speaker's panel marks them as scripted (v1.8), and a
1104
3313
  place should have them acknowledge the player ("give me a moment") rather than
1105
3314
  answer a question they did not ask.
@@ -1161,12 +3370,181 @@ What the kit and Castle promise, and what they do not:
1161
3370
  | 8 avatar plumbing | §11, owned by the kit |
1162
3371
  | 9 arrival facing | §5, `arrival.face` |
1163
3372
 
3373
+ ## Cell interest (v1.65)
3374
+
3375
+ `hub.interest: "cells"` opts the deck's places into interest management. Any
3376
+ other value is a manifest error: `hub.interest must be "cells" (or left out).`
3377
+ The public `hubPlace` carries `interest: "cells"` and the place's
3378
+ `nearestPlayers` only while this mode is active. Its default is 48 other
3379
+ players (`NEAREST_PLAYERS_CELLS`); an explicit `hub.nearestPlayers` or place's
3380
+ `nearestPlayers` still wins, with the existing 1..100 bound. Without the key,
3381
+ the default stays 30 and all wire traffic and behavior stay unchanged.
3382
+
3383
+ Each place reads its own scene's top-level table, authored as:
3384
+
3385
+ ```json
3386
+ "cells": {
3387
+ "version": 1,
3388
+ "eyeMax": 14,
3389
+ "hysteresis": 2.5,
3390
+ "cells": [
3391
+ { "id": "square", "outline": [[-20, -20], [20, -20], [20, 20], [-20, 20]],
3392
+ "sees": ["square"], "why": "Open square" }
3393
+ ]
3394
+ }
3395
+ ```
3396
+
3397
+ Outlines are polygons in world metres, x east and z south, in either winding;
3398
+ they need not be rectangular. Version must be 1, ids must be unique strings,
3399
+ outlines must have at least three finite `[x,z]` pairs, and `sees` must include
3400
+ the cell itself and refer only to known ids. The authored polygons partition
3401
+ the ground. Actor `cell` tags do not decide interest: the server resolves
3402
+ players and moving objects from their current body positions. It keeps their
3403
+ previous cell while they remain within `hysteresis` metres of its polygon
3404
+ (default 2.5). `eyeMax` and `why` describe the authored table; they do not
3405
+ change the server's view radius.
3406
+
3407
+ A viewer sees the union of `sees` from all polygons within **10 metres** of
3408
+ its body (`VIEW_RADIUS_M`), allowing for the orbit camera sitting in a
3409
+ neighbour cell. Per-player lookups are cached each tick. Other players whose
3410
+ body cells are visible become candidates, after the existing block/hidden-pair
3411
+ filter. Players the viewer follows or who follow the viewer (either direction),
3412
+ and mutual friends, rank first from that viewer's own server cache, then nearest
3413
+ distance, retaining the existing `KEEP_NEARER` preference for players already
3414
+ known. The server cuts
3415
+ at the smaller of the client's cap and the place's `nearestPlayers`. Entry
3416
+ uses the existing `in` message and full current player row.
3417
+
3418
+ Under this key, the base SDK's `relationsAmong` reads the same host
3419
+ `hubFriendsAmong` operation: `userIds` supplies mutual friends, and `follows` /
3420
+ `followedBy` supply follows in either direction when ghost provides them
3421
+ (mutual friends only before that). The cache is primed after a signed-in player's
3422
+ hello and body exist, with deck-requested ids first, then other signed-in players
3423
+ in the place, deduped and capped at 100. Deck asks share the same pending read
3424
+ and still return mutual friends only. An ask with uncovered ids waits for a
3425
+ pending read, then can read its own candidates first once 31 seconds have passed
3426
+ since the last read started; before that it answers only covered mutual friends.
3427
+ Every five seconds the tick checks for expiry and new players outside the asked
3428
+ set: expired entries refresh even with an unchanged roster or after a refusal,
3429
+ and entries with mutual friends also become stale after 60 seconds when new
3430
+ players are present. All reads under the key stay at least 31 seconds apart,
3431
+ with one read in flight per player. Only non-empty mutual friends get the
3432
+ 10-minute TTL; empty mutual friends, including follows-only answers and
3433
+ refusals, keep the 40-second TTL. Expired entries confer no interest priority
3434
+ until refreshed. These relation lists remain server-side for ordering and
3435
+ never go to any client. Chat rules are unchanged.
3436
+
3437
+ `{ k: "hub-cap", n }` asks for an integer cap, clamped to
3438
+ 1..place.nearestPlayers. Malformed requests are ignored; at most four valid
3439
+ requests per second are accepted, and leaving forgets the cap. Before a
3440
+ request, the cap is the place's limit. Clients send on WORLD/place load and
3441
+ tier changes: Low asks for 16, High for the place limit. On High, a p95 frame
3442
+ time above 40 ms over the last 3 seconds drops the cap to 16. After 20
3443
+ continuous seconds with p95 below 28 ms it returns to full. Frame-guard
3444
+ changes are at least 10 seconds apart; transition/hidden frames do not count.
3445
+ A place without active cell interest sends no cap messages.
3446
+
3447
+ The optional real-time `objectInterest(sim)` hook returns a Map from player
3448
+ id to a Set of object ids. Deltas carry changed visible `os` rows and the full
3449
+ current row of every object entering the viewer's set, with those ids in
3450
+ `oin`. Leaving sends no notice; the client retains its last pose. `oin`
3451
+ starts a fresh interpolation, smoothing and steering history so re-entry
3452
+ snaps to the current pose. WORLD continues sending every object. Ownership
3453
+ (`own`), removals (`gone`), acknowledgements (`ack`) and deck fields remain
3454
+ common. The hub includes objects in visible body cells and always includes
3455
+ the viewer's owned or held object.
3456
+
3457
+ Under this key, common `labels`, `tints` and `marks` are latched dictionary
3458
+ patches: `labelsD`, `tintsD`, `marksD`, each `{ actorId: newValue | null }`.
3459
+ Only changed keys are sent, and null deletes a key. WORLD still carries whole
3460
+ maps. Clients merge patches into the same state as whole maps. Diffing uses
3461
+ exactly the existing common, privacy-filtered block; private `hub-labels`,
3462
+ visibility (`hub-vis`), wear and other per-viewer overrides keep their
3463
+ existing routes and precedence. Labels themselves are not scoped to cells.
3464
+
3465
+ Fail-safe rules: a missing or invalid table warns once with
3466
+ `[hub] interest: cells table ...` and restores behavior as if the key were
3467
+ absent, including the old default cap and whole dictionaries. A body in no
3468
+ resolvable cell is included; a viewer outside all cells sees everything
3469
+ allowed by existing privacy rules. A null or throwing object hook, or a
3470
+ viewer absent from its Map, sees every object that tick; re-entering objects
3471
+ still get full rows. A failing player hook retains the existing hidden-pair
3472
+ fallback. This feature **narrows only**: NPC chat, blocks, hidden pairs and
3473
+ per-viewer overrides never gain a new recipient through interest filtering.
3474
+
1164
3475
  ## Changes in v1
1165
3476
 
1166
3477
  Minor additions, each optional; a deck written before them reads the same.
1167
3478
 
1168
3479
  | date | change |
1169
3480
  | --- | --- |
3481
+ | 2026-10-08 (v1.91) | §1/§12 opt-in per-place `visibility: true`, coalesced `hub-visibility` client signal and `visibility(hub, { playerId, visible, at })` server hook. Hidden delivery is immediate; absent key preserves listeners, state and wire bytes. |
3482
+ | 2026-10-08 (v1.90) | §13 optional `hub.preferNpc(playerId, npcId \| null)` privately prefers an in-range physical NPC for the talk button, with nearest fallback, explicit clear, departure cleanup and retained-hello replay. Optional NPC `holdMovement(boolean)` cancels and prevents walks/follows, including asynchronous token reads, until cleared. No opt-in means no new bytes or behavior. |
3483
+ | 2026-10-07 (v1.89) | §1/§12 optional `resume: { keep: true }` retains a result-place visit through a same-id reconnect strictly within 60 wall-clock seconds: restore pose, arrival time, hold, tune, provenance and result eligibility without leave/arrive; expiry and shutdown leave once, and a return after expiry is fresh. Existing `resume: true` and absent keys keep their old behavior and bytes; the object form uses existing wire fields only. Optional `resume(hub, { playerId })` (§2/§12) signals retained-id hellos after private replay sends, allowing a deck to reinstall its current HUD and pointer without an arrival; hook presence is the opt-in, including for towns. |
3484
+ | 2026-10-07 (v1.88) | §12 a fresh hello under a retained player id replays that player's current private HUD, labels, tune and avatar overrides once on the next tick, to that player alone. Nothing is sent where none was ever set or the last value sent was empty, except after a `resume: true` hello: that client kept what it held and may have missed a clear, so every channel ever sent to it goes again once, empty ones too. An `again: true` hello replays nothing. No new wire keys. |
3485
+ | 2026-10-07 (v1.87) | §11 dormant avatar colours: six toon colours per character; hello `color`, ghost `avatarColor` and latched `hubAvC` with blocked-pair privacy and empty clearing. Platform colours require both the host's `color` field and the deck's castle.base SDK marker `Avatar.colors === true` (a base republished from main at or after this change); stand-in colours require confirmed platform support or boolean `hub.avatarColors: true`, and hello colours require the manifest opt-in. Absent/false opt-in preserves stored manifest, behavior and wire bytes without ghost colours. Cached recoloured models preserve faces and fits; the avatar cap drops colour before character and reuses already-drawn plain models. Old clients ignore `hubAvC`. |
3486
+ | 2026-10-07 (v1.86) | §9 a private place menu whose spec carries `face` caps its sheet at 40vh (40dvh where supported), leaving room above for the avatar close-up; its tile area scrolls as before. Replacing the spec updates the cap. Without `face`, the existing 55vh/55dvh cap, element styles and CSS text are unchanged. Client only; no server or wire changes. |
3487
+ | 2026-10-07 (v1.85) | §9 private place menu's optional `face`: finite degrees normalised into [-180, 180), the same `(sin f, cos f)` x/z facing as `hub.placeAt`. The player's own client holds its avatar facing while the sheet is shown under orbit control (including held orbit shots); normal moves report it to other players. Holds and seats take precedence; follow-camera places ignore `face`, and camera yaw is never changed. Close, replacement without `face`, leave and higher-priority UI release it. Older clients ignore the key; absent `face` preserves control and wire bytes. |
3488
+ | 2026-10-07 (v1.84) | §13 a talk panel kept open across a same-player-id reconnect re-attaches with the existing `hub-npc-open`, retaining its visible transcript and using the new conversation's notes before sending a pending question. `HUB_NPC_NOT_TALKING` also permits one re-attach and retry per question, never a loop or a replay of an admitted turn. A refused re-attach shows the place's supplied busy/unavailable line or a fixed interruption line, then closes and keeps unsent words as that body's input draft. Works with one or three slots and owner companions; a new player id still clears the old panel and drafts. No wire keys or privacy changes; without reconnect or a stale-panel refusal traffic is byte-identical. |
3489
+ | 2026-10-07 (v1.83) | §13 optional `hub.npcs.turnsAtOnce` and per-body `HubNpc.turnsAtOnce` (integer 1-3, default 1) give each body conversation slots with speaker-specific openings, notes and pending turns, sharing the existing per-minute budget. Each speaker receives only their own panel, replies, notes and persistent asks; ambient lines never carry player input or another speaker’s reply. `talkingWith` lists open speakers in order; `talkingTo` is the earliest and handle-only `turnsAtOnce` exposes the effective capacity. Multi-slot conversations leave place walks and follows running and face a speaker only while idle. End/leave frees only that speaker’s slot. Absent keys retain the stored manifest, wire, behavior and timing; explicit 1 adds no manifest or wire key. |
3490
+ | 2026-10-07 (v1.82) | §6 seats accept optional `HubSeat.pose: "sit" \| "lie"`: lie offers "Lie down" and every client draws the player on their back, centred along the seat facing, head toward its back. §10 decor copies inherit the pose and turn with their template-facing offset. Holds, seat ids, Stand, input and nap hooks stay unchanged. Absent key = byte-identical sitting pose and wire; explicit `"sit"` also preserves today's behavior. The check refuses other poses and unknown HubSeat keys. |
3491
+ | 2026-10-07 (v1.81) | §10 a goal may carry `edge: false`: a hint hovers over its on-screen destination and disappears off screen or behind the camera. The two nearest drawable goals are chosen, so hidden hints never displace edge-drawn goals. Only exactly false on a goal with `to` is stored and sent; keys absent are byte-identical. Hub places only; no editor, classic or other Cauldron deck changes. |
3492
+ | 2026-10-07 (v1.80) | §13 a place may keep chips on offer after a reply with optional synchronous `npcAsks(hub, npc, playerId) -> { persistentAsks: string[] } \| null`. Re-read with the mind's notes; up to two trimmed, distinct strings cut to 40 characters, invalid entries dropped. Only the talking player's `hub-npc-notes` carries the offer; changes issue notes even when the prefix stays the same, and null clears it. The latest offer leads suggestions or unused opening questions in the existing three-chip row and is exempt from sent questions staying gone while still offered. Throws and rejected async results are caught and logged once without private words; the conversation's bound speaker is rechecked before delivery. Without the hook, no new message key or refill path; notes wire bytes stay identical. Older clients ignore the key. |
3493
+ | 2026-10-07 (v1.79) | §1/§4/§9/§12 private place menu: `menu: true` enables `hub.menu(playerId, spec \| null)` and a versioned item/close hook. A phone bottom sheet has up to eight sections and 48 total items, color/icon tiles, selection and readOnly; walking is held while open. Private offers coalesce to four/s; stale/unknown picks drop, six/s burst eight. Keys absent preserve existing behavior and wire bytes. |
3494
+ | 2026-10-07 (v1.78) | §4/§9 owner-only bird `pose: 'show'` flies to a camera-relative left view at about one-third screen height fitted from paper and worn vertices (excluding glow) under the active orbit lens, with a 4% screen inset; upright camera-basis orientation, shallow side angle and gentle turn, portrait centre at 27% width / 40% height with a player margin, raised wing flutter and reduced glow; proportional species hats and neck accessories in every pose, with opaque paper and full scale from the first approach frame; hides temporary hat try-on and returns to follow when cleared; absent pose preserves wire bytes and lantern rejects pose. Owner-only bird `dress`: fixed species, wear and tint enums; empty/default dress omitted with literal v1.71 wire compatibility; lantern rejects dress. Folded-paper owl, parrot and hummingbird share the songbird rig, glow, motion and quiet opacity; worn accessories hide during hat try-on and dress rebuilds dispose all resources. `hub.companionDress` gates dress and the separate `hub.companionPose` gates pose, preserving fallback for dress-only kits; show reaches its target in 0.7 s and keeps the full geometry at least `near + 0.15` away in camera depth; `hubGlow` stays presence only. |
3495
+ | 2026-10-07 (v1.77) | §11 and §12 a harbour boat deed's first unlock names its destination: a home item whose `piece` (or id, when it has none) starts with `boat-` sends private `{ k: 'hub-home-unlock', to: 'boat' }` and the client says "Sent to your boat at the Harbour". Every other home item sends exactly `{"k":"hub-home-unlock"}` and says "Sent to your house"; a repeat unlock sends nothing, as before. An older client ignores `to` and says "Sent to your house", which is acceptable. Decks without a boat deed, and keys-absent decks, send and receive the same bytes as before. |
3496
+ | 2026-10-07 (v1.76) | §13 personalised walk-up bubble: a signed-in inspect privately offers physical mind body/character ids via `hub-npc-hooks`, never text. Idle approach reads `status` with reserved `greeting:<character>` once per character per session; opening chat first drops the hooks without reading, failures never retry. Ghost consumes the due hook transactionally; the server checks the captured account/body, returned character and cleaned line, then speaks through only the nearest eligible body within Chat range plus 2 m, to the speaker alone for 7 s. Guests, owners, virtual companions, busy bodies and stale/null results say nothing. Greeting cache stays for the next chat opening and notes. No public text, snapshots, logs or place hooks; no editor or classic deck changes. |
3497
+ | 2026-10-07 (v1.75) | §1 place-only `ask: true`; §4 private `hub.ask(playerId, spec \| null)` and `answer(hub, playerId, id, text)`; §9 phone-first single-line prompt, OK/Enter and Cancel, keyboard-aware card and walking/orbit input lock released on every close. §12 private `hub-ask` prompts/closures and `hub-answer` submissions, checked against both current and last-sent versions and ids, limited to two/s, burst four, dropped attempts included. Plain specs have exactly own id/title/max read once, validated and copied; titles and answers reject whitespace-only, control, Bidi_Control and zero-width text. Every changed prompt advances the session counter; tick offers coalesce to four/s, equal sent/current content and version suppressed; fresh hello replays once and leave forgets. A current answer with refused text consumes as Cancel, passing only null. An accepted answer consumes and queues its close before the hook runs; hook errors are contained and logged once without text. Typed text reaches only the place server hook, is never echoed or retained by the kit, and a place must never show it to another player. Absent keys add no API, hook lookup, private state, chrome or wire bytes. |
3498
+ | 2026-10-07 (v1.74) | §1 place-only `actions: true`; §4 private `hub.actions(playerId, items \| null)` and `action(hub, playerId, id)`; §9 up to three phone-first action chips, stacked above existing bottom-right controls. §12 private whole `hub-actions` offers (`items`, safe-integer version `n`) and `hub-action` presses (`id`, `n`), checked against both the sender's current version and current ids and limited to six/s, burst eight, dropped presses included. Invalid API calls throw before state changes; plain items carry own fields read once, with labels of 1..16 characters (code points), no control, direction or zero-width characters and never whitespace-only. Changed recorded lists advance `n`; tick deliveries coalesce to at most four offers a second per player, newest wins, equal last-sent/current lists suppressed. Leave forgets offers; re-hello clears stale client chips and replays the current offer once with its current `n`. Async hooks are neither serialised nor cancelled on leave. Top controls bound the stack from above; pointer presses never focus chips. Absent keys add no API, hook lookup, private state, chrome or wire bytes. Door games use buttons for choices; stand-on pads stay for go doors and race starts. |
3499
+ | 2026-10-07 (v1.73) | §1 and §11 add the `pet` home class: adopted species in the house pet book, with up to 16 per deck counted separately from 6 furniture/deed and 8 wearable items. Pet pieces match `pet-[a-z][a-z0-9-]{0,19}`; `pet-walk-*` stages remain furniture and cannot be pet species. Furniture/deed validation is unchanged. Pets share home ownership, first-unlock "Sent to your house", guest/dev session unlocks and local wear refusal, and never enter the earned slot or wire. Unlisted pet pieces warn against `docs/home-pieces.md`; ghost must accept `pet` before any declaration or it refuses the whole unlocks list. SDK home types include `pet`; absent pets preserve wire/host bytes. |
3500
+ | 2026-10-07 (v1.72) | §1 place-only `resume: true`, valid only on a place with `result` (a manifest error elsewhere, and for any value but `true`); `hubPlace.resume: true` is carried only by an opted-in place. §12 such a game takes the reconnect re-hello under the same player id, both the client's resume hello and the place's late greet: whichever comes first arrives a player its `leave` let go once (one `arrive`), and the other is idempotent; a player still arrived is not arrived again and is re-sent their private HUD, labels, tune, avatars, visibility and party. The visit goes on, under four invariants: (I1) one result per visit whatever the order of leave, report and resume, a result reported inside `leave` included; (I2) the `maxDurationSec` deadline is set once, at the first arrival; (I3) restored state with a packet is sent again on resume, an ended visit's `hub-end` with `again: true` (taken only by a client not already ending); (I4) `from` and `fromDeckId` are written once per visit. Absent: no new code path, state, message, field or listener; games keep taking neither hello under the same id and wire bytes stay identical. |
3501
+ | 2026-10-07 (v1.71) | Allocated before v1.74, landed after it: §1 place-only `companion: true` or `{ chat: { character, name } }`; §13 an owner-only virtual NPC chat record with private authored lines and the existing talk panel; §4 private `hub.companion(playerId, spec \| null)`; §9 a lantern or paper bird follower and the owner's timed speech bubble, all tiers, tiny shoulder glows for others; §12 owner-only `hub-companion` with a session version and four/s coalescing, replayed on fresh hello and forgotten on leave, plus latched public `hubGlow` player ids alone. Plain own fields are read once and invalid specs throw atomically. The place authors every line; nothing a player typed may be passed to `say`; the line is never shown to anyone else. Absent keys add no API, state, drawer or wire bytes. |
3502
+ | 2026-10-07 (v1.68, no bump) | §12 reconnect re-hello (default, all places), the client half, a fix with no contract version: alongside the place's own greet above, a connection the session takes back after a drop says a fresh `hub-hello` itself (`resume: true`, `party: 1`, no `carry` or `near`), seen client-side as a second WORLD snapshot on the same connection or a new player id on it, so it holds while the page's frames were stopped and needs no re-save of the place (the client is the town page's). Whichever of the two hellos comes first arrives the player, once, and marks stale what the client still holds privately (HUD, labels, tune, avatars, visibility, party, ballot card, leaving line); a hello from a player still arrived does not replay the arrival. A new player id on the same connection is a new session: the client drops the old one's private state (HUD, tune, decor, card, labels, holds) before the new one's packets apply, and starts beside nobody. Games (a place with `result`) take neither hello, client or server, under the same player id; a game connection back under a new player id (a fresh session) says an ordinary first hello (a party of one, nothing carried), so the player is arrived. No steady-state message |
3503
+ | 2026-10-07 (v1.68, no bump) | Reconnect re-hello (bug fix, all places), ruled a default fix by #791 per Jesse's standing order that reconnects must work: a connection that comes back without a hello after the place let its player go (the host's reconnect window keeps the client's connection object, so the client never greets again) is greeted for by the place 3 s later, with the avatar it last chose here; only players let go in the last 10 minutes, so a newcomer always sends its own first hello (party, arrival). The player arrives again (arrive hook, HUD, shots, doors). No message, field or hook changes; nothing differs until a reconnect |
3504
+ | 2026-10-06 (v1.68, no bump) | §Idle play, a default fix Jesse approved, no contract version: an emote's emoji is drawn from the top of the emoting avatar's drawn head (beside the head on its open side where above it would leave the view or go under the top chrome; none for a head wholly off the view), 42 px, and each emote plays 0.8 s longer with a stronger pose (wave 2.8, dance 3.2, cheer 2.4, bow 2.4, spin 2 s). No message, field or hook changes; a deck gets the longer emotes when it is saved with this kit |
3505
+ | 2026-10-06 (v1.69) | §1 `tiers`: an actor may carry `"tier": "low"` beside `id` in its scene file: Low draws it at any distance, High removes its node (drawn on High only in the frame that built it), and a live tier change restores/removes it on the next frame. Low draws no `engine.sky`: while Low the scene runtime's `sky` reads null (an own property hub-game sets and deletes; physics-3d is unchanged), so there is no dome draw, zone stepping or texture upload, a scene load's frame included. No sky key and no low mark: unchanged; no `hub.tiers`: none of it. |
3506
+ | 2026-10-06 (v1.68) | §1 `ballot` (a place's: `true`, or `{ lines }` of at most 32 `{ id, text, about }`), §4 `hub.ballot(playerIds \| null, spec \| null)` and the `ballot` hook, §6 "The choice card": a generic tappable card of faces, the deck's fixed lines and options in `talk`, `vote` and `reveal` modes, drawn by the kit as a phone-first bottom sheet under the HUD. Taps are ids only (`hub-ballot`), checked against the card the player was sent and limited to a burst of three then one per 1.5 s; no free text. §12 private `hub-ballot-card` and `hubPlace.ballot`. Rule A: each player's card has an opaque string version `v` (this server's epoch and a counter) that moves only when what can be tapped changes (mode, faces and `off`, lines, option ids, `picked`); a tap carries it and is taken only when it is both the version delivered and the current one, with ids on that card. Rule B: keys absent, no ballot code runs, client or server; on the client one gate (`hub-ballot-card`) holds a card, buffering one ahead of WORLD; every WORLD naming a keyless place lets a held card go. The card is a pure function of who is here now: faces and feed rows of absent players are left off for every viewer, nothing is remembered after a player leaves, and blocks among players here hide faces and feed rows and take the names of present hidden players out of every word the card shows (a departed name in the deck's words is not redacted, as with the HUD), manifest lines included (`words`); a lock on a face not shown is `picked: {}`. State for connections that left is pruned whether or not they said hello. A deck with no `ballot` anywhere has no `hub.ballot`. A place without the key sends, draws and listens exactly as before (no message, field, DOM or listener) |
3507
+ | 2026-10-06 (v1.67) | §1/§4 owner houses: the SDK copies platform `owner` onto frozen `session.hub` only for a non-empty string; `hub.owner` is that user id or null, and deck-only `house: { devOwner: "first" }` keeps the first dev arrival as owner for the session. §10 Decorating: place-only `decor` grid/layers, private `hub.decor.button/open/close/update`, catalogue thumbnails, stock/locks/swatches, touch/mouse grid ghosts and Rotate/Put away/✓. The validated `decor` hook owns every edit; only the opener's catalogue ids reach it, with a per-player budget. §12 client `decor` and private whole `hub-decor` state, replayed on fresh hello and forgotten on departure, never in shared snapshots. Spawned seats work in decor places, including kinematic copies; moving/hiding/stashing stands the sitter. Absent keys retain byte-identical SDK objects, manifests, snapshots, deltas, messages and legacy drawing. |
3508
+ | 2026-10-06 (v1.66) | §4/§13 tools: `npcTools(hub, npc, playerId)` declares up to 8 lookups (name, description, input_schema; capped and filtered, never costing a turn) sent with a newly admitted turn, and `npcTool(hub, npc, playerId, name, input)` answers the mind's one lookup for that turn, checked against the admitted operation, speaker, character and declared names, at most 1 KiB, to the mind alone. Needs a host with place tools (`init.characterTools`) and a ghost and worker that run the round; elsewhere declarations are dropped and a turn is one call as before. No manifest key; decks without the hooks send byte-identical turns |
3509
+ | 2026-10-06 (v1.65) | §12 `hub.interest: "cells"`: scene-authored body-cell visibility with a 10 m view radius and hysteresis, viewer follows in either direction and mutual friends first, then nearest players, default nearestPlayers 48 and client `hub-cap`. Base SDK `relationsAmong` primes relations for players in the place under the key using the host's `hubFriendsAmong` reply fields `follows`/`followedBy` when available (mutual friends only on older ghost); chat rules stay unchanged. Real-time `objectInterest` filters object deltas with full `oin` entry rows; owned/held objects remain included and WORLD keeps all objects. Common labels/tints/marks send dictionary patches; private overrides and hidden pairs keep their existing privacy. Missing/invalid tables restore legacy behavior, and keyless decks retain byte-identical traffic. |
3510
+ | 2026-10-06 (v1.64) | §1 `tiers`: visibility cells. A scene's top-level `cells` key (`version` 1, `eyeMax`, `hysteresis`, cells of `id`, `outline`, `sees`) and an actor's `cell` field (an id or a list) have Low leave out every authored actor whose cells are none of those seen from the camera's cell, overriding `"tier": "keep"`; only an inert actor (every current component in `CELL_INERT`: `Transform`, `Shape`, `Model`, `Solid`, `Lookable`, `RouteAnchor`, `WalkSurface`; none in the backstop `CELL_PROTECTED`, wardrobes included) is ever out for its cell, decided from its components on every look, never cached by id. The rule is off outside every outline (checked before the hysteresis), above `eyeMax`, in a game through a door, and for a malformed table (a row not seeing itself included) or `cell`; the cell is held with hysteresis between outlines. Looked at again the frame the cell changes. `?hubcells=1` overlay; `__hub.tier.cell`, `.cellHidden`, `.cells(on)` for A/B. Client only, Low only, nothing on the wire; a scene without the key is drawn exactly as before |
3511
+ | 2026-10-06 (v1.63) | §1 `tiers`: an actor may carry `"tier": "near"` beside `id` in its scene file. Low treats it as scenery whatever its components, using the sized 30 m distance test; High draws it as authored. NPCs keep their own rule and `keep` wins. Client node only: labels, colliders and server state are unchanged; scenes without the mark behave as before. |
3512
+ | 2026-10-06 (v1.62) | §4/§10 `hub.hide/show(actorId, { to: [playerIds], clear?: boolean })`: per-viewer actor visibility, including baked Models. Connected viewers only, capped at 256 overrides per player, atomic refusals warn once; clearing restores shared state and leaving drops overrides. §12 private `hub-vis` sends whole hide/show lists on change and on fresh join, without altering snapshots/deltas. Clients merge shared hidden and private overrides for existing drawing, pads, idle and soundscape readers. Server bodies and shared `h.hidden` logic (pads, labels, doors, idle) stay unchanged. Shared-only places retain byte-identical wire traffic. |
3513
+ | 2026-10-05 (v1.61) | §4 `hub.shot(playerId, shot \| null)`: private, validated orbit moment shots for data-only places. Four shots/s with burst four, bounded equal-pose repeats and unthrottled clears; no-op without the scene orbit key, no collision, and identity-owned client cleanup on travel, leave, load/place change and disconnect; held poses renew privately every 2 s and on fresh join, preserving equal-shot identity without spending the rate budget. The client expires an unrenewed shot after 5 s, even when its watcher was delayed in a background tab; renewals restore disconnect losses but respect scene-load, travel, round-end and deck-ownership clears until a fresh explicit call. Clearing, travel, round end or forgetting the holder stops renewals, and unused places have no renewal callback. No state or work until called. |
3514
+ | 2026-10-05 (v1.56) | §6 NPC babble retuned to all four original round-6 options as `HubNpc.voice.type`: townsfolk, lively, gruff and gentle. A valid explicit type wins; whole-word role/character/name keywords default in gruff/gentle/lively precedence, otherwise townsfolk. Per-character pitch/mouth/rate variation and word seeds retain the existing actor/name hash and random draws. Rosenberg/LF Fourier source waves and breath gated on the glottal open phase before formants keep each option’s calibrated source gain (voice RMS matched within 0.1% in the audition). Legacy `HubNpc.voice.pitch` stays 80–500 Hz; rate 4–10 maps linearly to synthesis rate 2.5–6; waveform timbre names remain accepted and are ignored. Lines fit complete words within 3 s including the fade and within 30 syllables; 22 synthesis nodes plus distance gain, three-source cuts and complete natural/failure cleanup. The fixed level (about 0.248) matches the previous babble's median active RMS (about −25.6 dBFS at volume 0.7), measured offline in Chromium. Existing voice priority, panel ownership, gates and stall rules remain; keyless and `babble: false` audio traces are unchanged and market round-3 speakers retain their existing voices. Grass steps are low-passed at 2.5 kHz instead of high-passed at 2.2 kHz, and grass (+2.35 dB) and wood (−2.08 dB) are levelled so every surface's step sounds within about 1 dB of the others (K-weighted, measured offline); boolean `steps: true` (street) is unchanged. Referenced crowd/market/harbour beds now prewarm serially after activation while sound is allowed, current zone first, scheduling the same seeded events up front with zero offline suspends. |
3515
+ | 2026-10-05 (v1.54) | §1 `yourGames`, §5 private hearted/recent rows and account hearts (`Hub.hearts`, `Hub.setHearts`), three/five-row Your games section and 15 s arrival/return offers. Opt-in only; keyless decks retain their messages and chrome. |
3516
+ | 2026-10-05 (v1.57) | §4 `hub.friendBests(key, { better })`: signed-in bests in a serialized, top-100 `fb:<key>` deck index, best friend lookup through `friendsAmong`, cached by layer and visit; every failure is silent. No manifest key; unused places send and store nothing new |
3517
+ | 2026-10-05 (v1.60) | §6 and `hub.cue`: closed `busker-jig`/`busker-waltz` placeholder tunes, original pooled synthesis independent of short UI cues and zone music. Actor sends refreshed every 10 s or less lease a distance-scaled loop for 25 s, only while in radius and visible with sound live; one loudest loop per client, 0.3 s switches and fade-out, return within lease resumes. Private targets hear one full-gain pass. Ten fixed nodes per phrase player, frame scheduling within 0.3 s, missed notes dropped, full cleanup and unchanged cues-off/keyless behavior; level targets −40 dBFS active RMS at volume 0.7 pending Chromium calibration. |
3518
+ | 2026-10-05 (v1.36) | §4 `hub.friendsAmong(playerId, userIds)`: at most 100 deduped decimal candidates, the player's friends only, 40 s empty/10 min non-empty cache and silent refusals. One private latched `hub-friends-wanted` message enables immediate and 20 s client asks, then 90 s refresh; unused places are unchanged. Local dev fixture `CASTLE_DEV_HUB_FRIENDS=all` |
3519
+ | 2026-10-05 (v1.55) | §10 "Turning displays": a scene actor's `"HubSpin": { "rate" }` (degrees a second, -720 to 720, not 0, sign the way round) is turned about its vertical axis by every client, rate x frame time, from scene data alone -- no op, no wire or snapshot field, no body. The hub town's hat shop could turn a display only by `hub.move` on a kinematic body broadcast to everyone. The check refuses it on a dynamic or kinematic `Body`, a solid actor, a `Player`, `HubDoor`, `HubNpc`, `HubSeat` or `Pickup` (which turns itself), and any other key; hidden actors wait unturned, spawned copies of a template turn. A scene without it is looked through once per load and runs as it did |
3520
+ | 2026-10-05 (v1.53) | §1 `hub.unlocks`, §4 `hub.unlock`, `hub.wearEarned`, `hub.unlocksOf`, `hub.earned`, §11 "The Earned slot": a second wearable slot for small items a game gives for a stated deed (badge, pin, belt, sash, held), declared in castle.json, no rarity, never random, tradeable or paid, chosen by the town alone; ghost keeps them per account (SDK `session.hub.unlock`, `wearEarned`, `readUnlocks`), and a guest's or the dev serve's last the session. Drawn at a per-class anchor fitted to every avatar, from ten new models (`models/earned/`, `scripts/gen-earned.mjs`) in the item's colour, beside the Look. §12 `hubEarned` and `hub-earned`. **Nothing changes for a place where nobody has an earned item**: no new key in any snapshot, delta or message, byte for byte (`scripts/test-earned.mjs`), and `hub.wearing` is unchanged |
3521
+ | 2026-10-05 (v1.52) | §4 `hub.leaving(playerId, text)`, a private next-visit line trimmed and cut at 120 characters; null or empty clears it. Captured when leaving via Back, a game end or a door, under the cover title then as a toast for the remainder of 2.8 s from the start, combined with the return result. Trips never wait for it; classic cabinets do not use it. No snapshot field or traffic from a place that never calls it; localhost `?hubLeaving=<text>` previews it. |
3522
+ | 2026-10-05 (v1.51) | §11 sixteen avatars. Twelve more toon characters, ids `4`-`15` (Biscuit, Mochi, Hop, Pip, Ribbit, Ember, Bolt, Gloop, Cap, Toast, Scoop, Zest), each with its blueprint, its model (at most 1,500 triangles with the outline and 8 draw calls), its height, its hat fit and its earned-item fit (v1.53's badge, pin, belt, sash and held thing; the other sets use toon's for `4`-`15`); the client's and the place's count are 16. The picker is a grid, four across (eight on a phone on its side), of faces and names in place of four numbered circles, the one worn ringed, in a card that scrolls inside itself rather than leave the screen; shut, it is the same "Character" button in the same place. New defaults span all sixteen: a guest with no stored local choice gets a random one of `0`-`15`; ghost defaults accounts that never picked to `userId % 16` from its user-id cutoff on, while existing accounts below it keep `userId % 4`. Stored choices stay unchanged. Server messages for the same avatar inputs stay byte-for-byte unchanged. The other sets (`blocky`, `bean`, `pixel`) draw `4`-`15` from toon's blueprint at toon's height and hat fit. §12 the wire is safe for a client from before v1.51, which cannot draw `4`-`15`: `hubAv` (and `hub-av`) only ever names `0`-`3`, `avatar % 4` for a player who wears another, and a new block `hubAv2` names what such players really wear, sent only while there is one (and `{}` once in a delta when the last is gone). A v1.51 client draws `hubAv2`'s; an older one ignores it and draws the stand-in, so nobody is ever left undrawn. Across versions: a place on an older kit shows a player wearing `4`-`15` as avatar `0` to everyone but themselves; a v1.51 client draws an id of 16 or more, from a later kit, as `id % 4`. Ghost must take `0`-`15` for a pick to be kept; its account default cutoff is a separate ghost-server change. Client display only: `?hubAvDistinct=N` has a viewer draw at most N different characters at once (by default all sixteen), the farthest past that as their stand-in but never anyone within 8 m, and different characters draw from shared materials (`?hubAvShare=0` off). |
3523
+ | 2026-10-05 (v1.50) | §1 explicit `soundscape.cues`, §6 named original audition voices and client-observed actions, ops table `hub.cue(target, name)`: private player delivery or actor broadcasts with finite distance falloff, strict names and six-token server budgets. The client consumes at most eight queued events, sharing UI's two-voice/four-start cap and all sound gates; nearby actions have lower priority. Wave B, dance C, cheer, bow, spin, sit and private NPC panel opening use existing structured state; pad ticks/go are explicit cue names because no structured pad countdown reaches the client. Parts are built 75 ms ahead and released at their end; no free-text parsing. Every footfall body, including landing, has a 150–220 Hz low cut and a lighter, shorter thump. Square, meadow, night and selected harbour A target about −33 dBFS RMS (up 8 dB); the 4.1 kHz cricket pulses remain removed, wind/owl retained. Round-2 square A/B, Sunny A/B and Hollow pad A/B, plus round-3 stadium Victory lap/Arena bounce and harbour Drift/Harbour jig, alternate every 3–5 minutes at bar boundaries with 4–8 s silence. Chosen notes, timbres, envelopes and tempos are retained in fixed pools, with music raised 9 dB from its old −47 dBFS RMS calibration target and Hollow retaining its old sine plus the pad 3 dB below. Harbour A-rolled keeps its swell/gull/creak with two 3.5 kHz wash low-passes and 1.6 kHz foam high-pass; its first wave is scaled to the second peak and the whole bed recalibrated. Stadium crowd A retains 12 voices/eight clappers in 87 fixed nodes. Market Stalls/Haggling alternate every 3–5 minutes with two pooled Simlish graphs for zones/spots. All beds target about −33 dBFS active RMS; music rises 9 dB from its old −47 calibration target, roughly level with the beds, including stadium and the original market melody. Four closed court names add chime A at stone 0, bell A, splash A and flutter B; no new keys or API arguments. Stadium, market (including spots) and harbour beds render offline once per page context from the same seeded generators into seamless 40/60/48 s loops, so phones play one buffer instead of the live graph; music stays live. Keyless audio traces and boolean opt-in behavior remain unchanged apart from the approved footstep timbre adjustment. |
3524
+ | 2026-10-05 (v1.49) | §1 `soundscape.zones`, `ambience: { beds, default, spots, music }` and object `steps: { default, zones, paths }`; §6 "The soundscape": opt-in synthesised square, meadow, night, harbour, crowd and market beds, 1.5 s zone cross-fades with a two-bed cap, nearby spot murmur and quiet original seeded music. Zones use the local player with a 0.75 m exit margin; path polylines override zone surfaces, including new cobble. Audible `hub.sound` loops duck music and ambience. All beds obey the existing activation and settling gate, hidden tab, trip, mute and volume rules. Existing boolean parts sound as before; keyless frames keep their original trace. Strict manifest validation and fake-context real-frame tests cover geometry, bounds, cleanup and ducking. Explicit `soundscape.ui: true` adds quiet synthesised door departure/settled arrival, private town HUD timer activity and chip tap cues on the UI bus, capped at two voices and four starts per second. Only the departure tail may finish into a trip; hiding or muting stops it immediately. Arrival waits at most 3 s for settling. Token text and ambiguous holds make no cue; no wire data is added. Boolean `true` enables no UI, and tests cover opt-in callbacks, caps, gates and graph cleanup. Approved square, meadow and night beds target about −41 dBFS RMS at volume 0.7; crowd, harbour, market and music retain their previous levels pending a second audition, and the periodic cricket tone is removed. |
3525
+ | 2026-10-05 (v1.48) | §5 a joining player's body without a readable saved pose, the kit's arrival row, door jumps, party pad placements and an unstick answer without `y` start at a proved clear standing height no higher than the given height, or keep that height unchanged (normally 1.2). On production an arriving player fell to 0.74, was lifted to 1.2 at ~1.1 s and settled at ~2.8 s: the server's drop height and later settle placements made the player bob. This private proof reads scene and spawned solids at each body's current position and rotation, or its authored Transform when there is no body, and respects hide/show immediately. Support is the highest upright fixed box or cylinder top within the body's padded footprint and no higher than its given feet, or implicit ground at 0 unless the scene has none; add the player's half height and 0.06 m, only when the candidate is no higher and its full height is clear. Nearby non-fixed solids (kinematic or dynamic) never provide support and keep the given height; spheres, tilted and other uncertain shapes use enclosing spheres. Solids entirely above the given body are irrelevant, so a high ball or ceiling does not refuse placement. Friend placement keeps its original clearance rules. No scene query or physics step; body poses are read without changing velocities, sleep or pending kinematic targets. The first join uses the place and actors read before admission. Saved poses, heights given by the place, holds and placements beside another player are unchanged. A default in every hub place; no key, nothing new sent. |
3526
+ | 2026-10-05 (v1.47) | §6 and §13 up to three nearest free NPC bodies within 6 flat metres face a player and answer their emote, with the same motion and emoji on every client and sometimes short public authored speech. Per-player 4 s and per-NPC 8 s limits keep a crowd still between reactions; conversations, follows, walks, moves, holds and speaking bodies are skipped. `HubNpc.reactions` and `npcReact` replace or refuse kit choices, with no model called. `hubNpcEmotes` is sent only after a body has emoted. The Chat prompt starts the speaker's inspect read on approach; refusals still retry on the next open. A character's private `nextGreeting` replaces that speaker's opening text, keeps the place's questions and enters the same private notes; `npcOpening` receives `greeting`, and departure clears the cache. No greeting in public speech, snapshots or logs. Every NPC open gets an increasing integer `info.conversation`, passed to `npcOpening` and captured at admission for `npcHeard` and an authored say's `npcLine`, so a place can match words to the opening it gave. The kit never hands a place words from a conversation that has ended or changed hands: after an awaited send it rechecks the sequence, account key and exact body, dropping stale words without logging them. Only hub places; no editor, classic or other Cauldron deck changes; places with no NPCs keep their messages and snapshots |
3527
+ | 2026-10-05 (v1.46) | §4 and §13 a mind speaks first when `npcOpening` gives no words: "Hi, I'm <first name>! Ask me anything.", with three questions and six more. A place opening keeps its own words and questions; a body without a mind keeps its hello. `npcOpening.more` adds up to nine later questions (40 characters each, deduped); `more` is sent only when non-empty. A mind's Chat with panel shows the text box above "or try:" chips, focuses it only with a fine pointer and no touch, and draws a three-dot typing bubble (static with reduced motion). Chips refill after replies or scripted lines from status suggestions, else unused opening questions; sent questions never return. The client retries its inspect read on each open until one succeeds, hiding typing and chips while pending or refused and remembering only success per net. Ghost's speaker gate is unchanged. Only hub places; no editor, classic or other Cauldron deck changes |
3528
+ | 2026-10-05 (v1.43) | §1 `labels: "near"`, §10 "Labels kept near": a deck may have its towns keep the world labels (`hub.label`'s plates, NPC lines and `"sign"`s over scene actors) near the player and apart -- a `"sign"` only from 12 m (kept to 14 m, thinning), no two overlapping (the plate stood by, then the NPC's line, then signs by how near; the other is not drawn), three at most, with hysteresis at each edge (a label taken down for another stays down two seconds). The owner, standing in one district of the 4x world with the orbit camera: "from sunny side i can see labels for the harbor, sunny side, hollow end, the stadium all at the same time" -- seven pills, drawn on one another, the nearest sign 34 m off. Goal and friend pointers, players' bubbles, emotes and marks, name tags, a cabinet's card, the ribbon and the "Stuck?" chip are not world labels and are untouched. The deck's and the client's alone, like `tiers`: validated (`"near"` or left out), read by no server, in no manifest. A deck without the key runs the statements it ran: the hub system asks the key before its one new branch, and the chrome's two new methods (`measureLabel`, which makes its node on first use, and `hudClearBox`, which reads) are called by nothing else |
3529
+ | 2026-10-05 (v1.42) | §1 `soundscape`, §6 "The soundscape": a deck may have the kit make sounds of its own, synthesised in the client and never a file or speech. `true`, or `{ babble, steps }`. Babble: an NPC's line (in the talk panel for the player it answers; over the NPC for whoever is sent it, by distance to 12 m) is voiced as syllables paced to its text, in a voice that is that NPC's from its actor id and name, or its optional `HubNpc.voice: { pitch, rate, timbre }`; two voices at once at most. Steps: footfalls by the ground covered, a jump and a landing for the player, and quieter steps for the players and NPCs within 10 m. A speaker button (mute, volume, kept in `localStorage`) sets the level of both and of the place's `hub.sound` files. Silent before the first gesture, during a trip and while the page is hidden. Client only: no message, no snapshot field, and the server's manifest gains the key only where it is on. Without the key no audio context, listener, storage read or control is made, and `hub.sound` plays exactly as it did (`scripts/test-soundscape.mjs`) |
3530
+ | 2026-10-05 (v1.41) | §11 what players wear is drawn under each avatar's own node rather than as actors, so it moves and turns with the avatar in the same frame and, under the orbit camera, is left out with a player's own body when the camera is pressed into it (a hat's brim filled a quarter of the screen). Each hat is the kit's model (`models/hats/<id>.pxmodel`, `scripts/gen-hats.mjs`) with the avatars' look, where it was one to three plain shapes; Star's and Beat's hat fits are measured again (a hat sank into Star's point; Beat's crest came through the crown). A halo is a ring with an open middle sized to the head, and an aura a ring round a faint disc: Jesse took a halo for a flat hat. A mounted pack is given the engine's hat models with its avatars. `hub.wearing(playerId)` reads the wearable a player here owns. Nothing sent or saved changes, and no key: every place draws wearables this way |
3531
+ | 2026-10-05 (v1.40) | §5 an arriving player is kept where the arrival put them (the kit's row, beside a friend, or wherever the place's `arrive` hook placed them) for the first 0.6 s, the settle a door jump has had since v1.10. A player waits for their group at the scene's spawn, where their client agrees they are; once placed, that client's move reports still on their way name the spawn, and the movement clamp let each pull the body a step back toward it. In the production town four players back from Tag were each given a spot of their own and two were dragged 2 to 3 m toward the arrival, onto Summit Sprint's pad, and taken into its game (the same pull took a pair back from Foot Race into King of the Hill). Only a player the arrival moved from where they waited (more than the hold's slack) is kept, and any later placement by the place (`hub.placeAt`, a hold, a jump) is where they are from then on. Not a hold: the player is not in the held list and walks off at will after the moment; a player the place holds keeps the hold's spot. A default, in every hub place; no key, nothing new sent. |
3532
+ | 2026-10-05 (v1.39) | §5 "Stuck?", behind the same `hub.stuck`. (a) The rule: the chip shows when 3 s of walk input have been seen within the last 8 s -- counted across breaks, where v1.33 started over at every break of 250 ms, so a player walking in bursts never saw it -- and over that stretch the box round where the body was is under 1 m corner to corner (v1.33: within 0.3 m of where the count began). The frame rules are unchanged. (b) §4 `unstick(hub, playerId, from)`: a place may pick the spot a stuck player is put at, since from the arrival a straight line could run back into the same obstacle; null, no hook, a throw or an answer that is not a spot in the world box is the arrival as before. In a place with the hook `hubStuck` carries `hook: true`, the client asks what a tap would do (`hub-unstick` with `ask: true`, answered by `hub-unstick-to`) to word the chip, and the `hub-jumped` after a tap carries `stuck` (§12). A deck without `hub.stuck`, and a place without the hook, are sent what they were. Also §10: a goal label may say which distance its pointer shows, `{ distanceM: n }` (that many metres in place of the straight line the client measures, for a pointer aimed at the next corner of a route) or `{ distance: false }` (none); a goal without either, and every other label, is stored, sent and drawn as before |
3533
+ | 2026-10-05 (v1.38) | §9 the hub chrome's pointer chips are drawn under the labels as well as under every panel: an NPC's speech bubble (and any label) is read over a goal's or a friend's chip, which cut through the words of an NPC standing by a goal (Flop Park, on a phone). And a chip at the screen's edge is kept beside the round quick-chat, emote and grab buttons, never under one (half its words were covered at the right edge). A default, in every hub place; no key. |
3534
+ | 2026-10-05 (v1.37) | §4 and §13 `npcOpening(hub, npc, playerId, { met })`: an NPC speaks first. A new player opening an NPC's chat saw an empty panel and did not know what it could be asked: the place may now give the NPC's first words and up to three tappable questions, shown at once with no model call. The open message carries `opening: { text, asks }` only when the hook gives one, and the talk panel makes its row of question chips only then, so a place without the hook is sent and draws what it did. |
3535
+ | 2026-10-05 (v1.35) | §9 the NPC talk panel: a new reply is scrolled so its first word is at the top of what shows (it was scrolled to the end of the log, so a long reply had to be scrolled back up to be read); the player's own line still goes to the end; a player who has scrolled up to read is left where they are. A default, in every hub place; no key. A mind's instructions should still keep a reply to two or three short sentences. |
3536
+ | 2026-10-05 (v1.34) | §9 the hub chrome's pointer chips (the pointers to friends in a town, a place's `goals` arrows) are drawn under every panel, card and button of the chrome -- the NPC talk panel, the say panel, People, Doors, the question card -- as the labels always were. They were drawn over them, so a goal's arrow could sit on the words of an NPC being read. A default, in every hub place; no key. |
3537
+ | 2026-10-04 (v1.33) | §1 `stuck`, §5 "Stuck?": a deck may have its towns offer a player who walks and gets nowhere the way back to the arrival. Walk input for 3 s with the body inside 0.3 m shows a chip ("Stuck? Tap to go to the square"), and the Doors list gains a "Stuck?" row; a tap sends `hub-unstick` (§12) and the place puts that player at its arrival as the fall rule does, once in 5 s, never held, never in a game. A town that takes it says so in its snapshot (`hubStuck`). Nobody is moved without a tap. A deck without `stuck` is sent and draws exactly what it did, and `hub-unstick` there is the place's own message |
3538
+ | 2026-10-04 (v1.32) | §2 `cues` (a): the extra friends asks come at about 1, 3, 9 and 15 s, bounded as two in any 8 s at least 2 s apart (was one in 4 s): measured on production after v1.31, the ask at 1 s often came back before the host had both connections and the next was 4 s later. The same number of asks over time (15 a minute, 16 in the worst-placed minute), four for someone never named. A deck without `hub.cues` asks exactly as before. |
3539
+ | 2026-10-04 (v1.31) | §2 `cues` (a): the extra friends asks come at about 1, 5, 10 and 16 s after someone is first seen (were 2, 6, 11, 17), and may follow any ask by 1 s (was 2). The host now names a mutual follow in the same layer within a few seconds of their joining, so the first of these is the one that tells a player their friend is here. Still at most one extra ask in 4 s, 15 a minute, four for someone never named. A deck without `hub.cues` asks exactly as before. |
3540
+ | 2026-10-04 (v1.30) | §1 `tiers`: `"tier": "keep"` on an actor in a scene file (beside `id`, not a component) has it drawn on every tier. Low does not draw an actor with only `Transform`/`Shape`/`Model`, which is what the hub world's ground is (paving, grass, the running track, merged per-cell dressing), so on Low its stalls and benches stood on black; giving ground a `Solid` or `Lookable` it does not need was the only way round. A marked actor is never taken out by Low: not as decoration, not as scenery past 30 m, not as an NPC body past 20 m. Client only, read from the scene file with the ids the tiers already read there; a scene with no mark, and a deck without `tiers`, are drawn exactly as before |
3541
+ | 2026-10-04 (v1.29) | §2 `cues`: the chat field that cannot be used reads "Friends only" with one sentence as its note and label for every reason ("Typed chat is for friends who follow each other. Emotes work with everyone."), and (e) a player back from a game through a door is asked "Play <door> again?" for 20 s. Behind `hub.cues`, a town only; a deck without it is unchanged. |
3542
+ | 2026-10-04 (v1.28) | §4 and §11 `hub.tryOn(playerId, { kind, color, rarity } \| null)`: a wearable shown on a player in this place only, instead of the one they own, until `null`, their leaving or the place's end. `hub.wear` was the only way to put anything on a player's head and it saves to the account, replacing what the player owns (a hat bought in the town) with no way to read it first: the town's hat shops want a try-on on a mat, and Trick-or-Treat Lane a costume for the visit (it had fallen back to a tag alone). Nothing is written to ghost or read from it; `hubWear` is unchanged by it; a `hub.wear` during a try-on saves as before and shows when the try-on clears. `hubTry` and `hub-try` (§12) tell clients, only once a place has called it; no manifest key. A client older than v1.28 ignores both and draws the owned wearable. A place that never calls it is sent and drawn exactly what it was |
3543
+ | 2026-10-04 (v1.27) | §4 and §6 `hub.keepFor(actorId, playerId \| null)`: a loose object kept for one player. No other player is offered it (their client passes it over for the next nearest, and it gives up a `steady` offer at once), and anyone else's grab of it is refused on the server before the place's `grab` hook, which is not called; the keeper's grab is unchanged. Ends with `null`, `hub.hide` and the player's leaving; outlives `hub.reset`. `hubKept` (§12) tells clients, only once something is kept. Pillow Dojo playtests and bots: each player has a pillow of their own, the button offered the nearest pillow, the hook answered NOT YOURS, and the player's own a step farther was never offered. It does not change who simulates an object: a keeper is offered theirs only while they are the nearest player to it. A place that never calls it is offered, asked and sent exactly what it was |
3544
+ | 2026-10-04 (v1.26) | §1 and §9 `hud: { clear: true }`: a place may ask for a clear HUD -- a big line drawn at 32 px on one line (shrunk to fit, at least 18 px) when a text line is under it, everything the hub chrome places over the world (labels, speech, marks, emotes, goal and friend pointers, a cabinet's card, the result ribbon) moved to just under the HUD's box when it would lie over it, and on a view 480 px tall or less the text kept to two lines and the box to 40% of the height. Playtests of ten games, most testers, on a phone: "the big banner covers the instructions", "labels overlap the HUD text", "HUD line cut off". The place's own key, told to the client in `hubPlace.hud`, so it holds whether the place is opened directly or through a town's door. A place without it is read, sent and drawn exactly what it was. |
3545
+ | 2026-10-04 (v1.25) | §1 and §6 `grab.keepHeld`: a held object stays its holder's until the hold ends, instead of going to whichever player stands nearer (the multiplayer kit's rule for every loose object); the holder's client says `hub-grab` `op: "hold"` once a second (§12) and the server keeps the object 2.5 s past the last. Flop Park playtests, 3 of 4 players: a carried dummy left its holder's hands whenever the other player came close. A place without `keepHeld` is sent, simulated and drawn exactly as before |
3546
+ | 2026-10-04 (v1.24) | §11 hats: the kit draws the wearable kinds `hat-<id>` for sixteen ids, listed for a place's server in `code/client/hats.js` (`HATS`). The town is to sell hats, and a `hat-` kind was already stored and relayed but drawn by nothing. No field, message or manifest key is new: ghost and the kit's server took any lowercase kind before. A place where nobody wears a hat is sent and drawn exactly what it was |
3547
+ | 2026-10-04 (v1.23) | §1 `cues`: a town may tell its players more about the friends and party they came with. Two-player playtests of the town: a friend who came in was not known as one for up to 20 s (so no "is here", no pointer, a disabled chat field for up to 15 s more), a friend already there was never announced, the chat field did not say who reads it, "Let's play…" named the nearest door rather than the one the party was asked to, and joining a party showed nothing. With `cues`: the friends ask is repeated a few times in the ~17 s after someone unnamed is first seen (the host learns presence on a heartbeat of about 15 s, so one early ask came back empty: measured on production, "is here" 21 s after a friend arrived); a friend already here is announced once; the chat field says who reads it or why it is off, and chat peers are asked for again when someone comes in; "Let's play…" names the party's proposed door; a party's new member is toasted. A deck without `cues` is sent and draws exactly what it did: the server picks the door as before, and the client takes none of the new branches |
1170
3548
  | 2026-10-04 (v1.22) | §1 and §6 `grab.reach` (1.6-3 m) and `grab.steady`: a place may offer objects from farther away and keep an offer up through a moment at its edge (the same object kept within the reach plus 0.4 m and 90 degrees of facing; the button held 600 ms through a lost owner or a turn; a press then waits 500 ms for the object to be this client's again), never past 3 m centre to centre. Sonnet playtests of Pillow Dojo and Number Pals on phones: the Grab button came and went at the reach, the cone and a shared owner, and bouts went on walking. Client only; a place without them is sent and drawn exactly what it was |
1171
3549
  | 2026-10-04 (v1.21) | §1 `tiers`: a deck may ask for device tiers, a cheaper picture drawn by a slow device's client (no sun shadow, decorative actors not drawn, scenery past 30 m and NPC bodies past 20 m not drawn) and a Graphics: Auto / Low / High row in the Character card. Phones the town was measured on (Galaxy Tab A7 Lite, Redmi 9A) drew it at 12 fps. Client only; a deck without `tiers` is drawn and behaves exactly as before |
1172
3550
  | 2026-10-04 (v1.20) | §5 a jump onto a pad (Doors Go, a party's go) is put on a spot no one stands within 1.1 m of (a ring 1.2 m about the pad's middle, at most half its radius, then a ring nearer its edge, then the middle, else the spot with the most room): a body put down touching another was pushed apart by physics and could push the one already there off the pad, so a pad that needed both never fired (production 18:00Z Oct 4). |
@@ -1207,3 +3585,4 @@ Minor additions, each optional; a deck written before them reads the same.
1207
3585
  | 2026-10-02 (v1.1) | §11 `hub.mark`, carried as `marks` (§12). M1's Zone Wars could not show anyone's team and Tag could not show who was it |
1208
3586
  | 2026-10-02 (v1.1) | §13 minds on every layer: on an SDK with `Multiplayer.placeCharacters` the main place joins a layer and its NPCs read `session.characters`, one memory per place; `npcs.route` is the fallback for older SDKs. A deck without `npcs` is unchanged |
1209
3587
  | 2026-10-02 (v1.1) | §10 `hub.move` and `hub.tint`; §4 `hub.actorsWith` adds `shape` and `body`. The snapshot carries `tints` (§12). M1's Vault Crew and Tile Fall said a plate's or tile's state with labels and could not have a moving platform; Zone Wars and Summit Sprint repeated each zone's and pillar's size in its marker |
3588
+ | 2026-10-06 (v1.70) | §1 and §11 home unlocks: up to 6 furniture or deed items in addition to 8 wearable earned items, `piece` instead of `shape`, shared unique ids; `docs/home-pieces.md` is the catalogue, an unlisted piece warns and stays owned. `hub.unlock` keeps home ownership and announces "Sent to your house" on first unlock, session-only for guests/dev serve; `hub.unlocksOf` includes home items, the wardrobe filters them out, and `hub.wearEarned` refuses them with `_NOT_WEARABLE`. Home items never enter the shown slot or earned wire; decks and players without home items send and receive the same bytes. SDK types distinguish `piece` and `shape`. |