castle-web-cli 0.4.232 → 0.4.234
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.
- package/dist/agent-failures.d.ts +8 -0
- package/dist/agent-failures.js +19 -2
- package/dist/agent-prompts.d.ts +1 -1
- package/dist/agent-prompts.js +10 -3
- package/dist/agent.d.ts +64 -3
- package/dist/agent.js +170 -81
- package/dist/api.d.ts +11 -0
- package/dist/api.js +43 -0
- package/dist/bundle.d.ts +64 -0
- package/dist/bundle.js +558 -2
- package/dist/castle-host/host.d.ts +18 -2
- package/dist/castle-host/host.js +844 -39
- package/dist/castleJson.d.ts +23 -2
- package/dist/castleJson.js +46 -2
- package/dist/check.d.ts +3 -1
- package/dist/check.js +20 -3
- package/dist/chunkLoader.d.ts +3 -0
- package/dist/chunkLoader.js +111 -0
- package/dist/devParty.d.ts +26 -0
- package/dist/devParty.js +231 -0
- package/dist/devSaveStorage.js +4 -0
- package/dist/devSessionStorage.js +50 -2
- package/dist/devSocial.d.ts +24 -0
- package/dist/devSocial.js +70 -0
- package/dist/ide.d.ts +2 -0
- package/dist/ide.js +119 -15
- package/dist/importPinMismatch.d.ts +22 -0
- package/dist/importPinMismatch.js +77 -0
- package/dist/importRegression.js +3 -15
- package/dist/imports.d.ts +10 -3
- package/dist/imports.js +88 -20
- package/dist/index.js +11 -4
- package/dist/init.js +1 -1
- package/dist/platformDoc.js +22 -0
- package/dist/routerFences.d.ts +5 -0
- package/dist/routerFences.js +12 -2
- package/dist/save-deck.d.ts +25 -1
- package/dist/save-deck.js +178 -9
- package/dist/serve.js +32 -11
- package/dist/shell/assets/{index-D2tWM896.js → index-DulbYIJm.js} +97 -97
- package/dist/shell/assets/index-MVLfNYd9.css +1 -0
- package/dist/shell/index.html +2 -2
- package/dist/taskSteer.d.ts +13 -0
- package/dist/taskSteer.js +22 -2
- package/dist/vitePlugins.d.ts +2 -1
- package/dist/vitePlugins.js +13 -0
- package/kits/base/castle.json +1 -1
- package/kits/base/package-lock.json +1 -1
- package/kits/base/sdk/README.md +339 -5
- package/kits/base/sdk/avatar.d.ts +6 -2
- package/kits/base/sdk/avatar.js +12 -4
- package/kits/base/sdk/castle.d.ts +7 -3
- package/kits/base/sdk/castle.js +2 -0
- package/kits/base/sdk/commands.d.ts +176 -1
- package/kits/base/sdk/commands.js +3 -0
- package/kits/base/sdk/display.d.ts +3 -0
- package/kits/base/sdk/display.js +9 -3
- package/kits/base/sdk/hub.d.ts +37 -6
- package/kits/base/sdk/hub.js +63 -4
- package/kits/base/sdk/multiplayer.d.ts +7 -1
- package/kits/base/sdk/multiplayer.js +148 -32
- package/kits/base/sdk/multiplayerProtocol.d.ts +2 -0
- package/kits/base/sdk/party.d.ts +23 -0
- package/kits/base/sdk/party.js +91 -0
- package/kits/base/sdk/reconnectBudget.d.ts +23 -0
- package/kits/base/sdk/reconnectBudget.js +96 -0
- package/kits/base/sdk/save.d.ts +38 -1
- package/kits/base/sdk/save.js +81 -7
- package/kits/base/sdk/server/hub.d.ts +117 -0
- package/kits/base/sdk/server/hub.js +119 -2
- package/kits/base/sdk/server/platformHandle.d.ts +43 -1
- package/kits/base/sdk/server/storage.d.ts +17 -0
- package/kits/base/sdk/server/storage.js +65 -3
- package/kits/base/sdk/server/wrapper.d.ts +43 -6
- package/kits/base/sdk/server/wrapper.js +93 -9
- package/kits/base/sdk/social.d.ts +9 -0
- package/kits/base/sdk/social.js +5 -0
- package/kits/hub-game/CLAUDE.md +451 -13
- package/kits/hub-game/README.md +63 -0
- package/kits/hub-game/blueprints/avatar-10.scene +28 -0
- package/kits/hub-game/blueprints/avatar-11.scene +28 -0
- package/kits/hub-game/blueprints/avatar-12.scene +28 -0
- package/kits/hub-game/blueprints/avatar-13.scene +28 -0
- package/kits/hub-game/blueprints/avatar-14.scene +28 -0
- package/kits/hub-game/blueprints/avatar-15.scene +28 -0
- package/kits/hub-game/blueprints/avatar-4.scene +28 -0
- package/kits/hub-game/blueprints/avatar-5.scene +28 -0
- package/kits/hub-game/blueprints/avatar-6.scene +28 -0
- package/kits/hub-game/blueprints/avatar-7.scene +28 -0
- package/kits/hub-game/blueprints/avatar-8.scene +28 -0
- package/kits/hub-game/blueprints/avatar-9.scene +28 -0
- package/kits/hub-game/castle.json +5 -5
- package/kits/hub-game/code/client/act.js +312 -0
- package/kits/hub-game/code/client/actionLayout.js +147 -0
- package/kits/hub-game/code/client/actionOverflow.js +556 -0
- package/kits/hub-game/code/client/actorBudget.js +47 -0
- package/kits/hub-game/code/client/arrivalCamera.js +50 -0
- package/kits/hub-game/code/client/askSlot.js +117 -0
- package/kits/hub-game/code/client/attention.js +11 -2
- package/kits/hub-game/code/client/avatar.js +311 -35
- package/kits/hub-game/code/client/avatarCap.js +228 -0
- package/kits/hub-game/code/client/avatarColors.js +70 -0
- package/kits/hub-game/code/client/avatarFaces.js +21 -0
- package/kits/hub-game/code/client/avatarShare.js +253 -0
- package/kits/hub-game/code/client/backVisibility.js +13 -0
- package/kits/hub-game/code/client/ballot.js +472 -0
- package/kits/hub-game/code/client/build.js +38 -0
- package/kits/hub-game/code/client/chat.js +41 -5
- package/kits/hub-game/code/client/chatModeration.js +5 -0
- package/kits/hub-game/code/client/chrome.js +2144 -160
- package/kits/hub-game/code/client/companion.js +716 -0
- package/kits/hub-game/code/client/companionDress.js +99 -0
- package/kits/hub-game/code/client/crowdNames.js +241 -0
- package/kits/hub-game/code/client/decor.js +515 -0
- package/kits/hub-game/code/client/defaultEnvironment.js +194 -0
- package/kits/hub-game/code/client/doorErrors.js +39 -0
- package/kits/hub-game/code/client/earned.js +131 -0
- package/kits/hub-game/code/client/emoteBubble.js +75 -0
- package/kits/hub-game/code/client/fall.js +18 -0
- package/kits/hub-game/code/client/farAvatars.js +233 -0
- package/kits/hub-game/code/client/firstJoin.js +9 -2
- package/kits/hub-game/code/client/fpsTelemetry.js +50 -0
- package/kits/hub-game/code/client/frameBatch.js +5 -0
- package/kits/hub-game/code/client/grab.js +368 -29
- package/kits/hub-game/code/client/hookLayer.js +385 -20
- package/kits/hub-game/code/client/hudCopy.js +51 -0
- package/kits/hub-game/code/client/hudRate.js +20 -0
- package/kits/hub-game/code/client/idle.js +177 -24
- package/kits/hub-game/code/client/interestCap.js +81 -0
- package/kits/hub-game/code/client/invites.js +231 -0
- package/kits/hub-game/code/client/joinError.js +9 -0
- package/kits/hub-game/code/client/keys.js +36 -0
- package/kits/hub-game/code/client/labelsNear.js +234 -0
- package/kits/hub-game/code/client/landscapeLayout.js +17 -0
- package/kits/hub-game/code/client/layoutCache.js +264 -0
- package/kits/hub-game/code/client/loadTelemetry.js +20 -0
- package/kits/hub-game/code/client/loadingCover.js +148 -0
- package/kits/hub-game/code/client/loadingEntry.js +8 -0
- package/kits/hub-game/code/client/menuIcons.js +34 -0
- package/kits/hub-game/code/client/menuRows.js +43 -0
- package/kits/hub-game/code/client/modelReady.js +7 -0
- package/kits/hub-game/code/client/pack.js +6 -2
- package/kits/hub-game/code/client/packFormat.js +3 -3
- package/kits/hub-game/code/client/padCueArrival.js +23 -0
- package/kits/hub-game/code/client/padCues.js +112 -0
- package/kits/hub-game/code/client/padOccupancy.js +88 -0
- package/kits/hub-game/code/client/padReadability.js +26 -0
- package/kits/hub-game/code/client/padRings.js +69 -0
- package/kits/hub-game/code/client/pushVisit.js +14 -0
- package/kits/hub-game/code/client/quality.js +205 -0
- package/kits/hub-game/code/client/qualityEntry.js +55 -0
- package/kits/hub-game/code/client/rehello.js +167 -0
- package/kits/hub-game/code/client/safeLayout.js +338 -0
- package/kits/hub-game/code/client/safeStyle.js +42 -0
- package/kits/hub-game/code/client/say.js +12 -3
- package/kits/hub-game/code/client/shot.js +146 -0
- package/kits/hub-game/code/client/shotFit.js +56 -0
- package/kits/hub-game/code/client/signIn.js +28 -0
- package/kits/hub-game/code/client/sound.js +63 -8
- package/kits/hub-game/code/client/soundscape.js +1151 -0
- package/kits/hub-game/code/client/soundscapeActions.js +99 -0
- package/kits/hub-game/code/client/soundscapeAmbience.js +453 -0
- package/kits/hub-game/code/client/soundscapeBaked.js +143 -0
- package/kits/hub-game/code/client/soundscapeBusker.js +217 -0
- package/kits/hub-game/code/client/soundscapeCourt.js +200 -0
- package/kits/hub-game/code/client/soundscapeCrowd.js +331 -0
- package/kits/hub-game/code/client/soundscapeCues.js +362 -0
- package/kits/hub-game/code/client/soundscapeMap.js +181 -0
- package/kits/hub-game/code/client/soundscapeMarket.js +176 -0
- package/kits/hub-game/code/client/soundscapeMusic.js +126 -0
- package/kits/hub-game/code/client/soundscapeMusicEngine.js +460 -0
- package/kits/hub-game/code/client/soundscapeSimlish.js +737 -0
- package/kits/hub-game/code/client/soundscapeSongs.js +127 -0
- package/kits/hub-game/code/client/soundscapeSongsRound3.js +63 -0
- package/kits/hub-game/code/client/soundscapeSynthesis.js +168 -0
- package/kits/hub-game/code/client/soundscapeUi.js +211 -0
- package/kits/hub-game/code/client/soundscapeVoice.js +1209 -0
- package/kits/hub-game/code/client/soundscapeWaves.js +206 -0
- package/kits/hub-game/code/client/spin.js +101 -0
- package/kits/hub-game/code/client/state.js +162 -1
- package/kits/hub-game/code/client/stuck.js +259 -0
- package/kits/hub-game/code/client/talk.js +714 -59
- package/kits/hub-game/code/client/tiers.js +543 -52
- package/kits/hub-game/code/client/toastBand.js +37 -0
- package/kits/hub-game/code/client/together.js +39 -2
- package/kits/hub-game/code/client/visibility.js +43 -0
- package/kits/hub-game/code/client/weakestLookBake.js +92 -0
- package/kits/hub-game/code/client/weakestTier.js +295 -0
- package/kits/hub-game/code/client/wear.js +461 -170
- package/kits/hub-game/code/client/worldLabels.js +241 -0
- package/kits/hub-game/code/client/yours.js +200 -0
- package/kits/hub-game/code/companionSpec.js +45 -0
- package/kits/hub-game/code/npcDisplayText.js +55 -0
- package/kits/hub-game/code/privateText.js +7 -0
- package/kits/hub-game/code/server/act.js +124 -0
- package/kits/hub-game/code/server/actions.js +138 -0
- package/kits/hub-game/code/server/actors.js +11 -2
- package/kits/hub-game/code/server/analytics.js +83 -0
- package/kits/hub-game/code/server/anonymousEntry.js +49 -0
- package/kits/hub-game/code/server/arrivalPose.js +36 -0
- package/kits/hub-game/code/server/ask.js +155 -0
- package/kits/hub-game/code/server/ballot.js +539 -0
- package/kits/hub-game/code/server/cells.js +100 -0
- package/kits/hub-game/code/server/companion.js +107 -0
- package/kits/hub-game/code/server/cues.js +70 -0
- package/kits/hub-game/code/server/decor.js +269 -0
- package/kits/hub-game/code/server/doorAnalytics.js +52 -0
- package/kits/hub-game/code/server/earned.js +478 -0
- package/kits/hub-game/code/server/frameBatch.js +183 -0
- package/kits/hub-game/code/server/friendBests.js +166 -0
- package/kits/hub-game/code/server/friendsAmong.js +272 -0
- package/kits/hub-game/code/server/history.js +7 -0
- package/kits/hub-game/code/server/hub.js +2510 -95
- package/kits/hub-game/code/server/idle.js +60 -12
- package/kits/hub-game/code/server/index.js +28 -6
- package/kits/hub-game/code/server/invites.js +19 -0
- package/kits/hub-game/code/server/labels.js +36 -2
- package/kits/hub-game/code/server/loadAbandon.js +106 -0
- package/kits/hub-game/code/server/manifest.js +586 -7
- package/kits/hub-game/code/server/menu.js +161 -0
- package/kits/hub-game/code/server/npcs.js +1025 -113
- package/kits/hub-game/code/server/observe.js +408 -0
- package/kits/hub-game/code/server/padOccupancy.js +85 -0
- package/kits/hub-game/code/server/party.js +2 -2
- package/kits/hub-game/code/server/players.js +30 -0
- package/kits/hub-game/code/server/resumePose.js +152 -0
- package/kits/hub-game/code/server/say.js +1 -1
- package/kits/hub-game/code/server/shot.js +110 -0
- package/kits/hub-game/code/server/standing.js +123 -0
- package/kits/hub-game/code/server/storageLimit.js +187 -0
- package/kits/hub-game/code/server/vis.js +175 -0
- package/kits/hub-game/code/server/wear.js +12 -0
- package/kits/hub-game/code/server/yours.js +59 -0
- package/kits/hub-game/code/shared/act.js +35 -0
- package/kits/hub-game/code/shared/cues.js +9 -0
- package/kits/hub-game/code/shared/danceIdle.js +28 -0
- package/kits/hub-game/code/shared/decor.js +41 -0
- package/kits/hub-game/code/shared/loadStages.js +12 -0
- package/kits/hub-game/code/shared/quality.js +74 -0
- package/kits/hub-game/code/shared/say.js +2 -0
- package/kits/hub-game/code/shared/shot.js +53 -0
- package/kits/hub-game/code/shared/spin.js +57 -0
- package/kits/hub-game/code/systems/hub.js +1753 -202
- package/kits/hub-game/docs/analytics.md +279 -0
- package/kits/hub-game/docs/content-pack.md +1 -1
- package/kits/hub-game/docs/contract.md +3475 -77
- package/kits/hub-game/docs/home-pieces.md +71 -0
- package/kits/hub-game/docs/observed-progress.md +252 -0
- package/kits/hub-game/main.jsx +2 -0
- package/kits/hub-game/models/avatar-10.pxmodel +28 -0
- package/kits/hub-game/models/avatar-11.pxmodel +28 -0
- package/kits/hub-game/models/avatar-12.pxmodel +27 -0
- package/kits/hub-game/models/avatar-13.pxmodel +24 -0
- package/kits/hub-game/models/avatar-14.pxmodel +29 -0
- package/kits/hub-game/models/avatar-15.pxmodel +24 -0
- package/kits/hub-game/models/avatar-4.pxmodel +29 -0
- package/kits/hub-game/models/avatar-5.pxmodel +27 -0
- package/kits/hub-game/models/avatar-6.pxmodel +26 -0
- package/kits/hub-game/models/avatar-7.pxmodel +25 -0
- package/kits/hub-game/models/avatar-8.pxmodel +24 -0
- package/kits/hub-game/models/avatar-9.pxmodel +30 -0
- package/kits/hub-game/models/earned/badge-round.pxmodel +100 -0
- package/kits/hub-game/models/earned/badge-shield.pxmodel +117 -0
- package/kits/hub-game/models/earned/badge-star.pxmodel +87 -0
- package/kits/hub-game/models/earned/belt-plain.pxmodel +72 -0
- package/kits/hub-game/models/earned/held-ball.pxmodel +43 -0
- package/kits/hub-game/models/earned/held-lantern.pxmodel +85 -0
- package/kits/hub-game/models/earned/held-net.pxmodel +57 -0
- package/kits/hub-game/models/earned/held-trophy.pxmodel +109 -0
- package/kits/hub-game/models/earned/pin-round.pxmodel +62 -0
- package/kits/hub-game/models/earned/sash-plain.pxmodel +66 -0
- package/kits/hub-game/models/earned/square/belt-plain.pxmodel +104 -0
- package/kits/hub-game/models/earned/square/sash-plain.pxmodel +98 -0
- package/kits/hub-game/models/hats/bat-clip.pxmodel +206 -0
- package/kits/hub-game/models/hats/beekeeper.pxmodel +149 -0
- package/kits/hub-game/models/hats/cap.pxmodel +162 -0
- package/kits/hub-game/models/hats/captain.pxmodel +178 -0
- package/kits/hub-game/models/hats/crooked-top.pxmodel +172 -0
- package/kits/hub-game/models/hats/flower-crown.pxmodel +451 -0
- package/kits/hub-game/models/hats/foam-crown.pxmodel +179 -0
- package/kits/hub-game/models/hats/lantern.pxmodel +230 -0
- package/kits/hub-game/models/hats/laurel.pxmodel +533 -0
- package/kits/hub-game/models/hats/lighthouse.pxmodel +96 -0
- package/kits/hub-game/models/hats/sailor.pxmodel +141 -0
- package/kits/hub-game/models/hats/souwester.pxmodel +131 -0
- package/kits/hub-game/models/hats/straw.pxmodel +139 -0
- package/kits/hub-game/models/hats/sunflower.pxmodel +406 -0
- package/kits/hub-game/models/hats/sweatband.pxmodel +112 -0
- package/kits/hub-game/models/hats/witch.pxmodel +147 -0
- package/kits/hub-game/package-lock.json +10 -1
- package/kits/hub-game/package.json +6 -2
- package/kits/hub-game/play/player.js +142 -0
- package/kits/hub-game/play/registry.js +47 -0
- package/kits/hub-game/play.jsx +37 -0
- package/kits/hub-game/scripts/check.mjs +117 -16
- package/kits/hub-game/scripts/companion-follower-wire.json +1 -0
- package/kits/hub-game/scripts/fixtures/decor-keyless-draw.json +132 -0
- package/kits/hub-game/scripts/fixtures/decor-keyless.json +293 -0
- package/kits/hub-game/scripts/fixtures/engine-models-stub.mjs +26 -0
- package/kits/hub-game/scripts/fixtures/fake-dom.mjs +123 -0
- package/kits/hub-game/scripts/fixtures/interest-legacy.json +385 -0
- package/kits/hub-game/scripts/fixtures/npc-notes-v1.77.jsonl +4 -0
- package/kits/hub-game/scripts/fixtures/vis-shared-wire.json +1 -0
- package/kits/hub-game/scripts/gen-avatars.mjs +933 -16
- package/kits/hub-game/scripts/gen-earned.mjs +285 -0
- package/kits/hub-game/scripts/gen-hats.mjs +827 -0
- package/kits/hub-game/scripts/grab.before-orbit.mjs +400 -0
- package/kits/hub-game/scripts/pose-storage-fixture.mjs +46 -0
- package/kits/hub-game/scripts/soundscape-wave-analysis.mjs +125 -0
- package/kits/hub-game/scripts/test-act-client.mjs +186 -0
- package/kits/hub-game/scripts/test-act.mjs +171 -0
- package/kits/hub-game/scripts/test-action-layout.mjs +80 -0
- package/kits/hub-game/scripts/test-action-observers.mjs +46 -0
- package/kits/hub-game/scripts/test-actions-client.mjs +853 -0
- package/kits/hub-game/scripts/test-actions.mjs +298 -0
- package/kits/hub-game/scripts/test-actor-budget.mjs +44 -0
- package/kits/hub-game/scripts/test-actors.mjs +38 -23
- package/kits/hub-game/scripts/test-analytics.mjs +76 -0
- package/kits/hub-game/scripts/test-anonymous-entry.mjs +28 -0
- package/kits/hub-game/scripts/test-arrival-pose-server.mjs +196 -0
- package/kits/hub-game/scripts/test-arrival-pose.mjs +24 -0
- package/kits/hub-game/scripts/test-ask-client.mjs +358 -0
- package/kits/hub-game/scripts/test-ask-slot.mjs +85 -0
- package/kits/hub-game/scripts/test-ask.mjs +269 -0
- package/kits/hub-game/scripts/test-attention.mjs +10 -1
- package/kits/hub-game/scripts/test-avatar-cap.mjs +379 -0
- package/kits/hub-game/scripts/test-avatar-colors.mjs +72 -0
- package/kits/hub-game/scripts/test-avatar-models.mjs +181 -0
- package/kits/hub-game/scripts/test-avatar-share.mjs +318 -0
- package/kits/hub-game/scripts/test-avatar-wire.mjs +792 -0
- package/kits/hub-game/scripts/test-avatar.mjs +584 -7
- package/kits/hub-game/scripts/test-back-visibility.mjs +82 -0
- package/kits/hub-game/scripts/test-ballot.mjs +1008 -0
- package/kits/hub-game/scripts/test-ban-join.mjs +121 -13
- package/kits/hub-game/scripts/test-build.mjs +49 -0
- package/kits/hub-game/scripts/test-cells.mjs +71 -0
- package/kits/hub-game/scripts/test-chat.mjs +863 -0
- package/kits/hub-game/scripts/test-classic.mjs +2 -0
- package/kits/hub-game/scripts/test-companion-chat.mjs +216 -0
- package/kits/hub-game/scripts/test-companion-client.mjs +1167 -0
- package/kits/hub-game/scripts/test-companion.mjs +259 -0
- package/kits/hub-game/scripts/test-control-layout-dom.mjs +120 -0
- package/kits/hub-game/scripts/test-crowd-names.mjs +205 -0
- package/kits/hub-game/scripts/test-decor-client.mjs +344 -0
- package/kits/hub-game/scripts/test-decor.mjs +464 -0
- package/kits/hub-game/scripts/test-default-environment-root.mjs +95 -0
- package/kits/hub-game/scripts/test-default-environment.mjs +267 -0
- package/kits/hub-game/scripts/test-door-analytics.mjs +58 -0
- package/kits/hub-game/scripts/test-door-jump.mjs +100 -0
- package/kits/hub-game/scripts/test-earned-client.mjs +459 -0
- package/kits/hub-game/scripts/test-earned.mjs +1224 -0
- package/kits/hub-game/scripts/test-emote-bubble.mjs +110 -0
- package/kits/hub-game/scripts/test-far-avatars.mjs +340 -0
- package/kits/hub-game/scripts/test-fps-telemetry.mjs +112 -0
- package/kits/hub-game/scripts/test-frame-batch.mjs +252 -0
- package/kits/hub-game/scripts/test-fresh-friends.mjs +118 -0
- package/kits/hub-game/scripts/test-friend-bests.mjs +435 -0
- package/kits/hub-game/scripts/test-grab-orbit.mjs +961 -0
- package/kits/hub-game/scripts/test-grab.mjs +7 -0
- package/kits/hub-game/scripts/test-hats.mjs +422 -168
- package/kits/hub-game/scripts/test-high-only.mjs +170 -0
- package/kits/hub-game/scripts/test-hub-leaving.mjs +203 -0
- package/kits/hub-game/scripts/test-hub-ops.mjs +758 -2
- package/kits/hub-game/scripts/test-hub-trip.mjs +1594 -12
- package/kits/hub-game/scripts/test-hud-clear.mjs +484 -57
- package/kits/hub-game/scripts/test-hud-defects-dom.mjs +100 -0
- package/kits/hub-game/scripts/test-hud-rate.mjs +224 -0
- package/kits/hub-game/scripts/test-hud-safe-visibility-dom.mjs +83 -0
- package/kits/hub-game/scripts/test-idle.mjs +427 -1
- package/kits/hub-game/scripts/test-interest-cap.mjs +36 -0
- package/kits/hub-game/scripts/test-interest-cells.mjs +513 -0
- package/kits/hub-game/scripts/test-interest-client.mjs +118 -0
- package/kits/hub-game/scripts/test-interest.mjs +15 -0
- package/kits/hub-game/scripts/test-invites-client.mjs +430 -0
- package/kits/hub-game/scripts/test-invites.mjs +109 -0
- package/kits/hub-game/scripts/test-keys.mjs +46 -1
- package/kits/hub-game/scripts/test-labels.mjs +664 -0
- package/kits/hub-game/scripts/test-landscape-layout.mjs +194 -0
- package/kits/hub-game/scripts/test-list-scroll-dom.mjs +49 -0
- package/kits/hub-game/scripts/test-load-abandon.mjs +246 -0
- package/kits/hub-game/scripts/test-loading-cover.mjs +162 -0
- package/kits/hub-game/scripts/test-manifest.mjs +472 -0
- package/kits/hub-game/scripts/test-menu-client.mjs +585 -0
- package/kits/hub-game/scripts/test-menu.mjs +319 -0
- package/kits/hub-game/scripts/test-npcs.mjs +2528 -13
- package/kits/hub-game/scripts/test-object-entry.mjs +76 -0
- package/kits/hub-game/scripts/test-observed.mjs +745 -0
- package/kits/hub-game/scripts/test-pack.mjs +7 -0
- package/kits/hub-game/scripts/test-pad-cues.mjs +304 -0
- package/kits/hub-game/scripts/test-pad-occupancy.mjs +177 -0
- package/kits/hub-game/scripts/test-picker.mjs +541 -0
- package/kits/hub-game/scripts/test-placement-cache.mjs +690 -0
- package/kits/hub-game/scripts/test-progress-reset.mjs +559 -0
- package/kits/hub-game/scripts/test-push-visit.mjs +26 -0
- package/kits/hub-game/scripts/test-quality.mjs +385 -0
- package/kits/hub-game/scripts/test-rehello.mjs +1733 -0
- package/kits/hub-game/scripts/test-relations-among.mjs +222 -0
- package/kits/hub-game/scripts/test-relations-refresh.mjs +188 -0
- package/kits/hub-game/scripts/test-resume-action-order.mjs +598 -0
- package/kits/hub-game/scripts/test-resume-held.mjs +239 -0
- package/kits/hub-game/scripts/test-resume-pose.mjs +142 -0
- package/kits/hub-game/scripts/test-safe-events-dom.mjs +116 -0
- package/kits/hub-game/scripts/test-safe-layout.mjs +330 -0
- package/kits/hub-game/scripts/test-say.mjs +1 -1
- package/kits/hub-game/scripts/test-shot.mjs +901 -0
- package/kits/hub-game/scripts/test-signin-client.mjs +45 -0
- package/kits/hub-game/scripts/test-soundscape.mjs +5437 -0
- package/kits/hub-game/scripts/test-spin.mjs +314 -0
- package/kits/hub-game/scripts/test-standing.mjs +449 -0
- package/kits/hub-game/scripts/test-storage-limit.mjs +333 -0
- package/kits/hub-game/scripts/test-stuck.mjs +1904 -0
- package/kits/hub-game/scripts/test-talk-overlay-dom.mjs +130 -0
- package/kits/hub-game/scripts/test-tier-cells.mjs +706 -0
- package/kits/hub-game/scripts/test-tiers-render.mjs +412 -0
- package/kits/hub-game/scripts/test-tiers.mjs +476 -2
- package/kits/hub-game/scripts/test-toast-band.mjs +61 -0
- package/kits/hub-game/scripts/test-try-on.mjs +22 -22
- package/kits/hub-game/scripts/test-vis.mjs +770 -0
- package/kits/hub-game/scripts/test-visibility.mjs +134 -0
- package/kits/hub-game/scripts/test-weakest-tier.mjs +924 -0
- package/kits/hub-game/scripts/test-world-labels.mjs +367 -0
- package/kits/hub-game/scripts/test-yours-chrome.mjs +210 -0
- package/kits/hub-game/scripts/test-yours.mjs +403 -0
- package/kits/multiplayer-3d/CLAUDE.md +50 -0
- package/kits/multiplayer-3d/castle.json +5 -5
- package/kits/multiplayer-3d/code/client/avatars.js +7 -0
- package/kits/multiplayer-3d/code/client/gait.js +65 -0
- package/kits/multiplayer-3d/code/client/joinFailure.js +27 -0
- package/kits/multiplayer-3d/code/client/nameTags.js +59 -4
- package/kits/multiplayer-3d/code/client/resumeGate.js +139 -0
- package/kits/multiplayer-3d/code/options.js +5 -0
- package/kits/multiplayer-3d/code/server/ownership.js +10 -2
- package/kits/multiplayer-3d/code/server/sceneBodies.js +12 -0
- package/kits/multiplayer-3d/code/server/world.js +7 -0
- package/kits/multiplayer-3d/code/systems/multiplayer.js +443 -34
- package/kits/multiplayer-3d/package-lock.json +8 -1
- package/kits/multiplayer-3d/package.json +3 -1
- package/kits/multiplayer-3d/scripts/fixtures/README.md +11 -0
- package/kits/multiplayer-3d/scripts/fixtures/ownership-legacy.json +2 -0
- package/kits/multiplayer-3d/scripts/ownership-harness.mjs +102 -0
- package/kits/multiplayer-3d/scripts/ownership-loader.mjs +46 -0
- package/kits/multiplayer-3d/scripts/ownership-worker.mjs +15 -0
- package/kits/multiplayer-3d/scripts/record-ownership-session.mjs +98 -0
- package/kits/multiplayer-3d/scripts/test-eligible-claims.mjs +167 -0
- package/kits/multiplayer-3d/scripts/test-join-watchdog.mjs +436 -0
- package/kits/multiplayer-3d/scripts/test-own-name-tag.mjs +247 -0
- package/kits/multiplayer-3d/scripts/test-resume-gate.mjs +624 -0
- package/kits/physics-2d/CLAUDE.md +19 -1
- package/kits/physics-2d/castle.json +2 -2
- package/kits/physics-2d/engine/frozenActors.js +233 -0
- package/kits/physics-2d/engine/scene.js +337 -3
- package/kits/physics-2d/engine/skyKey.js +129 -0
- package/kits/physics-2d/engine/stillClock.js +106 -0
- package/kits/physics-2d/engine/updateBudget.js +21 -0
- package/kits/physics-2d/eslint.config.js +1 -1
- package/kits/physics-2d/play/behaviors/AnalogStick.js +198 -0
- package/kits/physics-2d/play/behaviors/Camera.js +40 -0
- package/kits/physics-2d/play/behaviors/Collider.js +122 -0
- package/kits/physics-2d/play/behaviors/Draggable.js +115 -0
- package/kits/physics-2d/play/behaviors/Goal.js +46 -0
- package/kits/physics-2d/play/behaviors/Joints.js +126 -0
- package/kits/physics-2d/play/behaviors/Layout.js +71 -0
- package/kits/physics-2d/play/behaviors/RigidBody.js +57 -0
- package/kits/physics-2d/play/behaviors/Slingshot.js +142 -0
- package/kits/physics-2d/play/behaviors/SoundPlayer.js +263 -0
- package/kits/physics-2d/play/behaviors/Sprite.js +406 -0
- package/kits/physics-2d/play/behaviors/Style.js +209 -0
- package/kits/physics-2d/play/behaviors/Text.js +85 -0
- package/kits/physics-2d/play/behaviors/Video.js +93 -0
- package/kits/physics-2d/scripts/test-skip-unchanged.mjs +326 -1
- package/kits/physics-3d/CLAUDE.md +42 -529
- package/kits/physics-3d/behaviors/Body.jsx +3 -0
- package/kits/physics-3d/behaviors/Model.jsx +3 -0
- package/kits/physics-3d/behaviors/Player.jsx +661 -87
- package/kits/physics-3d/behaviors/Shape.jsx +3 -0
- package/kits/physics-3d/behaviors/Solid.jsx +3 -0
- package/kits/physics-3d/behaviors/Transform.jsx +3 -0
- package/kits/physics-3d/castle.json +3 -3
- package/kits/physics-3d/docs/engine-camera.md +542 -0
- package/kits/physics-3d/docs/engine-frame-cap.md +136 -0
- package/kits/physics-3d/docs/engine-load.md +149 -0
- package/kits/physics-3d/docs/engine-look.md +114 -0
- package/kits/physics-3d/docs/engine-shadows.md +372 -0
- package/kits/physics-3d/docs/engine-skip-work.md +187 -0
- package/kits/physics-3d/docs/engine-sky.md +198 -0
- package/kits/physics-3d/docs/engine-static-actors.md +226 -0
- package/kits/physics-3d/docs/engine-view.md +37 -0
- package/kits/physics-3d/docs/pxmodel-format.md +9 -1
- package/kits/physics-3d/engine3d/PlayOnly3D.jsx +5 -1
- package/kits/physics-3d/engine3d/Scene3DPlayer.jsx +19 -277
- package/kits/physics-3d/engine3d/actornode.js +87 -0
- package/kits/physics-3d/engine3d/animationBudget.js +23 -0
- package/kits/physics-3d/engine3d/branches.js +3 -13
- package/kits/physics-3d/engine3d/cage.js +2 -7
- package/kits/physics-3d/engine3d/cageops.js +2 -17
- package/kits/physics-3d/engine3d/dataBehaviors.js +12 -0
- package/kits/physics-3d/engine3d/editorWorld.js +6 -0
- package/kits/physics-3d/engine3d/emptynodes.js +232 -0
- package/kits/physics-3d/engine3d/framecap.js +99 -0
- package/kits/physics-3d/engine3d/frozenphysics.js +140 -0
- package/kits/physics-3d/engine3d/frozenstatics.js +273 -0
- package/kits/physics-3d/engine3d/gait.js +126 -0
- package/kits/physics-3d/engine3d/initialModelFiles.js +18 -0
- package/kits/physics-3d/engine3d/kithooks.js +47 -0
- package/kits/physics-3d/engine3d/look.js +514 -48
- package/kits/physics-3d/engine3d/lookbake.js +208 -0
- package/kits/physics-3d/engine3d/materialpresets.js +2 -0
- package/kits/physics-3d/engine3d/modelFiles.js +3 -17
- package/kits/physics-3d/engine3d/modelMath.js +49 -0
- package/kits/physics-3d/engine3d/modelready.js +16 -0
- package/kits/physics-3d/engine3d/motion.js +39 -10
- package/kits/physics-3d/engine3d/nearshadows.js +106 -21
- package/kits/physics-3d/engine3d/optimize.js +9 -5
- package/kits/physics-3d/engine3d/orbitinput.js +522 -10
- package/kits/physics-3d/engine3d/orbitlens.js +48 -0
- package/kits/physics-3d/engine3d/ownmodel.js +213 -0
- package/kits/physics-3d/engine3d/partgeometry.js +1 -16
- package/kits/physics-3d/engine3d/paths.js +1 -9
- package/kits/physics-3d/engine3d/playTimings.js +50 -0
- package/kits/physics-3d/engine3d/playerRun.js +372 -0
- package/kits/physics-3d/engine3d/pxmodel.js +42 -11
- package/kits/physics-3d/engine3d/rapier.js +27 -0
- package/kits/physics-3d/engine3d/scatter.js +1 -11
- package/kits/physics-3d/engine3d/shadowfade.js +890 -0
- package/kits/physics-3d/engine3d/sky.js +547 -0
- package/kits/physics-3d/engine3d/skylife.js +306 -0
- package/kits/physics-3d/engine3d/squarefirst.js +177 -0
- package/kits/physics-3d/engine3d/stillshadows.js +399 -0
- package/kits/physics-3d/engine3d/sweep.js +1 -25
- package/kits/physics-3d/engine3d/unchanged.js +11 -0
- package/kits/physics-3d/engine3d/viewrange.js +52 -0
- package/kits/physics-3d/engine3d/world3d.js +1253 -76
- package/kits/physics-3d/eslint.config.js +2 -1
- package/kits/physics-3d/main.jsx +10 -2
- package/kits/physics-3d/package-lock.json +7 -0
- package/kits/physics-3d/package.json +5 -1
- package/kits/physics-3d/play/behaviors/Body.js +31 -0
- package/kits/physics-3d/play/behaviors/Door.js +37 -0
- package/kits/physics-3d/play/behaviors/Lookable.js +16 -0
- package/kits/physics-3d/play/behaviors/Model.js +23 -0
- package/kits/physics-3d/play/behaviors/Pickup.js +46 -0
- package/kits/physics-3d/play/behaviors/Player.js +1204 -0
- package/kits/physics-3d/play/behaviors/Shape.js +47 -0
- package/kits/physics-3d/play/behaviors/Solid.js +16 -0
- package/kits/physics-3d/play/behaviors/Transform.js +29 -0
- package/kits/physics-3d/pnpm-lock.yaml +8 -0
- package/kits/physics-3d/scripts/bench-shadow-fade.mjs +37 -0
- package/kits/physics-3d/scripts/build-rapier-gz.mjs +56 -0
- package/kits/physics-3d/scripts/frozen-statics-fixture.mjs +141 -0
- package/kits/physics-3d/scripts/look-baseline.mjs +155 -0
- package/kits/physics-3d/scripts/test-camera-follow.mjs +5 -1
- package/kits/physics-3d/scripts/test-camera-orbit.mjs +2613 -82
- package/kits/physics-3d/scripts/test-drop-empty-parts.mjs +2 -2
- package/kits/physics-3d/scripts/test-empty-gait-hints.mjs +89 -0
- package/kits/physics-3d/scripts/test-frame-cap-bob.mjs +438 -0
- package/kits/physics-3d/scripts/test-frame-cap.mjs +452 -0
- package/kits/physics-3d/scripts/test-frozen-nested.mjs +49 -0
- package/kits/physics-3d/scripts/test-frozen-statics-legacy-physics2d.mjs +123 -0
- package/kits/physics-3d/scripts/test-frozen-statics.mjs +434 -0
- package/kits/physics-3d/scripts/test-gait.mjs +387 -0
- package/kits/physics-3d/scripts/test-look-bake.mjs +1056 -0
- package/kits/physics-3d/scripts/test-model-parse-cache.mjs +92 -0
- package/kits/physics-3d/scripts/test-near-shadows.mjs +5 -2
- package/kits/physics-3d/scripts/test-orbit-shadow-fade.mjs +2001 -0
- package/kits/physics-3d/scripts/test-orbit-shift-lock.mjs +582 -0
- package/kits/physics-3d/scripts/test-orbit-shot.mjs +657 -0
- package/kits/physics-3d/scripts/test-orbit-view.mjs +230 -0
- package/kits/physics-3d/scripts/test-rapier-gz.mjs +106 -0
- package/kits/physics-3d/scripts/test-skip-empty-nodes.mjs +845 -0
- package/kits/physics-3d/scripts/test-sky.mjs +2470 -0
- package/kits/physics-3d/scripts/test-square-first.mjs +921 -0
- package/kits/physics-3d/scripts/test-static-actors.mjs +10 -1
- package/kits/physics-3d/scripts/test-static-physics.mjs +4 -1
- package/kits/physics-3d/scripts/test-static-scenery.mjs +2174 -0
- package/kits/physics-3d/scripts/test-steady-hover.mjs +7 -2
- package/kits/physics-3d/scripts/test-still-shadows.mjs +477 -0
- package/kits/physics-3d/scripts/test-view-range.mjs +260 -0
- package/kits/physics-3d/systems/physics3d.js +419 -9
- package/kits/real-time/castle.json +2 -2
- package/kits/real-time/code/client/connection.js +33 -10
- package/kits/real-time/code/client/gameHooks.js +2 -0
- package/kits/real-time/code/client/joinOverlay.js +9 -4
- package/kits/real-time/code/server/gameHooks.js +7 -0
- package/kits/real-time/code/server/session.js +102 -22
- package/kits/real-time/package-lock.json +1 -1
- package/package.json +2 -2
- package/dist/shell/assets/index-Cf61cNfT.css +0 -1
|
@@ -35,7 +35,7 @@ bottom }`; any ref can pick a frame of a multi-frame sprite with
|
|
|
35
35
|
`mass`, `castRay(origin, dir, maxToi, excludeActor)` (rays skip sensors).
|
|
36
36
|
`addForce(actor, {x,y,z})` pushes through this frame's physics steps only
|
|
37
37
|
(ask every frame from `update` for a steady push; `resetForces(actor)`
|
|
38
|
-
drops what the frame asked):
|
|
38
|
+
drops what the frame asked): docs/engine-camera.md has the rule.
|
|
39
39
|
Fixed/kinematic actors ARE moved by writing their Transform.
|
|
40
40
|
- The scene has the lighting rig built in (hemisphere + ambient + one
|
|
41
41
|
shadow-casting sun, ground plane at y=0); meshes cast and receive shadows
|
|
@@ -61,534 +61,30 @@ bottom }`; any ref can pick a frame of a multi-frame sprite with
|
|
|
61
61
|
or stood on: whatever is not on an actor falls (pits, lava, sky islands).
|
|
62
62
|
`Shape.artRepeat: [u, v]` tiles a texture across a
|
|
63
63
|
face so long walls don't stretch.
|
|
64
|
-
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
> Fast-path state (snapshots, pass marks, cached signatures) is trusted only
|
|
89
|
-
> across a span in which no code outside the engine has run. A pass in which
|
|
90
|
-
> the engine calls out (any callback), is re-entered, or sees the scene
|
|
91
|
-
> change, finishes exactly as main would and leaves no fast-path state
|
|
92
|
-
> behind.
|
|
93
|
-
|
|
94
|
-
The engine moves a counter before it does anything, inside a pass over the
|
|
95
|
-
actors, that can run code that is not its own; it does not work out
|
|
96
|
-
afterwards whether something ran. The places, all of them:
|
|
97
|
-
`scene.three.scene.userData.groundHeight`, called while a walking model is
|
|
98
|
-
animated; and three.js listeners (`added`, `removed`, `childadded`,
|
|
99
|
-
`childremoved`, `dispose`) on the scene, a node, a geometry or a material,
|
|
100
|
-
told when a node is built, rebuilt or released, when the scene changes, when
|
|
101
|
-
the ground is dressed anew, and when an instanced mesh is replaced; and
|
|
102
|
-
`syncActors` called again from inside any of those. From that point the
|
|
103
|
-
pass does each actor the old way and writes nothing down, and when it ends,
|
|
104
|
-
or if it throws, everything written down before is dropped. So:
|
|
105
|
-
- a frame in which any actor's mesh is built, rebuilt or released costs what
|
|
106
|
-
it costs without the key, and the frame after it reads every actor once
|
|
107
|
-
more before skipping resumes;
|
|
108
|
-
- a scene with a `groundHeight` callback, or with `instanceModels` on, runs
|
|
109
|
-
every pass the old way and keeps only the matrix saving;
|
|
110
|
-
- the physics pass calls nothing outside the engine until its collision
|
|
111
|
-
callbacks, which come last;
|
|
112
|
-
- a component nested more than 32 levels deep is compared the old way every
|
|
113
|
-
frame.
|
|
114
|
-
|
|
115
|
-
What is written down lives in the world's own maps (`world.snapshots`,
|
|
116
|
-
`world.modelSigs`) and in the physics system's (`remembered`), never on a
|
|
117
|
-
node entry or a body entry, and is dropped by replacing or clearing those.
|
|
118
|
-
The one thing on a node, an ActorNode's `computedFrom`, is numbers only and
|
|
119
|
-
refers to no object.
|
|
120
|
-
A world being disposed never skips: `disposeWorld` drops what was written
|
|
121
|
-
down before it releases the nodes and again after their `dispose` listeners
|
|
122
|
-
have run, so a listener that syncs the world again leaves nothing.
|
|
123
|
-
- Within the terms, these are followed: any stored field of a Shape, Model,
|
|
124
|
-
Body or Transform changed, added, removed or reordered, at any depth; art
|
|
125
|
-
loading or being replaced; a model file, or a model it references, edited;
|
|
126
|
-
a node's, or any object under it's, position, rotation (angles or order),
|
|
127
|
-
quaternion, scale or visibility set; children added, removed, reordered,
|
|
128
|
-
or moved to another parent and back; a body's type changed through
|
|
129
|
-
`scene.physics3d.bodyOf`.
|
|
130
|
-
- Outside the terms the result is not promised. The engine does notice some
|
|
131
|
-
of it and then does the old work for that actor, as protection, not as a
|
|
132
|
-
guarantee to build on: a component with an accessor, a `toJSON` or a class
|
|
133
|
-
of its own found when it is first read; an object under a node with
|
|
134
|
-
`matrixAutoUpdate` off or an `updateMatrixWorld` of its own (a camera, a
|
|
135
|
-
skinned mesh); a world matrix written by hand; a transform changed, used
|
|
136
|
-
and put back between frames.
|
|
137
|
-
- It does not notice, among others: a `Proxy` in place of a component, of
|
|
138
|
-
`actor.components` or of the `sprites` / `files` tables; a getter on
|
|
139
|
-
`Transform`, on `Shape.solid`, or on `actor.components` itself; a stored
|
|
140
|
-
field redefined as a getter after the engine has read it; an object's
|
|
141
|
-
local `matrix` written by hand while its `matrixAutoUpdate` is on (set
|
|
142
|
-
`position` / `quaternion` / `scale` instead); three.js private fields
|
|
143
|
-
written directly (`rotation._order`, `quaternion._x`).
|
|
144
|
-
- `"engine": { "dropEmptyParts": true }` at the scene file's top level (the
|
|
145
|
-
same `engine` object) asks the engine to place models without the groups
|
|
146
|
-
that draw nothing. A placed model is a game build: its meshes are merged
|
|
147
|
-
into a few draw calls, but every part keeps its own three.js group, most of
|
|
148
|
-
them then empty, and three.js and the engine visit every object under the
|
|
149
|
-
scene on every frame. A town of a few hundred models is two thirds such
|
|
150
|
-
groups. The terms:
|
|
151
|
-
> With the key absent, a model is built and placed exactly as before: the
|
|
152
|
-
> same objects, the same shared build, the same node. With the key present,
|
|
153
|
-
> every object that is drawn (a mesh, its outline, anything that is not a
|
|
154
|
-
> plain group) is the same object with the same geometry, material and
|
|
155
|
-
> world matrix as without it, on every frame, and walks, `motion`, clips and
|
|
156
|
-
> glow play the same. What a deck must not rely on under the key is finding
|
|
157
|
-
> the group of a part that draws nothing unless that part is one that
|
|
158
|
-
> stays.
|
|
159
|
-
|
|
160
|
-
What goes: a group with nothing drawn on it or anywhere under it -- no
|
|
161
|
-
mesh, line, points, sprite, light or camera. That includes the group of a
|
|
162
|
-
part that IS drawn when its mesh was merged into a batch on the model's
|
|
163
|
-
root or on a moving part: the picture keeps the part, `modelParts` does
|
|
164
|
-
not. What always stays, with every group above it:
|
|
165
|
-
- a part marked `keep: true` (docs/pxmodel-format.md: "for a deck that
|
|
166
|
-
reaches for it by id"), with its own mesh as before;
|
|
167
|
-
- a part named `slot-...`. The format's docs let a deck "parent your own
|
|
168
|
-
parts to it", and nothing says that happens only in the model file, so a
|
|
169
|
-
slot is never dropped: a deck may hang a mesh on one at runtime and it is
|
|
170
|
-
drawn where it would be without the key;
|
|
171
|
-
- a part the walk moves (`legL`, `legR`, `armL`, `armR`, `torso`) or the
|
|
172
|
-
model's `motion`, gait or `clips` move, drawn or not, and every copy of
|
|
173
|
-
one;
|
|
174
|
-
- anything a kept part or slot holds that is not another part.
|
|
175
|
-
|
|
176
|
-
An actor whose model draws nothing at all (an invisible collider placing an
|
|
177
|
-
empty model) gets no rig group under its node: the node is there, with
|
|
178
|
-
`userData.modelParts` an empty Map and no children.
|
|
179
|
-
So under the key:
|
|
180
|
-
- `scene.three.nodes.get(id).node.userData.modelParts` holds only the parts
|
|
181
|
-
that stayed. `modelParts.get('door')` for a part that draws nothing and
|
|
182
|
-
is none of the above is `undefined`, where without the key it is an empty
|
|
183
|
-
group. To reach for an empty part as a locator (a muzzle, a hand), mark
|
|
184
|
-
it `keep: true` or name it `slot-...`; it then stands exactly where it
|
|
185
|
-
did.
|
|
186
|
-
- code that walks a node's tree counts fewer objects, and a node's first
|
|
187
|
-
child is its rig only when its model draws something.
|
|
188
|
-
- nothing else changes: which actors have nodes, `userData.actorId`, the
|
|
189
|
-
rig's `yOffset` and `scale`, physics, picking, shadows (casters are
|
|
190
|
-
culled by their own meshes' bounds), `instanceModels`.
|
|
191
|
-
|
|
192
|
-
It is read when the scene loads, as `skipUnchangedActors` is, and each
|
|
193
|
-
scene decides for itself: a node and a shared model build made for a scene
|
|
194
|
-
that asked are never used for one that did not, or the other way round (a
|
|
195
|
-
resident scene parked while another plays, a pack mounted in a town, a door
|
|
196
|
-
trip, a scene file reloaded with the key changed -- every node is then
|
|
197
|
-
built again). The scene editor and the play panel draw a scene through the
|
|
198
|
-
same engine, so both follow the scene's key; the editor selects actors, not
|
|
199
|
-
parts, and is not affected. The model editor and `npm run render` build a
|
|
200
|
-
model for themselves, with every part's group, whatever any scene says.
|
|
201
|
-
Opt in with `skipUnchangedActors` when a scene is hundreds of placed
|
|
202
|
-
models; a scene of a few gains nothing.
|
|
203
|
-
- `"engine": { "shadows": { "distance": 40 } }` at the scene file's top level
|
|
204
|
-
(the same `engine` object) asks the engine to draw the sun's shadows where
|
|
205
|
-
they can be seen, near the camera, rather than in the sun's fixed box.
|
|
206
|
-
Without it the sun's shadow camera is a fixed 150 x 120 m box round the
|
|
207
|
-
origin, so every caster under the box is drawn a second time each frame
|
|
208
|
-
wherever the player stands, and a scene larger than the box has no shadows
|
|
209
|
-
outside it. The terms:
|
|
210
|
-
> With the key absent, a scene is drawn exactly as before: the same shadow
|
|
211
|
-
> camera, map, `castShadow` flags and render calls. On a frame the mode
|
|
212
|
-
> draws, everything the camera sees within `distance` metres (measured along
|
|
213
|
-
> the way it looks) is shadowed as it would be under a box that covered it,
|
|
214
|
-
> with texels exactly the size the sun's own are and the same softness and
|
|
215
|
-
> bias. Shadows are complete out to `distance` for casters inside the depth
|
|
216
|
-
> range below; a point farther off may or may not be shadowed, and nothing
|
|
217
|
-
> cuts shadows off there.
|
|
218
|
-
|
|
219
|
-
The depth range is the sun's own `near` and `far` along the light, measured
|
|
220
|
-
from the engine's shadow camera, which stands as far from the middle of the
|
|
221
|
-
view's sphere (taken along the light to the height of the sun's target) as
|
|
222
|
-
the sun does from its target. For the engine's sun (19.9 m from its target,
|
|
223
|
-
near 0.5, far 50) that is casters up to 19.4 m toward the sun and 30.1 m
|
|
224
|
-
away from it, from the ground under the middle of the view. It is what the
|
|
225
|
-
sun's own camera draws for a view round its target: there too a caster 25 m
|
|
226
|
-
up the light from a point on the ground is not drawn.
|
|
227
|
-
|
|
228
|
-
How it stays out of the scene's way (`engine3d/nearshadows.js` has the rule
|
|
229
|
-
and the code):
|
|
230
|
-
> The scene's sun, its shadow object, its shadow camera, its map and its
|
|
231
|
-
> target are never written by this mode. What the mode needs is its own
|
|
232
|
-
> objects, attached only for the duration of one renderer.render call
|
|
233
|
-
> inside try/finally. Outside that call the world is as main leaves it, so
|
|
234
|
-
> there is nothing to restore on a scene change, a throw, a dispose or a
|
|
235
|
-
> keyless frame.
|
|
236
|
-
|
|
237
|
-
Who the key is for:
|
|
238
|
-
> The key is for a scene whose deck leaves the renderer's shadow settings
|
|
239
|
-
> and the drawing of the world to the engine. A deck must not set the key if
|
|
240
|
-
> any of its code, in any scene played in the same world, changes
|
|
241
|
-
> renderer.shadowMap.type, .enabled, .autoUpdate or .needsUpdate after the
|
|
242
|
-
> world is made; calls renderer.render or the composer itself, inside or
|
|
243
|
-
> between the engine's frames; calls renderWorld from inside a frame; or
|
|
244
|
-
> gives the world's renderer to another world. In a deck that does, shadows
|
|
245
|
-
> may be drawn wrongly with the key, and three.js's shadow bookkeeping for
|
|
246
|
-
> the sun's own map (its filter, its size) may differ from a world that
|
|
247
|
-
> never had the key until the world is disposed. A deck that never sets the
|
|
248
|
-
> key is unaffected whatever it does.
|
|
249
|
-
|
|
250
|
-
(three.js keeps the shadow pass's state, the type it last drew with and the
|
|
251
|
-
frustum it culls by, inside the renderer, where the engine can neither read
|
|
252
|
-
it nor put it back. Nothing in the kits does any of the above after
|
|
253
|
-
`makeWorld3D`.) Nothing of the renderer's is ever written by the mode.
|
|
254
|
-
|
|
255
|
-
Within that, the mode draws a frame only when all of these hold; otherwise
|
|
256
|
-
the frame is drawn exactly as without the key. They are cheap protection,
|
|
257
|
-
looked at every frame, not promises about a deck outside the condition
|
|
258
|
-
above. After any `renderWorld` call returns, either the mode drew that
|
|
259
|
-
frame or nothing of the mode's is allocated: every way out of the mode (a
|
|
260
|
-
frame drawn plain for any term, a re-entry, a throw, a dispose) frees its
|
|
261
|
-
map at that moment:
|
|
262
|
-
1. the scene now playing asked, with a finite distance above 0
|
|
263
|
-
(`runtime.nearShadowDistance`, read when the scene loads), the frame is
|
|
264
|
-
the player's (the scene and model editors give `renderWorld` no runtime),
|
|
265
|
-
and the world is not being disposed;
|
|
266
|
-
2. `renderWorld` was not entered from inside another `renderWorld` of this
|
|
267
|
-
world that had anything of the mode's to do, keyed or not, and no frame
|
|
268
|
-
of this world has been entered that way before. The call inside is drawn
|
|
269
|
-
plain; the sun has its own shadow back before that call draws, and still
|
|
270
|
-
has it when the call returns, whatever the call did, disposing the world
|
|
271
|
-
included; the mode is off for this world from then until the world is
|
|
272
|
-
disposed (`world.nearShadows.off`); and the frame that was re-entered,
|
|
273
|
-
whose map is freed under it, may have wrong or missing shadows, that
|
|
274
|
-
once;
|
|
275
|
-
3. read at the start of the frame, `renderer.shadowMap.type` is
|
|
276
|
-
`PCFSoftShadowMap` and `.enabled` and `.autoUpdate` are on, which is how
|
|
277
|
-
the engine makes the renderer; and the frame before was also a frame
|
|
278
|
-
with the key that found the same and was drawn to the end
|
|
279
|
-
(`world.nearShadows.lastType`). So the first frame with the key, after a
|
|
280
|
-
load or after any frame without it, is drawn plain, and three.js
|
|
281
|
-
allocates and configures the sun's own map as it would have; and so is
|
|
282
|
-
the frame after one that threw, and after one the mode drew that ended
|
|
283
|
-
with no map on the engine's shadow (three.js drew nothing: a lost
|
|
284
|
-
context). The engine's shadow never has a blur map;
|
|
285
|
-
4. the sun (`world.sun`, the light whose bias the engine fits) is still a
|
|
286
|
-
child of the scene, is the first directional light there that casts, has
|
|
287
|
-
`castShadow` on, is visible and on the camera's layers, and its own
|
|
288
|
-
shadow is a directional light's, has `autoUpdate` on and has its map.
|
|
289
|
-
Looked at every frame: a sun removed or replaced means plain frames, in
|
|
290
|
-
which a replacement draws its own box as without the key;
|
|
291
|
-
5. the camera is a perspective camera, and the sun's own box and map size
|
|
292
|
-
give a texel size: its shadow camera has zoom 1 and no view offset.
|
|
293
|
-
|
|
294
|
-
All of the mode's work in a `renderWorld` call (deciding the terms, fitting
|
|
295
|
-
the bias, allocating, swapping, rendering, leaving, disposing) happens
|
|
296
|
-
inside one outermost try/finally, counted on the world
|
|
297
|
-
(`world.nearShadows.depth`). A call that arrives while the count is up
|
|
298
|
-
draws plain, puts the mode off and makes nothing. The finally establishes
|
|
299
|
-
the postcondition itself: unless the mode drew this frame to the end, on a
|
|
300
|
-
world not disposed, with the mode not off and a map on its shadow, nothing
|
|
301
|
-
of the mode's is allocated and the sun has its own shadow. Its order is
|
|
302
|
-
what makes that hold through a `dispose` listener that throws: first the
|
|
303
|
-
sun gets its own shadow back (an assignment, which calls no one), then what
|
|
304
|
-
is freed is detached and only then disposed, and looked at again after the
|
|
305
|
-
callbacks; the count comes down in a finally of its own that nothing skips.
|
|
306
|
-
A world with no mode state playing a scene without the key does not enter
|
|
307
|
-
any of it: `renderWorld` runs its two statements (fit the bias, render)
|
|
308
|
-
with no counter and no try, as it always did.
|
|
309
|
-
|
|
310
|
-
On such a frame `renderWorld` fits the bias of the sun's own shadow as
|
|
311
|
-
always, puts the engine's shadow on the sun (`sun.shadow`), renders, and
|
|
312
|
-
puts the sun's own back in a `finally`; that assignment is the only write,
|
|
313
|
-
and it is undone only by the frame that made it (a frame that finds the
|
|
314
|
-
world disposed, its state replaced or itself re-entered touches nothing).
|
|
315
|
-
three.js keeps nothing per shadow object (the shadow pass and the light
|
|
316
|
-
uniforms read `light.shadow` afresh every render), so the next plain render
|
|
317
|
-
reads the sun's own as if nothing had happened. The engine's shadow
|
|
318
|
-
(`world.nearShadows.shadow`, a DirectionalLightShadow with its own camera,
|
|
319
|
-
map, matrix and frustum), each frame:
|
|
320
|
-
- looks along the sun's direction, from as far as the sun is from its
|
|
321
|
-
target, with the sun's own near and far, round the smallest sphere that
|
|
322
|
-
holds the camera's view out to `distance`: one size whichever way the
|
|
323
|
-
camera turns (it changes only with the canvas's shape or the camera's
|
|
324
|
-
lens). It sits a whole number of texels along each of its axes, so a
|
|
325
|
-
shadow's edge does not crawl as the camera moves. The light does not move;
|
|
326
|
-
- has texels exactly the size of the sun's own (the sun's box over its map
|
|
327
|
-
size, read each frame), so its box is `map size x texel` and it copies the
|
|
328
|
-
bias `fitShadowBias` fitted to the sun's own, with its intensity and
|
|
329
|
-
radius: 40 m on a portrait phone is a 710 x 888 map. Its map is never
|
|
330
|
-
larger than the sun's own in area (2048 x 2048) nor than the renderer's
|
|
331
|
-
largest texture on a side; a `distance` that would need more is drawn as
|
|
332
|
-
the largest that fits (about 100 m in portrait, 38 m at 32:9) rather than
|
|
333
|
-
with larger texels;
|
|
334
|
-
- hands three.js a frustum to cull casters with (`getFrustum`) that is its
|
|
335
|
-
box narrowed to the view's outline, out to `distance`, as the sun sees it,
|
|
336
|
-
pushed out by everything three.js's shader moves a shadow lookup by across
|
|
337
|
-
the light: the normal bias drawn with that frame (the lookup is made at
|
|
338
|
-
`position + normal * normalBias`) and four texels for the soft filter's
|
|
339
|
-
taps. The box is wider by the same. Every caster whose shadow
|
|
340
|
-
can land on something the view sees within `distance` is drawn into the
|
|
341
|
-
map; one whose shadow cannot is not. No `castShadow` flag is changed and
|
|
342
|
-
nothing is cached: every caster that is drawn is drawn every frame, so a
|
|
343
|
-
moving thing's shadow moves with it as before.
|
|
344
|
-
|
|
345
|
-
A frame without the key drops what the mode holds, all but `off`;
|
|
346
|
-
`disposeWorld` drops it all. The engine's map (and a blur map, were there
|
|
347
|
-
one) is taken off its shadow before it is disposed, once.
|
|
348
|
-
|
|
349
|
-
What a deck that works on the sun sees under the key: the sun's own
|
|
350
|
-
`shadow.camera` box, `mapSize` and any `getFrustum` of its own are left as
|
|
351
|
-
they are and not used for drawing on the frames the mode draws (a sun whose
|
|
352
|
-
`shadow.autoUpdate` the deck turned off gets plain frames, term 4),
|
|
353
|
-
except that the box over the map size gives the texel size and `near`/`far`,
|
|
354
|
-
`bias`, `normalBias`, `intensity` and `radius` are copied each frame;
|
|
355
|
-
three.js does not draw the sun's own shadow on those frames, so its map and
|
|
356
|
-
its shadow camera's matrices stay as the last plain frame left them; a sun
|
|
357
|
-
moved or re-aimed is followed (its direction is read each frame). Without
|
|
358
|
-
the key such a deck works exactly as before. What differs on screen with
|
|
359
|
-
the key: shadows no longer end at the fixed box's edge, so a scene larger
|
|
360
|
-
than that box gains shadows where it had none; beyond `distance` from the
|
|
361
|
-
camera they thin out and, past the engine's box (which reaches somewhat
|
|
362
|
-
farther than `distance`), end, with a hard edge if the camera can see that
|
|
363
|
-
far (pick a distance past the ground the camera can see). Opt in when a
|
|
364
|
-
scene is wide enough that most of its casters are out of sight; a scene
|
|
365
|
-
that fits the view gains nothing.
|
|
366
|
-
- `"engine": { "camera": { "follow": "rigid" } }` at the scene file's top
|
|
367
|
-
level (the same `engine` object) asks the `Player` behavior for a follow
|
|
368
|
-
camera that moves with the player instead of easing after it. Without it
|
|
369
|
-
the camera eases its whole position toward its place behind the player, so
|
|
370
|
-
how far it trails a walking player depends on how long each frame is: on
|
|
371
|
-
frames of uneven length (a page missing every other vsync) the distance
|
|
372
|
-
changes every frame and the view judders, which reads as an up-and-down
|
|
373
|
-
shake walking forward, since the camera looks down. The terms:
|
|
374
|
-
> With the key absent, the camera is placed exactly as before: the same
|
|
375
|
-
> code, in the same place in the frame. With the key present, the camera's
|
|
376
|
-
> offset from the player (its angle and height) and the player's height are
|
|
377
|
-
> eased at the rate the old camera eases, with an easing that trails a
|
|
378
|
-
> steadily moving target by the same distance however the frames are cut;
|
|
379
|
-
> the player's ground position is not eased. So a steady walk leaves the
|
|
380
|
-
> player at one place on screen, a turn swings the camera round as before,
|
|
381
|
-
> and a jump lifts the player on screen while the camera follows smoothly.
|
|
382
|
-
> A teleport (more than 3 m in a frame, or the camera more than 20 m off)
|
|
383
|
-
> still snaps it, and it still looks at the player.
|
|
384
|
-
|
|
385
|
-
Where it is placed: behaviors run before physics, so the Player sees the
|
|
386
|
-
position the last frame drew. Under the key it asks for its camera instead
|
|
387
|
-
(`scene.followCamera`: its actor id and the scene data it asked in), every
|
|
388
|
-
frame, whether physics is ready or not, and the physics system places it
|
|
389
|
-
last in its `afterBehaviors`, after this frame's positions are written back
|
|
390
|
-
and the collision callbacks have run, on the position the frame is drawn
|
|
391
|
-
with; on a frame physics cannot step (rapier still loading, or the first
|
|
392
|
-
frame after a load) it is placed all the same. The player is looked up as
|
|
393
|
-
the scene has it then: one a callback despawned gets no camera, and a
|
|
394
|
-
request made before a load is not used after it (a load and a dispose drop
|
|
395
|
-
it). Systems registered after physics (the hub's) see the camera already
|
|
396
|
-
placed. The offset is read each frame from where the camera is, against
|
|
397
|
-
the point it followed the frame before, so a camera something else placed
|
|
398
|
-
(a hub trip's camera, a cutscene) is eased on from wherever it was put.
|
|
399
|
-
The play panel and a published deck play the scene through the same
|
|
400
|
-
runtime, so both follow the scene's key; the scene editor's own orbit
|
|
401
|
-
camera is not a follow camera and is not affected.
|
|
402
|
-
|
|
403
|
-
The key means "the player is held steady on screen", so it also changes
|
|
404
|
-
how the `Player` hovers. Without it the hover spring (and the fall-faster
|
|
405
|
-
pull) is an impulse, pushed once per drawn frame, while gravity pulls once
|
|
406
|
-
per fixed 1/60 physics step, and a frame takes none, one or two steps: on
|
|
407
|
-
a frame that is not exactly one step the player is kicked up or let drop,
|
|
408
|
-
a bob of 0.6 to 2 cm walking on a phone, which a camera that holds the
|
|
409
|
-
player still would show as the whole view bobbing. The terms:
|
|
410
|
-
> With the key absent, the Player makes the calls on `scene.physics3d` it
|
|
411
|
-
> made before, with the same arguments, in the same order. With the key
|
|
412
|
-
> present, the hover and the fall-faster pull are forces
|
|
413
|
-
> (`scene.physics3d.addForce`), which act once per physics step as gravity
|
|
414
|
-
> does: walking on flat ground the player's height does not move, whatever
|
|
415
|
-
> the frame lengths. The spring is the same one (160 and 18), resting
|
|
416
|
-
> 1.38 cm higher (`STEADY_REST`) so that the kit's player (gravity scale
|
|
417
|
-
> 2) stands where it does without the key, 0.7412 m, to within 0.01 mm; a
|
|
418
|
-
> jump reaches 2.348 m (2.347 on alternating frames) where without the key
|
|
419
|
-
> it reaches 2.347 to 2.354 m depending on the frames. A player with
|
|
420
|
-
> another gravity scale stands 0.69 cm per unit of scale off its keyless
|
|
421
|
-
> height. The walk push is an impulse either way (it leaves the height
|
|
422
|
-
> alone, and the rigid camera does not show its unevenness).
|
|
423
|
-
|
|
424
|
-
The rule for forces: **a force is for the frame it was asked in.** rapier
|
|
425
|
-
keeps a force on a body until it is reset, so nothing outside the physics
|
|
426
|
-
system puts one on a body. `addForce(actor, v)` writes down what was asked
|
|
427
|
-
(asking again in the frame adds; `resetForces(actor)` drops it: the
|
|
428
|
-
Player does that on the frame of a jump, or the frame's lift would add
|
|
429
|
-
11 cm to it); the physics pass puts the forces on their bodies just before
|
|
430
|
-
the frame's fixed steps and takes them off straight after, in a `finally`
|
|
431
|
-
(`stepForced`, systems/physics3d.js), however many steps there were. So
|
|
432
|
-
between frames no body carries a force, and each of these leaves none: the
|
|
433
|
-
Player not running (turned off, physics not ready) asks for nothing; a
|
|
434
|
-
player despawned after asking has no body by the pass; a scene load or a
|
|
435
|
-
dispose (`reset`) drops what was asked, so a door trip from a keyed scene
|
|
436
|
-
to one without the key starts clean; the key going away means the next
|
|
437
|
-
frame asks for nothing; a frame that never reached physics, or a force
|
|
438
|
-
asked for after the pass (from a collision callback), is not used in a
|
|
439
|
-
later frame (requests carry the scene time they were asked at). Code that
|
|
440
|
-
places the player through its body (the hub's fall catch, the multiplayer
|
|
441
|
-
kit's placement and clamps: `setTranslation` and a zero velocity, after
|
|
442
|
-
physics) needs nothing new: there is no force to clear. A behavior that
|
|
443
|
-
wants a steady push asks every frame from `update`, and stops by not
|
|
444
|
-
asking. scripts/test-steady-hover.mjs holds all of it, on a stand-in
|
|
445
|
-
rapier and, where rapier is installed, on rapier itself.
|
|
446
|
-
- `"engine": { "camera": { "follow": "rigid", "control": "orbit" } }` (the
|
|
447
|
-
same `camera` object) asks the `Player` behavior for a third-person camera
|
|
448
|
-
the player controls: they turn it, tilt it and zoom it, walking is
|
|
449
|
-
relative to it, and the character turns to face the way it walks. Without
|
|
450
|
-
it the Player drives like a tank (A/D and a sideways drag steer, the
|
|
451
|
-
camera stays behind) and the camera's height and distance are the fixed
|
|
452
|
-
`camHeight` and `camDistance`. The terms:
|
|
453
|
-
> With `control` absent, everything is exactly as before: the same code,
|
|
454
|
-
> the same calls on `scene.physics3d` in the same order, the same camera,
|
|
455
|
-
> the same listeners on the canvas, for a scene with no camera key and for
|
|
456
|
-
> one with `"follow": "rigid"` alone. `control` means something only as
|
|
457
|
-
> exactly `"orbit"` beside exactly `"follow": "rigid"`; anything else, or
|
|
458
|
-
> `"orbit"` without the rigid follow, is as absent. The key is read when
|
|
459
|
-
> the scene loads (`scene.cameraControl`, `'orbit'` or `null`), as the
|
|
460
|
-
> other engine keys are. With the key present the Player hovers, jumps and
|
|
461
|
-
> falls as it does under `"follow": "rigid"` (forces), and the camera
|
|
462
|
-
> moves with the player as that one does: the player's ground position is
|
|
463
|
-
> not eased, its height is.
|
|
464
|
-
|
|
465
|
-
Controls under the key:
|
|
466
|
-
- Touch and pen: a drag that starts in the left half of the canvas is the
|
|
467
|
-
movement stick (the same stick, `scene.moveInput`: 56 px to full
|
|
468
|
-
deflection, analogue). A drag that starts in the right half turns and
|
|
469
|
-
tilts the camera, 0.006 rad per CSS pixel: dragging right swings the
|
|
470
|
-
view right, dragging up looks up (the camera goes lower). The left half
|
|
471
|
-
is the stick's: a finger that lands there is never part of a pinch, so
|
|
472
|
-
a thumb put down to walk while the other looks walks, and two thumbs
|
|
473
|
-
put down together walk and look. Two fingers that both landed in the
|
|
474
|
-
right half (the second while the first is still a tap or turning the
|
|
475
|
-
camera) are a pinch: fingers apart bring the camera nearer; while they
|
|
476
|
-
pinch neither turns the camera, a finger in the left half can still
|
|
477
|
-
take the stick, and the finger left when one lifts does nothing more
|
|
478
|
-
until it lifts too. A second drag in the left half while the stick is
|
|
479
|
-
held does nothing. A short tap that did not move still jumps, anywhere;
|
|
480
|
-
a finger that was part of a pinch, or left spent, never jumps.
|
|
481
|
-
- Mouse: a drag with any button turns and tilts, and is never the stick;
|
|
482
|
-
the wheel zooms, a tenth per notch; the context menu is kept off the
|
|
483
|
-
canvas. A left click that did not move jumps.
|
|
484
|
-
- Keys: W/S and up/down walk away from and toward the camera, A/D
|
|
485
|
-
strafe, left/right swing the camera, Space jumps.
|
|
486
|
-
|
|
487
|
-
What the Player's properties mean under it: `speed` and `jumpSpeed` are
|
|
488
|
-
what they were. `turnSpeed` is how fast left/right swing the camera,
|
|
489
|
-
rad/s; the character itself turns to face its walk at a fixed 12/s.
|
|
490
|
-
The character faces the way it walks; standing still it keeps its
|
|
491
|
-
facing. It starts facing away from the camera (PI - camAngle, as without
|
|
492
|
-
the key). Without the key its facing is always PI - camAngle, so code
|
|
493
|
-
that turns it sets camAngle; under the key the camera and the character
|
|
494
|
-
turn apart, and turning the character is asked for: `scene.faceRequest =
|
|
495
|
-
<radians>`, taken once by the Player's next update (a value that is not
|
|
496
|
-
a finite number is dropped) and dropped by a scene load. The hub asks
|
|
497
|
-
this way beside each of its camAngle writes (its arrival facing, a jump
|
|
498
|
-
to a door); any other deck that turns the player must do the same, since
|
|
499
|
-
a camAngle written without a request turns only the camera. The
|
|
500
|
-
player's own left/right and drags turn the camera only.
|
|
501
|
-
`camDistance` and `camHeight` are where the camera starts: its distance
|
|
502
|
-
from the point it looks at is `hypot(camDistance, camHeight - 0.8)` and
|
|
503
|
-
its tilt `atan2(camHeight - 0.8, camDistance)`, which is where the fixed
|
|
504
|
-
camera sits. It looks at the player 0.8 m above its Transform (the fixed
|
|
505
|
-
cameras look 0.5 m above).
|
|
506
|
-
|
|
507
|
-
Limits: the tilt stays between 5 and 70 degrees above the horizontal and
|
|
508
|
-
the distance between 3 and 12 m; a Player whose numbers start it nearer
|
|
509
|
-
or farther has room to where it starts, and a starting tilt outside the
|
|
510
|
-
limits is brought inside. What is asked is eased in at 20/s.
|
|
511
|
-
|
|
512
|
-
Collision: each frame one ray goes from the point the camera is placed
|
|
513
|
-
from (the player, with its height eased as the camera eases it, 0.8 m
|
|
514
|
-
up) toward where the camera wants to be, as far as its distance and
|
|
515
|
-
0.25 m past it, against fixed bodies' solid colliders only
|
|
516
|
-
(`scene.physics3d.castRayFixed(origin, dir, maxToi)`: like `castRay`,
|
|
517
|
-
passing through sensors and dynamic and kinematic bodies; other players
|
|
518
|
-
and thrown things do not move the camera). What it finds is a limit on
|
|
519
|
-
how far out the camera may be: 0.25 m in front of the hit, never nearer
|
|
520
|
-
the look point than 0.6 m. A nearer limit is taken at once; a farther
|
|
521
|
-
one, or none, is eased out to at 6/s and let go once the camera is back
|
|
522
|
-
at its distance. The camera sits at the nearer of its eased distance and
|
|
523
|
-
that limit, so zooming in while held in front of a wall brings it no
|
|
524
|
-
nearer until the distance asked is nearer than the wall, and it never
|
|
525
|
-
goes past the player; the view is never inside a wall and never pops
|
|
526
|
-
outward. While a takeover blend lasts (below) the point actually drawn,
|
|
527
|
-
its place plus what is left of the blend, is collided the same way with
|
|
528
|
-
a second ray: pulled in along its own line to 0.25 m in front of what is
|
|
529
|
-
in the way, and the next frame eases on from there. Settled, one ray a
|
|
530
|
-
frame. No ray is cast on a frame physics has no world.
|
|
531
|
-
|
|
532
|
-
There is no return-behind (no swinging the camera back behind a walking
|
|
533
|
-
player when it is left alone): walking forward already keeps the camera
|
|
534
|
-
behind, and chasing a strafe would turn a straight walk into a circle.
|
|
535
|
-
|
|
536
|
-
Where the state is. The yaw is `scene.persistent.camAngle`, with the
|
|
537
|
-
meaning it always had (the camera sits at player + (-d sin, h, d cos) of
|
|
538
|
-
it), so code that reads or sets it (the hub's arrival facing) works as
|
|
539
|
-
before; a yaw set a full turn away is reached the short way round. The
|
|
540
|
-
tilt and distance the player chose are client-only: they are on the
|
|
541
|
-
runtime (`scene.cameraOrbit`), which a scene load does not replace, so
|
|
542
|
-
they carry from scene to scene (a Player with other
|
|
543
|
-
`camDistance`/`camHeight` starts from its own), and are never on
|
|
544
|
-
`scene.persistent`, which the multiplayer kit sends. What the camera is
|
|
545
|
-
doing between frames is on the actor's `runtime`, which a scene load
|
|
546
|
-
rebuilds. `scene.lookInput` (engine3d/orbitinput.js) holds what the
|
|
547
|
-
pointers asked for until the Player takes it, once a frame; it is made
|
|
548
|
-
the first time a pointer goes down under the key or a Player runs under
|
|
549
|
-
it (`scene.orbitInput()`), so a runtime that never meets the key has
|
|
550
|
-
none.
|
|
551
|
-
|
|
552
|
-
When something else has the camera. A teleport (more than 3 m in a
|
|
553
|
-
frame) snaps it, and so does a camera more than 20 m from its place. The
|
|
554
|
-
camera is the player's to steer on a frame only when the Player also
|
|
555
|
-
placed it on the frame before (so a Player turned off, even for a frame
|
|
556
|
-
and even by a collision callback after its update, does not come back to
|
|
557
|
-
a queued drag), the camera is where the Player left it, and the look
|
|
558
|
-
input is not locked. `scene.lookInput.lock()` makes the next take empty
|
|
559
|
-
and drops what was asked; the hub calls it each frame of a door trip
|
|
560
|
-
under the key (beside its `lockInput`), so a drag made during a
|
|
561
|
-
trip neither moves the trip's camera nor turns the view when it ends. On
|
|
562
|
-
any frame the camera is not where the Player left it (a hub trip writes
|
|
563
|
-
it every frame; the first frame of a scene; a Player turned off and on)
|
|
564
|
-
the Player starts again from the chosen tilt and distance and eases on
|
|
565
|
-
from where the camera was put (a twentieth of the way left after 0.3 s).
|
|
566
|
-
|
|
567
|
-
Loads. A scene without the key, loaded after one with it, runs the code
|
|
568
|
-
it always ran from its first frame: the latch is per load, and the
|
|
569
|
-
Player's and the input's branches each read it once. On every scene
|
|
570
|
-
load and on dispose the physics system's `reset` resets the orbit input
|
|
571
|
-
(`scene.lookInput.reset()`, only when it is the one orbitinput.js made:
|
|
572
|
-
`isOrbitLook`): every pointer it holds is let go of (the stick released
|
|
573
|
-
if one of them held it, no tap), what was asked of the camera is
|
|
574
|
-
dropped, and the wheel and context-menu listeners are taken off; a keyed
|
|
575
|
-
scene's Player puts the listeners back on its first frame. A
|
|
576
|
-
`faceRequest` not yet taken is dropped on every load, whether or not the
|
|
577
|
-
orbit input was ever made. A tap already taken as a jump and not yet
|
|
578
|
-
used carries across a load with or without the key, as it always has. A
|
|
579
|
-
runtime that never met the key has no orbit input.
|
|
580
|
-
So a finger held across any load into or out of a keyed scene, or
|
|
581
|
-
between two keyed scenes, does nothing more until it lifts: the old
|
|
582
|
-
handlers do not know it either. A finger the old handlers hold across a
|
|
583
|
-
load into a keyed scene keeps their stick until it lifts or a pointer
|
|
584
|
-
goes down under the key, which lets go of everything they hold; only
|
|
585
|
-
one of the two ever writes the stick. scripts/test-camera-orbit.mjs
|
|
586
|
-
holds all of it, with the Player as it was before the key
|
|
587
|
-
(scripts/Player.before-orbit.mjs) and Scene3DPlayer's `attachInput` as
|
|
588
|
-
it was (scripts/Scene3DPlayer.before-orbit.jsx) as the references for
|
|
589
|
-
the scenes without it, and the loads, the lock and a Player turned off
|
|
590
|
-
and on run through physics-2d's SceneRuntime and Scene3DPlayer's own
|
|
591
|
-
`attachInput`.
|
|
64
|
+
- A scene file's top level may carry an `engine` object, beside `ground`.
|
|
65
|
+
Every key in it is opt-in: a scene without the key runs the engine exactly
|
|
66
|
+
as before. Each key's terms are in a file under `docs/`; read that file
|
|
67
|
+
before setting the key, or before changing code in a scene that sets it.
|
|
68
|
+
- `load` -- builds the models near the player before the first frame and
|
|
69
|
+
the rest in slices after it: docs/engine-load.md.
|
|
70
|
+
- `skipUnchangedActors`, `dropEmptyParts`, `skipEmptyNodes`,
|
|
71
|
+
`skipEmptyGaitHints` -- per-frame savings for a scene of hundreds of
|
|
72
|
+
mostly still actors: docs/engine-skip-work.md.
|
|
73
|
+
- `staticActors`, `frozenStatics` -- the engine leaves alone actors the
|
|
74
|
+
scene file marks `"static": true`. A write to a marked actor is not
|
|
75
|
+
followed unless `scene.touch(id)` comes first (`scene.touch?.(id)` under
|
|
76
|
+
an older kit): docs/engine-static-actors.md.
|
|
77
|
+
- `shadows` -- sun shadows drawn near the camera instead of in a fixed box:
|
|
78
|
+
docs/engine-shadows.md.
|
|
79
|
+
- `camera` -- `follow: "rigid"`, the `control: "orbit"` third-person
|
|
80
|
+
camera, and its `pitch`, `minPitch`, `distance` and `fov`; also the rule
|
|
81
|
+
for steady forces: docs/engine-camera.md.
|
|
82
|
+
- `view` -- view distance and fog: docs/engine-view.md.
|
|
83
|
+
- `look` -- models drawn first and their look baked after:
|
|
84
|
+
docs/engine-look.md.
|
|
85
|
+
- `sky` -- a sky per zone, fading between zones: docs/engine-sky.md.
|
|
86
|
+
- `maxFps` -- a cap on the play loop's frame rate:
|
|
87
|
+
docs/engine-frame-cap.md.
|
|
592
88
|
- `.scene` files open in the kit's 3d scene editor (same chrome as the 2d
|
|
593
89
|
kit's): blueprint hotbar (tap to inspect/edit the template, drag onto the
|
|
594
90
|
stage to place), orbit camera (drag orbits, wheel zooms), click to select /
|
|
@@ -632,6 +128,10 @@ bottom }`; any ref can pick a frame of a multi-frame sprite with
|
|
|
632
128
|
|
|
633
129
|
## Making a model
|
|
634
130
|
|
|
131
|
+
A deck may set top-level `"gait": "model"` in its own `castle.json` for
|
|
132
|
+
scale-aware walk cadence (docs/pxmodel-format.md, Animation). Absent keeps
|
|
133
|
+
the fixed gait unchanged; this is a deck option, not a scene/model field.
|
|
134
|
+
|
|
635
135
|
Read all of `docs/pxmodel-format.md` before writing a model. Then:
|
|
636
136
|
|
|
637
137
|
1. Decide what makes this one distinctive: its silhouette and two or three
|
|
@@ -702,3 +202,16 @@ formats, imports, reloading, editors -- are the Castle CLI's, not this deck's.
|
|
|
702
202
|
The serve writes them fresh at every start to `.castle/docs/platform.md`, loaded here:
|
|
703
203
|
|
|
704
204
|
@.castle/docs/platform.md
|
|
205
|
+
|
|
206
|
+
Client rig budgeting: `entry.node.userData.animationEvery` is an optional
|
|
207
|
+
positive finite cadence in seconds for composed model animation (biped walk
|
|
208
|
+
and authored motion together). The animator accumulates dt until that cadence
|
|
209
|
+
and flushes pending time when the field is removed or its cadence changes. It changes no physics, actor transforms, or events. The hub
|
|
210
|
+
town sets it only for distant NPC/display actors on its opt-in Low budget.
|
|
211
|
+
|
|
212
|
+
A client controller may set `actor.runtime.renderSleep = true` only after
|
|
213
|
+
detaching its existing actor node from the render scene. Render sync then
|
|
214
|
+
keeps the node allocated but skips transform/model/animation work; an absent
|
|
215
|
+
node is still created, and a reattached node always synchronizes. The
|
|
216
|
+
controller must check live actor data and clear the flag before reattaching
|
|
217
|
+
or restoring High. This does not pause physics, events, or network state.
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// motion: 'dynamic' is simulated (gravity, pushes), 'kinematic' is unpushable
|
|
4
4
|
// but follows Transform edits with proper contact resolution (moving doors,
|
|
5
5
|
// platforms). `lockRotations` keeps a dynamic body upright (characters).
|
|
6
|
+
import { registerDataBehavior } from '../engine3d/dataBehaviors.js';
|
|
6
7
|
import React from 'react';
|
|
7
8
|
import { SelectField } from '@imports/castle.physics-2d/engine/ui';
|
|
8
9
|
import { AutoFields, overrideProps } from '@imports/castle.physics-2d/engine/autoInspector';
|
|
@@ -58,3 +59,5 @@ export class Body {
|
|
|
58
59
|
this.props = props;
|
|
59
60
|
}
|
|
60
61
|
}
|
|
62
|
+
|
|
63
|
+
registerDataBehavior(Body);
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// feet-at-zero model under a capsule whose center is the Transform. Models
|
|
5
5
|
// with the walk part ids (legL/legR/armL/armR/torso) animate automatically
|
|
6
6
|
// from how the actor actually moves.
|
|
7
|
+
import { registerDataBehavior } from '../engine3d/dataBehaviors.js';
|
|
7
8
|
export class Model {
|
|
8
9
|
static behaviorName = 'Model';
|
|
9
10
|
static defaultProps = { file: '', scale: 1, yOffset: 0 };
|
|
@@ -16,3 +17,5 @@ export class Model {
|
|
|
16
17
|
this.props = props;
|
|
17
18
|
}
|
|
18
19
|
}
|
|
20
|
+
|
|
21
|
+
registerDataBehavior(Model);
|