@crowdedkingdoms/crowdyjs 18.30.0 → 18.31.1-dev.1
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/MIGRATION.md +39 -0
- package/README.md +21 -15
- package/dist/default-origin.d.ts +6 -6
- package/dist/default-origin.d.ts.map +1 -1
- package/dist/default-origin.js +6 -6
- package/dist/generated/graphql-schema.d.ts +2 -0
- package/dist/generated/graphql-schema.d.ts.map +1 -1
- package/dist/generated/graphql.d.ts +1 -0
- package/dist/generated/graphql.d.ts.map +1 -1
- package/dist/generated/graphql.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/stores/chunks.d.ts +101 -47
- package/dist/stores/chunks.d.ts.map +1 -1
- package/dist/stores/chunks.js +490 -200
- package/package.json +1 -1
package/MIGRATION.md
CHANGED
|
@@ -120,6 +120,45 @@ super-admin's session). There is no SDK replacement.
|
|
|
120
120
|
`dev`'s SDL after #417 merged (`npm run schema:sync:paths -- --schema <that schema.gql>`, then
|
|
121
121
|
`npm run codegen`).
|
|
122
122
|
|
|
123
|
+
## 18.31.1: a stored copy's times are clamped too
|
|
124
|
+
|
|
125
|
+
What 18.31.0 needs. A stored copy's `updatedAt` (the row's and each voxel state's) is held to 5
|
|
126
|
+
minutes past this machine's clock, as a notification's and a recorded edit's times already were,
|
|
127
|
+
so a copy dated far ahead cannot hold its voxels against every later change.
|
|
128
|
+
|
|
129
|
+
## 18.31.0: the ChunkStore merges by the server's time
|
|
130
|
+
|
|
131
|
+
**What it needs.** ck-api `v2.69.0` (cks-game-api #668): `chunks.get` selects each voxel state's
|
|
132
|
+
`updatedAt`, which an older Game API refuses. Promote the Game API before the SDK on each tier.
|
|
133
|
+
Buddy `v0.46.0` dates a realtime edit with the moment the server accepted it, so a catch-up's
|
|
134
|
+
`createdAt` and a notification's `epochMillis` come from one clock; with an older Buddy the merge
|
|
135
|
+
still holds, by the database's write time.
|
|
136
|
+
|
|
137
|
+
**What changes for a game using `session.chunks`.**
|
|
138
|
+
|
|
139
|
+
- **Changes merge by the server's time.** Each voxel keeps the value the server confirmed last
|
|
140
|
+
and when: a stored copy's write, an entry's `updatedAt`, a notification's `epochMillis`, a
|
|
141
|
+
recorded edit's `createdAt`. A change older than the value held is dropped, so a slow
|
|
142
|
+
notification or a late page no longer overwrites a newer value. A time more than 5 minutes past
|
|
143
|
+
this machine's clock counts as 5 minutes ahead. `confirmedAt(coord, x, y, z)` reads it.
|
|
144
|
+
- **A change that arrives while a chunk loads is kept.** The store tracks a chunk it is reading,
|
|
145
|
+
and its copy merges under what arrived meanwhile: a newer change stays, an older one gives way.
|
|
146
|
+
It dropped them before.
|
|
147
|
+
- **Another client's edit goes under this client's unanswered edit.** The voxel keeps showing your
|
|
148
|
+
edit until the server answers it; if the server refuses it (or it times out), the voxel shows
|
|
149
|
+
the other client's edit, not what it held before yours. `VoxelEditRefusal.restored` is true
|
|
150
|
+
whenever the voxel stopped showing the edit. It showed the other edit at once before, and your
|
|
151
|
+
echo put yours back.
|
|
152
|
+
- **An echo matches by its value too**: sender, sequence number, voxel, type and state. A change
|
|
153
|
+
with your uuid and sequence number but another value is another change.
|
|
154
|
+
- **`catchUp(since, boxes?)` covers every chunk the store tracks**, the never-stored (`missing`)
|
|
155
|
+
ones included, read in boxes of at most 17³; or the boxes you pass (cut to 17³; more than 64
|
|
156
|
+
resolves false). It covered the last `ensureAround` area. It resolves whether anything was read.
|
|
157
|
+
- **`evict(coord)` and `pruneIf(predicate)`** drop chunks for a view that is not a cube; a chunk
|
|
158
|
+
queued for write-back stays. `pruneBeyond` returns how many it dropped.
|
|
159
|
+
- **`hydrate(coord)` resolves whether its copy was applied**: false for a chunk never stored, or one
|
|
160
|
+
evicted while the read was out (it is not brought back).
|
|
161
|
+
|
|
123
162
|
## 18.30.0: a ChunkStore the game can stand behind
|
|
124
163
|
|
|
125
164
|
**What it needs.** What 18.29.0 needs (ck-api `v2.68.0` for the GraphQL proxy); the box reads and
|
package/README.md
CHANGED
|
@@ -12,24 +12,30 @@ gameplay, minted per app through `client.portal`.
|
|
|
12
12
|
|
|
13
13
|
Start here:
|
|
14
14
|
|
|
15
|
-
- [SDK guide](https://docs.crowdedkingdoms.com/crowdyjs/readme) — the canonical
|
|
15
|
+
- [SDK guide](https://docs.dev.crowdedkingdoms.com/crowdyjs/readme) — the canonical
|
|
16
16
|
walkthrough of everything in this README.
|
|
17
|
-
- [Build a game](https://docs.crowdedkingdoms.com/build-a-game/intro) — a
|
|
17
|
+
- [Build a game](https://docs.dev.crowdedkingdoms.com/build-a-game/intro) — a
|
|
18
18
|
hands-on tutorial from sign-in to a playable voxel game.
|
|
19
|
-
- [Platform overview](https://docs.crowdedkingdoms.com/overview/client-workflow)
|
|
19
|
+
- [Platform overview](https://docs.dev.crowdedkingdoms.com/overview/client-workflow)
|
|
20
20
|
— how a client session flows through the platform.
|
|
21
21
|
|
|
22
22
|
## Install
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
|
-
npm install @crowdedkingdoms/crowdyjs
|
|
25
|
+
npm install @crowdedkingdoms/crowdyjs@dev
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
+
This README is the `dev` branch's: it documents the release on the `dev` dist-tag
|
|
29
|
+
(`npm view @crowdedkingdoms/crowdyjs dist-tags`), and its links go to the dev docs site. A
|
|
30
|
+
plain `npm install` resolves `latest`, the production release, which has no `client.exec`.
|
|
31
|
+
|
|
28
32
|
**Server compatibility.** A release selects fields the Game API it was built against has,
|
|
29
33
|
so it needs that Game API or newer; promote the Game API before the SDK on each tier.
|
|
30
34
|
|
|
31
35
|
| CrowdyJS | Needs the Game API (ck-api) |
|
|
32
36
|
| --- | --- |
|
|
37
|
+
| 18.31.1 | as 18.31.0 |
|
|
38
|
+
| 18.31.0 | v2.69.0 or later (`chunks.get` selects `VoxelState.updatedAt`) |
|
|
33
39
|
| 18.30.0 | as 18.29.0 (`ChunkStore` reads boxes and `since`: v2.67.0) |
|
|
34
40
|
| 18.29.0 | v2.68.0 or later for the GraphQL proxy (`udpNotifications` selects `ChunkChangedNotification`) |
|
|
35
41
|
| 18.28.0 | v2.67.0 or later (`gameApps.nearbyGrids` selects `permissionKeys`) |
|
|
@@ -225,8 +231,8 @@ Notes:
|
|
|
225
231
|
- Use `client.auth.setToken(token)` to seed a token externally (e.g. when
|
|
226
232
|
restoring auth from a non-default storage).
|
|
227
233
|
|
|
228
|
-
Deeper reading: [Portals & app-scoped tokens](https://docs.crowdedkingdoms.com/management-api/portals-and-app-tokens)
|
|
229
|
-
and [Sign in](https://docs.crowdedkingdoms.com/management-api/authentication).
|
|
234
|
+
Deeper reading: [Portals & app-scoped tokens](https://docs.dev.crowdedkingdoms.com/management-api/portals-and-app-tokens)
|
|
235
|
+
and [Sign in](https://docs.dev.crowdedkingdoms.com/management-api/authentication).
|
|
230
236
|
|
|
231
237
|
### Org-managed players
|
|
232
238
|
|
|
@@ -518,7 +524,7 @@ query AppForRouting($appId: BigInt!) {
|
|
|
518
524
|
`CrowdyClient` with `httpUrl: gameApiUrl` (and the matching `wsUrl`) holding
|
|
519
525
|
that app's app-scoped token, then drive gameplay through that client. Apps
|
|
520
526
|
with no `gameApiUrl` keep working against the default `httpUrl` you
|
|
521
|
-
configured. See [Loading an app's Game API](https://docs.crowdedkingdoms.com/crowdyjs/shared-environment-routing).
|
|
527
|
+
configured. See [Loading an app's Game API](https://docs.dev.crowdedkingdoms.com/crowdyjs/shared-environment-routing).
|
|
522
528
|
|
|
523
529
|
## Realtime notifications
|
|
524
530
|
|
|
@@ -971,7 +977,7 @@ reach your bundle. Reads are synchronous snapshots and writes happen on
|
|
|
971
977
|
WebSocket events (not `requestAnimationFrame`), so render loops read freely
|
|
972
978
|
and a backgrounded tab keeps ingesting updates; pass `workerTicker()` to also
|
|
973
979
|
keep timer-driven sends at full rate while hidden. See the
|
|
974
|
-
[World Stores guide](https://docs.crowdedkingdoms.com/crowdyjs/stores).
|
|
980
|
+
[World Stores guide](https://docs.dev.crowdedkingdoms.com/crowdyjs/stores).
|
|
975
981
|
|
|
976
982
|
## Game Kit
|
|
977
983
|
|
|
@@ -1049,7 +1055,7 @@ The protocol is held to ck-exec's golden record of the starters
|
|
|
1049
1055
|
(`test/unit/fixtures/kit-protocol.json`): every module call and topic in it is replayed in
|
|
1050
1056
|
`test/unit/game-kit.test.mjs`. The blueprints, `kit.deploy`, the engines and the model-backed
|
|
1051
1057
|
helpers went with the game model in 18.0.0; the hub modules replace them. See the
|
|
1052
|
-
[Game Kit docs](https://docs.crowdedkingdoms.com/game-kit/intro) and
|
|
1058
|
+
[Game Kit docs](https://docs.dev.crowdedkingdoms.com/game-kit/intro) and
|
|
1053
1059
|
[MIGRATION.md](MIGRATION.md).
|
|
1054
1060
|
|
|
1055
1061
|
## ck-exec
|
|
@@ -1113,7 +1119,7 @@ Integers above 2^53 decode as `number` and lose precision unless you pass
|
|
|
1113
1119
|
`{ decode: { useBigInt64: true } }`. A call's whole numbers outside 32 bits (a timestamp in
|
|
1114
1120
|
milliseconds, a player id) go out as 64-bit integers (18.11.0; before, as floats, which a
|
|
1115
1121
|
hub's integer fields refuse). The wire format is in the
|
|
1116
|
-
[ck-exec docs](https://docs.crowdedkingdoms.com/exec/intro).
|
|
1122
|
+
[ck-exec docs](https://docs.dev.crowdedkingdoms.com/exec/intro).
|
|
1117
1123
|
|
|
1118
1124
|
### A mod's CLIENT half
|
|
1119
1125
|
|
|
@@ -1184,7 +1190,7 @@ counts what was dropped); `invoke` sends at most 256 KiB each way and is refused
|
|
|
1184
1190
|
module is not running. `NOT_FOUND` holds a CLIENT half back 15 s and `RATE_LIMITED` 60 s. The
|
|
1185
1191
|
grid's owner is asked about their own CLIENT halves like anyone; answer yes in `confirm` when
|
|
1186
1192
|
`prompt.authorId` is the player. See
|
|
1187
|
-
[CLIENT halves](https://docs.crowdedkingdoms.com/exec/client-halves).
|
|
1193
|
+
[CLIENT halves](https://docs.dev.crowdedkingdoms.com/exec/client-halves).
|
|
1188
1194
|
|
|
1189
1195
|
## Hosting your game
|
|
1190
1196
|
|
|
@@ -1197,7 +1203,7 @@ set response headers. Then, in Studio, open the app's
|
|
|
1197
1203
|
origin as the app's **Launch URL**. The redirect URI is what admits the origin to CORS
|
|
1198
1204
|
and to the hosted sign-in return, so `portal.signIn` works there as in the
|
|
1199
1205
|
[Quick start](#quick-start).
|
|
1200
|
-
[Host your game](https://docs.crowdedkingdoms.com/build-a-game/host-your-game)
|
|
1206
|
+
[Host your game](https://docs.dev.crowdedkingdoms.com/build-a-game/host-your-game)
|
|
1201
1207
|
has the requirements and recipes.
|
|
1202
1208
|
|
|
1203
1209
|
`client.hosting`, `uploadPublishFiles`, `publishDirectory` and `manifestForDirectory`
|
|
@@ -1293,8 +1299,8 @@ CLIENT project needs ck-api `v2.25.1` or later. A CLIENT crate still on the lega
|
|
|
1293
1299
|
`mountCrowdyStudio` and the controller take `mods: client.exec`. Crowdy Studio runs nothing
|
|
1294
1300
|
on legacy player compute since 18.0.0.
|
|
1295
1301
|
|
|
1296
|
-
See [CLIENT halves](https://docs.crowdedkingdoms.com/exec/client-halves), [mods](https://docs.crowdedkingdoms.com/exec/mods)
|
|
1297
|
-
and [Embed Crowdy Studio in your game](https://docs.crowdedkingdoms.com/crowdyjs/crowdy-studio-embed).
|
|
1302
|
+
See [CLIENT halves](https://docs.dev.crowdedkingdoms.com/exec/client-halves), [mods](https://docs.dev.crowdedkingdoms.com/exec/mods)
|
|
1303
|
+
and [Embed Crowdy Studio in your game](https://docs.dev.crowdedkingdoms.com/crowdyjs/crowdy-studio-embed).
|
|
1298
1304
|
|
|
1299
1305
|
### The Studio agent (DeepSeek Harness in the browser)
|
|
1300
1306
|
|
|
@@ -1550,7 +1556,7 @@ no other repositories and no network access required:
|
|
|
1550
1556
|
`src/generated/graphql-schema.ts`, the generated schema types.
|
|
1551
1557
|
|
|
1552
1558
|
Schema refresh is explicit, from the published
|
|
1553
|
-
[SDL](https://docs.crowdedkingdoms.com/schema/game-api.graphql):
|
|
1559
|
+
[SDL](https://docs.dev.crowdedkingdoms.com/schema/game-api.graphql):
|
|
1554
1560
|
|
|
1555
1561
|
```bash
|
|
1556
1562
|
npm run schema:sync:prod
|
package/dist/default-origin.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GENERATED — do not edit. The operator tooling's
|
|
3
|
-
* `sync-client-origins.mjs --write --tier
|
|
3
|
+
* `sync-client-origins.mjs --write --tier dev` writes this file, and
|
|
4
4
|
* `check-sdk-default-origin.mjs` refuses it when it names the wrong tier or a
|
|
5
5
|
* host that declaration does not carry. Regenerate; never hand-edit.
|
|
6
6
|
*
|
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
* than no default at all. Every fallback this SDK ever removed named a host that
|
|
11
11
|
* was already dead. A generated file plus a gate is what makes this one different.
|
|
12
12
|
*
|
|
13
|
-
* Source: the operator's per-tier public CK API origin declaration, tier '
|
|
13
|
+
* Source: the operator's per-tier public CK API origin declaration, tier 'dev'
|
|
14
14
|
*/
|
|
15
15
|
/** The tier this build of the SDK is published for. */
|
|
16
|
-
export declare const CROWDY_DEFAULT_TIER = "
|
|
16
|
+
export declare const CROWDY_DEFAULT_TIER = "dev";
|
|
17
17
|
/** The public CK API origin for that tier. */
|
|
18
|
-
export declare const CROWDY_DEFAULT_HTTP_ORIGIN = "https://ck.
|
|
18
|
+
export declare const CROWDY_DEFAULT_HTTP_ORIGIN = "https://ck.dev.crowdedkingdoms.com";
|
|
19
19
|
/** The same host over WebSocket. A scheme is composed; a hostname is looked up. */
|
|
20
|
-
export declare const CROWDY_DEFAULT_WS_ORIGIN = "wss://ck.
|
|
20
|
+
export declare const CROWDY_DEFAULT_WS_ORIGIN = "wss://ck.dev.crowdedkingdoms.com";
|
|
21
21
|
/** The bare hostname, for callers that need to compare rather than dial. */
|
|
22
|
-
export declare const CROWDY_DEFAULT_HOST = "ck.
|
|
22
|
+
export declare const CROWDY_DEFAULT_HOST = "ck.dev.crowdedkingdoms.com";
|
|
23
23
|
//# sourceMappingURL=default-origin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"default-origin.d.ts","sourceRoot":"","sources":["../src/default-origin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,uDAAuD;AACvD,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"default-origin.d.ts","sourceRoot":"","sources":["../src/default-origin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,uDAAuD;AACvD,eAAO,MAAM,mBAAmB,QAAQ,CAAC;AAEzC,8CAA8C;AAC9C,eAAO,MAAM,0BAA0B,uCAAuC,CAAC;AAE/E,mFAAmF;AACnF,eAAO,MAAM,wBAAwB,qCAAqC,CAAC;AAE3E,4EAA4E;AAC5E,eAAO,MAAM,mBAAmB,+BAA+B,CAAC"}
|
package/dist/default-origin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* GENERATED — do not edit. The operator tooling's
|
|
3
|
-
* `sync-client-origins.mjs --write --tier
|
|
3
|
+
* `sync-client-origins.mjs --write --tier dev` writes this file, and
|
|
4
4
|
* `check-sdk-default-origin.mjs` refuses it when it names the wrong tier or a
|
|
5
5
|
* host that declaration does not carry. Regenerate; never hand-edit.
|
|
6
6
|
*
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
* than no default at all. Every fallback this SDK ever removed named a host that
|
|
11
11
|
* was already dead. A generated file plus a gate is what makes this one different.
|
|
12
12
|
*
|
|
13
|
-
* Source: the operator's per-tier public CK API origin declaration, tier '
|
|
13
|
+
* Source: the operator's per-tier public CK API origin declaration, tier 'dev'
|
|
14
14
|
*/
|
|
15
15
|
/** The tier this build of the SDK is published for. */
|
|
16
|
-
export const CROWDY_DEFAULT_TIER = '
|
|
16
|
+
export const CROWDY_DEFAULT_TIER = 'dev';
|
|
17
17
|
/** The public CK API origin for that tier. */
|
|
18
|
-
export const CROWDY_DEFAULT_HTTP_ORIGIN = 'https://ck.
|
|
18
|
+
export const CROWDY_DEFAULT_HTTP_ORIGIN = 'https://ck.dev.crowdedkingdoms.com';
|
|
19
19
|
/** The same host over WebSocket. A scheme is composed; a hostname is looked up. */
|
|
20
|
-
export const CROWDY_DEFAULT_WS_ORIGIN = 'wss://ck.
|
|
20
|
+
export const CROWDY_DEFAULT_WS_ORIGIN = 'wss://ck.dev.crowdedkingdoms.com';
|
|
21
21
|
/** The bare hostname, for callers that need to compare rather than dial. */
|
|
22
|
-
export const CROWDY_DEFAULT_HOST = 'ck.
|
|
22
|
+
export const CROWDY_DEFAULT_HOST = 'ck.dev.crowdedkingdoms.com';
|
|
@@ -10044,6 +10044,8 @@ export type VoxelState = {
|
|
|
10044
10044
|
__typename?: 'VoxelState';
|
|
10045
10045
|
/** BASE64-encoded binary state blob for this voxel (decode from base64); null/empty when the voxel has no extra state. */
|
|
10046
10046
|
state: Maybe<Scalars['String']['output']>;
|
|
10047
|
+
/** When this entry was last written: the recorded voxel edit's time, or the chunk's own write for a state stored with it. A client that also hears realtime voxel updates keeps, per voxel, the newer of this and a notification's time (a realtime edit is recorded at the time its notification carries, replication servers v0.46.0). Null when the read did not apply recorded edits. Game API v2.69.0. */
|
|
10048
|
+
updatedAt: Maybe<Scalars['DateTime']['output']>;
|
|
10047
10049
|
/** Voxel position within the chunk (signed 16-bit per axis, app-defined). */
|
|
10048
10050
|
voxelCoord: VoxelCoordinates;
|
|
10049
10051
|
/** Voxel type id at this position (signed 16-bit, app-defined). */
|