castle-web-cli 0.4.159 → 0.4.160
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/init.js +24 -10
- package/kits/base/castle.json +1 -1
- package/kits/multiplayer-2d/CLAUDE.md +41 -0
- package/kits/multiplayer-2d/castle.json +1 -1
- package/kits/multiplayer-3d/CLAUDE.md +53 -11
- package/kits/multiplayer-3d/castle.json +1 -1
- package/kits/physics-2d/castle.json +1 -1
- package/kits/physics-3d/castle.json +1 -1
- package/kits/real-time/CLAUDE.md +15 -0
- package/kits/real-time/castle.json +1 -1
- package/kits/turn-based/CLAUDE.md +57 -27
- package/kits/turn-based/castle.json +1 -1
- package/package.json +1 -1
package/dist/init.js
CHANGED
|
@@ -5,7 +5,7 @@ import { installDeps } from './install.js';
|
|
|
5
5
|
import { deckMainFile, deckStarterScene, STARTER_STYLE_FILES } from './castleJson.js';
|
|
6
6
|
import { addImportTo, IMPORTS_DIR, lockImportTree, restoreMissingImports, syncImportDependencies, } from './imports.js';
|
|
7
7
|
import { discardParentSource, fetchParentSource, unpackParentSource, writeRemixIdentity, } from './remix.js';
|
|
8
|
-
import { getCliEntryPath, getKitsDir, getSdkPackagePath, toPosixPath
|
|
8
|
+
import { getCliEntryPath, getKitsDir, getSdkPackagePath, toPosixPath } from './localPaths.js';
|
|
9
9
|
import { serve } from './serve.js';
|
|
10
10
|
import { createVersion } from './versions.js';
|
|
11
11
|
// Default kit imported by `init` when no --kit is given. `none`/`bare` skips the
|
|
@@ -357,15 +357,29 @@ Do not edit anything under \`${IMPORTS_DIR}/\`: those files belong to the deck t
|
|
|
357
357
|
came from, and are replaced wholesale when the import is updated.
|
|
358
358
|
`;
|
|
359
359
|
}
|
|
360
|
-
|
|
360
|
+
// Whether the scaffolded deck runs a server, read back from the copied import so
|
|
361
|
+
// that adopting a kit later describes the deck the same way scaffolding from it
|
|
362
|
+
// does.
|
|
363
|
+
function kitShipsServer(deckDir, alias) {
|
|
364
|
+
const config = readJsonFile(path.join(deckDir, IMPORTS_DIR, alias, 'castle.json')) ?? {};
|
|
365
|
+
return !!config.server;
|
|
366
|
+
}
|
|
367
|
+
function makeImportedKitClaudeMd(alias, hasServer) {
|
|
368
|
+
const server = hasServer
|
|
369
|
+
? `
|
|
370
|
+
This deck has a server. \`castle.json\`'s \`server.main\` points at the kit's, which
|
|
371
|
+
runs in the session process and decides what is true for everyone playing
|
|
372
|
+
together. The kit's guide says what a deck adds to it, and when to write its own
|
|
373
|
+
instead.
|
|
374
|
+
`
|
|
375
|
+
: '';
|
|
361
376
|
return `# Castle deck
|
|
362
377
|
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
378
|
+
This deck is built on the **${alias}** kit, imported at \`${IMPORTS_DIR}/${alias}/\`
|
|
379
|
+
and read-only. Read \`${IMPORTS_DIR}/${alias}/CLAUDE.md\` first: it is the authoring
|
|
380
|
+
guide, and it says what this kit adds over the kits imported beside it. The Castle
|
|
381
|
+
SDK and the rules every deck shares come from \`${BASE_ALIAS}\`.
|
|
382
|
+
${server}
|
|
369
383
|
This deck holds only its own content -- \`scenes/\`, \`drawings/\`,
|
|
370
384
|
\`blueprints/\`, \`behaviors/\` -- plus \`index.html\` (which points at the kit's
|
|
371
385
|
entry point) and \`castle.json\` (editor config and the import pin).
|
|
@@ -391,7 +405,7 @@ export function retargetBareClaudeMd(deckDir, alias) {
|
|
|
391
405
|
catch {
|
|
392
406
|
return;
|
|
393
407
|
}
|
|
394
|
-
fs.writeFileSync(claudePath, makeImportedKitClaudeMd(alias));
|
|
408
|
+
fs.writeFileSync(claudePath, makeImportedKitClaudeMd(alias, kitShipsServer(deckDir, alias)));
|
|
395
409
|
appendPlatformSection(deckDir);
|
|
396
410
|
}
|
|
397
411
|
// How the deck names the kit it was built on. `scripts/publish-kits.mjs` stamps
|
|
@@ -540,7 +554,7 @@ function scaffoldFromKitImport(kit, projectDir) {
|
|
|
540
554
|
scripts: makeKitDeckScripts(kitDir, alias, cliCommand),
|
|
541
555
|
dependencies,
|
|
542
556
|
});
|
|
543
|
-
fs.writeFileSync(path.join(projectDir, 'CLAUDE.md'), makeImportedKitClaudeMd(alias));
|
|
557
|
+
fs.writeFileSync(path.join(projectDir, 'CLAUDE.md'), makeImportedKitClaudeMd(alias, !!kitConfig.server));
|
|
544
558
|
appendPlatformSection(projectDir);
|
|
545
559
|
ensureAgentsSymlink(projectDir);
|
|
546
560
|
for (const importedAlias of copied.keys()) {
|
package/kits/base/castle.json
CHANGED
|
@@ -17,6 +17,47 @@ renderer, the editors, and the behaviors (`Layout`, `Collider`, `RigidBody`,
|
|
|
17
17
|
the site: `import * as Smoothing from '@imports/castle.real-time/code/client/smooth.js'`,
|
|
18
18
|
then `Smoothing.smooth(…)`. File names stay lowercase.
|
|
19
19
|
|
|
20
|
+
## Quick reference
|
|
21
|
+
|
|
22
|
+
<!-- Injected into Castle's create assistant every turn; keep this compact and factual. -->
|
|
23
|
+
|
|
24
|
+
- Real-time multiplayer over the physics-2d engine: everyone in a session sees
|
|
25
|
+
the same matter world. The scene, blueprints, drawings, behaviors and editors
|
|
26
|
+
are all physics-2d's and work as that kit's CLAUDE.md describes; this kit adds
|
|
27
|
+
the network.
|
|
28
|
+
- **The server is authoritative and already written.** `castle.json` points
|
|
29
|
+
`server.main` at `imports/castle.multiplayer-2d/code/server/index.js`, which
|
|
30
|
+
builds a matter world from the deck's own `scenes/main.scene` and steps it at
|
|
31
|
+
`tickRate` (30). Never fork it.
|
|
32
|
+
- **A game is added as hooks, not by replacing anything.** Write
|
|
33
|
+
`code/server/game.js` with a default export of up to six functions --
|
|
34
|
+
`ready(sim)`, `message(session, player, data)`, `place(sim, handovers)`,
|
|
35
|
+
`step(sim, handovers)`, `join(sim)`, `delta(sim)` -- and it is found by glob.
|
|
36
|
+
`code/client/game.js` is the browser half. Both optional.
|
|
37
|
+
- `place` runs BEFORE the physics step; a write that only reaches a body at the
|
|
38
|
+
next step belongs there. `delta` returning news is its own reason to broadcast,
|
|
39
|
+
so a tick where nothing moved but a round ended still reaches players.
|
|
40
|
+
- **Players appear by themselves.** Each other player is spawned from the deck's
|
|
41
|
+
`blueprints/other-player.scene`; the local one is the `Player` behavior. Ship
|
|
42
|
+
that blueprint and there is nothing to wire.
|
|
43
|
+
- **One client owns a moving object at a time.** A client near a crate claims it,
|
|
44
|
+
the server grants it, and that client simulates and reports it while everyone
|
|
45
|
+
else interpolates -- which is what makes a push feel immediate to the person
|
|
46
|
+
pushing. Ownership is asked for by proximity, never assigned by the deck.
|
|
47
|
+
- A pose is card pixels and radians: `[x, y, angle]` for an object,
|
|
48
|
+
`[x, y, facing, clamped]` for a player, measured from the Layout box's
|
|
49
|
+
top-left. `code/client/poses.js` is where that is written down.
|
|
50
|
+
- **The server refuses a move that travelled too far** and sends back a clamped
|
|
51
|
+
pose; that returned pose is the only thing that moves the local character
|
|
52
|
+
against its own simulation. Don't design around trusting the client.
|
|
53
|
+
- Messages a deck sends are the deck's own shape -- there is no envelope here.
|
|
54
|
+
Identity comes from `player.playerId` / `player.userId`, never from a body.
|
|
55
|
+
- The kit ships `code/systems/multiplayer.js`, the frame loop. A deck that writes
|
|
56
|
+
its own file of that path gets its own instead; most decks should not.
|
|
57
|
+
- Two players is the test that matters: `castle-web serve`, then the play URL in
|
|
58
|
+
two tabs. The session process holds the room, so restart the serve for a fresh
|
|
59
|
+
one.
|
|
60
|
+
|
|
20
61
|
## Layout
|
|
21
62
|
|
|
22
63
|
```
|
|
@@ -14,14 +14,14 @@ caller that wants the clock, the transport, the tracks, the smoothing, the
|
|
|
14
14
|
ownership rule, the wire kinds, the deck hooks or the block latches imports them
|
|
15
15
|
from `@imports/castle.real-time/code/...`.
|
|
16
16
|
|
|
17
|
-
| here
|
|
18
|
-
|
|
|
19
|
-
| `client/poses.js`
|
|
20
|
-
| `client/avatars.js`, `nameTags.js`
|
|
21
|
-
| `systems/multiplayer.js`
|
|
22
|
-
| `server/index.js`
|
|
23
|
-
| `server/limits.js`
|
|
24
|
-
| `server/world.js`, `ownership.js`, `players.js`, `sceneBodies.js` | the rapier world
|
|
17
|
+
| here | what it is |
|
|
18
|
+
| ----------------------------------------------------------------- | ------------------------------------------------------- |
|
|
19
|
+
| `client/poses.js` | the pose codec the core calls back into, and the metres |
|
|
20
|
+
| `client/avatars.js`, `nameTags.js` | other players' actors and their three.js labels |
|
|
21
|
+
| `systems/multiplayer.js` | the frame loop, wiring the core to the engine |
|
|
22
|
+
| `server/index.js` | `makeSession` with this kit's world, players, ownership |
|
|
23
|
+
| `server/limits.js` | the metres and the tests over them |
|
|
24
|
+
| `server/world.js`, `ownership.js`, `players.js`, `sceneBodies.js` | the rapier world |
|
|
25
25
|
|
|
26
26
|
The move report carries `[x, y, z, facing]` in `p`, with no separate `f` field:
|
|
27
27
|
the transport sends one packed array and never looks inside it. A deck that
|
|
@@ -38,6 +38,49 @@ The kit has no behaviors and no `behaviors/` directory; when a file here names
|
|
|
38
38
|
the site: `import * as Smoothing from './smooth.js'`, then `Smoothing.smooth(…)`.
|
|
39
39
|
File names stay lowercase.
|
|
40
40
|
|
|
41
|
+
## Quick reference
|
|
42
|
+
|
|
43
|
+
<!-- Injected into Castle's create assistant every turn; keep this compact and factual. -->
|
|
44
|
+
|
|
45
|
+
- Real-time multiplayer over the physics-3d engine: everyone in a session shares
|
|
46
|
+
one rapier world. Scenes, blueprints, models, behaviors and editors are all
|
|
47
|
+
physics-3d's and work as that kit's CLAUDE.md describes; this kit adds the
|
|
48
|
+
network.
|
|
49
|
+
- **The server is authoritative and already written.** `castle.json` points
|
|
50
|
+
`server.main` at `imports/castle.multiplayer-3d/code/server/index.js`, which
|
|
51
|
+
builds a rapier world from the deck's own `scenes/main.scene` and steps it at
|
|
52
|
+
`tickRate` (30). Never fork it.
|
|
53
|
+
- **A game is added as hooks, not by replacing anything.** Write
|
|
54
|
+
`code/server/game.js` with a default export of up to six functions --
|
|
55
|
+
`ready(sim)`, `message(session, player, data)`, `place(sim, handovers)`,
|
|
56
|
+
`step(sim, handovers)`, `join(sim)`, `delta(sim)` -- and it is found by glob.
|
|
57
|
+
Optional, as is `code/server/deckComponents.js` for component defaults.
|
|
58
|
+
- `place` runs BEFORE the physics step, which is where a write through a deferred
|
|
59
|
+
channel (`player.at`, `setNextKinematicTranslation`) has to happen to reach the
|
|
60
|
+
body this tick. `message` is dispatched before the world exists, so a lobby
|
|
61
|
+
handshake never waits on it.
|
|
62
|
+
- **Players appear by themselves.** Each other player is spawned from the deck's
|
|
63
|
+
`blueprints/other-player.scene` and carries a name tag that holds a constant
|
|
64
|
+
screen size; the local one is the engine's `Player` behavior. Ship that
|
|
65
|
+
blueprint and there is nothing to wire.
|
|
66
|
+
- **One client owns a moving object at a time.** A client near an object claims
|
|
67
|
+
it, the server grants it, and that client simulates and reports it while
|
|
68
|
+
everyone else interpolates. Ownership is asked for by proximity, never assigned
|
|
69
|
+
by the deck.
|
|
70
|
+
- A pose is metres and radians: `[x, y, z, facing]`, packed as one array the
|
|
71
|
+
transport never looks inside. `code/client/poses.js` is where that is written
|
|
72
|
+
down.
|
|
73
|
+
- **The server refuses a move that travelled too far** and sends back a clamped
|
|
74
|
+
pose; that returned pose is the only thing that moves the local character
|
|
75
|
+
against its own simulation. Don't design around trusting the client.
|
|
76
|
+
- Messages a deck sends are the deck's own shape -- there is no envelope here.
|
|
77
|
+
Identity comes from `player.playerId` / `player.userId`, never from a body.
|
|
78
|
+
- The kit ships `code/systems/multiplayer.js`, the frame loop. A deck that writes
|
|
79
|
+
its own file of that path gets its own instead; most decks should not.
|
|
80
|
+
- Two players is the test that matters: `castle-web serve`, then the play URL in
|
|
81
|
+
two tabs. The session process holds the room, so restart the serve for a fresh
|
|
82
|
+
one.
|
|
83
|
+
|
|
41
84
|
## Layout
|
|
42
85
|
|
|
43
86
|
```
|
|
@@ -58,9 +101,8 @@ because only the browser reads it.
|
|
|
58
101
|
"server": { "main": "imports/castle.multiplayer-3d/code/server/index.js" }
|
|
59
102
|
```
|
|
60
103
|
|
|
61
|
-
and then
|
|
62
|
-
|
|
63
|
-
glob in `code/server/gameHooks.js`:
|
|
104
|
+
and then, all optional, all found by root-anchored glob in
|
|
105
|
+
`code/server/gameHooks.js`:
|
|
64
106
|
|
|
65
107
|
| deck file | what it is |
|
|
66
108
|
| ------------------------------- | --------------------------------------------------- |
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"autoUpdateWhenImported": true,
|
|
34
34
|
"deckId": "ZwA_P_-VO-Qh",
|
|
35
35
|
"cardId": "bvRmCzyUpt_a",
|
|
36
|
-
"publishedVersion": "2026-09-
|
|
36
|
+
"publishedVersion": "2026-09-02T05:55:13.845Z",
|
|
37
37
|
"main": "main.jsx",
|
|
38
38
|
"server": {
|
|
39
39
|
"main": "code/server/index.js",
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
"main": "main.jsx",
|
|
133
133
|
"autoUpdateWhenImported": true,
|
|
134
134
|
"title": "physics-2d",
|
|
135
|
-
"publishedVersion": "2026-09-
|
|
135
|
+
"publishedVersion": "2026-09-02T05:55:15.826Z",
|
|
136
136
|
"imports": {
|
|
137
137
|
"castle.base": {
|
|
138
138
|
"deckId": "yRcmH4_aYllE",
|
package/kits/real-time/CLAUDE.md
CHANGED
|
@@ -9,6 +9,21 @@ Two kits sit on it -- `castle.multiplayer-2d` (matter) and
|
|
|
9
9
|
dimensions. A deck imports one of those for the physics and the actors, and
|
|
10
10
|
imports these modules from here directly.
|
|
11
11
|
|
|
12
|
+
## Quick reference
|
|
13
|
+
|
|
14
|
+
<!-- Injected into Castle's create assistant every turn; keep this compact and factual. -->
|
|
15
|
+
|
|
16
|
+
- The shared half of `castle.multiplayer-2d` and `castle.multiplayer-3d`: the
|
|
17
|
+
clock, the transport, the pose tracks, the smoothing, the ownership rule and
|
|
18
|
+
the session process. It is imported because one of those kits is, not on its
|
|
19
|
+
own.
|
|
20
|
+
- **A deck normally writes nothing against it.** The multiplayer kit it came with
|
|
21
|
+
already drives all of this; a deck's own code goes in `code/server/game.js` and
|
|
22
|
+
`code/client/game.js`, which that kit documents.
|
|
23
|
+
- A pose is an opaque array of numbers here, so anything reading inside one takes
|
|
24
|
+
the kit's `code/client/poses.js` as an argument. That is the seam to use when
|
|
25
|
+
something genuinely needs a lower level.
|
|
26
|
+
|
|
12
27
|
## Layout
|
|
13
28
|
|
|
14
29
|
```
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
# turn-based kit
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
anybody
|
|
3
|
+
Multiplayer where players take turns: the **room** they play in -- seats,
|
|
4
|
+
spectators, reconnect, and when state left in a session stops belonging to
|
|
5
|
+
anybody -- plus a small game already playing in it, for a deck to edit or throw
|
|
6
|
+
away. The room knows no rule of any game.
|
|
6
7
|
|
|
7
8
|
Built ON TOP of the `physics-2d` kit as an import, the way `physics-3d` is: the
|
|
8
9
|
engine, scenes, blueprints, drawings, behaviors and editors all come from
|
|
9
10
|
`imports/castle.physics-2d/` and work exactly as that kit's CLAUDE.md describes.
|
|
10
|
-
This kit adds no engine
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
- `
|
|
11
|
+
This kit adds no engine and no editors. What it holds:
|
|
12
|
+
|
|
13
|
+
- `room.js` -- the room, and the clock it reads. The part a deck keeps.
|
|
14
|
+
- `code/server/index.js` -- the starter game: two seats claim squares on a
|
|
15
|
+
4x4 board, and the fuller board wins. Rules, not bookkeeping, so a deck
|
|
16
|
+
rewrites this.
|
|
17
|
+
- `code/behaviors/Board.jsx`, `Square.jsx`, `scenes/main.scene`,
|
|
18
|
+
`blueprints/`, `drawings/square.sprite` -- that game's client half.
|
|
14
19
|
- `testing.js` -- a `MultiplayerServerSession` double, a movable clock, the room
|
|
15
20
|
conformance suite, and the node resolver hook that lets a plain test script
|
|
16
21
|
import a deck module written with `@imports/`.
|
|
@@ -19,10 +24,19 @@ code:
|
|
|
19
24
|
|
|
20
25
|
<!-- Injected into Castle's create assistant every turn; keep this compact and factual. -->
|
|
21
26
|
|
|
22
|
-
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
- **Turn-based multiplayer: the server decides, and one player moves at a time.**
|
|
28
|
+
The scene, blueprints, drawings, behaviors and editors are physics-2d's and
|
|
29
|
+
work as that kit's CLAUDE.md describes; this kit adds the room and a starter
|
|
30
|
+
game to change.
|
|
31
|
+
- **A scaffolded deck is already a playable game.** `castle.json` points
|
|
32
|
+
`server.main` at `imports/castle.turn-based/code/server/index.js` -- two seats
|
|
33
|
+
claiming squares -- and `scenes/main.scene` is its board. Play it in two tabs
|
|
34
|
+
before changing anything.
|
|
35
|
+
- **Making a different game means writing the server.** Add `server/index.js` to
|
|
36
|
+
the deck, point `server.main` at it, and keep the room:
|
|
37
|
+
`createRoom({ seats, idleMs, graceMs })` from
|
|
38
|
+
`@imports/castle.turn-based/room.js`. Copy the kit's server as the starting
|
|
39
|
+
point -- it is the shape a game of this kind has.
|
|
26
40
|
- `room.join(session, player)` and `room.leave(session, player)` both return
|
|
27
41
|
`{ table }`. One table per `session.sessionId`, made on demand.
|
|
28
42
|
- **The deck owns its game.** `table.game` starts null and a clear puts it back
|
|
@@ -30,6 +44,9 @@ code:
|
|
|
30
44
|
The kit never builds or reads it.
|
|
31
45
|
- The table also carries `seatOf(playerId)`, `playerAt(seat)`, `seatNames()`,
|
|
32
46
|
`spectatorCount(session)` and `keepAlive()`.
|
|
47
|
+
- **The seat decides what a message may do, not the message.** Identity is
|
|
48
|
+
`player.playerId` / `player.userId`; a body that names its own seat is a body
|
|
49
|
+
claiming to be someone.
|
|
33
50
|
- `table.keepAlive()` stamps the idle clock and must be called ONLY past every
|
|
34
51
|
rejection -- a refused message is not a sign of life.
|
|
35
52
|
- **A leave never clears the game.** The kit releases the seat, remembers the
|
|
@@ -43,6 +60,8 @@ code:
|
|
|
43
60
|
whatever the deck attached to that seat. State only one person may see -- a
|
|
44
61
|
hand of cards, a hidden role -- must be keyed by the `playerId` it was dealt
|
|
45
62
|
to, never by the seat id.
|
|
63
|
+
- Send each player their own view: the starter's `stateFor` builds the public
|
|
64
|
+
board once and varies only `you`, which is the seat that recipient holds.
|
|
46
65
|
- Test it with `checkRoom({...})` and `createSessionHarness(server)` from
|
|
47
66
|
`@imports/castle.turn-based/testing.js`, run from the deck dir as
|
|
48
67
|
`node --import ./imports/castle.turn-based/testing.js tools/check.mjs` -- that
|
|
@@ -53,9 +72,15 @@ code:
|
|
|
53
72
|
## Using it
|
|
54
73
|
|
|
55
74
|
The kit is imported with `autoUpdateWhenImported`, so a decision it makes today
|
|
56
|
-
changes every shipped deck's behaviour tomorrow without the author asking.
|
|
57
|
-
|
|
58
|
-
freshness. Every number, every rule and every
|
|
75
|
+
changes every shipped deck's behaviour tomorrow without the author asking. That
|
|
76
|
+
holds for `room.js`, which is why it decides only bookkeeping -- seats,
|
|
77
|
+
spectators, departures, session freshness. Every number, every rule and every
|
|
78
|
+
message is the deck's.
|
|
79
|
+
|
|
80
|
+
The starter game in `code/server/index.js` is a deck's to replace, and replacing
|
|
81
|
+
it is the normal path: write `server/index.js`, point `server.main` at it, and
|
|
82
|
+
the room stays. It is the shape such a server takes -- rule functions, then the
|
|
83
|
+
session callbacks:
|
|
59
84
|
|
|
60
85
|
```js
|
|
61
86
|
import * as Room from '@imports/castle.turn-based/room.js';
|
|
@@ -266,32 +291,37 @@ dependency-free one to copy. It needs the serve on **loopback** and to itself: a
|
|
|
266
291
|
socket with no browser Origin is admitted from nowhere else, and a browser tab
|
|
267
292
|
already on that serve holds a seat the suite expects to be free.
|
|
268
293
|
|
|
269
|
-
## What
|
|
294
|
+
## What the room deliberately does not decide
|
|
295
|
+
|
|
296
|
+
The starter game answers all of these for itself, and answers only for itself.
|
|
297
|
+
`room.js` holds none of it:
|
|
270
298
|
|
|
271
299
|
- **The solo fallback** (`conn.isSolo`). Three decks wrote three incompatible and
|
|
272
300
|
individually correct answers -- pass-and-play on one device, a bot, a waiting
|
|
273
|
-
screen. A
|
|
301
|
+
screen. A room choosing one would be choosing the game.
|
|
274
302
|
- **The message envelope.** `type` vs `t` vs `kind` is the deck's.
|
|
275
303
|
- **A HUD or status line.** Rendering is the deck's.
|
|
276
|
-
- **Fonts and other assets.** A typeface is a game's choice, not a room's
|
|
277
|
-
|
|
304
|
+
- **Fonts and other assets.** A typeface is a game's choice, not a room's. The
|
|
305
|
+
faces and `theme.style` a scaffolded deck starts with are the starter game's,
|
|
306
|
+
copied from `castle-client/core/assets/`, and a deck replaces them.
|
|
278
307
|
- **Any game rule.**
|
|
279
308
|
|
|
280
309
|
## Wiring a deck
|
|
281
310
|
|
|
282
311
|
```sh
|
|
283
|
-
castle-web init <dir> --kit
|
|
284
|
-
castle-web add-import <turn-based deckId> <dir> --as castle.turn-based
|
|
312
|
+
castle-web init <dir> --kit turn-based
|
|
285
313
|
```
|
|
286
314
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
315
|
+
That writes the whole wiring: `index.html` pointing at
|
|
316
|
+
`/imports/castle.turn-based/main.jsx` (physics-2d's entry, re-exported so a deck
|
|
317
|
+
imports one kit and not two), `server.main` in `castle.json`, and the starter
|
|
318
|
+
scene. `castle.physics-2d` comes along with the import -- transitive imports are
|
|
319
|
+
flattened into one `imports/` at the deck root.
|
|
291
320
|
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
321
|
+
Adding the kit to a deck that already exists is
|
|
322
|
+
`castle-web add-import <turn-based deckId> <dir> --as castle.turn-based`.
|
|
323
|
+
The alias matters: it is the path every `@imports/...` specifier is written
|
|
324
|
+
against, and it is never re-derived from the upstream deck name.
|
|
295
325
|
|
|
296
326
|
## Platform
|
|
297
327
|
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"autoUpdateWhenImported": true,
|
|
29
29
|
"deckId": "K6-Xs7dCoMVi",
|
|
30
30
|
"cardId": "Kh_08IYATpC3",
|
|
31
|
-
"publishedVersion": "2026-09-
|
|
31
|
+
"publishedVersion": "2026-09-02T05:55:21.391Z",
|
|
32
32
|
"server": {
|
|
33
33
|
"main": "code/server/index.js",
|
|
34
34
|
"maxPlayers": 8,
|