@genex-ai/multiplayer 0.17.6 → 0.17.9
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/PROTOCOL.md +102 -31
- package/README.md +35 -14
- package/WORLD-GLTF.md +109 -0
- package/WORLD-SCENE.md +135 -0
- package/dist/authority/fast-udp.d.ts +4 -2
- package/dist/authority/fast-udp.js +8 -46
- package/dist/authority/fast-webtransport.d.ts +26 -4
- package/dist/authority/fast-webtransport.js +12 -115
- package/dist/authority/index.d.ts +379 -41
- package/dist/authority/index.js +247 -47
- package/dist/authority/module.d.ts +2 -1
- package/dist/authority/module.js +1 -1
- package/dist/bridge-authority.d.ts +3 -2
- package/dist/bridge-authority.global.js +10 -9
- package/dist/bridge-authority.js +11 -6
- package/dist/bridge.global.js +5 -5
- package/dist/bridge.js +3 -3
- package/dist/chunk-2NGXXQDS.js +1916 -0
- package/dist/{chunk-7QVOIHJF.js → chunk-DJ2XYETS.js} +2 -2
- package/dist/{chunk-Y6XHXDIK.js → chunk-MQYARUGU.js} +864 -539
- package/dist/{chunk-K3SF5VDS.js → chunk-OD6NRSX2.js} +3 -1
- package/dist/{chunk-UX3F6YTV.js → chunk-TEHGMFAG.js} +1 -1
- package/dist/chunk-TSYEWPVO.js +44 -0
- package/dist/chunk-TVTVIMIH.js +675 -0
- package/dist/{chunk-ZSWF4VCN.js → chunk-WEMRRIHH.js} +80 -2
- package/dist/chunk-YWQ3ALYY.js +69 -0
- package/dist/{chunk-5JGRFT2N.js → chunk-ZDGSUR6E.js} +879 -1898
- package/dist/{fast-client-CZ41v-oB.d.ts → fast-client--A88q0kk.d.ts} +85 -4
- package/dist/index.js +3 -3
- package/dist/level-build-CbRqrYJq.d.ts +140 -0
- package/dist/{module-DqtFb5wA.d.ts → module-CSpXrzFc.d.ts} +151 -400
- package/dist/{physics-predict-49udN3a1.d.ts → physics-predict-C7ZB1gDG.d.ts} +18 -3
- package/dist/protocol.d.ts +90 -2
- package/dist/protocol.js +17 -1
- package/dist/shot-world-D22tqOUT.d.ts +485 -0
- package/dist/world-fit/index.d.ts +549 -0
- package/dist/world-fit/index.js +4763 -0
- package/dist/world-fit/three.d.ts +77 -0
- package/dist/world-fit/three.js +140 -0
- package/package.json +15 -3
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
import { AuthorityCloseCode } from '../protocol.js';
|
|
2
|
+
export { AUTHORITY_ROOM_ENDED_TEXT, authorityCloseCodeOf } from '../protocol.js';
|
|
1
3
|
import * as _colyseus_schema from '@colyseus/schema';
|
|
2
4
|
import { SchemaType } from '@colyseus/schema';
|
|
3
|
-
import { T as TickHz, E as EntityData, J as Json, R as ResolvedModuleConfig, P as PlayerInfo, L as LeaveReason, I as InputData, a as PhysicsErrorCode, b as InputRepeat, c as LiftVec, C as ContactPolicy,
|
|
4
|
-
export {
|
|
5
|
-
import { P as PhysicsCeiling, a as PhysEvRow, b as PhysAnswerRow, c as PhysBodyRow, d as PredictStatus, C as ContactBody, R as RemoteInput, A as AuthorityContactRule, e as AuthoritySeatRule, f as PredictCore, g as PredictBodyRule, h as PredictKinematicRule } from '../physics-predict-
|
|
6
|
-
export { i as AdoptReport, B as BODY_CORRECTION_TAU_MS, j as BODY_EXTRAPOLATE_BACK_TICKS, k as BODY_EXTRAPOLATE_MAX_MS, l as BODY_SNAP_METRES, m as BodyDrawing, n as BodyFields, o as BodyPose, p as BodyQuantization, q as BodySnap, r as BodyState, s as CONTACT_FIELDS, t as ContactField, D as DrawClock, u as DrawHandoff, v as DrawQuat, w as DrawVec3, H as HOST_BODY_FIELDS, I as ISLAND_MARGIN_METRES, x as IslandBody, K as KeyframeBody, y as KeyframeJoint, z as KeyframeOutside, E as KeyframeSeat, O as OwnPoseOf, F as PHYSICS_BODY_FIELDS, G as PHYSICS_CEILING_FACTOR, J as PHYSICS_CONTESTED_METRES, L as PHYSICS_CONTRACT, M as PHYSICS_DEFAULT_CEILING, N as PHYSICS_DEFAULT_LIMITS, Q as PHYSICS_DEFAULT_PATCH_HZ, S as PHYSICS_FULL_RATE_BODIES, T as PHYSICS_KEY_MAX_BYTES, U as PHYSICS_KIND_MAX_BYTES, V as PHYSICS_LIMIT_NAMES, W as PHYSICS_OVERLAP_MAX_KEYS, X as PHYSICS_PATCH_HZ, Y as PHYSICS_PREDICT_MAX_ANGULAR, Z as
|
|
7
|
-
import { b as
|
|
8
|
-
export {
|
|
5
|
+
import { T as TickHz, E as EntityData, J as Json, R as ResolvedModuleConfig, P as PlayerInfo, L as LeaveReason, I as InputData, a as PhysicsErrorCode, b as InputRepeat, c as LiftVec, C as ContactPolicy, d as Lift, e as LiftsPolicy, f as RemotePredict, S as StandRule, g as TopRule, h as PropSlide, i as ContactDrawing } from '../module-CSpXrzFc.js';
|
|
6
|
+
export { A as AuthorityLifetime, j as CONTACT_DEFAULTS, k as CONTACT_PAIRS_MAX, l as CONTACT_PASSES_MAX, m as CONTACT_PRESETS, n as CONTACT_TAG_MAX, o as CONTACT_VALUE_MAX, p as ContactConfigError, q as ContactDeclaration, r as ContactPreset, s as ContactPresetParams, t as ContactPush, u as ContactShape, v as ContactShapeKind, w as EntityApi, x as EntityInit, G as GenexRoomModule, H as HeadFriction, y as INPUTS_DEFAULT, z as INPUT_PRESETS, B as INPUT_SETTLE_MS, D as InitContext, F as InputConfigError, K as InputDeclaration, M as InputPolicy, N as LIFETIME_DEFAULT, O as LIFTS_MAX, Q as LIFT_ID_MAX, U as LIFT_POINTS_MAX, V as LIFT_SPIN_MIN_PERIOD, W as LIFT_TICKS_MAX, X as LIFT_VALUE_MAX, Y as LifetimeConfigError, Z as LifetimeDeclaration, _ as LifetimePolicy, $ as LiftEase, a0 as LiftImpart, a1 as LiftPath, a2 as LiftPathMode, a3 as LiftShape, a4 as LiftShapeKind, a5 as LiftSpin, a6 as LiftTooFast, a7 as LiftsApi, a8 as LiftsConfigError, a9 as MODULE_CONTRACT, aa as ModuleConfig, ab as NO_LIFTS, ac as PairRule, ad as PhysicsAnswer, ae as PhysicsApi, af as PhysicsBodyDesc, ag as PhysicsBodyState, ah as PhysicsBodyType, ai as PhysicsColliderDesc, aj as PhysicsCommandResult, ak as PhysicsCommands, 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, ay as PresetSpec, az as ProjectileApi, aA as ProjectileField, aB as ProjectileFlight, aC as ProjectileHit, aD as ProjectileInit, aE as Quat, aF as ResolvedPhysics, aG as RewindApi, aH as RewoundPose, aI as RoomContext, aJ as SHOOTER_CENTER, aK as ShotWorldSpec, aL as SlideRule, aM as TopPolicy, aN as Vec3, aO as WorldApi, aP as WorldClaim, aQ as WorldClaimOptions, aR as WorldRayHit, aS as WorldRayOptions, aT as defineRoom, aU as isLiftId, aV as presetInputRepeat, aW as resolveContactConfig, aX as resolveInputConfig, aY as resolveLifetime, aZ as resolveLifts } from '../module-CSpXrzFc.js';
|
|
7
|
+
import { P as PhysicsCeiling, a as PhysEvRow, b as PhysAnswerRow, c as PhysBodyRow, d as PredictStatus, C as ContactBody, R as RemoteInput, A as AuthorityContactRule, e as AuthoritySeatRule, f as PredictCore, g as PredictBodyRule, h as PredictKinematicRule } from '../physics-predict-C7ZB1gDG.js';
|
|
8
|
+
export { i as AdoptReport, B as BODY_CORRECTION_TAU_MS, j as BODY_EXTRAPOLATE_BACK_TICKS, k as BODY_EXTRAPOLATE_MAX_MS, l as BODY_SNAP_METRES, m as BodyDrawing, n as BodyFields, o as BodyPose, p as BodyQuantization, q as BodySnap, r as BodyState, s as CONTACT_FIELDS, t as ContactField, D as DrawClock, u as DrawHandoff, v as DrawQuat, w as DrawVec3, H as HOST_BODY_FIELDS, I as ISLAND_MARGIN_METRES, x as IslandBody, K as KeyframeBody, y as KeyframeJoint, z as KeyframeOutside, E as KeyframeSeat, O as OwnPoseOf, F as PHYSICS_BODY_FIELDS, G as PHYSICS_CEILING_FACTOR, J as PHYSICS_CONTESTED_METRES, L as PHYSICS_CONTRACT, M as PHYSICS_DEFAULT_CEILING, N as PHYSICS_DEFAULT_LIMITS, Q as PHYSICS_DEFAULT_PATCH_HZ, S as PHYSICS_FULL_RATE_BODIES, T as PHYSICS_KEY_MAX_BYTES, U as PHYSICS_KIND_MAX_BYTES, V as PHYSICS_LIMIT_NAMES, W as PHYSICS_OVERLAP_MAX_KEYS, X as PHYSICS_PATCH_HZ, Y as PHYSICS_PREDICT_MAX_ANGULAR, Z as PHYSICS_PREDICT_MAX_BOXES, _ as PHYSICS_PREDICT_MAX_LINEAR, $ as PHYSICS_PREDICT_MAX_RAMPS, a0 as PHYSICS_PREDICT_MIN_ITERATIONS, a1 as PHYSICS_PRESET_LENGTH_UNITS, a2 as PHYSICS_REAL_LIMITS, a3 as PHYSICS_ROTATING_BODIES, a4 as PHYSICS_SCALED_LIMITS, a5 as PHYSICS_SHAPES_MAX, a6 as PHYSICS_SHAPE_MAX_CHARS, a7 as PHYSICS_STATIC_PIECE_BYTES, a8 as PHYSICS_STATIC_PREFIX, a9 as PHYSICS_SUBSTEPS, aa as PHYS_BUDGET_CALM_SHARE, ab as PHYS_BUDGET_MIN_SAMPLES, ac as PHYS_BUDGET_P90_FACTOR, ad as PHYS_BUDGET_WINDOW, ae as PHYS_CANARY_MAX_MISMATCH, af as PHYS_CANARY_MIN_SAMPLES, ag as PHYS_CANARY_WINDOW, ah as PHYS_CPU_CALM_PROBES, ai as PHYS_CPU_PROBE_MS, aj as PHYS_PREDICT_HASHES_KEPT, ak as PHYS_PREDICT_SET_SIZES, al as PHYS_RESIM_BUDGET_MS, am as PairPush, an as PhysDesc, ao as PhysDescPredict, ap as PhysEvContactBegin, aq as PhysEvKind, ar as PhysEvOther, as as PhysHitRow, at as PhysOverlapRow, au as PhysicsBodyField, av as PhysicsConfigRange, aw as PhysicsPredictRange, ax as PhysicsPredictor, ay as PhysicsResolution, az as PhysicsWorldDesc, aA as PredictKeyframe, aB as PredictLifts, aC as PredictResult, aD as PredictSmoothing, aE as PredictWorld, aF as PredictorOptions, aG as PresetBodyShape, aH as QuantizedRange, aI as RULED_SLEW, aJ as RULED_SNAP_TICKS, aK as RemoteStep, aL as RuleSeat, aM as RuleTick, aN as RuleVelocity, aO as SEAT_LIFT_MAX, aP as SEAT_PAIR_EASE, aQ as SEAT_ROUND_RATE, aR as SHAPE_REF_KINDS, aS as SeatContacts, aT as SeatSide, aU as WIRE_REST_MAX, aV as WIRE_ROW_STRIDE, aW as WireBodyState, aX as WireFields, aY as bodyRadiusOf, aZ as bodyStateOf, a_ as checkResolvedPhysics, a$ as clampedVelocity, b0 as correctionAt, b1 as correctionShare, b2 as correctionTauMs, b3 as decayedInput, b4 as dequantizeBodyValue, b5 as drawBody, b6 as effectivePatchHz, b7 as extrapolateBody, b8 as extrapolationSeconds, b9 as inlineShapes, ba as innerDtOf, bb as isPhysicsKey, bc as isPhysicsKind, bd as isPhysicsPatchHz, be as keyframeTicks, bf as liftOff, bg as motorText, bh as nextPredictSetSize, bi as parsePhysDesc, bj as physDescText, bk as physicsBudgetMs, bl as physicsCeilingValid, bm as physicsLimitsAt, bn as physicsLimitsForWorld, bo as physicsWorldDesc, bp as physicsWorldPredicts, bq as proximityIslands, br as quantizeBodyValue, bs as quatMul, bt as quatNormalize, bu as receiveBodyState, bv as remoteInputWeight, bw as resolvePhysicsConfig, bx as restStepsOf, by as ruledPoseAt, bz as sameBodyState, bA as seatPairKey, bB as seatRuleTick, bC as selfTestPredictCore, bD as separateAround, bE as separateDrawn, bF as separateSeats, bG as slerpFromIdentity, bH as snapMetresOf, bI as solverIterationsOf, bJ as wasmSimdSupported, bK as wireFieldsOf, bL as wireRowOfExport, bM as wireRowOfState, bN as writeWireRow } from '../physics-predict-C7ZB1gDG.js';
|
|
9
|
+
import { S as ShotWorldCount, W as WorldCostMeter, P as PresetName, H as HullBody, a as PosedSolid, b as HullOps, c as PosedWorld, F as FirstpersonWorld, d as FirstpersonWorldSpec } from '../shot-world-D22tqOUT.js';
|
|
10
|
+
export { C as ClaimVerdict, E as EMPTY_WORLD, e as EMPTY_WORLD_HASH, f as FIRSTPERSON_DEFAULTS, g as FirstpersonBody, h as FirstpersonInput, i as FirstpersonParams, j as FirstpersonStep, M as MoveState, N as NO_POSED, k as POSED_MAX, l as PRESETS, m as PRESET_MAX_DT_S, n as Preset, o as PresetBody, p as PresetDefinition, q as PresetField, r as PresetInput, s as PresetParamRange, t as ShotWorldCost, T as TOPDOWN_DEFAULTS, u as TREE_KEY_RADIX, v as TopdownBody, w as TopdownInput, x as TopdownParams, V as VEHICLE_DEFAULTS, y as VehicleBody, z as VehicleInput, A as VehicleParams, B as VehicleStep, D as WorldBox, G as WorldError, I as WorldKey, J as WorldLimits, K as WorldRamp, L as axisToClaim, O as claimToAxis, Q as definitionOf, R as firstpersonWorld, U as hullOps, X as isPresetName, Y as posedWorld, Z as presetParamsValid, _ as resolveFirstpersonParams, $ as resolvePresetParams, a0 as resolveTopdownParams, a1 as resolveVehicleParams, a2 as stepFirstperson, a3 as stepPreset, a4 as stepTopdown, a5 as stepVehicle, a6 as withWorldCostMeter, a7 as worldTreeOrder } from '../shot-world-D22tqOUT.js';
|
|
11
|
+
import { a as FastFallbackReason, F as FastSocketOpener } from '../fast-client--A88q0kk.js';
|
|
12
|
+
export { A as AcceptKind, c as AcceptOptions, d as AcceptResult, e as AcceptedInput, C as ClientRx, E as EntityMotion, f as FAST_ACK_EAGER_GAP_MS, g as FAST_ACK_EAGER_RECORDS, h as FAST_BIND_REV, i as FAST_CHALLENGE_JUMP, j as FAST_FRAME_GAP_MS, k as FAST_GAP_FILL_MS, l as FAST_HANDSHAKE_MS, m as FAST_KEEPALIVE_BIND_MS, n as FAST_KEEPALIVE_MS, o as FAST_KEY_BYTES, p as FAST_MAX_ACTIONS, q as FAST_MAX_DATAGRAM_BYTES, r as FAST_MAX_FRAGMENTS, s as FAST_MAX_RECORD_BYTES, t as FAST_OPEN_ROUND_TRIPS, u as FAST_REASSEMBLY_SLOTS, v as FAST_RETRY_BASE_MS, w as FAST_RETRY_MAX_MS, x as FAST_RETURN_PROOF, y as FAST_RETURN_STABLE_MS, z as FAST_SEQ_AHEAD_MS, B as FAST_SNAPSHOT_HISTORY, D as FAST_STALL_FALLBACK_MS, G as FAST_VERSION, b as FastBindMessage, H as FastBinding, I as FastClient, J as FastClientOptions, K as FastDatagramSocket, L as FastFault, M as FastInput, N as FastKind, O as FastMessage, P as FastOffMessage, Q as FastOnMessage, R as FastReceipt, S as FastResult, T as FastSnapshot, U as FastWebTransport, V as Fragment, W as HeldSnapshot, X as INPUT_REDUNDANCY_MAX, Y as INPUT_REDUNDANCY_MIN, Z as INPUT_REDUNDANCY_MS, _ as MotionRecord, $ as MotionRecordKind, a0 as PartialSnapshot, a1 as RECORD_ID_MAX_CHARS, a2 as ReceiveResult, a3 as Records, a4 as SeatEcho, a5 as SeatRx, a6 as SnapshotBody, a7 as SnapshotHead, a8 as Uplink, a9 as UplinkOptions, aa as acceptUplink, ab as applyBody, ac as blankEntityMotion, ad as blankSeatEcho, ae as decodeFragment, af as decodeRecord, ag as decodeUplink, ah as deltaBase, ai as dequantizeCode, aj as diffSnapshot, ak as emptyClientRx, al as encodeRecord, am as encodeSnapshot, an as encodeUplink, ao as fastRetryDelayMs, ap as fromHex, aq as gapFillMax, ar as heldInputs, as as inputRedundancyTicks, at as isFastBind, au as isPress, av as openFastClient, aw as parseBody, ax as quantizeCode, ay as receiveFragment, az as renderStamp, aA as seqAheadMax, aB as toHex, aC as uplinkFor, aD as uplinkMaxBytes } from '../fast-client--A88q0kk.js';
|
|
9
13
|
import { A as AuthSource } from '../join-CGoInvUM.js';
|
|
10
14
|
|
|
11
15
|
/** The Colyseus view tag on an entity's motion fields in a physics room's state (PROTOCOL.md §17.12
|
|
@@ -315,6 +319,7 @@ declare const AuthorityRoomState: _colyseus_schema.SchemaWithExtendsConstructor<
|
|
|
315
319
|
motor: string;
|
|
316
320
|
} & {} & _colyseus_schema.Schema<any> & _colyseus_schema.Schema<unknown>, string> | undefined, true, true>;
|
|
317
321
|
lifts: _colyseus_schema.FieldBuilder<string | undefined, false, true>;
|
|
322
|
+
matchKey: _colyseus_schema.FieldBuilder<string | undefined, false, true>;
|
|
318
323
|
}, _colyseus_schema.BuilderInitProps<{
|
|
319
324
|
players: _colyseus_schema.FieldBuilder<_colyseus_schema.MapSchema<{
|
|
320
325
|
name: string;
|
|
@@ -395,6 +400,7 @@ declare const AuthorityRoomState: _colyseus_schema.SchemaWithExtendsConstructor<
|
|
|
395
400
|
motor: string;
|
|
396
401
|
} & {} & _colyseus_schema.Schema<any> & _colyseus_schema.Schema<unknown>, string> | undefined, true, true>;
|
|
397
402
|
lifts: _colyseus_schema.FieldBuilder<string | undefined, false, true>;
|
|
403
|
+
matchKey: _colyseus_schema.FieldBuilder<string | undefined, false, true>;
|
|
398
404
|
}>, typeof _colyseus_schema.Schema>;
|
|
399
405
|
type AuthorityRoomState = SchemaType<typeof AuthorityRoomState>;
|
|
400
406
|
declare const AuthorityPhysicsRoomState: _colyseus_schema.SchemaWithExtendsConstructor<{
|
|
@@ -477,6 +483,7 @@ declare const AuthorityPhysicsRoomState: _colyseus_schema.SchemaWithExtendsConst
|
|
|
477
483
|
motor: string;
|
|
478
484
|
} & {} & _colyseus_schema.Schema<any> & _colyseus_schema.Schema<unknown>, string> | undefined, true, true>;
|
|
479
485
|
lifts: _colyseus_schema.FieldBuilder<string | undefined, false, true>;
|
|
486
|
+
matchKey: _colyseus_schema.FieldBuilder<string | undefined, false, true>;
|
|
480
487
|
}, _colyseus_schema.BuilderInitProps<{
|
|
481
488
|
entities: _colyseus_schema.FieldBuilder<_colyseus_schema.MapSchema<{
|
|
482
489
|
kind: string;
|
|
@@ -557,6 +564,7 @@ declare const AuthorityPhysicsRoomState: _colyseus_schema.SchemaWithExtendsConst
|
|
|
557
564
|
motor: string;
|
|
558
565
|
} & {} & _colyseus_schema.Schema<any> & _colyseus_schema.Schema<unknown>, string> | undefined, true, true>;
|
|
559
566
|
lifts: _colyseus_schema.FieldBuilder<string | undefined, false, true>;
|
|
567
|
+
matchKey: _colyseus_schema.FieldBuilder<string | undefined, false, true>;
|
|
560
568
|
}>, typeof _colyseus_schema.Schema>;
|
|
561
569
|
type AuthorityPhysicsRoomState = SchemaType<typeof AuthorityPhysicsRoomState>;
|
|
562
570
|
|
|
@@ -566,11 +574,15 @@ declare const GuestGlobal: {
|
|
|
566
574
|
readonly TICK: "__genex_tick";
|
|
567
575
|
/** A physics room's static world, called once after init (§17.10 *The static world*). */
|
|
568
576
|
readonly WORLD: "__genex_world";
|
|
577
|
+
/** The room's hand-off at the end of a drain (PROTOCOL.md §17.13), called once. */
|
|
578
|
+
readonly HANDOFF: "__genex_handoff";
|
|
569
579
|
};
|
|
570
580
|
/** Wire limits. Sizes are JS string lengths (UTF-16 code units), as everywhere in the protocol. */
|
|
571
581
|
declare const AuthorityLimits: {
|
|
572
582
|
/** Entities one tick may update, and separately remove. */
|
|
573
583
|
readonly MAX_ENTITIES: 256;
|
|
584
|
+
/** A room's hand-off (`onDrain`, PROTOCOL.md §17.13) as JSON text. Over it the successor starts clean. */
|
|
585
|
+
readonly MAX_HANDOFF_CHARS: number;
|
|
574
586
|
/** Entities one room may hold at once. The room state lives on the host, outside the sandbox's
|
|
575
587
|
* memory limit, so this cap is what bounds it (and every client's patches). */
|
|
576
588
|
readonly MAX_ROOM_ENTITIES: 1024;
|
|
@@ -613,8 +625,12 @@ declare const AuthorityLimits: {
|
|
|
613
625
|
readonly MAX_PHYS_COMMANDS: 256;
|
|
614
626
|
readonly MAX_PHYS_BYTES: number;
|
|
615
627
|
readonly MAX_PHYSICS_OUTPUT_BYTES: number;
|
|
616
|
-
/**
|
|
617
|
-
|
|
628
|
+
/** The most a physics room's static world holds (§17.10 *The static world*): §17.7's caps, so any world a
|
|
629
|
+
* module may carry has its physics core. `limits.staticPieces` follows a world past its default. */
|
|
630
|
+
readonly MAX_PHYSICS_WORLD_BOXES: 32768;
|
|
631
|
+
readonly MAX_PHYSICS_WORLD_RAMPS: 4096;
|
|
632
|
+
/** `__genex_world()`'s text: base64 of the largest such world, 4 · ⌈(8 + 24 · 32768 + 36 · 4096) / 3⌉. */
|
|
633
|
+
readonly MAX_WORLD_TEXT_CHARS: 1245196;
|
|
618
634
|
};
|
|
619
635
|
/** Every tick rate a module may ask for; 120 only with physics (§17.11). */
|
|
620
636
|
declare const TICK_RATES: readonly TickHz[];
|
|
@@ -639,6 +655,8 @@ declare const TickOutFault: {
|
|
|
639
655
|
readonly TOO_MANY_EVENTS: "too_many_events";
|
|
640
656
|
readonly RESERVED_EVENT: "reserved_event";
|
|
641
657
|
readonly BAD_CONFIG: "bad_config";
|
|
658
|
+
/** The module's maps leave a room without a shot world (§17.7 *The shot world*). */
|
|
659
|
+
readonly NO_SHOT_WORLD: "no_shot_world";
|
|
642
660
|
/** More `phys` commands than MAX_PHYS_COMMANDS, or more `physQ` queries than `queriesPerStep`. */
|
|
643
661
|
readonly TOO_MANY_COMMANDS: "too_many_commands";
|
|
644
662
|
};
|
|
@@ -665,7 +683,9 @@ type InputUse = (typeof InputUse)[keyof typeof InputUse];
|
|
|
665
683
|
* fed to the module; `cseq` is the input's CLIENT sequence (Colyseus's `ackSeq` once the host has
|
|
666
684
|
* consumed it: the seat's inputs counted from 1, the number a client keys a predicted projectile
|
|
667
685
|
* by, §17.9). `seen` is the sender's lag-comp snapshot: entity id → [x, y, z] as that player saw it
|
|
668
|
-
* (present only for inputs that match `lagComp.buttons`). `
|
|
686
|
+
* (present only for inputs that match `lagComp.buttons`). `seenPose` rides beside it: entity id →
|
|
687
|
+
* [yaw, duck] as that player saw it, for the entities that faced or ducked otherwise than they do
|
|
688
|
+
* now (`ctx.rewind.pose`); a snapshot without it reads every entity's as the tick began. `use` is how the tick uses it
|
|
669
689
|
* ({@link InputUse}; absent = `step`): a repeat carries the seat's last real input with that
|
|
670
690
|
* input's `seq` and `cseq`, never a `seen`. */
|
|
671
691
|
interface TickInput {
|
|
@@ -674,6 +694,7 @@ interface TickInput {
|
|
|
674
694
|
cseq: number;
|
|
675
695
|
i: InputData;
|
|
676
696
|
seen?: Record<string, [number, number, number]>;
|
|
697
|
+
seenPose?: Record<string, [number, number]>;
|
|
677
698
|
use?: InputUse;
|
|
678
699
|
/** How many ticks later than its client meant the input is applied (negative: earlier), when its
|
|
679
700
|
* seat sends `tick@1` and the two differ (§17.11 *The input's tick*); absent: 0. */
|
|
@@ -740,6 +761,12 @@ interface TickOut {
|
|
|
740
761
|
* physics room's carries `phys` (applied at load) and never `physQ`. */
|
|
741
762
|
interface InitOut extends TickOut {
|
|
742
763
|
config: ResolvedModuleConfig;
|
|
764
|
+
/** The names of the module's `worlds` map (§17.2 *Choosing a room*), when it has one. */
|
|
765
|
+
worlds?: string[];
|
|
766
|
+
/** What the load counted of the module's shot world (§17.7 *The shot world*), when it has one. */
|
|
767
|
+
shotWorld?: ShotWorldCount;
|
|
768
|
+
/** How the module's maps leave a room without a shot world: the validator refuses it as `no_shot_world`. */
|
|
769
|
+
noShotWorld?: string;
|
|
743
770
|
}
|
|
744
771
|
/** What the host passes `validateTickOut` in a physics room. */
|
|
745
772
|
interface PhysicsTickIndex {
|
|
@@ -784,10 +811,6 @@ declare function sanitizeInput(raw: Record<string, unknown>): InputData;
|
|
|
784
811
|
* room, §17.10) it reads `phys` and `physQ` and the body-entity rules; without, those keys are
|
|
785
812
|
* unknown and dropped. */
|
|
786
813
|
declare function validateTickOut(raw: unknown, room?: EntityIndex, physics?: PhysicsTickIndex): WireResult<TickOut>;
|
|
787
|
-
/** Validates the `__genex_init` result: every TickOut rule plus a well-formed resolved config.
|
|
788
|
-
* `physics`: the room was admitted with physics (its ceiling); the resolved config must then ask
|
|
789
|
-
* for physics within it, its `phys` is read and a `physQ` refused. Without it, a config that asks
|
|
790
|
-
* for physics is a bad config. */
|
|
791
814
|
declare function validateInitOut(raw: unknown, physics?: PhysicsAdmission): WireResult<InitOut>;
|
|
792
815
|
|
|
793
816
|
/** Repeats owed at most, as time (shared/duration units: ms); {@link repeatMaxTicks} in ticks. */
|
|
@@ -933,6 +956,112 @@ declare function seatLeadClock(stepped: number, drawn: number, t: InputThrottle,
|
|
|
933
956
|
* real time at a time, each input sent once half of its step has been paid. */
|
|
934
957
|
declare function throttleSteps(t: InputThrottle, dtMs: number, stepMs: number): number;
|
|
935
958
|
|
|
959
|
+
/** The walk, and what it may cost. */
|
|
960
|
+
declare const WorldCost: {
|
|
961
|
+
/** What a step may average, in weighted operations: below the least count of any world that ended a room, ten seats on a c2-standard-4
|
|
962
|
+
* (micro 8,192 at 5,318, one run of two: integration cw/vm1). A warning to a creator, and a coarse one: bodies are walked from seeded
|
|
963
|
+
* solids, so a world that holds its cost where its module really spawns seats reads low (a cell 2.5 times, dense tiles 3), and one built to
|
|
964
|
+
* dodge the walk reads nothing. The sandbox's mean budget and CPU limits are what protect a host. */
|
|
965
|
+
readonly MAX_OPS_PER_STEP: 5000;
|
|
966
|
+
/** What each kind of operation costs against a tree entry, c2-standard-4, offline: an entry 4.9 ns, an exact test 36, a wedge's sweep test
|
|
967
|
+
* 382. A slab's sweep test has no weight of its own: it comes with exact tests in every world measured, three to one. */
|
|
968
|
+
readonly TEST_WEIGHT: 7;
|
|
969
|
+
readonly WEDGE_WEIGHT: 78;
|
|
970
|
+
/** The seats {@link WorldCost.MAX_OPS_PER_STEP} is sized for. */
|
|
971
|
+
readonly SEATS: 10;
|
|
972
|
+
/** Bodies walking, and the ticks each walks. */
|
|
973
|
+
readonly WALKERS: 16;
|
|
974
|
+
readonly TICKS: 120;
|
|
975
|
+
readonly SEED: 2026;
|
|
976
|
+
/** The step's dt: 30 Hz, the rate most rooms run. */
|
|
977
|
+
readonly DT: number;
|
|
978
|
+
/** Where a body starts above the top of the solid it is dropped on. */
|
|
979
|
+
readonly DROP: 1;
|
|
980
|
+
/** A body's chance a tick to turn, jump and duck. */
|
|
981
|
+
readonly TURN_CHANCE: 0.03;
|
|
982
|
+
readonly JUMP_CHANCE: 0.04;
|
|
983
|
+
readonly DUCK_CHANCE: 0.05;
|
|
984
|
+
};
|
|
985
|
+
/** What {@link worldCost} counted. */
|
|
986
|
+
interface WorldCostReport extends WorldCostMeter {
|
|
987
|
+
solids: number;
|
|
988
|
+
/** Steps walked. */
|
|
989
|
+
steps: number;
|
|
990
|
+
/** The operations, weighted by kind, a step on average, rounded down. */
|
|
991
|
+
opsPerStep: number;
|
|
992
|
+
/** Whether `opsPerStep` is within {@link WorldCost.MAX_OPS_PER_STEP}. */
|
|
993
|
+
accepted: boolean;
|
|
994
|
+
}
|
|
995
|
+
/**
|
|
996
|
+
* The cost of `spec` to a room of `preset` (firstperson's or vehicle's), with `params` as the module gives
|
|
997
|
+
* them. Bodies start on seeded solids, so a world cannot hide its dense part behind where it says bodies
|
|
998
|
+
* spawn, and a solid is as likely a start as any: where a bake spent its solids is where the bodies are.
|
|
999
|
+
*/
|
|
1000
|
+
declare function worldCost(spec: unknown, preset?: PresetName, params?: unknown): WorldCostReport;
|
|
1001
|
+
|
|
1002
|
+
/** The bounds of §17.2 *Choosing a room*. */
|
|
1003
|
+
declare const AuthorityRoomLimits: {
|
|
1004
|
+
/** A match key's longest length. */
|
|
1005
|
+
readonly MAX_MATCH_KEY_CHARS: 32;
|
|
1006
|
+
/** A room code's longest length (Colyseus's room ids are 9). */
|
|
1007
|
+
readonly MAX_CODE_CHARS: 32;
|
|
1008
|
+
/** The most named worlds one module's `worlds` map may hold. */
|
|
1009
|
+
readonly MAX_WORLDS: 16;
|
|
1010
|
+
};
|
|
1011
|
+
/** Whether `value` is a match key: 1 to 32 characters of a-z 0-9 . _ : -, a letter or digit first. */
|
|
1012
|
+
declare function validMatchKey(value: unknown): value is string;
|
|
1013
|
+
/** Whether `value` is a room code: 1 to 32 characters of A-Z a-z 0-9 _ -. A code goes into a url. */
|
|
1014
|
+
declare function validRoomCode(value: unknown): value is string;
|
|
1015
|
+
/** A join's `matchKey` option as the pool it names: '' for no key (absent or empty), null when it is
|
|
1016
|
+
* malformed (refused with 400). */
|
|
1017
|
+
declare function matchKeyOf(value: unknown): string | null;
|
|
1018
|
+
/** The ways into an authority room, by the Colyseus call that makes them. */
|
|
1019
|
+
declare const AuthorityJoinMethod: {
|
|
1020
|
+
readonly JoinOrCreate: "joinOrCreate";
|
|
1021
|
+
readonly Create: "create";
|
|
1022
|
+
readonly JoinById: "joinById";
|
|
1023
|
+
};
|
|
1024
|
+
type AuthorityJoinMethod = (typeof AuthorityJoinMethod)[keyof typeof AuthorityJoinMethod];
|
|
1025
|
+
/** Why a client refuses a target before anything reaches the network. */
|
|
1026
|
+
declare const AuthorityTargetRefusal: {
|
|
1027
|
+
readonly BadMatchKey: "bad_match_key";
|
|
1028
|
+
readonly BadCode: "bad_code";
|
|
1029
|
+
readonly Conflict: "conflict";
|
|
1030
|
+
};
|
|
1031
|
+
type AuthorityTargetRefusal = (typeof AuthorityTargetRefusal)[keyof typeof AuthorityTargetRefusal];
|
|
1032
|
+
/** Which room a client asks for: a pool (`matchKey`), a new private room, or a room by its code. */
|
|
1033
|
+
interface AuthorityRoomTarget {
|
|
1034
|
+
/** The pool to join, or the key of the private room to create. */
|
|
1035
|
+
matchKey?: string;
|
|
1036
|
+
/** Create a private room. */
|
|
1037
|
+
createPrivate?: boolean;
|
|
1038
|
+
/** Join the room with this code. */
|
|
1039
|
+
code?: string;
|
|
1040
|
+
}
|
|
1041
|
+
/** The Colyseus call a target makes, and the options it adds to the join's own. */
|
|
1042
|
+
type AuthorityJoinPlan = {
|
|
1043
|
+
method: AuthorityJoinMethod;
|
|
1044
|
+
roomId?: string;
|
|
1045
|
+
options: {
|
|
1046
|
+
matchKey?: string;
|
|
1047
|
+
private?: true;
|
|
1048
|
+
successorOf?: string;
|
|
1049
|
+
successorClosed?: true;
|
|
1050
|
+
};
|
|
1051
|
+
} | {
|
|
1052
|
+
refused: AuthorityTargetRefusal;
|
|
1053
|
+
};
|
|
1054
|
+
/** What `target` sends. Nothing asked sends nothing new, so a game that names no room joins as it
|
|
1055
|
+
* always has. A code names one room, whose key is its own: a key or a create beside it is a mistake. */
|
|
1056
|
+
declare function planAuthorityJoin(target: AuthorityRoomTarget): AuthorityJoinPlan;
|
|
1057
|
+
/** The region a join by code tries after refusal `error` on region `region` of `regions`, or null
|
|
1058
|
+
* when the refusal is final: only another region can hold a room this one refused as elsewhere. */
|
|
1059
|
+
declare function nextCodeRegion(error: unknown, region: number, regions: number): number | null;
|
|
1060
|
+
/** The world a room with match key `key` runs, as the sandbox picks it: the `worlds` entry the key
|
|
1061
|
+
* names, else `world` (absent: the empty world). A client calls this with the module's own map and
|
|
1062
|
+
* hands the result to `setWorld`, so its hash is the room's and prediction runs. */
|
|
1063
|
+
declare function selectMatchWorld<W>(worlds: Readonly<Record<string, W>> | undefined, world: W | undefined, key: string): W | undefined;
|
|
1064
|
+
|
|
936
1065
|
/** What `physicsPrediction` reports. */
|
|
937
1066
|
interface PhysicsPredictionStatus {
|
|
938
1067
|
status: PredictStatus;
|
|
@@ -999,23 +1128,26 @@ declare function tickInstant(tick: number, tickOrigin: number, tickHz: number):
|
|
|
999
1128
|
type V3 = readonly [number, number, number];
|
|
1000
1129
|
/** One face of a grown solid: a point p is inside it when `n · p < e` (n of unit length). */
|
|
1001
1130
|
type Plane = readonly [number, number, number, number];
|
|
1002
|
-
/**
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
/** A world compiled for one hull: every solid grown by it, and the clearance kept from a surface. */
|
|
1131
|
+
/**
|
|
1132
|
+
* A world compiled for one hull: every solid grown by it, and the clearance kept from a surface. Flat, so a
|
|
1133
|
+
* large world costs its numbers and no objects: `bounds` holds each solid's six (the grown footprint and
|
|
1134
|
+
* height: min x y z, max x y z; a ramp's box is its bound), boxes first. A box's six planes follow from
|
|
1135
|
+
* its bounds (see {@link planeInto}); a ramp's seven are in `rampPlanes`, four numbers each, the bottom last.
|
|
1136
|
+
*/
|
|
1009
1137
|
interface ContactWorld {
|
|
1010
|
-
|
|
1138
|
+
/** Solids, and how many of them are boxes. */
|
|
1139
|
+
readonly count: number;
|
|
1140
|
+
readonly boxCount: number;
|
|
1141
|
+
readonly bounds: Float64Array;
|
|
1142
|
+
readonly rampPlanes: Float64Array;
|
|
1011
1143
|
/** A point is inside a solid only when it is more than this inside every plane (the preset's skin). */
|
|
1012
1144
|
readonly skin: number;
|
|
1013
|
-
/** The solids by where they stand (compileContactWorld's; none: a
|
|
1145
|
+
/** The solids by where they stand (compileContactWorld's; none: a query visits every solid). */
|
|
1014
1146
|
readonly grid?: SolidGrid;
|
|
1015
1147
|
}
|
|
1016
1148
|
/**
|
|
1017
|
-
* A compiled world's solids on an x/y grid, so a cast visits the solids whose footprint
|
|
1018
|
-
* rather than every one (a dust2 map's 1500, about 0.5 ms a cast in QuickJS): cell (i, j) covers
|
|
1149
|
+
* A compiled world's solids on an x/y grid, so a cast or a point query visits the solids whose footprint
|
|
1150
|
+
* it can reach rather than every one (a dust2 map's 1500, about 0.5 ms a cast in QuickJS): cell (i, j) covers
|
|
1019
1151
|
* [x0 + i·size, x0 + (i + 1)·size) on x (the edge cells reach on to the world's ends), and holds every
|
|
1020
1152
|
* solid whose bounds grown by castWorld's margin meet it, ascending; a solid on more than GRID_WIDE
|
|
1021
1153
|
* cells is on `wide` alone, which every query visits. Only where a cast visits solids changes, never
|
|
@@ -1027,10 +1159,14 @@ interface SolidGrid {
|
|
|
1027
1159
|
readonly size: number;
|
|
1028
1160
|
readonly nx: number;
|
|
1029
1161
|
readonly ny: number;
|
|
1030
|
-
/** Cell (i, j)
|
|
1031
|
-
|
|
1162
|
+
/** Cell (i, j) is c = i + j·nx: its solids' indices are `cellSolids` from `cellStart[c]` up to
|
|
1163
|
+
* `cellStart[c + 1]`, ascending. */
|
|
1164
|
+
readonly cellStart: Int32Array;
|
|
1165
|
+
readonly cellSolids: Int32Array;
|
|
1032
1166
|
/** The solids too wide for the cells (a floor, a map-long wall), ascending. */
|
|
1033
|
-
readonly wide:
|
|
1167
|
+
readonly wide: Int32Array;
|
|
1168
|
+
/** Each cell's solids and the wide ones as one list, kept once a query has asked for it: most queries are one cell's, and ask again. */
|
|
1169
|
+
readonly merged: (ArrayLike<number> | undefined)[];
|
|
1034
1170
|
}
|
|
1035
1171
|
/** A static world as a module gives it (§17.7): boxes `[x0 y0 z0 x1 y1 z1]`, then ramps
|
|
1036
1172
|
* `[x0 y0 z0 x1 y1 z1 axis lo hi]`. */
|
|
@@ -1667,6 +1803,13 @@ interface ContactEnv {
|
|
|
1667
1803
|
/** The id of a seat that never moves (a drawing's own entity, §17.11 *Drawing other seats*): the
|
|
1668
1804
|
* other seat of its pair takes the whole push, its own way (along a wall, never into it). */
|
|
1669
1805
|
readonly fixed?: string;
|
|
1806
|
+
/** A pass's memo of each seat's support up (see {@link contactPass}), by the place it was read at. */
|
|
1807
|
+
readonly supports?: Map<PolicyBody, {
|
|
1808
|
+
x: number;
|
|
1809
|
+
y: number;
|
|
1810
|
+
z: number;
|
|
1811
|
+
up: V3;
|
|
1812
|
+
}>;
|
|
1670
1813
|
}
|
|
1671
1814
|
/** One pair's contact: its kind, axis (unit, from `a` to `b`) and depth along it. */
|
|
1672
1815
|
interface PairContact {
|
|
@@ -1903,14 +2046,71 @@ declare const psin: (a: number) => number;
|
|
|
1903
2046
|
* angle, or one past ±1e9, is read as 0 (cosine 1). */
|
|
1904
2047
|
declare const pcos: (a: number) => number;
|
|
1905
2048
|
|
|
2049
|
+
/** Which transport a seat's motion and inputs are on. */
|
|
2050
|
+
declare const FastTransport: {
|
|
2051
|
+
readonly Udp: "udp";
|
|
2052
|
+
readonly WebSocket: "websocket";
|
|
2053
|
+
};
|
|
2054
|
+
type FastTransport = (typeof FastTransport)[keyof typeof FastTransport];
|
|
2055
|
+
/** Why a seat that never had the channel is on the WebSocket. A fallback's reason is `FastFallbackReason`. */
|
|
2056
|
+
declare const FastNotAsked: {
|
|
2057
|
+
/** The game turned it off (`fast: false`, `bFastChannel = false`, ...). */
|
|
2058
|
+
readonly Off: "off";
|
|
2059
|
+
/** This runtime has no UDP socket (WebGL, a browser with no opener). */
|
|
2060
|
+
readonly NoUdp: "no_udp";
|
|
2061
|
+
/** The seat asked and the room sent no binding. */
|
|
2062
|
+
readonly NotOffered: "not_offered";
|
|
2063
|
+
};
|
|
2064
|
+
type FastNotAsked = (typeof FastNotAsked)[keyof typeof FastNotAsked];
|
|
2065
|
+
/** How long after a socket's first state a seat waits for its binding before it says the room offered
|
|
2066
|
+
* none: the binding follows the state on one ordered stream, so any wait covers it; the handshake's. */
|
|
2067
|
+
declare const FAST_OFFER_WAIT_MS = 1000;
|
|
2068
|
+
/** The line for a seat on UDP to `url`. */
|
|
2069
|
+
declare const udpLine: (url: string) => string;
|
|
2070
|
+
/** The line for a seat on the WebSocket because of `reason` (a {@link FastNotAsked} or a fallback reason). */
|
|
2071
|
+
declare const webSocketLine: (reason: string) => string;
|
|
2072
|
+
/** What a seat knows of its channel at one instant. */
|
|
2073
|
+
interface FastLineObservation {
|
|
2074
|
+
/** The game left the channel on. */
|
|
2075
|
+
asked: boolean;
|
|
2076
|
+
/** This runtime has a UDP socket to open. */
|
|
2077
|
+
udp: boolean;
|
|
2078
|
+
/** Milliseconds since this socket's first state; null before it. */
|
|
2079
|
+
joinedMs: number | null;
|
|
2080
|
+
/** The binding's url; null before one came. */
|
|
2081
|
+
url: string | null;
|
|
2082
|
+
/** Snapshots applied on this socket. */
|
|
2083
|
+
snapshots: number;
|
|
2084
|
+
/** Why this socket fell back; null if it has not. */
|
|
2085
|
+
fallback: string | null;
|
|
2086
|
+
}
|
|
2087
|
+
/** Says each line once per socket. */
|
|
2088
|
+
interface FastLineAnnouncer {
|
|
2089
|
+
/** The line this instant owes, or null. */
|
|
2090
|
+
observe(o: FastLineObservation): string | null;
|
|
2091
|
+
/** A new socket: everything may be said again. */
|
|
2092
|
+
reset(): void;
|
|
2093
|
+
}
|
|
2094
|
+
/** A seat's announcer. */
|
|
2095
|
+
declare function fastLineAnnouncer(): FastLineAnnouncer;
|
|
2096
|
+
|
|
1906
2097
|
/** What the session reads of a seat's fast channel. */
|
|
1907
2098
|
interface FastSeatStatus {
|
|
1908
2099
|
/** Snapshots are flowing and inputs go by datagram. */
|
|
1909
2100
|
readonly live: boolean;
|
|
1910
2101
|
/** Snapshots applied on this session. */
|
|
1911
2102
|
readonly snapshots: number;
|
|
1912
|
-
/** Why this
|
|
2103
|
+
/** Why this seat is on the WebSocket, else null (on the channel, connecting, or the game turned it
|
|
2104
|
+
* off): {@link FastFallbackReason}. */
|
|
1913
2105
|
readonly fallback: FastFallbackReason | null;
|
|
2106
|
+
/** Times this session fell back. */
|
|
2107
|
+
readonly fallbacks: number;
|
|
2108
|
+
/** Times this session came back to the channel after a fallback. */
|
|
2109
|
+
readonly returns: number;
|
|
2110
|
+
/** The transport as last said: UDP once a snapshot came over it, the WebSocket before that and after a fallback. */
|
|
2111
|
+
readonly transport: FastTransport;
|
|
2112
|
+
/** The newest transport line (fast-line.ts), once there is one: names the transport and why. */
|
|
2113
|
+
readonly line: string | null;
|
|
1914
2114
|
}
|
|
1915
2115
|
|
|
1916
2116
|
/** One latency sample of `url` in ms; rejects (or never settles) when the relay doesn't answer. */
|
|
@@ -1953,10 +2153,111 @@ declare function rankAuthorityRegions(regions: readonly AuthorityRegion[], best:
|
|
|
1953
2153
|
/** Every attempt of a join that every server refuses 503, over `regionCount` ranked regions and the
|
|
1954
2154
|
* capacity schedule `delays`: a prefix of it is the walk of a join that is seated. */
|
|
1955
2155
|
declare function capacityWalk(regionCount: number, delays: readonly number[]): CapacityAttempt[];
|
|
2156
|
+
/** What a refused join does next (§17.1 *Regions*). */
|
|
2157
|
+
declare const RefusalKind: {
|
|
2158
|
+
/** A full region, or a process shutting down that a sibling answers: the schedule, on this region. */
|
|
2159
|
+
readonly Capacity: "capacity";
|
|
2160
|
+
/** A dead path, with other regions healthy: the next region at once. */
|
|
2161
|
+
readonly NextRegion: "next_region";
|
|
2162
|
+
/** The server's answer: final. */
|
|
2163
|
+
readonly Final: "final";
|
|
2164
|
+
};
|
|
2165
|
+
type RefusalKind = (typeof RefusalKind)[keyof typeof RefusalKind];
|
|
2166
|
+
/** What a join refused with `code` does next; no number at all is a network that failed. */
|
|
2167
|
+
declare function refusalKind(code: unknown): RefusalKind;
|
|
1956
2168
|
/** Probes every region (relay-select.ts's tolerant samples, one url per sample) and answers the order
|
|
1957
2169
|
* to try them in. One region is not probed; none answers []. Never rejects on a probe. */
|
|
1958
2170
|
declare function selectAuthorityRegions(regions: readonly AuthorityRegion[], options?: RelaySelectOptions): Promise<AuthorityRegionPick[]>;
|
|
1959
2171
|
|
|
2172
|
+
/** The rejoin's schedule and windows, ms. */
|
|
2173
|
+
declare const REJOIN: {
|
|
2174
|
+
/** Waits before each attempt; past the end the last one repeats. */
|
|
2175
|
+
readonly scheduleMs: readonly [0, 250, 500, 1000, 2000, 4000];
|
|
2176
|
+
/** Each wait adds up to this much, by chance, so a room's seats do not arrive at once. */
|
|
2177
|
+
readonly jitterMs: 250;
|
|
2178
|
+
/** How long a seat keeps trying: long enough for a roll's next process to come up on a full node. */
|
|
2179
|
+
readonly budgetMs: 180000;
|
|
2180
|
+
/** How long a seat stays with its own region before it tries the next one. */
|
|
2181
|
+
readonly regionStayMs: 60000;
|
|
2182
|
+
/** How long a public seat looks for its room's successor before it joins the game's pool. */
|
|
2183
|
+
readonly successorMs: 90000;
|
|
2184
|
+
};
|
|
2185
|
+
/** How long a successor room stays closed to the game's pool. Longer than `REJOIN.successorMs`, so a
|
|
2186
|
+
* late seat of the lost room still reaches it; then it serves the pool like any room. */
|
|
2187
|
+
declare const SUCCESSOR_OPEN_MS = 120000;
|
|
2188
|
+
/** The ways back: the lost room by its id (a socket drop, where it may still live), its successor, or
|
|
2189
|
+
* the game's pool. */
|
|
2190
|
+
declare const RejoinWay: {
|
|
2191
|
+
readonly Room: "room";
|
|
2192
|
+
readonly Successor: "successor";
|
|
2193
|
+
readonly Pool: "pool";
|
|
2194
|
+
};
|
|
2195
|
+
type RejoinWay = (typeof RejoinWay)[keyof typeof RejoinWay];
|
|
2196
|
+
/** Why a rejoin stopped. */
|
|
2197
|
+
declare const RejoinStop: {
|
|
2198
|
+
readonly Final: "final";
|
|
2199
|
+
readonly Budget: "budget";
|
|
2200
|
+
};
|
|
2201
|
+
type RejoinStop = (typeof RejoinStop)[keyof typeof RejoinStop];
|
|
2202
|
+
/** What an attempt is decided from. */
|
|
2203
|
+
interface RejoinInput {
|
|
2204
|
+
/** Attempts already made. */
|
|
2205
|
+
attempt: number;
|
|
2206
|
+
/** Since the close. */
|
|
2207
|
+
elapsedMs: number;
|
|
2208
|
+
/** What the last attempt was refused with; null for none yet or a failed network. */
|
|
2209
|
+
refusal: number | null;
|
|
2210
|
+
/** The close that started this rejoin. */
|
|
2211
|
+
lostCode: number;
|
|
2212
|
+
/** The lost room was private: its seats keep to its successor. */
|
|
2213
|
+
closed: boolean;
|
|
2214
|
+
/** How many regions the client knows. */
|
|
2215
|
+
regions: number;
|
|
2216
|
+
/** A number in [0, 1): the attempt's share of the jitter window. */
|
|
2217
|
+
jitter: number;
|
|
2218
|
+
}
|
|
2219
|
+
type RejoinStep = {
|
|
2220
|
+
stop: RejoinStop;
|
|
2221
|
+
} | {
|
|
2222
|
+
waitMs: number;
|
|
2223
|
+
region: number;
|
|
2224
|
+
way: RejoinWay;
|
|
2225
|
+
};
|
|
2226
|
+
/** Whether a seat closed with `code` goes back into play by itself. */
|
|
2227
|
+
declare function comesBackAfter(code: number): boolean;
|
|
2228
|
+
/** The next attempt of a rejoin, or why there is none. */
|
|
2229
|
+
declare function rejoinStep(input: RejoinInput): RejoinStep;
|
|
2230
|
+
/** Whether `value` can name a lost room: a room code, so nothing else reaches a room filter. */
|
|
2231
|
+
declare function validSuccessorOf(value: unknown): value is string;
|
|
2232
|
+
/** The options a seat's successor join adds to the join's own. */
|
|
2233
|
+
declare function planSuccessorJoin(input: {
|
|
2234
|
+
lostRoomId: string;
|
|
2235
|
+
matchKey: string;
|
|
2236
|
+
closed: boolean;
|
|
2237
|
+
}): {
|
|
2238
|
+
matchKey?: string;
|
|
2239
|
+
successorOf: string;
|
|
2240
|
+
successorClosed?: true;
|
|
2241
|
+
};
|
|
2242
|
+
|
|
2243
|
+
/** `draining`: the server closes this room in `closesInMs`, -1 when an older server does not say. Play
|
|
2244
|
+
* on: the seat moves by itself at the close. */
|
|
2245
|
+
type AuthorityDraining = {
|
|
2246
|
+
closesInMs: number;
|
|
2247
|
+
};
|
|
2248
|
+
/** `rejoining`: the room is gone and attempt `attempt` (from 1) of finding the next one starts in
|
|
2249
|
+
* `waitMs`. `code` is the close that lost it. Show "reconnecting"; there is nothing to do. */
|
|
2250
|
+
type AuthorityRejoining = {
|
|
2251
|
+
attempt: number;
|
|
2252
|
+
code: number;
|
|
2253
|
+
waitMs: number;
|
|
2254
|
+
};
|
|
2255
|
+
/** `rejoined`: back in play, as a new seat in a new room (the invite `code` is new too). */
|
|
2256
|
+
type AuthorityRejoined = {
|
|
2257
|
+
code: string;
|
|
2258
|
+
url: string;
|
|
2259
|
+
};
|
|
2260
|
+
|
|
1960
2261
|
/** The own-entity fields a prediction step may read and write: the pose and velocity always, and
|
|
1961
2262
|
* firstperson's `pitch`, `duck`, `mstate` and `cap` and vehicle's `spin` and `fuel` when a step
|
|
1962
2263
|
* lists them in `fields`. */
|
|
@@ -2012,6 +2313,10 @@ type AuthorityConnectOptions = {
|
|
|
2012
2313
|
* can be drawn through it. Both `predicted` and `separate` keep every seat out of yours and out of
|
|
2013
2314
|
* each other on screen (`separateSeats`). */
|
|
2014
2315
|
seatDrawing?: SeatDrawing;
|
|
2316
|
+
/** The pool to join (§17.2 *Choosing a room*): players with one key share rooms, and the room module
|
|
2317
|
+
* reads it at init to choose a world or mode. At most 32 of a-z 0-9 . _ : -; absent: the game's one
|
|
2318
|
+
* pool. Give the world the key picks to `world` (`selectMatchWorld`). */
|
|
2319
|
+
matchKey?: string;
|
|
2015
2320
|
/** The `firstperson` or `vehicle` collision world, as the room module exports it (`setWorld` later, too):
|
|
2016
2321
|
* your own entity is predicted only while its hash equals the room's `params.world`. */
|
|
2017
2322
|
world?: FirstpersonWorldSpec | FirstpersonWorld;
|
|
@@ -2052,18 +2357,23 @@ type AuthorityConnectOptions = {
|
|
|
2052
2357
|
* and draws them as predicted bodies; omitted, they hold each keyframe's pose and are drawn from the
|
|
2053
2358
|
* server's states. */
|
|
2054
2359
|
kinematicRule?: PredictKinematicRule;
|
|
2055
|
-
/** The fast channel (PROTOCOL.md §17.12):
|
|
2056
|
-
*
|
|
2057
|
-
*
|
|
2058
|
-
*
|
|
2059
|
-
*
|
|
2060
|
-
fast?: FastSocketOpener;
|
|
2360
|
+
/** The fast channel (PROTOCOL.md §17.12): on by default wherever this runtime can reach it, UDP in Node and
|
|
2361
|
+
* WebTransport in a browser whose room's server runs the relay. Your inputs and the room's motion go by
|
|
2362
|
+
* datagram, everything else stays on the WebSocket, and the seat falls back to the WebSocket and returns by
|
|
2363
|
+
* itself (`session.fast` says when and why, and one line says so). An opener is the socket to use instead.
|
|
2364
|
+
* `false` keeps the seat on the WebSocket. */
|
|
2365
|
+
fast?: FastSocketOpener | false;
|
|
2366
|
+
/** Where the transport line goes (fast-line.ts). Default: stderr in Node, else `console.info`. */
|
|
2367
|
+
fastLog?: (line: string) => void;
|
|
2061
2368
|
/** The millisecond clock the fast channel's deadlines and round trips run on (default
|
|
2062
2369
|
* `performance.now`). */
|
|
2063
2370
|
fastClock?: () => number;
|
|
2064
2371
|
/** Waits before each retry of a join refused for capacity (503). Default 1 s, 2 s, 4 s; `[]` never
|
|
2065
2372
|
* retries. No other refusal is retried. */
|
|
2066
2373
|
capacityRetryMs?: readonly number[];
|
|
2374
|
+
/** Whether a seat whose room ended for a deploy, or whose socket no reconnect restored, goes back into
|
|
2375
|
+
* play by itself (§17.13 *Drain and rejoin*). Default true; false makes that close final. */
|
|
2376
|
+
rejoin?: boolean;
|
|
2067
2377
|
/** Every message the server sends, in order, by type: the room module's events and the server's
|
|
2068
2378
|
* own (`server:restart` before a drain), with no name withheld. For a facade that forwards them
|
|
2069
2379
|
* all, such as the engine bridge; a game subscribes with `on(type)`. */
|
|
@@ -2186,14 +2496,18 @@ type AuthorityTelemetry = {
|
|
|
2186
2496
|
inputsDropped: number;
|
|
2187
2497
|
/** Server acks the reconciler checked its prediction against. */
|
|
2188
2498
|
reconciles: number;
|
|
2189
|
-
/** Reconciles that moved the own entity by more than 0.05
|
|
2499
|
+
/** Reconciles that moved the own entity's place by more than 5 cm (0.05 × the room's units per metre). */
|
|
2190
2500
|
visibleCorrections: number;
|
|
2191
|
-
/** The visible corrections by size,
|
|
2192
|
-
* (
|
|
2501
|
+
/** The visible corrections by size, metres: under 0.5, 0.5-1, 1-5, 5-20 and over 20
|
|
2502
|
+
* (CORRECTION_BUCKET_METRES); they sum to `visibleCorrections`. */
|
|
2193
2503
|
correctionBuckets: number[];
|
|
2194
|
-
/** Largest correction seen, and the latest one
|
|
2504
|
+
/** Largest correction of the own entity's place seen, and the latest one: the length of the move, in
|
|
2505
|
+
* room units. Velocity and angles are never in it. */
|
|
2195
2506
|
peakCorrection: number;
|
|
2196
2507
|
lastCorrection: number;
|
|
2508
|
+
/** Largest correction of any other mirrored field (velocity, heading, pitch, duck), each in its own
|
|
2509
|
+
* unit, so only zero or not says anything: with `peakCorrection`, whether the prediction was exact. */
|
|
2510
|
+
peakStateCorrection: number;
|
|
2197
2511
|
/** Times the prediction was re-seeded from the server: an epoch bump on your own entity (a respawn
|
|
2198
2512
|
* or teleport, snapped to the server's new pose and never counted as a correction) or a reconnect. */
|
|
2199
2513
|
reseeds: number;
|
|
@@ -2236,6 +2550,11 @@ type AuthoritySession = {
|
|
|
2236
2550
|
* `frame()`, or pass `world` to `connectAuthority`; a later call re-seeds the prediction.
|
|
2237
2551
|
*/
|
|
2238
2552
|
setWorld(world: FirstpersonWorldSpec | FirstpersonWorld): number;
|
|
2553
|
+
/** The room's invite code (§17.2 *Choosing a room*): friends pass it to `joinPrivateAuthority()`. */
|
|
2554
|
+
readonly code: string;
|
|
2555
|
+
/** The room's match key, '' for none. A friend who joined by code reads it here once the first state
|
|
2556
|
+
* has landed, to hand the room's world to `setWorld`; until then its entity is unpredicted. */
|
|
2557
|
+
readonly matchKey: string;
|
|
2239
2558
|
/** Whether your own entity is predicted right now, and why not. */
|
|
2240
2559
|
readonly prediction: AuthorityPredictionStatus;
|
|
2241
2560
|
/** Hands the SDK the physicsHash (16 hex digits) of the physics world your client runs a copy of
|
|
@@ -2298,8 +2617,15 @@ type AuthoritySession = {
|
|
|
2298
2617
|
code: number;
|
|
2299
2618
|
}) => void): () => void;
|
|
2300
2619
|
on(event: 'reconnected', handler: () => void): () => void;
|
|
2301
|
-
/** The session is over
|
|
2302
|
-
|
|
2620
|
+
/** The session is over: a close nothing comes back from, or a rejoin that ran out (§17.13). `reason` is why an authority room
|
|
2621
|
+
* ended, for you, the game's creator: show players AUTHORITY_ROOM_ENDED_TEXT, not the code. Null with no such reason. */
|
|
2622
|
+
on(event: 'disconnect', handler: (code: number, reason: AuthorityCloseCode | null) => void): () => void;
|
|
2623
|
+
/** The server closes this room soon, for a deploy (§17.13). Play on: the seat moves by itself. */
|
|
2624
|
+
on(event: 'draining', handler: (info: AuthorityDraining) => void): () => void;
|
|
2625
|
+
/** The room is gone and the seat is on its way back. Say so; there is nothing to do. */
|
|
2626
|
+
on(event: 'rejoining', handler: (info: AuthorityRejoining) => void): () => void;
|
|
2627
|
+
/** Back in play: a new seat (`id`) in a new room (`code`). */
|
|
2628
|
+
on(event: 'rejoined', handler: (info: AuthorityRejoined) => void): () => void;
|
|
2303
2629
|
/** A game event the room module emitted. */
|
|
2304
2630
|
on(event: string, handler: (data: unknown) => void): () => void;
|
|
2305
2631
|
/** Leave on purpose. Never reconnects. */
|
|
@@ -2329,5 +2655,17 @@ declare const DEFAULT_SEAT_DRAWING: SeatDrawing;
|
|
|
2329
2655
|
* (`NOT_ENTITLED`), 424, 429 and 426 are not retried; 503 is retried per `capacityRetryMs`.
|
|
2330
2656
|
*/
|
|
2331
2657
|
declare function connectAuthority(opts: AuthorityConnectOptions): Promise<AuthoritySession>;
|
|
2658
|
+
/**
|
|
2659
|
+
* Creates a private authority room (§17.2 *Choosing a room*) and returns its session: `session.code`
|
|
2660
|
+
* is the invite, which friends pass to `joinPrivateAuthority()`. No matchmaking ever reaches the room.
|
|
2661
|
+
* `matchKey` chooses its world or mode as it does a pool's.
|
|
2662
|
+
*/
|
|
2663
|
+
declare function createPrivateAuthority(opts: AuthorityConnectOptions): Promise<AuthoritySession>;
|
|
2664
|
+
/**
|
|
2665
|
+
* Joins the private authority room with invite `code`, walking the regions until one holds it. The
|
|
2666
|
+
* room's key is its own (`session.matchKey`, once the first state lands): hand its world to `setWorld`
|
|
2667
|
+
* with `selectMatchWorld`. `opts.matchKey` must be unset.
|
|
2668
|
+
*/
|
|
2669
|
+
declare function joinPrivateAuthority(code: string, opts: AuthorityConnectOptions): Promise<AuthoritySession>;
|
|
2332
2670
|
|
|
2333
|
-
export { AUTHORITY_REFUSALS_PER_REGION, AuthorityBody, type AuthorityConnectOptions, AuthorityContactRule, AuthorityEntity, type AuthorityEntityView, AuthorityInput, AuthorityJoint, AuthorityLimits, AuthorityPhysicsEntity, AuthorityPhysicsRoomState, type AuthorityPhysicsStatus, AuthorityPlayer, type AuthorityPlayerView, type AuthorityPrediction, type AuthorityPredictionStatus, type AuthorityRegion, type AuthorityRegionPick, AuthorityRoomState, type AuthoritySeatPass, AuthoritySeatRule, type AuthoritySession, AuthorityShape, type AuthorityStep, type AuthorityTelemetry, CONVEYOR_RATE, type Carried, type CarryReport, type CastHit, ContactBody, ContactDrawing, type ContactEnv, ContactEvent, ContactKind, type ContactPassOptions, ContactPolicy, type ContactReport, type
|
|
2671
|
+
export { AUTHORITY_REFUSALS_PER_REGION, AuthorityBody, AuthorityCloseCode, type AuthorityConnectOptions, AuthorityContactRule, type AuthorityDraining, AuthorityEntity, type AuthorityEntityView, AuthorityInput, AuthorityJoinMethod, type AuthorityJoinPlan, AuthorityJoint, AuthorityLimits, AuthorityPhysicsEntity, AuthorityPhysicsRoomState, type AuthorityPhysicsStatus, AuthorityPlayer, type AuthorityPlayerView, type AuthorityPrediction, type AuthorityPredictionStatus, type AuthorityRegion, type AuthorityRegionPick, type AuthorityRejoined, type AuthorityRejoining, AuthorityRoomLimits, AuthorityRoomState, type AuthorityRoomTarget, type AuthoritySeatPass, AuthoritySeatRule, type AuthoritySession, AuthorityShape, type AuthorityStep, AuthorityTargetRefusal, type AuthorityTelemetry, CONVEYOR_RATE, type Carried, type CarryReport, type CastHit, ContactBody, ContactDrawing, type ContactEnv, ContactEvent, ContactKind, type ContactPassOptions, ContactPolicy, type ContactReport, type ContactWorld, type ContactWorldSpec, type ConveyorBody, DEFAULT_SEAT_DRAWING, DEFAULT_TICK_HZ, type DeclaredContacts, type DrawnPose, EntityData, type EntityIndex, type EntityOut, type EventOut, FAST_OFFER_WAIT_MS, type FaceFilter, FastFallbackReason, type FastLineAnnouncer, type FastLineObservation, FastNotAsked, type FastSeatStatus, FastSocketOpener, FastTransport, FirstpersonWorld, FirstpersonWorldSpec, type Frame, GuestGlobal, HEAD_LANDING_SPEED, HeadHold, type HeadSlabs, type HeadsContext, type HeldSeat, HullBody, HullOps, INPUT_REPEAT_MAX_MS, INPUT_REPEAT_RUN_MS, INPUT_REPEAT_STEADY, INPUT_TICK_MOD, INPUT_TICK_SLACK_S, type InitOut, InputData, InputRepeat, type InputThrottle, InputUse, Json, type KinematicSupport, LeaveReason, Lift, type LiftBodyPose, type LiftCollider, type LiftPose, type LiftSeat, LiftSolidsCache, type LiftTick, LiftVec, LiftsPolicy, MAX_PROJECTILE_G, MAX_PROJECTILE_TICK, MAX_TICK_HZ, MOTION_VIEW_TAG, PHYSICS_ONLY_TICK_HZ, type PairContact, type PairOutcome, PhysAnswerRow, PhysBodyRow, type PhysCommand, PhysEvRow, type PhysicsAdmission, PhysicsCeiling, PhysicsErrorCode, type PhysicsPredictionStatus, type PhysicsTickIndex, type Plane, PlayerInfo, type PolicyBody, PosedSolid, PosedWorld, PredictBodyRule, PredictCore, PredictKinematicRule, PredictStatus, type PredictedBody, type PredictedField, PresetName, type ProjectileLaunch, type ProjectilePrediction, type ProjectileState, type PropBody, type PropNudge, type PropSeat, PropSlide, REJOIN, RIDE_CHAIN_MAX, type ReconcilerAckHold, RefusalKind, type RejoinInput, type RejoinStep, RejoinStop, RejoinWay, RemoteInput, RemotePredict, ResolvedModuleConfig, type Ride, type RiderPose, SEAT_DRAWINGS, SHOVE_EASE_DONE, STALL_PREDICT_MS, STEADY_BUCKETS, SUCCESSOR_OPEN_MS, type SeatChange, type SeatClock, type SeatDrawing, type SeatLifts, type SeatMotion, type SeatOffset, type SeatPass, type SeatPose, type SeatRate, type SeatRepeats, type SeatStep, SeatWorld, type SeatWorldLifts, type SeatWorldOptions, ShotWorldCount, SlideWay, type SolidGrid, StandRule, THROTTLE_DILATION, THROTTLE_LOW_INPUTS, THROTTLE_SEAT_LEAD, TICK_RATES, TickHz, type TickIn, type TickInput, type TickOut, TickOutFault, type TickSolids, TopRule, UNSTICK_SOLIDS, type V3, type WireResult, WorldCost, WorldCostMeter, type WorldCostReport, capacityWalk, carryOnLift, carrySlot, carryTick, castWorld, comesBackAfter, compileContactWorld, connectAuthority, consumedUse, contactOf, contactPair, contactPass, contactPassOf, contactRuleOf, conveyorNudges, conveyorUnder, createPrivateAuthority, declaredContacts, farApart, fastLineAnnouncer, feedWithPayback, forgiveRepeats, frameOf, hasStand, headHold, headOffset, headSlab, headSlabs, headStands, impartSlot, impartTick, inLiftFrame, inputThrottle, inputTickField, inputTickLag, inputTickSlack, insideFace, insideWorld, isProjectile, joinPrivateAuthority, liftBodyKey, liftBodyPose, liftBodySpawn, liftCollider, liftDrawnAt, liftPose, liftPoses, liftPosesAt, liftStartsOf, liftTopAt, liftUnder, matchKeyOf, mayStand, nextCodeRegion, normalizeAuthorityRegions, pcos, planAuthorityJoin, planSuccessorJoin, posedFor, posedSolids, projectileAt, propSlideNudges, psin, psincos, rankAuthorityRegions, reconcileThrough, reconcilerAck, reconcilerAckHold, refusalKind, regionProbePlan, rejoinStep, repeatMaxTicks, repeatRunTicks, repeatStarved, repeatsSeat, rideSlot, rideStep, rideTick, ridesOn, rodeBy, roomAlong, sameHeldInput, sanitizeInput, seatClock, seatLeadClock, seatLiftsOf, seatOffset, seatRepeats, seatTauMs, seatTouchShare, seatUnderProp, selectAuthorityRegions, selectMatchWorld, serverTick, shoveEase, spinStep, stateThrough, stepOnLifts, steppedThrough, surfaceUp, tagsOf, throttleState, throttleSteps, tickInstant, tickSolids, topRuleOf, udpLine, unstickBody, validMatchKey, validRoomCode, validSuccessorOf, validateInitOut, validateTickOut, viewOnLift, webSocketLine, worldCost, yieldShares };
|