@genex-ai/multiplayer 0.17.6 → 0.17.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/PROTOCOL.md +101 -30
  2. package/README.md +35 -14
  3. package/WORLD-GLTF.md +109 -0
  4. package/WORLD-SCENE.md +135 -0
  5. package/dist/authority/fast-udp.d.ts +4 -2
  6. package/dist/authority/fast-udp.js +8 -46
  7. package/dist/authority/fast-webtransport.d.ts +26 -4
  8. package/dist/authority/fast-webtransport.js +12 -115
  9. package/dist/authority/index.d.ts +379 -41
  10. package/dist/authority/index.js +247 -47
  11. package/dist/authority/module.d.ts +2 -1
  12. package/dist/authority/module.js +1 -1
  13. package/dist/bridge-authority.d.ts +3 -2
  14. package/dist/bridge-authority.global.js +10 -9
  15. package/dist/bridge-authority.js +11 -6
  16. package/dist/bridge.global.js +5 -5
  17. package/dist/bridge.js +3 -3
  18. package/dist/chunk-2NGXXQDS.js +1916 -0
  19. package/dist/{chunk-ZSWF4VCN.js → chunk-CSQEEANB.js} +78 -2
  20. package/dist/{chunk-UX3F6YTV.js → chunk-FPWP22Y7.js} +1 -1
  21. package/dist/{chunk-5JGRFT2N.js → chunk-NFMGIKFZ.js} +879 -1898
  22. package/dist/{chunk-K3SF5VDS.js → chunk-OD6NRSX2.js} +3 -1
  23. package/dist/{chunk-7QVOIHJF.js → chunk-QY3QQNDJ.js} +2 -2
  24. package/dist/{chunk-Y6XHXDIK.js → chunk-QZOCUQJT.js} +820 -537
  25. package/dist/chunk-TSYEWPVO.js +44 -0
  26. package/dist/chunk-TVTVIMIH.js +675 -0
  27. package/dist/chunk-YWQ3ALYY.js +69 -0
  28. package/dist/{fast-client-CZ41v-oB.d.ts → fast-client--A88q0kk.d.ts} +85 -4
  29. package/dist/index.js +3 -3
  30. package/dist/level-build-CbRqrYJq.d.ts +140 -0
  31. package/dist/{module-DqtFb5wA.d.ts → module-CSpXrzFc.d.ts} +151 -400
  32. package/dist/{physics-predict-49udN3a1.d.ts → physics-predict-C7ZB1gDG.d.ts} +18 -3
  33. package/dist/protocol.d.ts +87 -2
  34. package/dist/protocol.js +15 -1
  35. package/dist/shot-world-D22tqOUT.d.ts +485 -0
  36. package/dist/world-fit/index.d.ts +549 -0
  37. package/dist/world-fit/index.js +4763 -0
  38. package/dist/world-fit/three.d.ts +77 -0
  39. package/dist/world-fit/three.js +140 -0
  40. package/package.json +15 -3
@@ -36,8 +36,26 @@ var AuthorityJoinOption = {
36
36
  /** The capabilities this client implements: at most {@link AuthorityCaps.MAX_CAPS} strings of at
37
37
  * most {@link AuthorityCaps.MAX_CAP_CHARS} characters; absent = []. Any other value is refused
38
38
  * with 400 by every authority room. */
39
- CAPS: "caps"
39
+ CAPS: "caps",
40
+ /** The client's SDK and version, `<sdk>/<version>` (§17.1): counted so a protocol bump can see whom it would
41
+ * strand. Telemetry only: anything malformed is counted as unknown, never refused. */
42
+ SDK: "sdk",
43
+ /** The pool this join asks for (§17.2 *Choosing a room*): rooms are found by it beside the game and
44
+ * the region. Absent or empty = the game's one pool, as a client that names no room has always had.
45
+ * Malformed (authority/room-key.ts `matchKeyOf`) is refused with 400. */
46
+ MATCH_KEY: "matchKey",
47
+ /** `true` on a `create` makes a private room: no matchmaking reaches it, only its code. Any other
48
+ * type is refused with 400. */
49
+ PRIVATE: "private",
50
+ /** The room this seat lost (§17.13 *Drain and rejoin*): a room code. Rooms are found by it too, so a
51
+ * lost room's seats meet in one successor, which alone reads the room's hand-off. Absent or empty =
52
+ * no successor. Malformed is refused with 400. */
53
+ SUCCESSOR_OF: "successorOf",
54
+ /** `true` keeps a successor closed to the game's pool: the lost room was private. Any other type is
55
+ * refused with 400. */
56
+ SUCCESSOR_CLOSED: "successorClosed"
40
57
  };
58
+ var AUTHORITY_SDK_LABEL = "ts/0.17.8";
41
59
  var AuthorityCaps = {
42
60
  /** Decodes and draws §17.10's physics bodies. A physics room refuses a join without it (426). An
43
61
  * SDK sends it only once its drawing passes `physics-draw.json` and, for an engine SDK, its own
@@ -68,6 +86,10 @@ var AuthorityCaps = {
68
86
  * beside `tick@1`. An SDK sends it only once it passes `fast-transport.json` and its transport
69
87
  * tests; a room that does not offer the channel ignores it. */
70
88
  FAST: "fast@1",
89
+ /** The seat can come back to the fast channel after a fallback (§17.12 *Return to the channel*): it asks
90
+ * for a fresh binding, proves the path and swaps. Sent beside `fast@1`; a host that does not know it
91
+ * ignores it, and a client asks only a host whose binding says `rev` 2. */
92
+ FAST_RETURN: "fast-return@1",
71
93
  MAX_CAPS: 16,
72
94
  MAX_CAP_CHARS: 32
73
95
  };
@@ -101,7 +123,8 @@ var AUTHORITY_SERVER_OWNED_JOIN_OPTIONS = [
101
123
  "seed",
102
124
  "units",
103
125
  "leaseId",
104
- "region"
126
+ "region",
127
+ "createdBy"
105
128
  ];
106
129
  var JoinError = {
107
130
  /** A server-owned option was sent. */
@@ -110,6 +133,9 @@ var JoinError = {
110
133
  AUTH_REQUIRED: 401,
111
134
  /** Token for another game ('wrong game'), or the room's guest cap is full. */
112
135
  FORBIDDEN: 403,
136
+ /** A join by code entered through another region than the room's (§17.2 *Choosing a room*): the
137
+ * client tries its next region. */
138
+ WRONG_REGION: 421,
113
139
  /** `protocol` missing or outside the room type's window ({@link RELAY_WINDOW},
114
140
  * {@link AUTHORITY_WINDOW}). Update the client. */
115
141
  PROTOCOL_UNSUPPORTED: 426,
@@ -190,6 +216,14 @@ var RATE_LANES = {
190
216
  };
191
217
  var GLOBAL_RATE = { rate: 180, burst: 360 };
192
218
  var MAX_MESSAGES_PER_SECOND = 1200;
219
+ var AUTHORITY_MAX_MESSAGES_PER_SECOND = 2400;
220
+ var AUTHORITY_MAX_FRAME_BYTES = 4 * 1024;
221
+ var SeatCloseReason = {
222
+ /** Its socket passed {@link AUTHORITY_MAX_MESSAGES_PER_SECOND} (4002). */
223
+ MessageFlood: "message_flood",
224
+ /** Its input had not changed for the room's idle limit (4408). */
225
+ SeatIdle: "seat_idle"
226
+ };
193
227
  var MESSAGE_LANE = {
194
228
  [ClientMessage.STATE]: "state",
195
229
  [ClientMessage.STATE_SNAP]: "state",
@@ -235,12 +269,47 @@ var CloseCode = {
235
269
  REVOKED: 4401,
236
270
  /** A newer session of the same player took the seat (second tab, or the page reloaded). */
237
271
  SUPERSEDED: 4409,
272
+ /** Authority rooms: the seat's input had not changed for the room's idle limit (§17.6 *Room lifetime*). */
273
+ IDLE: 4408,
238
274
  // ---- authority rooms only (§17.6), terminal ----
239
275
  /** The operator or the platform halted the room (kill switch, takedown, disabled game). */
240
276
  MODULE_HALTED: 4500,
241
277
  /** The game's room module broke its limits or threw; the room is gone. */
242
278
  MODULE_FAULT: 4501
243
279
  };
280
+ var AuthorityCloseCode = {
281
+ /** A call ran past its hard timeout (an infinite loop, a long microtask). */
282
+ ModuleTimeout: "module_timeout",
283
+ /** The module hit its memory limit, or the heap poll caught it near the limit. */
284
+ ModuleMemory: "module_memory",
285
+ /** The module threw (or failed to load) too many times. */
286
+ ModuleError: "module_error",
287
+ /** The module's output broke the wire limits too many times. */
288
+ ModuleOutputInvalid: "module_output_invalid",
289
+ /** The module stayed under the hard timeout but over the mean CPU budget for a whole window. */
290
+ ModuleBudget: "module_budget",
291
+ /** The operator or the platform stopped the room (kill switch, takedown, disabled game). */
292
+ Halted: "halted",
293
+ /** isolated-vm's wall-clock backstop stopped a call while the guest's own CPU stayed under its limit: the
294
+ * host stalled (contention, a GC pause, descheduled). The guest was cut off mid-call, so it is
295
+ * never called again; the room ends, but the module is not at fault. */
296
+ HostStall: "host_stall",
297
+ /** The room's physics passed the physics meter for the third strike (§17.10). */
298
+ PhysicsBudget: "physics_budget",
299
+ /** The room reached its age limit (§17.6 *Room lifetime*), announced like a drain. Not a fault. */
300
+ RoomAge: "room_age",
301
+ /** The room sent more than its ceiling for a whole window (§17.6 *The downlink budget*): its module writes
302
+ * too much state or too many events for its seats. Lower what it writes; no strike comes first. */
303
+ ModuleBandwidth: "module_bandwidth",
304
+ /** The physics core answered `internal` (C§11.3): every physics room on that instance ends. Never
305
+ * the module's fault. */
306
+ PhysicsInternal: "physics_internal"
307
+ };
308
+ function authorityCloseCodeOf(reason) {
309
+ const known = Object.values(AuthorityCloseCode);
310
+ return known.includes(reason) ? reason : null;
311
+ }
312
+ var AUTHORITY_ROOM_ENDED_TEXT = "This match ended because of a problem with the game. Please try again.";
244
313
  var Limits = {
245
314
  ROOM_MAX_CLIENTS: 64,
246
315
  MAX_NAME_CHARS: 64,
@@ -413,6 +482,7 @@ export {
413
482
  RoomType,
414
483
  JoinOption,
415
484
  AuthorityJoinOption,
485
+ AUTHORITY_SDK_LABEL,
416
486
  AuthorityCaps,
417
487
  capsOf,
418
488
  AUTHORITY_PHYSICS_UNITS,
@@ -437,8 +507,14 @@ export {
437
507
  RATE_LANES,
438
508
  GLOBAL_RATE,
439
509
  MAX_MESSAGES_PER_SECOND,
510
+ AUTHORITY_MAX_MESSAGES_PER_SECOND,
511
+ AUTHORITY_MAX_FRAME_BYTES,
512
+ SeatCloseReason,
440
513
  MESSAGE_LANE,
441
514
  CloseCode,
515
+ AuthorityCloseCode,
516
+ authorityCloseCodeOf,
517
+ AUTHORITY_ROOM_ENDED_TEXT,
442
518
  Limits,
443
519
  RelayTiming,
444
520
  AuthorityTiming,
@@ -2,7 +2,7 @@ import {
2
2
  ClientReconnection,
3
3
  JoinError,
4
4
  PROTOCOL_VERSION
5
- } from "./chunk-ZSWF4VCN.js";
5
+ } from "./chunk-CSQEEANB.js";
6
6
 
7
7
  // src/join.ts
8
8
  import { Client as Client2 } from "@colyseus/sdk";