@genex-ai/multiplayer 0.17.1 → 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 (45) hide show
  1. package/PROTOCOL.md +761 -9
  2. package/README.md +285 -1
  3. package/WORLD-GLTF.md +109 -0
  4. package/WORLD-SCENE.md +135 -0
  5. package/dist/authority/fast-udp.d.ts +15 -0
  6. package/dist/authority/fast-udp.js +14 -0
  7. package/dist/authority/fast-webtransport.d.ts +67 -0
  8. package/dist/authority/fast-webtransport.js +21 -0
  9. package/dist/authority/index.d.ts +2671 -0
  10. package/dist/authority/index.js +958 -0
  11. package/dist/authority/module.d.ts +2 -0
  12. package/dist/authority/module.js +12 -0
  13. package/dist/bridge-authority.d.ts +101 -0
  14. package/dist/bridge-authority.global.js +15 -0
  15. package/dist/bridge-authority.js +291 -0
  16. package/dist/bridge-core-Dhc73GC8.d.ts +27 -0
  17. package/dist/bridge.d.ts +26 -20
  18. package/dist/bridge.global.js +7 -7
  19. package/dist/bridge.js +17 -48
  20. package/dist/chunk-2NGXXQDS.js +1916 -0
  21. package/dist/chunk-4R7C2TLH.js +68 -0
  22. package/dist/{chunk-C52XFIB6.js → chunk-CSQEEANB.js} +217 -4
  23. package/dist/chunk-FPWP22Y7.js +143 -0
  24. package/dist/chunk-NFMGIKFZ.js +2627 -0
  25. package/dist/chunk-OD6NRSX2.js +29 -0
  26. package/dist/{chunk-3ZUPU3GT.js → chunk-QY3QQNDJ.js} +13 -122
  27. package/dist/chunk-QZOCUQJT.js +6900 -0
  28. package/dist/chunk-TSYEWPVO.js +44 -0
  29. package/dist/chunk-TVTVIMIH.js +675 -0
  30. package/dist/chunk-YWQ3ALYY.js +69 -0
  31. package/dist/fast-client--A88q0kk.d.ts +546 -0
  32. package/dist/index.d.ts +3 -5
  33. package/dist/index.js +3 -2
  34. package/dist/join-CGoInvUM.d.ts +6 -0
  35. package/dist/level-build-CbRqrYJq.d.ts +140 -0
  36. package/dist/module-CSpXrzFc.d.ts +1187 -0
  37. package/dist/physics-predict-C7ZB1gDG.d.ts +1223 -0
  38. package/dist/protocol.d.ts +222 -2
  39. package/dist/protocol.js +47 -1
  40. package/dist/shot-world-D22tqOUT.d.ts +485 -0
  41. package/dist/world-fit/index.d.ts +549 -0
  42. package/dist/world-fit/index.js +4763 -0
  43. package/dist/world-fit/three.d.ts +77 -0
  44. package/dist/world-fit/three.js +140 -0
  45. package/package.json +46 -4
@@ -0,0 +1,2 @@
1
+ export { w as EntityApi, E as EntityData, x as EntityInit, G as GenexRoomModule, D as InitContext, I as InputData, J as Json, L as LeaveReason, a7 as LiftsApi, a9 as MODULE_CONTRACT, aa as ModuleConfig, ad as PhysicsAnswer, ae as PhysicsApi, af as PhysicsBodyDesc, ag as PhysicsBodyState, ah as PhysicsBodyType, ai as PhysicsColliderDesc, aj as PhysicsCommandResult, ak as PhysicsCommands, a as PhysicsErrorCode, al as PhysicsEvent, am as PhysicsGroups, an as PhysicsHit, ao as PhysicsJointDesc, ap as PhysicsLimits, aq as PhysicsMotor, ar as PhysicsOverlap, as as PhysicsPose, at as PhysicsQueryFilter, au as PhysicsRefusal, av as PhysicsRequest, aw as PhysicsSetPoseOptions, ax as PhysicsShape, P as PlayerInfo, ay as PresetSpec, az as ProjectileApi, aA as ProjectileField, aB as ProjectileFlight, aC as ProjectileHit, aD as ProjectileInit, aE as Quat, f as RemotePredict, R as ResolvedModuleConfig, aF as ResolvedPhysics, aG as RewindApi, aH as RewoundPose, aI as RoomContext, aK as ShotWorldSpec, T as TickHz, aN as Vec3, aO as WorldApi, aP as WorldClaim, aQ as WorldClaimOptions, aR as WorldRayHit, aS as WorldRayOptions, aT as defineRoom } from '../module-CSpXrzFc.js';
2
+ import '../shot-world-D22tqOUT.js';
@@ -0,0 +1,12 @@
1
+ import {
2
+ LeaveReason,
3
+ MODULE_CONTRACT,
4
+ RemotePredict,
5
+ defineRoom
6
+ } from "../chunk-OD6NRSX2.js";
7
+ export {
8
+ LeaveReason,
9
+ MODULE_CONTRACT,
10
+ RemotePredict,
11
+ defineRoom
12
+ };
@@ -0,0 +1,101 @@
1
+ import { f as PredictCore } from './physics-predict-C7ZB1gDG.js';
2
+ import { B as BridgeIdentity } from './bridge-core-Dhc73GC8.js';
3
+ import './module-CSpXrzFc.js';
4
+ import './shot-world-D22tqOUT.js';
5
+
6
+ /** The embed-sdk identity of an authority join: the authority cluster's urls, not the relay's. */
7
+ /**
8
+ * The authority build's contract version (BRIDGE.md): 3 adds `bodiesF32` and `bodyKeysJson` (physics
9
+ * prediction, PROTOCOL.md §17.11) to version 2's calls, every one unchanged. The relay build stays 2.
10
+ */
11
+ declare const version = 3;
12
+ /**
13
+ * Replace the authority identity source (`null` restores embed-sdk, whose `urls()` are
14
+ * `getAuthorityUrls()` and `regions()` `getAuthorityRegions()`). For a host page that manages
15
+ * identity itself, and for tests against a local authority server. Not part of the engine contract.
16
+ */
17
+ declare function setAuthorityIdentity(next: BridgeIdentity | null): void;
18
+ /**
19
+ * The physics core a predicting room's bodies are predicted with (PROTOCOL.md §17.11): the host page
20
+ * hands over a loader of `@genex-ai/physics` (after its `init()`, the non-SIMD module where the
21
+ * browser lacks WebAssembly SIMD); `null` forgets it. Sessions opened after the call use it. Not part
22
+ * of the engine contract: a function cannot cross the bridge.
23
+ */
24
+ declare function setAuthorityPhysicsCore(load: (() => Promise<PredictCore>) | null): void;
25
+ /**
26
+ * Start joining the game's authority room and return its handle at once. The outcome arrives as a
27
+ * `joined` or a terminal `joinFailed` event (`code` is the JoinError: 402, 424, 429, 426, 503 after
28
+ * the capacity retries, 403; 0 = local, e.g. no authority URL). Throws only for malformed options.
29
+ */
30
+ declare function openAuthority(optsJson: string): number;
31
+ /**
32
+ * Set the input `frame()` sends on each fixed step: a JSON object of any of `moveX`, `moveY`,
33
+ * `moveZ`, `yaw`, `pitch` (finite numbers) and `buttons` (a bitmask). Fields you leave out keep
34
+ * their value; other keys and non-number values are ignored. `false` without a live seat; throws
35
+ * only for malformed JSON or a non-object.
36
+ */
37
+ declare function setInput(handle: number, json: string): boolean;
38
+ /**
39
+ * Predict a projectile you fire (PROTOCOL.md §17.9): call it while staging the input that fires
40
+ * (after `setInput` sets the fire button, before the `frame()` that sends it). `json` is
41
+ * `{ kind, x, y, z, vx, vy, vz, g? }`, the launch the room module makes: it is drawn in `frame()`'s
42
+ * entities at once, under the id answered here (`<seat>.<seq>.<n>`), which the server's projectile
43
+ * keeps. A non-finite or non-number coordinate is 0, a non-string `kind` is `''`, and a `g` that is
44
+ * not a finite number is left out (0). `''` without a live seat or while it reconnects (no
45
+ * prediction while the socket is down); throws only for malformed JSON or a non-object.
46
+ */
47
+ declare function predictProjectile(handle: number, json: string): string;
48
+ /**
49
+ * The `firstperson` or `vehicle` collision world (PROTOCOL.md §17.7): the `{ boxes, ramps }` JSON the room module
50
+ * exports. Your own entity is predicted only while its hash equals the room's `params.world`
51
+ * (`authorityJson().prediction` says whether and why not). Call it any time after `openAuthority`,
52
+ * before the seat lands too: it is applied when the session joins. `false`, with a `warning` event
53
+ * naming the bad value, for a world §17.7 refuses (the previous world stays), and for an unknown or
54
+ * closed handle; throws only for malformed JSON or a non-object.
55
+ */
56
+ declare function setWorld(handle: number, json: string): boolean;
57
+ /**
58
+ * Once per render frame: send the inputs now due, advance prediction and interpolation, and answer
59
+ * `{ tick, sent, connected, me, entities }` as JSON — `me` your own entity, predicted (or `null`),
60
+ * `entities` every entity as rendered (yours included; each with every AuthorityEntityView field, a
61
+ * vehicle's `spin` and `fuel` among them, and a physics body's drawn orientation `qx qy qz qw`
62
+ * with `body` and `sleep`, §17.10). `now` defaults to `performance.now()`;
63
+ * pass nothing unless you drive time yourself. Never throws.
64
+ */
65
+ declare function frame(handle: number, now?: number): string;
66
+ /** Numbers per body in {@link bodiesF32}: px py pz qx qy qz qw flags. */
67
+ declare const BODY_F32_STRIDE = 8;
68
+ /** {@link bodiesF32}'s flags: the body is predicted (§17.11), and asleep. */
69
+ declare const BodyF32Flag: {
70
+ readonly PREDICTED: 1;
71
+ readonly ASLEEP: 2;
72
+ };
73
+ /**
74
+ * Bridge version 3 (PROTOCOL.md §17.11): every physics body as this session draws it now, in one
75
+ * Float32Array, {@link BODY_F32_STRIDE} numbers a body (position, orientation [x, y, z, w], flags:
76
+ * 1 predicted, 2 asleep) in the order `bodyKeysJson()` names. Call it after `frame()`; an engine
77
+ * that only moves bodies never parses the frame's body JSON. Empty for an unknown handle. Never throws.
78
+ */
79
+ declare function bodiesF32(handle: number): Float32Array;
80
+ /** The body keys `bodiesF32()` answers in, as a JSON array; `[]` for an unknown handle. Never throws. */
81
+ declare function bodyKeysJson(handle: number): string;
82
+ /**
83
+ * The session as JSON: `{ sessionId, connected, closed, tick, queued, players, telemetry,
84
+ * prediction }` (`prediction`: whether your own entity is predicted, and why not). Never throws; an
85
+ * unknown handle answers closed with no players.
86
+ */
87
+ declare function authorityJson(handle: number): string;
88
+ /**
89
+ * Every event queued since the last call, oldest first, as a JSON array. Never throws; an unknown
90
+ * handle answers `[]`.
91
+ */
92
+ declare function drainAuthorityEventsJson(handle: number): string;
93
+ /** Leave with consent: `disconnected` (4000, `"left"`) follows. Idempotent; never reconnects. */
94
+ declare function closeAuthority(handle: number): void;
95
+ /**
96
+ * `closeAuthority`, then forget the handle and free its queue: the engine dropped its session
97
+ * object. Afterwards the handle answers as an unknown one. Idempotent.
98
+ */
99
+ declare function disposeAuthority(handle: number): void;
100
+
101
+ export { BODY_F32_STRIDE, BodyF32Flag, authorityJson, bodiesF32, bodyKeysJson, closeAuthority, disposeAuthority, drainAuthorityEventsJson, frame, openAuthority, predictProjectile, setAuthorityIdentity, setAuthorityPhysicsCore, setInput, setWorld, version };