castle-web-cli 0.4.229 → 0.4.230
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-prompts.d.ts +2 -0
- package/dist/agent-prompts.js +16 -8
- package/dist/agent.d.ts +2 -0
- package/dist/agent.js +21 -21
- package/dist/api.d.ts +28 -2
- package/dist/api.js +74 -16
- package/dist/castle-host/host.d.ts +91 -0
- package/dist/castle-host/host.js +779 -3
- package/dist/castleJson.d.ts +44 -0
- package/dist/castleJson.js +131 -0
- package/dist/check.js +27 -1
- package/dist/contentPack.d.ts +49 -0
- package/dist/contentPack.js +273 -0
- package/dist/devExperiments.d.ts +21 -0
- package/dist/devExperiments.js +139 -0
- package/dist/devHub.d.ts +55 -0
- package/dist/devHub.js +187 -0
- package/dist/devSessionChild.js +3 -1
- package/dist/devSessionServer.d.ts +14 -1
- package/dist/devSessionServer.js +229 -44
- package/dist/experimentAssignment.d.ts +15 -0
- package/dist/experimentAssignment.js +41 -0
- package/dist/importCheckHook.d.ts +40 -0
- package/dist/importCheckHook.js +171 -0
- package/dist/importRegression.d.ts +15 -0
- package/dist/importRegression.js +100 -0
- package/dist/importTrust.d.ts +2 -0
- package/dist/importTrust.js +27 -0
- package/dist/importUpdateHook.d.ts +18 -0
- package/dist/importUpdateHook.js +31 -8
- package/dist/importUpdateHookRunner.js +19 -7
- package/dist/imports.d.ts +16 -0
- package/dist/imports.js +141 -31
- package/dist/index.js +3 -1
- package/dist/init.d.ts +3 -0
- package/dist/init.js +125 -8
- package/dist/install.js +4 -1
- package/dist/localPaths.js +4 -0
- package/dist/login.js +2 -2
- package/dist/platformDoc.js +3 -8
- package/dist/playPagePolicy.js +3 -1
- package/dist/remix.js +5 -0
- package/dist/routerTaskReport.d.ts +28 -0
- package/dist/routerTaskReport.js +56 -0
- package/dist/save-deck.d.ts +18 -0
- package/dist/save-deck.js +142 -6
- package/dist/serve.d.ts +8 -0
- package/dist/serve.js +94 -13
- package/dist/serverBundle.d.ts +1 -1
- package/dist/serverBundle.js +5 -1
- package/dist/webSourceSync.d.ts +2 -0
- package/dist/webSourceSync.js +2 -0
- package/kits/base/CLAUDE.md +2 -3
- package/kits/base/castle.json +1 -1
- package/kits/base/sdk/README.md +258 -52
- package/kits/base/sdk/agent.js +4 -4
- package/kits/base/sdk/avatar.d.ts +12 -0
- package/kits/base/sdk/avatar.js +23 -0
- package/kits/base/sdk/castle.d.ts +5 -0
- package/kits/base/sdk/castle.js +3 -0
- package/kits/base/sdk/commands.d.ts +208 -0
- package/kits/base/sdk/commands.js +16 -0
- package/kits/base/sdk/context.d.ts +6 -0
- package/kits/base/sdk/experiments.d.ts +15 -0
- package/kits/base/sdk/experiments.js +83 -0
- package/kits/base/sdk/hub.d.ts +85 -0
- package/kits/base/sdk/hub.js +107 -0
- package/kits/base/sdk/multiplayer.d.ts +45 -1
- package/kits/base/sdk/multiplayer.js +106 -4
- package/kits/base/sdk/server/hub.d.ts +169 -0
- package/kits/base/sdk/server/hub.js +125 -0
- package/kits/base/sdk/server/platformHandle.d.ts +42 -1
- package/kits/base/sdk/server/storage.d.ts +55 -2
- package/kits/base/sdk/server/wrapper.d.ts +32 -2
- package/kits/base/sdk/server/wrapper.js +90 -11
- package/kits/base/sdk/transport.d.ts +2 -1
- package/kits/base/sdk/transport.js +13 -1
- package/kits/hub-game/.prettierrc +5 -0
- package/kits/hub-game/CLAUDE.md +146 -0
- package/kits/hub-game/blueprints/avatar-0.scene +28 -0
- package/kits/hub-game/blueprints/avatar-1.scene +28 -0
- package/kits/hub-game/blueprints/avatar-2.scene +28 -0
- package/kits/hub-game/blueprints/avatar-3.scene +28 -0
- package/kits/hub-game/blueprints/bean/avatar-0.scene +28 -0
- package/kits/hub-game/blueprints/bean/avatar-1.scene +28 -0
- package/kits/hub-game/blueprints/bean/avatar-2.scene +28 -0
- package/kits/hub-game/blueprints/bean/avatar-3.scene +28 -0
- package/kits/hub-game/blueprints/blocky/avatar-0.scene +28 -0
- package/kits/hub-game/blueprints/blocky/avatar-1.scene +28 -0
- package/kits/hub-game/blueprints/blocky/avatar-2.scene +28 -0
- package/kits/hub-game/blueprints/blocky/avatar-3.scene +28 -0
- package/kits/hub-game/blueprints/pixel/avatar-0.scene +28 -0
- package/kits/hub-game/blueprints/pixel/avatar-1.scene +28 -0
- package/kits/hub-game/blueprints/pixel/avatar-2.scene +28 -0
- package/kits/hub-game/blueprints/pixel/avatar-3.scene +28 -0
- package/kits/hub-game/castle.json +96 -0
- package/kits/hub-game/code/client/attention.js +133 -0
- package/kits/hub-game/code/client/avatar.js +288 -0
- package/kits/hub-game/code/client/cabinets.js +90 -0
- package/kits/hub-game/code/client/chat.js +135 -0
- package/kits/hub-game/code/client/chrome.js +1001 -0
- package/kits/hub-game/code/client/doorFrame.js +15 -0
- package/kits/hub-game/code/client/firstJoin.js +14 -0
- package/kits/hub-game/code/client/grab.js +241 -0
- package/kits/hub-game/code/client/hookLayer.js +230 -0
- package/kits/hub-game/code/client/idle.js +326 -0
- package/kits/hub-game/code/client/keys.js +48 -0
- package/kits/hub-game/code/client/pack.js +232 -0
- package/kits/hub-game/code/client/packFormat.js +397 -0
- package/kits/hub-game/code/client/say.js +127 -0
- package/kits/hub-game/code/client/sha256.js +80 -0
- package/kits/hub-game/code/client/sound.js +147 -0
- package/kits/hub-game/code/client/state.js +131 -0
- package/kits/hub-game/code/client/talk.js +259 -0
- package/kits/hub-game/code/client/together.js +365 -0
- package/kits/hub-game/code/client/wear.js +149 -0
- package/kits/hub-game/code/server/actors.js +627 -0
- package/kits/hub-game/code/server/blocks.js +103 -0
- package/kits/hub-game/code/server/cabinets.js +309 -0
- package/kits/hub-game/code/server/game.js +137 -0
- package/kits/hub-game/code/server/grab.js +247 -0
- package/kits/hub-game/code/server/history.js +96 -0
- package/kits/hub-game/code/server/hub.js +1904 -0
- package/kits/hub-game/code/server/idle.js +412 -0
- package/kits/hub-game/code/server/index.js +64 -0
- package/kits/hub-game/code/server/labels.js +59 -0
- package/kits/hub-game/code/server/manifest.js +527 -0
- package/kits/hub-game/code/server/npcs.js +745 -0
- package/kits/hub-game/code/server/party.js +381 -0
- package/kits/hub-game/code/server/place.js +43 -0
- package/kits/hub-game/code/server/say.js +83 -0
- package/kits/hub-game/code/server/wear.js +142 -0
- package/kits/hub-game/code/systems/hub.js +2230 -0
- package/kits/hub-game/docs/content-pack.md +151 -0
- package/kits/hub-game/docs/contract.md +1139 -0
- package/kits/hub-game/docs/style.md +137 -0
- package/kits/hub-game/drawings/blocky/castle-eye.sprite +58 -0
- package/kits/hub-game/drawings/blocky/dash.sprite +59 -0
- package/kits/hub-game/drawings/blocky/pom.sprite +59 -0
- package/kits/hub-game/drawings/blocky/tabby.sprite +59 -0
- package/kits/hub-game/drawings/pixel/castle-arm.sprite +13 -0
- package/kits/hub-game/drawings/pixel/castle-body.sprite +23 -0
- package/kits/hub-game/drawings/pixel/castle-leg.sprite +12 -0
- package/kits/hub-game/drawings/pixel/kai-arm.sprite +14 -0
- package/kits/hub-game/drawings/pixel/kai-head.sprite +24 -0
- package/kits/hub-game/drawings/pixel/kai-leg.sprite +15 -0
- package/kits/hub-game/drawings/pixel/kai-torso.sprite +18 -0
- package/kits/hub-game/drawings/pixel/mimi-arm.sprite +13 -0
- package/kits/hub-game/drawings/pixel/mimi-head.sprite +23 -0
- package/kits/hub-game/drawings/pixel/mimi-leg.sprite +15 -0
- package/kits/hub-game/drawings/pixel/mimi-torso.sprite +18 -0
- package/kits/hub-game/drawings/pixel/nox-arm.sprite +13 -0
- package/kits/hub-game/drawings/pixel/nox-head.sprite +21 -0
- package/kits/hub-game/drawings/pixel/nox-leg.sprite +14 -0
- package/kits/hub-game/drawings/pixel/nox-torso.sprite +18 -0
- package/kits/hub-game/eslint.config.js +20 -0
- package/kits/hub-game/fonts.generated.js +9 -0
- package/kits/hub-game/index.html +22 -0
- package/kits/hub-game/main.jsx +6 -0
- package/kits/hub-game/models/avatar-0.pxmodel +21 -0
- package/kits/hub-game/models/avatar-1.pxmodel +24 -0
- package/kits/hub-game/models/avatar-2.pxmodel +27 -0
- package/kits/hub-game/models/avatar-3.pxmodel +22 -0
- package/kits/hub-game/models/bean/avatar-0.pxmodel +19 -0
- package/kits/hub-game/models/bean/avatar-1.pxmodel +24 -0
- package/kits/hub-game/models/bean/avatar-2.pxmodel +22 -0
- package/kits/hub-game/models/bean/avatar-3.pxmodel +24 -0
- package/kits/hub-game/models/blocky/avatar-0.pxmodel +21 -0
- package/kits/hub-game/models/blocky/avatar-1.pxmodel +30 -0
- package/kits/hub-game/models/blocky/avatar-2.pxmodel +28 -0
- package/kits/hub-game/models/blocky/avatar-3.pxmodel +27 -0
- package/kits/hub-game/models/pixel/avatar-0.pxmodel +24 -0
- package/kits/hub-game/models/pixel/avatar-1.pxmodel +16 -0
- package/kits/hub-game/models/pixel/avatar-2.pxmodel +19 -0
- package/kits/hub-game/models/pixel/avatar-3.pxmodel +23 -0
- package/kits/hub-game/package-lock.json +365 -0
- package/kits/hub-game/package.json +32 -0
- package/kits/hub-game/scenes/main.scene +318 -0
- package/kits/hub-game/scripts/check.mjs +339 -0
- package/kits/hub-game/scripts/fixtures/sdk-stub.mjs +3 -0
- package/kits/hub-game/scripts/gen-avatars-bean.mjs +748 -0
- package/kits/hub-game/scripts/gen-avatars-blocky.mjs +607 -0
- package/kits/hub-game/scripts/gen-avatars-pixel.mjs +771 -0
- package/kits/hub-game/scripts/gen-avatars.mjs +621 -0
- package/kits/hub-game/scripts/pack.mjs +192 -0
- package/kits/hub-game/scripts/test-actors.mjs +666 -0
- package/kits/hub-game/scripts/test-attention.mjs +103 -0
- package/kits/hub-game/scripts/test-avatar.mjs +472 -0
- package/kits/hub-game/scripts/test-ban-join.mjs +194 -0
- package/kits/hub-game/scripts/test-blocks.mjs +351 -0
- package/kits/hub-game/scripts/test-chat.mjs +98 -0
- package/kits/hub-game/scripts/test-classic.mjs +590 -0
- package/kits/hub-game/scripts/test-door-jump.mjs +131 -0
- package/kits/hub-game/scripts/test-door.mjs +56 -0
- package/kits/hub-game/scripts/test-grab.mjs +331 -0
- package/kits/hub-game/scripts/test-hub-ops.mjs +835 -0
- package/kits/hub-game/scripts/test-hub-trip.mjs +1310 -0
- package/kits/hub-game/scripts/test-idle.mjs +518 -0
- package/kits/hub-game/scripts/test-interest.mjs +413 -0
- package/kits/hub-game/scripts/test-keys.mjs +50 -0
- package/kits/hub-game/scripts/test-manifest.mjs +224 -0
- package/kits/hub-game/scripts/test-no-forms.mjs +16 -0
- package/kits/hub-game/scripts/test-npcs.mjs +714 -0
- package/kits/hub-game/scripts/test-pack.mjs +424 -0
- package/kits/hub-game/scripts/test-party.mjs +286 -0
- package/kits/hub-game/scripts/test-say.mjs +149 -0
- package/kits/hub-game/scripts/test-together.mjs +183 -0
- package/kits/hub-game/theme.style +3 -0
- package/kits/multiplayer-3d/castle.json +5 -5
- package/kits/multiplayer-3d/code/client/avatars.js +101 -1
- package/kits/multiplayer-3d/code/server/players.js +4 -1
- package/kits/multiplayer-3d/code/server/sceneBodies.js +27 -6
- package/kits/multiplayer-3d/code/server/world.js +20 -7
- package/kits/multiplayer-3d/code/systems/multiplayer.js +222 -11
- package/kits/physics-2d/castle.json +2 -2
- package/kits/physics-2d/engine/art.js +13 -0
- package/kits/physics-2d/engine/assets.js +4 -2
- package/kits/physics-2d/engine/scene.js +25 -5
- package/kits/physics-3d/CLAUDE.md +6 -1
- package/kits/physics-3d/castle.json +3 -3
- package/kits/physics-3d/engine3d/Scene3DPlayer.jsx +32 -4
- package/kits/physics-3d/engine3d/artobjects.js +2 -2
- package/kits/physics-3d/engine3d/materials.js +29 -1
- package/kits/physics-3d/engine3d/world3d.js +65 -1
- package/kits/physics-3d/systems/physics3d.js +5 -2
- package/kits/real-time/castle.json +2 -2
- package/kits/real-time/code/client/connection.js +77 -7
- package/kits/real-time/code/client/gameHooks.js +63 -3
- package/kits/real-time/code/client/messages.js +7 -0
- package/kits/real-time/code/server/gameHooks.js +24 -0
- package/kits/real-time/code/server/session.js +390 -22
- package/package.json +2 -2
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Avatar 1",
|
|
3
|
+
"actors": [
|
|
4
|
+
{
|
|
5
|
+
"components": {
|
|
6
|
+
"Transform": {
|
|
7
|
+
"y": 1
|
|
8
|
+
},
|
|
9
|
+
"Shape": {
|
|
10
|
+
"kind": "capsule",
|
|
11
|
+
"radius": 0.35,
|
|
12
|
+
"height": 1.4,
|
|
13
|
+
"color": "#7fc9b8",
|
|
14
|
+
"roughness": 0.4
|
|
15
|
+
},
|
|
16
|
+
"Body": {
|
|
17
|
+
"type": "kinematic",
|
|
18
|
+
"lockRotations": true
|
|
19
|
+
},
|
|
20
|
+
"Solid": {},
|
|
21
|
+
"Model": {
|
|
22
|
+
"file": "models/blocky/avatar-0.pxmodel",
|
|
23
|
+
"yOffset": -0.7
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Avatar 2",
|
|
3
|
+
"actors": [
|
|
4
|
+
{
|
|
5
|
+
"components": {
|
|
6
|
+
"Transform": {
|
|
7
|
+
"y": 1
|
|
8
|
+
},
|
|
9
|
+
"Shape": {
|
|
10
|
+
"kind": "capsule",
|
|
11
|
+
"radius": 0.35,
|
|
12
|
+
"height": 1.4,
|
|
13
|
+
"color": "#7fc9b8",
|
|
14
|
+
"roughness": 0.4
|
|
15
|
+
},
|
|
16
|
+
"Body": {
|
|
17
|
+
"type": "kinematic",
|
|
18
|
+
"lockRotations": true
|
|
19
|
+
},
|
|
20
|
+
"Solid": {},
|
|
21
|
+
"Model": {
|
|
22
|
+
"file": "models/blocky/avatar-1.pxmodel",
|
|
23
|
+
"yOffset": -0.7
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Avatar 3",
|
|
3
|
+
"actors": [
|
|
4
|
+
{
|
|
5
|
+
"components": {
|
|
6
|
+
"Transform": {
|
|
7
|
+
"y": 1
|
|
8
|
+
},
|
|
9
|
+
"Shape": {
|
|
10
|
+
"kind": "capsule",
|
|
11
|
+
"radius": 0.35,
|
|
12
|
+
"height": 1.4,
|
|
13
|
+
"color": "#7fc9b8",
|
|
14
|
+
"roughness": 0.4
|
|
15
|
+
},
|
|
16
|
+
"Body": {
|
|
17
|
+
"type": "kinematic",
|
|
18
|
+
"lockRotations": true
|
|
19
|
+
},
|
|
20
|
+
"Solid": {},
|
|
21
|
+
"Model": {
|
|
22
|
+
"file": "models/blocky/avatar-2.pxmodel",
|
|
23
|
+
"yOffset": -0.7
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Avatar 4",
|
|
3
|
+
"actors": [
|
|
4
|
+
{
|
|
5
|
+
"components": {
|
|
6
|
+
"Transform": {
|
|
7
|
+
"y": 1
|
|
8
|
+
},
|
|
9
|
+
"Shape": {
|
|
10
|
+
"kind": "capsule",
|
|
11
|
+
"radius": 0.35,
|
|
12
|
+
"height": 1.4,
|
|
13
|
+
"color": "#7fc9b8",
|
|
14
|
+
"roughness": 0.4
|
|
15
|
+
},
|
|
16
|
+
"Body": {
|
|
17
|
+
"type": "kinematic",
|
|
18
|
+
"lockRotations": true
|
|
19
|
+
},
|
|
20
|
+
"Solid": {},
|
|
21
|
+
"Model": {
|
|
22
|
+
"file": "models/blocky/avatar-3.pxmodel",
|
|
23
|
+
"yOffset": -0.7
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Avatar 1",
|
|
3
|
+
"actors": [
|
|
4
|
+
{
|
|
5
|
+
"components": {
|
|
6
|
+
"Transform": {
|
|
7
|
+
"y": 1
|
|
8
|
+
},
|
|
9
|
+
"Shape": {
|
|
10
|
+
"kind": "capsule",
|
|
11
|
+
"radius": 0.35,
|
|
12
|
+
"height": 1.4,
|
|
13
|
+
"color": "#7fc9b8",
|
|
14
|
+
"roughness": 0.4
|
|
15
|
+
},
|
|
16
|
+
"Body": {
|
|
17
|
+
"type": "kinematic",
|
|
18
|
+
"lockRotations": true
|
|
19
|
+
},
|
|
20
|
+
"Solid": {},
|
|
21
|
+
"Model": {
|
|
22
|
+
"file": "models/pixel/avatar-0.pxmodel",
|
|
23
|
+
"yOffset": -0.7
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Avatar 2",
|
|
3
|
+
"actors": [
|
|
4
|
+
{
|
|
5
|
+
"components": {
|
|
6
|
+
"Transform": {
|
|
7
|
+
"y": 1
|
|
8
|
+
},
|
|
9
|
+
"Shape": {
|
|
10
|
+
"kind": "capsule",
|
|
11
|
+
"radius": 0.35,
|
|
12
|
+
"height": 1.4,
|
|
13
|
+
"color": "#7fc9b8",
|
|
14
|
+
"roughness": 0.4
|
|
15
|
+
},
|
|
16
|
+
"Body": {
|
|
17
|
+
"type": "kinematic",
|
|
18
|
+
"lockRotations": true
|
|
19
|
+
},
|
|
20
|
+
"Solid": {},
|
|
21
|
+
"Model": {
|
|
22
|
+
"file": "models/pixel/avatar-1.pxmodel",
|
|
23
|
+
"yOffset": -0.7
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Avatar 3",
|
|
3
|
+
"actors": [
|
|
4
|
+
{
|
|
5
|
+
"components": {
|
|
6
|
+
"Transform": {
|
|
7
|
+
"y": 1
|
|
8
|
+
},
|
|
9
|
+
"Shape": {
|
|
10
|
+
"kind": "capsule",
|
|
11
|
+
"radius": 0.35,
|
|
12
|
+
"height": 1.4,
|
|
13
|
+
"color": "#7fc9b8",
|
|
14
|
+
"roughness": 0.4
|
|
15
|
+
},
|
|
16
|
+
"Body": {
|
|
17
|
+
"type": "kinematic",
|
|
18
|
+
"lockRotations": true
|
|
19
|
+
},
|
|
20
|
+
"Solid": {},
|
|
21
|
+
"Model": {
|
|
22
|
+
"file": "models/pixel/avatar-2.pxmodel",
|
|
23
|
+
"yOffset": -0.7
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Avatar 4",
|
|
3
|
+
"actors": [
|
|
4
|
+
{
|
|
5
|
+
"components": {
|
|
6
|
+
"Transform": {
|
|
7
|
+
"y": 1
|
|
8
|
+
},
|
|
9
|
+
"Shape": {
|
|
10
|
+
"kind": "capsule",
|
|
11
|
+
"radius": 0.35,
|
|
12
|
+
"height": 1.4,
|
|
13
|
+
"color": "#7fc9b8",
|
|
14
|
+
"roughness": 0.4
|
|
15
|
+
},
|
|
16
|
+
"Body": {
|
|
17
|
+
"type": "kinematic",
|
|
18
|
+
"lockRotations": true
|
|
19
|
+
},
|
|
20
|
+
"Solid": {},
|
|
21
|
+
"Model": {
|
|
22
|
+
"file": "models/pixel/avatar-3.pxmodel",
|
|
23
|
+
"yOffset": -0.7
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "hub-game",
|
|
3
|
+
"editor": {
|
|
4
|
+
"defaultPlayFile": "scenes/main.scene"
|
|
5
|
+
},
|
|
6
|
+
"imports": {
|
|
7
|
+
"castle.multiplayer-3d": {
|
|
8
|
+
"deckId": "ZwA_P_-VO-Qh",
|
|
9
|
+
"version": "2026-10-03T13:23:59.648Z"
|
|
10
|
+
},
|
|
11
|
+
"castle.real-time": {
|
|
12
|
+
"deckId": "xFVr-afOLuUQ",
|
|
13
|
+
"version": "2026-10-03T15:40:59.728Z"
|
|
14
|
+
},
|
|
15
|
+
"castle.physics-3d": {
|
|
16
|
+
"deckId": "JH0SclbPVP0y",
|
|
17
|
+
"version": "2026-10-03T09:17:32.572Z",
|
|
18
|
+
"via": "castle.multiplayer-3d"
|
|
19
|
+
},
|
|
20
|
+
"castle.physics-2d": {
|
|
21
|
+
"deckId": "ckRZGFW4iPrx",
|
|
22
|
+
"version": "2026-10-03T04:25:18.207Z",
|
|
23
|
+
"via": "castle.multiplayer-3d"
|
|
24
|
+
},
|
|
25
|
+
"castle.base": {
|
|
26
|
+
"deckId": "yRcmH4_aYllE",
|
|
27
|
+
"version": "2026-10-03T13:06:34.897Z"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"autoUpdateWhenImported": true,
|
|
31
|
+
"main": "main.jsx",
|
|
32
|
+
"server": {
|
|
33
|
+
"main": "code/server/index.js",
|
|
34
|
+
"tickRate": 30,
|
|
35
|
+
"maxPlayers": 8
|
|
36
|
+
},
|
|
37
|
+
"hub": {
|
|
38
|
+
"contract": 1,
|
|
39
|
+
"title": "Flag Dash",
|
|
40
|
+
"minPlayers": 1,
|
|
41
|
+
"maxPlayers": 8,
|
|
42
|
+
"lateJoin": true,
|
|
43
|
+
"maxDurationSec": 180,
|
|
44
|
+
"controller": "walk",
|
|
45
|
+
"arrival": {
|
|
46
|
+
"actor": "arrival",
|
|
47
|
+
"spread": 1.4,
|
|
48
|
+
"face": "actor"
|
|
49
|
+
},
|
|
50
|
+
"result": {
|
|
51
|
+
"outcomes": [
|
|
52
|
+
"win",
|
|
53
|
+
"lose"
|
|
54
|
+
],
|
|
55
|
+
"score": {
|
|
56
|
+
"unit": "ms",
|
|
57
|
+
"better": "lower",
|
|
58
|
+
"min": 0,
|
|
59
|
+
"max": 600000
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
"starterFiles": [
|
|
64
|
+
"code/server/game.js"
|
|
65
|
+
],
|
|
66
|
+
"starterConfig": {
|
|
67
|
+
"hub": {
|
|
68
|
+
"contract": 1,
|
|
69
|
+
"title": "Flag Dash",
|
|
70
|
+
"minPlayers": 1,
|
|
71
|
+
"maxPlayers": 8,
|
|
72
|
+
"lateJoin": true,
|
|
73
|
+
"maxDurationSec": 180,
|
|
74
|
+
"controller": "walk",
|
|
75
|
+
"arrival": {
|
|
76
|
+
"actor": "arrival",
|
|
77
|
+
"spread": 1.4,
|
|
78
|
+
"face": "actor"
|
|
79
|
+
},
|
|
80
|
+
"result": {
|
|
81
|
+
"outcomes": [
|
|
82
|
+
"win",
|
|
83
|
+
"lose"
|
|
84
|
+
],
|
|
85
|
+
"score": {
|
|
86
|
+
"unit": "ms",
|
|
87
|
+
"better": "lower",
|
|
88
|
+
"min": 0,
|
|
89
|
+
"max": 600000
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
"onCheck": "scripts/check.mjs",
|
|
95
|
+
"onPack": "scripts/pack.mjs"
|
|
96
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
// Words earned by attention, in a place that is not a game (a town). A town
|
|
2
|
+
// labels everything it has -- every statue's plate, every board, every pad's
|
|
3
|
+
// count, every NPC's call -- and drawn at once from the arrival spot that was
|
|
4
|
+
// a wall of fifteen labels. So in a town the player sees the plate of the one
|
|
5
|
+
// thing they stand by, the line of the one NPC nearest them, and the names of
|
|
6
|
+
// the people around them; the rest wait until they walk over. A game place
|
|
7
|
+
// keeps every label it sets: its labels are its rules (the hill's king, a
|
|
8
|
+
// plate's count), and nobody stands still in a game to read them.
|
|
9
|
+
|
|
10
|
+
// A plate (a statue's, a board's, a pad's count) shows within this of the player.
|
|
11
|
+
export const PLATE_NEAR_M = 4;
|
|
12
|
+
// An NPC's line carries further: it is how the NPC calls a player over.
|
|
13
|
+
export const SPEECH_NEAR_M = 9;
|
|
14
|
+
// Other players' names show within this, smaller than in a game.
|
|
15
|
+
export const NAME_NEAR_M = 12;
|
|
16
|
+
export const NAME_SCALE = 0.75;
|
|
17
|
+
// Past the radius a label fades over this much more distance, not at once.
|
|
18
|
+
const NAME_FADE_M = 2;
|
|
19
|
+
// A label coming or going fades over this long.
|
|
20
|
+
const FADE_MS = 250;
|
|
21
|
+
// The plate shown changes to a nearer one only when that one is nearer by
|
|
22
|
+
// this much, so standing between two statues does not flicker.
|
|
23
|
+
const SWITCH_M = 0.75;
|
|
24
|
+
|
|
25
|
+
export function makeAttention() {
|
|
26
|
+
return { alpha: new Map(), plate: null, speech: null, at: 0 };
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// `candidates` is every label the place has up: `{ id, d, speech }`, `d` its
|
|
30
|
+
// actor's distance from the player on the ground. Returns the ones to draw,
|
|
31
|
+
// id -> opacity: the nearest plate and the nearest line, fading in and out.
|
|
32
|
+
export function attend(a, candidates, now) {
|
|
33
|
+
const dt = a.at ? Math.min(100, Math.max(0, now - a.at)) : FADE_MS;
|
|
34
|
+
a.at = now;
|
|
35
|
+
a.plate = pick(
|
|
36
|
+
candidates.filter((c) => !c.speech),
|
|
37
|
+
a.plate,
|
|
38
|
+
PLATE_NEAR_M,
|
|
39
|
+
);
|
|
40
|
+
a.speech = pick(
|
|
41
|
+
candidates.filter((c) => c.speech),
|
|
42
|
+
a.speech,
|
|
43
|
+
SPEECH_NEAR_M,
|
|
44
|
+
);
|
|
45
|
+
const shown = new Map();
|
|
46
|
+
const live = new Set();
|
|
47
|
+
for (const c of candidates) {
|
|
48
|
+
live.add(c.id);
|
|
49
|
+
const target = c.id === a.plate || c.id === a.speech ? 1 : 0;
|
|
50
|
+
const was = a.alpha.get(c.id) ?? 0;
|
|
51
|
+
const step = dt / FADE_MS;
|
|
52
|
+
const alpha = target > was ? Math.min(target, was + step) : Math.max(target, was - step);
|
|
53
|
+
if (alpha > 0) {
|
|
54
|
+
a.alpha.set(c.id, alpha);
|
|
55
|
+
shown.set(c.id, alpha);
|
|
56
|
+
} else {
|
|
57
|
+
a.alpha.delete(c.id);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// A label the place cleared is gone at once, and forgotten.
|
|
61
|
+
for (const id of a.alpha.keys()) {
|
|
62
|
+
if (!live.has(id)) {
|
|
63
|
+
a.alpha.delete(id);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return shown;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// The nearest within `near`, keeping `current` unless another is clearly nearer.
|
|
70
|
+
function pick(list, current, near) {
|
|
71
|
+
let best = null;
|
|
72
|
+
let mine = null;
|
|
73
|
+
for (const c of list) {
|
|
74
|
+
if (c.d > near) {
|
|
75
|
+
continue;
|
|
76
|
+
}
|
|
77
|
+
if (!best || c.d < best.d) {
|
|
78
|
+
best = c;
|
|
79
|
+
}
|
|
80
|
+
if (c.id === current) {
|
|
81
|
+
mine = c;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (mine && best && best.d > mine.d - SWITCH_M) {
|
|
85
|
+
return mine.id;
|
|
86
|
+
}
|
|
87
|
+
return best?.id ?? null;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// How a name `d` metres from the player is drawn in a town: 1 inside the
|
|
91
|
+
// radius, fading to 0 over the next NAME_FADE_M.
|
|
92
|
+
export function nameOpacity(d) {
|
|
93
|
+
return Math.max(0, Math.min(1, (NAME_NEAR_M + NAME_FADE_M - d) / NAME_FADE_M));
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Other players' name tags (multiplayer-3d's sprites, `mp.avatars.tags`) in a
|
|
97
|
+
// town: smaller, and only those near the player. Run after the multiplayer kit
|
|
98
|
+
// has placed and sized them this frame. `touched` (a WeakMap) remembers each
|
|
99
|
+
// tag changed, the size the multiplayer kit gave it and the width it was
|
|
100
|
+
// shrunk to, so a tag the multiplayer kit did not resize this frame is not
|
|
101
|
+
// shrunk twice, and leaving the town puts it back as the multiplayer kit
|
|
102
|
+
// drew it.
|
|
103
|
+
export function fadeNames(mp, from, town, touched) {
|
|
104
|
+
for (const [key, tag] of mp?.avatars?.tags ?? []) {
|
|
105
|
+
const sprite = tag?.sprite;
|
|
106
|
+
if (!sprite) {
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
if (!town || !from) {
|
|
110
|
+
const was = touched.get(tag);
|
|
111
|
+
if (was) {
|
|
112
|
+
touched.delete(tag);
|
|
113
|
+
sprite.visible = true;
|
|
114
|
+
sprite.material.opacity = 1;
|
|
115
|
+
if (sprite.scale.x === was.shrunk) {
|
|
116
|
+
sprite.scale.x = was.x;
|
|
117
|
+
sprite.scale.y = was.y;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
const d = key === 'self' ? 0 : Math.hypot(sprite.position.x - from.x, sprite.position.z - from.z);
|
|
123
|
+
const opacity = nameOpacity(d);
|
|
124
|
+
sprite.visible = opacity > 0;
|
|
125
|
+
sprite.material.opacity = opacity;
|
|
126
|
+
if (touched.get(tag)?.shrunk !== sprite.scale.x) {
|
|
127
|
+
const { x, y } = sprite.scale;
|
|
128
|
+
sprite.scale.x = x * NAME_SCALE;
|
|
129
|
+
sprite.scale.y = y * NAME_SCALE;
|
|
130
|
+
touched.set(tag, { x, y, shrunk: sprite.scale.x });
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|