@genex-ai/multiplayer 0.17.1 → 0.17.6

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