@multitapio/multitap 0.0.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/dist/.stamp +0 -0
- package/dist/cache.d.ts +117 -0
- package/dist/cache.d.ts.map +1 -0
- package/dist/channel.d.ts +91 -0
- package/dist/channel.d.ts.map +1 -0
- package/dist/channel.worker.d.ts +3 -0
- package/dist/channel.worker.d.ts.map +1 -0
- package/dist/codegen/config.d.ts +107 -0
- package/dist/codegen/config.d.ts.map +1 -0
- package/dist/codegen/generator.d.ts +78 -0
- package/dist/codegen/generator.d.ts.map +1 -0
- package/dist/codegen/index.d.ts +13 -0
- package/dist/codegen/index.d.ts.map +1 -0
- package/dist/codegen/inject.d.ts +51 -0
- package/dist/codegen/inject.d.ts.map +1 -0
- package/dist/codegen/rust.d.ts +22 -0
- package/dist/codegen/rust.d.ts.map +1 -0
- package/dist/codegen/typescript.d.ts +22 -0
- package/dist/codegen/typescript.d.ts.map +1 -0
- package/dist/constants.d.ts +5 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/crypto.d.ts +141 -0
- package/dist/crypto.d.ts.map +1 -0
- package/dist/debug.d.ts +39 -0
- package/dist/debug.d.ts.map +1 -0
- package/dist/diagnostics/index.d.ts +12 -0
- package/dist/diagnostics/index.d.ts.map +1 -0
- package/dist/diagnostics.js +5502 -0
- package/dist/e2e/cli.d.ts +2 -0
- package/dist/e2e/cli.d.ts.map +1 -0
- package/dist/executor.d.ts +130 -0
- package/dist/executor.d.ts.map +1 -0
- package/dist/globals.d.ts +32 -0
- package/dist/helpers.d.ts +3 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/input-codec.d.ts +136 -0
- package/dist/input-codec.d.ts.map +1 -0
- package/dist/input-graph.d.ts +106 -0
- package/dist/input-graph.d.ts.map +1 -0
- package/dist/lib.d.ts +10 -0
- package/dist/lib.d.ts.map +1 -0
- package/dist/lib.js +9409 -0
- package/dist/messages.d.ts +63 -0
- package/dist/messages.d.ts.map +1 -0
- package/dist/peer-mesh.d.ts +77 -0
- package/dist/peer-mesh.d.ts.map +1 -0
- package/dist/react/Crosshair.d.ts +17 -0
- package/dist/react/Crosshair.d.ts.map +1 -0
- package/dist/react/Player.d.ts +10 -0
- package/dist/react/Player.d.ts.map +1 -0
- package/dist/react/PlayerPoseContext.d.ts +31 -0
- package/dist/react/PlayerPoseContext.d.ts.map +1 -0
- package/dist/react/hooks/index.d.ts +7 -0
- package/dist/react/hooks/index.d.ts.map +1 -0
- package/dist/react/hooks/useEvent.d.ts +46 -0
- package/dist/react/hooks/useEvent.d.ts.map +1 -0
- package/dist/react/hooks/useFrame.d.ts +23 -0
- package/dist/react/hooks/useFrame.d.ts.map +1 -0
- package/dist/react/hooks/usePlayers.d.ts +24 -0
- package/dist/react/hooks/usePlayers.d.ts.map +1 -0
- package/dist/react/hooks/useQuery.d.ts +41 -0
- package/dist/react/hooks/useQuery.d.ts.map +1 -0
- package/dist/react/hooks/useSession.d.ts +10 -0
- package/dist/react/hooks/useSession.d.ts.map +1 -0
- package/dist/react/index.d.ts +18 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/input/DesktopInputMapper.d.ts +38 -0
- package/dist/react/input/DesktopInputMapper.d.ts.map +1 -0
- package/dist/react/input/index.d.ts +4 -0
- package/dist/react/input/index.d.ts.map +1 -0
- package/dist/react/input/types.d.ts +46 -0
- package/dist/react/input/types.d.ts.map +1 -0
- package/dist/react/providers/SessionProvider.d.ts +17 -0
- package/dist/react/providers/SessionProvider.d.ts.map +1 -0
- package/dist/react/providers/index.d.ts +2 -0
- package/dist/react/providers/index.d.ts.map +1 -0
- package/dist/react/types/index.d.ts +2 -0
- package/dist/react/types/index.d.ts.map +1 -0
- package/dist/react/types/session.d.ts +88 -0
- package/dist/react/types/session.d.ts.map +1 -0
- package/dist/react/types.d.ts +134 -0
- package/dist/react/types.d.ts.map +1 -0
- package/dist/react/utils/math.d.ts +19 -0
- package/dist/react/utils/math.d.ts.map +1 -0
- package/dist/react/views/AsteroidsView.d.ts +24 -0
- package/dist/react/views/AsteroidsView.d.ts.map +1 -0
- package/dist/react/views/FirstPersonView.d.ts +10 -0
- package/dist/react/views/FirstPersonView.d.ts.map +1 -0
- package/dist/react/views/IsometricView.d.ts +21 -0
- package/dist/react/views/IsometricView.d.ts.map +1 -0
- package/dist/react/views/MapView.d.ts +16 -0
- package/dist/react/views/MapView.d.ts.map +1 -0
- package/dist/react/views/MobaView.d.ts +17 -0
- package/dist/react/views/MobaView.d.ts.map +1 -0
- package/dist/react/views/SideOnView.d.ts +23 -0
- package/dist/react/views/SideOnView.d.ts.map +1 -0
- package/dist/react/views/ThirdPersonFixedView.d.ts +21 -0
- package/dist/react/views/ThirdPersonFixedView.d.ts.map +1 -0
- package/dist/react/views/ThirdPersonView.d.ts +12 -0
- package/dist/react/views/ThirdPersonView.d.ts.map +1 -0
- package/dist/react/views/TopDownFixedView.d.ts +20 -0
- package/dist/react/views/TopDownFixedView.d.ts.map +1 -0
- package/dist/react/views/TopDownView.d.ts +12 -0
- package/dist/react/views/TopDownView.d.ts.map +1 -0
- package/dist/react/views/TwinStickView.d.ts +13 -0
- package/dist/react/views/TwinStickView.d.ts.map +1 -0
- package/dist/react/views/VehicleFixedView.d.ts +16 -0
- package/dist/react/views/VehicleFixedView.d.ts.map +1 -0
- package/dist/react/views/VehicleView.d.ts +13 -0
- package/dist/react/views/VehicleView.d.ts.map +1 -0
- package/dist/react/views/index.d.ts +21 -0
- package/dist/react/views/index.d.ts.map +1 -0
- package/dist/react/views/types.d.ts +136 -0
- package/dist/react/views/types.d.ts.map +1 -0
- package/dist/rollback.d.ts +193 -0
- package/dist/rollback.d.ts.map +1 -0
- package/dist/rollback.worker.d.ts +3 -0
- package/dist/rollback.worker.d.ts.map +1 -0
- package/dist/schema.d.ts +309 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/session-config.d.ts +119 -0
- package/dist/session-config.d.ts.map +1 -0
- package/dist/session.d.ts +120 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/state.d.ts +400 -0
- package/dist/state.d.ts.map +1 -0
- package/dist/stats.d.ts +21 -0
- package/dist/stats.d.ts.map +1 -0
- package/dist/test-session.d.ts +170 -0
- package/dist/test-session.d.ts.map +1 -0
- package/dist/types/cache.d.ts +117 -0
- package/dist/types/cache.d.ts.map +1 -0
- package/dist/types/channel.d.ts +91 -0
- package/dist/types/channel.d.ts.map +1 -0
- package/dist/types/channel.worker.d.ts +3 -0
- package/dist/types/channel.worker.d.ts.map +1 -0
- package/dist/types/codegen/config.d.ts +107 -0
- package/dist/types/codegen/config.d.ts.map +1 -0
- package/dist/types/codegen/generator.d.ts +78 -0
- package/dist/types/codegen/generator.d.ts.map +1 -0
- package/dist/types/codegen/index.d.ts +13 -0
- package/dist/types/codegen/index.d.ts.map +1 -0
- package/dist/types/codegen/inject.d.ts +51 -0
- package/dist/types/codegen/inject.d.ts.map +1 -0
- package/dist/types/codegen/rust.d.ts +22 -0
- package/dist/types/codegen/rust.d.ts.map +1 -0
- package/dist/types/codegen/typescript.d.ts +22 -0
- package/dist/types/codegen/typescript.d.ts.map +1 -0
- package/dist/types/constants.d.ts +5 -0
- package/dist/types/constants.d.ts.map +1 -0
- package/dist/types/crypto.d.ts +141 -0
- package/dist/types/crypto.d.ts.map +1 -0
- package/dist/types/debug.d.ts +39 -0
- package/dist/types/debug.d.ts.map +1 -0
- package/dist/types/diagnostics/index.d.ts +12 -0
- package/dist/types/diagnostics/index.d.ts.map +1 -0
- package/dist/types/e2e/cli.d.ts +2 -0
- package/dist/types/e2e/cli.d.ts.map +1 -0
- package/dist/types/executor.d.ts +130 -0
- package/dist/types/executor.d.ts.map +1 -0
- package/dist/types/helpers.d.ts +3 -0
- package/dist/types/helpers.d.ts.map +1 -0
- package/dist/types/input-codec.d.ts +136 -0
- package/dist/types/input-codec.d.ts.map +1 -0
- package/dist/types/input-graph.d.ts +106 -0
- package/dist/types/input-graph.d.ts.map +1 -0
- package/dist/types/lib.d.ts +10 -0
- package/dist/types/lib.d.ts.map +1 -0
- package/dist/types/messages.d.ts +63 -0
- package/dist/types/messages.d.ts.map +1 -0
- package/dist/types/peer-mesh.d.ts +77 -0
- package/dist/types/peer-mesh.d.ts.map +1 -0
- package/dist/types/react/Crosshair.d.ts +17 -0
- package/dist/types/react/Crosshair.d.ts.map +1 -0
- package/dist/types/react/Player.d.ts +10 -0
- package/dist/types/react/Player.d.ts.map +1 -0
- package/dist/types/react/PlayerPoseContext.d.ts +31 -0
- package/dist/types/react/PlayerPoseContext.d.ts.map +1 -0
- package/dist/types/react/hooks/index.d.ts +7 -0
- package/dist/types/react/hooks/index.d.ts.map +1 -0
- package/dist/types/react/hooks/useEvent.d.ts +46 -0
- package/dist/types/react/hooks/useEvent.d.ts.map +1 -0
- package/dist/types/react/hooks/useFrame.d.ts +23 -0
- package/dist/types/react/hooks/useFrame.d.ts.map +1 -0
- package/dist/types/react/hooks/usePlayers.d.ts +24 -0
- package/dist/types/react/hooks/usePlayers.d.ts.map +1 -0
- package/dist/types/react/hooks/useQuery.d.ts +41 -0
- package/dist/types/react/hooks/useQuery.d.ts.map +1 -0
- package/dist/types/react/hooks/useSession.d.ts +10 -0
- package/dist/types/react/hooks/useSession.d.ts.map +1 -0
- package/dist/types/react/index.d.ts +18 -0
- package/dist/types/react/index.d.ts.map +1 -0
- package/dist/types/react/input/DesktopInputMapper.d.ts +38 -0
- package/dist/types/react/input/DesktopInputMapper.d.ts.map +1 -0
- package/dist/types/react/input/index.d.ts +4 -0
- package/dist/types/react/input/index.d.ts.map +1 -0
- package/dist/types/react/input/types.d.ts +46 -0
- package/dist/types/react/input/types.d.ts.map +1 -0
- package/dist/types/react/providers/SessionProvider.d.ts +17 -0
- package/dist/types/react/providers/SessionProvider.d.ts.map +1 -0
- package/dist/types/react/providers/index.d.ts +2 -0
- package/dist/types/react/providers/index.d.ts.map +1 -0
- package/dist/types/react/types/index.d.ts +2 -0
- package/dist/types/react/types/index.d.ts.map +1 -0
- package/dist/types/react/types/session.d.ts +88 -0
- package/dist/types/react/types/session.d.ts.map +1 -0
- package/dist/types/react/types.d.ts +134 -0
- package/dist/types/react/types.d.ts.map +1 -0
- package/dist/types/react/utils/math.d.ts +19 -0
- package/dist/types/react/utils/math.d.ts.map +1 -0
- package/dist/types/react/views/AsteroidsView.d.ts +24 -0
- package/dist/types/react/views/AsteroidsView.d.ts.map +1 -0
- package/dist/types/react/views/FirstPersonView.d.ts +10 -0
- package/dist/types/react/views/FirstPersonView.d.ts.map +1 -0
- package/dist/types/react/views/IsometricView.d.ts +21 -0
- package/dist/types/react/views/IsometricView.d.ts.map +1 -0
- package/dist/types/react/views/MapView.d.ts +16 -0
- package/dist/types/react/views/MapView.d.ts.map +1 -0
- package/dist/types/react/views/MobaView.d.ts +17 -0
- package/dist/types/react/views/MobaView.d.ts.map +1 -0
- package/dist/types/react/views/SideOnView.d.ts +23 -0
- package/dist/types/react/views/SideOnView.d.ts.map +1 -0
- package/dist/types/react/views/ThirdPersonFixedView.d.ts +21 -0
- package/dist/types/react/views/ThirdPersonFixedView.d.ts.map +1 -0
- package/dist/types/react/views/ThirdPersonView.d.ts +12 -0
- package/dist/types/react/views/ThirdPersonView.d.ts.map +1 -0
- package/dist/types/react/views/TopDownFixedView.d.ts +20 -0
- package/dist/types/react/views/TopDownFixedView.d.ts.map +1 -0
- package/dist/types/react/views/TopDownView.d.ts +12 -0
- package/dist/types/react/views/TopDownView.d.ts.map +1 -0
- package/dist/types/react/views/TwinStickView.d.ts +13 -0
- package/dist/types/react/views/TwinStickView.d.ts.map +1 -0
- package/dist/types/react/views/VehicleFixedView.d.ts +16 -0
- package/dist/types/react/views/VehicleFixedView.d.ts.map +1 -0
- package/dist/types/react/views/VehicleView.d.ts +13 -0
- package/dist/types/react/views/VehicleView.d.ts.map +1 -0
- package/dist/types/react/views/index.d.ts +21 -0
- package/dist/types/react/views/index.d.ts.map +1 -0
- package/dist/types/react/views/types.d.ts +136 -0
- package/dist/types/react/views/types.d.ts.map +1 -0
- package/dist/types/rollback.d.ts +193 -0
- package/dist/types/rollback.d.ts.map +1 -0
- package/dist/types/rollback.worker.d.ts +3 -0
- package/dist/types/rollback.worker.d.ts.map +1 -0
- package/dist/types/schema.d.ts +309 -0
- package/dist/types/schema.d.ts.map +1 -0
- package/dist/types/session-config.d.ts +119 -0
- package/dist/types/session-config.d.ts.map +1 -0
- package/dist/types/session.d.ts +120 -0
- package/dist/types/session.d.ts.map +1 -0
- package/dist/types/state.d.ts +400 -0
- package/dist/types/state.d.ts.map +1 -0
- package/dist/types/stats.d.ts +21 -0
- package/dist/types/stats.d.ts.map +1 -0
- package/dist/types/test-session.d.ts +170 -0
- package/dist/types/test-session.d.ts.map +1 -0
- package/dist/types/utils.d.ts +26 -0
- package/dist/types/utils.d.ts.map +1 -0
- package/dist/types/vite/codegen-runner.d.ts +27 -0
- package/dist/types/vite/codegen-runner.d.ts.map +1 -0
- package/dist/types/vite/index.d.ts +20 -0
- package/dist/types/vite/index.d.ts.map +1 -0
- package/dist/types/vite/module-builder.d.ts +28 -0
- package/dist/types/vite/module-builder.d.ts.map +1 -0
- package/dist/types/vite/plugin.d.ts +27 -0
- package/dist/types/vite/plugin.d.ts.map +1 -0
- package/dist/types/vite/types.d.ts +37 -0
- package/dist/types/vite/types.d.ts.map +1 -0
- package/dist/types/vite/wasm-compiler.d.ts +32 -0
- package/dist/types/vite/wasm-compiler.d.ts.map +1 -0
- package/dist/utils.d.ts +26 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/vite/codegen-runner.d.ts +27 -0
- package/dist/vite/codegen-runner.d.ts.map +1 -0
- package/dist/vite/index.d.ts +20 -0
- package/dist/vite/index.d.ts.map +1 -0
- package/dist/vite/index.js +4202 -0
- package/dist/vite/module-builder.d.ts +28 -0
- package/dist/vite/module-builder.d.ts.map +1 -0
- package/dist/vite/plugin.d.ts +27 -0
- package/dist/vite/plugin.d.ts.map +1 -0
- package/dist/vite/types.d.ts +37 -0
- package/dist/vite/types.d.ts.map +1 -0
- package/dist/vite/wasm-compiler.d.ts +32 -0
- package/dist/vite/wasm-compiler.d.ts.map +1 -0
- package/package.json +92 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { type InputData, type TickMessage } from './messages';
|
|
2
|
+
export type TickNodePayload = Uint8Array;
|
|
3
|
+
export type GetTicksAfterOptions = {
|
|
4
|
+
limit?: number;
|
|
5
|
+
lag?: number;
|
|
6
|
+
sync?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export interface TickLog {
|
|
9
|
+
getSyncHead(): TickNode;
|
|
10
|
+
getPredictedHead(): TickNode;
|
|
11
|
+
addSyncTick(msg: TickMessage): void;
|
|
12
|
+
addOptimisticInput(input: InputData, preVerifiedSigner?: Uint8Array): void;
|
|
13
|
+
getParticipantSlots(tick: number): (Participant | undefined)[];
|
|
14
|
+
getTicksAfter(nodeId: string | null, options?: GetTicksAfterOptions): TickPrimitive[];
|
|
15
|
+
getPredictionCount(): number;
|
|
16
|
+
setOnParticipantJoined(fn: (participant: Participant) => void): void;
|
|
17
|
+
}
|
|
18
|
+
export interface AsyncTickLog {
|
|
19
|
+
getSyncHead(): Promise<TickNode>;
|
|
20
|
+
getPredictedHead(): Promise<TickNode>;
|
|
21
|
+
addSyncTick(msg: TickMessage): Promise<void>;
|
|
22
|
+
addOptimisticInput(input: InputData, preVerifiedSigner?: Uint8Array): Promise<void>;
|
|
23
|
+
getParticipantSlots(tick: number): Promise<(Participant | undefined)[]>;
|
|
24
|
+
getTicksAfter(nodeId: string | null, options?: GetTicksAfterOptions): Promise<TickPrimitive[]>;
|
|
25
|
+
getPredictionCount(): Promise<number>;
|
|
26
|
+
setOnParticipantJoined(fn: (participant: Participant) => void): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
export interface TickPrimitive {
|
|
29
|
+
id: string;
|
|
30
|
+
tick: number;
|
|
31
|
+
payloads: TickNodePayload[];
|
|
32
|
+
sync: boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface TickNode extends TickPrimitive {
|
|
35
|
+
parent: TickNode | null;
|
|
36
|
+
sig: Uint8Array;
|
|
37
|
+
pending?: boolean;
|
|
38
|
+
verified?: boolean;
|
|
39
|
+
syncPrev: TickNode | null;
|
|
40
|
+
syncNext: TickNode | null;
|
|
41
|
+
}
|
|
42
|
+
export interface Participant {
|
|
43
|
+
id: string;
|
|
44
|
+
pubKey: Uint8Array;
|
|
45
|
+
slot: number;
|
|
46
|
+
joined: number;
|
|
47
|
+
}
|
|
48
|
+
export interface InputGraphConfig {
|
|
49
|
+
genesisHash: Uint8Array;
|
|
50
|
+
maxTicks: number;
|
|
51
|
+
inputPayloadPredictor?: PayloadPredictor | undefined | null;
|
|
52
|
+
verificationPubKey?: Uint8Array | undefined | null;
|
|
53
|
+
debug?: boolean | undefined;
|
|
54
|
+
logSyncTicks?: boolean | undefined;
|
|
55
|
+
}
|
|
56
|
+
export type PayloadPredictor = (tick: number, participantIndex: number, parent: TickNode) => Uint8Array;
|
|
57
|
+
export declare class InputGraph implements TickLog {
|
|
58
|
+
private debug;
|
|
59
|
+
private genesisHash;
|
|
60
|
+
private genesis;
|
|
61
|
+
private syncNodesById;
|
|
62
|
+
private syncHead;
|
|
63
|
+
private predictedHead;
|
|
64
|
+
private pendingSyncMessages;
|
|
65
|
+
private nodeIdSequence;
|
|
66
|
+
private optimisticInputs;
|
|
67
|
+
private participantBySlot;
|
|
68
|
+
private inputPayloadPredictor;
|
|
69
|
+
private verificationPubKey;
|
|
70
|
+
private maxTicks;
|
|
71
|
+
private logSyncTicks;
|
|
72
|
+
private onParticipantJoined;
|
|
73
|
+
constructor(config: InputGraphConfig);
|
|
74
|
+
setOnParticipantJoined(fn: (participant: Participant) => void): void;
|
|
75
|
+
getSyncHead(): TickNode;
|
|
76
|
+
getPredictedHead(): TickNode;
|
|
77
|
+
addSyncTick(msg: TickMessage): void;
|
|
78
|
+
private recoverInputPubKey;
|
|
79
|
+
addOptimisticInput(input: InputData, preVerifiedSigner?: Uint8Array): void;
|
|
80
|
+
getParticipantSlots(tick: number): Participant[];
|
|
81
|
+
getTicksAfter(nodeId: string | null, options?: GetTicksAfterOptions): TickPrimitive[];
|
|
82
|
+
getPredictionCount(): number;
|
|
83
|
+
getSyncTicksAfter(nodeId: string | null): TickPrimitive[];
|
|
84
|
+
private getSyncChainForkPointFromNodeId;
|
|
85
|
+
private getPendingSyncMessages;
|
|
86
|
+
private verifyTickSignature;
|
|
87
|
+
private getOrderedPayloadsAtTick;
|
|
88
|
+
private updateHeads;
|
|
89
|
+
private ensureParticipantJoined;
|
|
90
|
+
private logSyncNodeForTests;
|
|
91
|
+
private dequeuePrediction;
|
|
92
|
+
private generateNodeId;
|
|
93
|
+
}
|
|
94
|
+
export declare class AsyncInputGraph implements AsyncTickLog {
|
|
95
|
+
private log;
|
|
96
|
+
constructor(log: TickLog);
|
|
97
|
+
getSyncHead(): Promise<TickNode>;
|
|
98
|
+
getPredictedHead(): Promise<TickNode>;
|
|
99
|
+
addSyncTick(msg: TickMessage): Promise<void>;
|
|
100
|
+
getTicksAfter(nodeId: string | null, options?: GetTicksAfterOptions): Promise<TickPrimitive[]>;
|
|
101
|
+
addOptimisticInput(input: InputData, preVerifiedSigner?: Uint8Array): Promise<void>;
|
|
102
|
+
getParticipantSlots(tick: number): Promise<(Participant | undefined)[]>;
|
|
103
|
+
getPredictionCount(): Promise<number>;
|
|
104
|
+
setOnParticipantJoined(fn: (participant: Participant) => void): Promise<void>;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=input-graph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-graph.d.ts","sourceRoot":"","sources":["../../src/input-graph.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAM9E,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC;AAEzC,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,CAAC,EAAE,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CAIvB;AASD,qBAAa,eAAgB,YAAW,YAAY;IAClD,OAAO,CAAC,GAAG,CAAU;gBACT,GAAG,EAAE,OAAO;IAIxB,WAAW,IAAI,OAAO,CAAC,QAAQ,CAAC;IAIhC,gBAAgB,IAAI,OAAO,CAAC,QAAQ,CAAC;IAIrC,WAAW,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAI5C,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAI9F,kBAAkB,CAAC,KAAK,EAAE,SAAS,EAAE,iBAAiB,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAInF,mBAAmB,CAAC,IAAI,EAAE,MAAM;IAIhC,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC;IAIrC,sBAAsB,CAAC,EAAE,EAAE,CAAC,WAAW,EAAE,WAAW,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;CAG9E"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './session';
|
|
2
|
+
export * from './session-config';
|
|
3
|
+
export * from './state';
|
|
4
|
+
export * as bindings from './input-codec';
|
|
5
|
+
export * from './stats';
|
|
6
|
+
export * from './crypto';
|
|
7
|
+
export * from './test-session';
|
|
8
|
+
export * from './helpers';
|
|
9
|
+
export * from './react';
|
|
10
|
+
//# sourceMappingURL=lib.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../src/lib.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export declare const MSG_TYPE_PING = 1;
|
|
2
|
+
export declare const MSG_TYPE_PONG = 2;
|
|
3
|
+
export declare const MSG_TYPE_INPUT = 3;
|
|
4
|
+
export declare const MSG_TYPE_TICK = 4;
|
|
5
|
+
export declare const SIGNATURE_SIZE = 65;
|
|
6
|
+
export declare const MAX_INPUT_PAYLOAD_SIZE = 255;
|
|
7
|
+
export declare const INPUT_HEADER_SIZE: number;
|
|
8
|
+
export declare const INPUT_IDX_SIZE = 1;
|
|
9
|
+
export declare const MIN_INPUT_SIZE: number;
|
|
10
|
+
export declare const MAX_INPUT_SIZE: number;
|
|
11
|
+
export declare const TICK_HEADER_SIZE: number;
|
|
12
|
+
export declare const PONG_PAYLOAD_SIZE = 8;
|
|
13
|
+
export declare const REPLAY_PING_SIZE = 11;
|
|
14
|
+
export declare const MSG_HEADER_SIZE = 3;
|
|
15
|
+
export declare const MAX_INPUTS_PER_TICK = 16;
|
|
16
|
+
export declare const NULL_INPUT_TARGET_TICK = 4294967295;
|
|
17
|
+
export interface PingMessage {
|
|
18
|
+
type: 'ping';
|
|
19
|
+
tickRate: number;
|
|
20
|
+
isReplay: boolean;
|
|
21
|
+
replayStart: number;
|
|
22
|
+
replayEnd: number;
|
|
23
|
+
}
|
|
24
|
+
export interface InputMessage {
|
|
25
|
+
type: 'input';
|
|
26
|
+
targetTick: number;
|
|
27
|
+
payload: Uint8Array;
|
|
28
|
+
signature: Uint8Array;
|
|
29
|
+
}
|
|
30
|
+
export interface TickMessage {
|
|
31
|
+
type: 'tick';
|
|
32
|
+
tick: number;
|
|
33
|
+
sig: Uint8Array;
|
|
34
|
+
inputs: InputData[];
|
|
35
|
+
}
|
|
36
|
+
export interface InputData {
|
|
37
|
+
targetTick: number;
|
|
38
|
+
payload: Uint8Array;
|
|
39
|
+
sig: Uint8Array;
|
|
40
|
+
idx: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* ParticipantTick represents a tick with inputs ordered by stable participant index.
|
|
44
|
+
* Used by the state loop to consume ticks without expensive pubkey recovery.
|
|
45
|
+
*/
|
|
46
|
+
export interface ParticipantTick {
|
|
47
|
+
tick: number;
|
|
48
|
+
sig: Uint8Array;
|
|
49
|
+
payloads: Uint8Array[];
|
|
50
|
+
}
|
|
51
|
+
export type DecodedMessage = PingMessage | InputMessage | TickMessage;
|
|
52
|
+
export declare function inputWireSize(payloadLen: number): number;
|
|
53
|
+
export declare function tickInputWireSize(payloadLen: number): number;
|
|
54
|
+
export declare const messageCodec: {
|
|
55
|
+
encodeInput(targetTick: number, payload: Uint8Array, signature: Uint8Array): Uint8Array;
|
|
56
|
+
encodePong(syncHead: number, latestHead: number): Uint8Array;
|
|
57
|
+
encodeTick(tick: TickMessage): Uint8Array;
|
|
58
|
+
decode(bytes: Uint8Array): DecodedMessage;
|
|
59
|
+
decodeTick(data: Uint8Array): TickMessage;
|
|
60
|
+
decodeInput(bytes: Uint8Array): InputMessage;
|
|
61
|
+
};
|
|
62
|
+
export declare function isNullInput(input: InputMessage | InputData): boolean;
|
|
63
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/messages.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,aAAa,IAAO,CAAC;AAClC,eAAO,MAAM,aAAa,IAAO,CAAC;AAClC,eAAO,MAAM,cAAc,IAAO,CAAC;AACnC,eAAO,MAAM,aAAa,IAAO,CAAC;AAGlC,eAAO,MAAM,cAAc,KAAK,CAAC;AACjC,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAC1C,eAAO,MAAM,iBAAiB,QAAQ,CAAC;AACvC,eAAO,MAAM,cAAc,IAAI,CAAC;AAChC,eAAO,MAAM,cAAc,QAAqC,CAAC;AACjE,eAAO,MAAM,cAAc,QAA8D,CAAC;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,MAAM,WAAW,UAAU,aAAa,UAAU,GAAG,UAAU;yBAwBlE,MAAM,cAAc,MAAM,GAAG,UAAU;qBAY3C,WAAW,GAAG,UAAU;kBA0C3B,UAAU,GAAG,cAAc;qBA+CxB,UAAU,GAAG,WAAW;uBA2CtB,UAAU,GAAG,YAAY;CAmC7C,CAAC;AAGF,wBAAgB,WAAW,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,GAAG,OAAO,CAEpE"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { SessionConfig } from './session-config';
|
|
2
|
+
import { type InputData } from './messages';
|
|
3
|
+
export interface PeerMeshConfig {
|
|
4
|
+
sessionConfig: SessionConfig;
|
|
5
|
+
publicKey: Uint8Array;
|
|
6
|
+
genesisHash: Uint8Array;
|
|
7
|
+
/** Callback when a peer input is received. Called with the input data and verified signer pubkey. */
|
|
8
|
+
onPeerInput: (input: InputData, signerPubKey: Uint8Array) => void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* PeerMesh manages WebRTC DataChannel connections to other peers in a session.
|
|
12
|
+
*
|
|
13
|
+
* Architecture:
|
|
14
|
+
* - Server tracks connected peers and broadcasts peer list via SSE
|
|
15
|
+
* - When peer list changes, clients establish connections based on pubkey comparison
|
|
16
|
+
* - Lower pubkey creates offer, higher pubkey creates answer
|
|
17
|
+
* - DataChannels are unreliable (maxRetransmits: 0) for lowest latency
|
|
18
|
+
*/
|
|
19
|
+
export declare class PeerMesh {
|
|
20
|
+
private config;
|
|
21
|
+
private peers;
|
|
22
|
+
private myPubKeyHex;
|
|
23
|
+
private eventSource;
|
|
24
|
+
private started;
|
|
25
|
+
private closed;
|
|
26
|
+
constructor(config: PeerMeshConfig);
|
|
27
|
+
/**
|
|
28
|
+
* Start peer discovery and connection establishment.
|
|
29
|
+
* Connects to SSE and waits for peer list from server.
|
|
30
|
+
*/
|
|
31
|
+
start(): Promise<void>;
|
|
32
|
+
/**
|
|
33
|
+
* Broadcast input bytes to all connected peers.
|
|
34
|
+
* Called after successfully sending to the relay.
|
|
35
|
+
*/
|
|
36
|
+
broadcast(inputBytes: Uint8Array): void;
|
|
37
|
+
/**
|
|
38
|
+
* Close all peer connections and stop SSE.
|
|
39
|
+
*/
|
|
40
|
+
close(): void;
|
|
41
|
+
/** Get count of connected peers (open DataChannels) */
|
|
42
|
+
getConnectedPeerCount(): number;
|
|
43
|
+
private getSignalingBaseURL;
|
|
44
|
+
private getSessionParam;
|
|
45
|
+
/**
|
|
46
|
+
* Connect to SSE endpoint for peer discovery and signaling.
|
|
47
|
+
*/
|
|
48
|
+
private connectEventSource;
|
|
49
|
+
/**
|
|
50
|
+
* Handle peer list update from server.
|
|
51
|
+
* Establishes connections to new peers based on pubkey comparison.
|
|
52
|
+
*/
|
|
53
|
+
private handlePeersUpdate;
|
|
54
|
+
/**
|
|
55
|
+
* Determine if we should answer (true) or offer (false) for a given peer.
|
|
56
|
+
* Lower pubkey offers, higher pubkey answers.
|
|
57
|
+
*/
|
|
58
|
+
private shouldAnswer;
|
|
59
|
+
/**
|
|
60
|
+
* Create an offer to a specific peer.
|
|
61
|
+
*/
|
|
62
|
+
private createOffer;
|
|
63
|
+
/**
|
|
64
|
+
* Handle an offer from a peer.
|
|
65
|
+
*/
|
|
66
|
+
private handleOffer;
|
|
67
|
+
/**
|
|
68
|
+
* Handle an answer to our offer.
|
|
69
|
+
*/
|
|
70
|
+
private handleAnswer;
|
|
71
|
+
private setupPeerConnection;
|
|
72
|
+
private setupDataChannel;
|
|
73
|
+
private handlePeerMessage;
|
|
74
|
+
private removePeer;
|
|
75
|
+
private waitForIceGathering;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=peer-mesh.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"peer-mesh.d.ts","sourceRoot":"","sources":["../../src/peer-mesh.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,E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;
|
|
4
|
+
/** Vertical offset as percentage of screen height (positive = down) */
|
|
5
|
+
offsetY?: number | undefined;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Simple crosshair component rendered as screen-space overlay.
|
|
9
|
+
*
|
|
10
|
+
* - 'center': Fixed at screen center (FPS, third-person mouselook)
|
|
11
|
+
* - 'cursor': Follows mouse cursor position (twin-stick, MOBA)
|
|
12
|
+
*
|
|
13
|
+
* Renders nothing for 'none' mode (shouldn't be rendered in that case).
|
|
14
|
+
*/
|
|
15
|
+
export declare function Crosshair({ mode, offsetY }: CrosshairProps): import("react/jsx-runtime").JSX.Element | null;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=Crosshair.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Crosshair.d.ts","sourceRoot":"","sources":["../../../src/react/Crosshair.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAOlD,UAAU,cAAc;IACtB,IAAI,EAAE,aAAa,CAAA;IACnB,uEAAuE;IACvE,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC7B;AAED;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,EAAE,IAAI,EAAE,OAAW,EAAE,EAAE,cAAc,kDAmF9D"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PlayerHandle, PlayerProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Player component
|
|
4
|
+
*
|
|
5
|
+
* Encapsulates camera, input handling, and player model.
|
|
6
|
+
* Every Player instance has its own camera and controller,
|
|
7
|
+
* but only the one with enableCamera=true is used for rendering.
|
|
8
|
+
*/
|
|
9
|
+
export declare const Player: import("react").ForwardRefExoticComponent<PlayerProps & import("react").RefAttributes<PlayerHandle>>;
|
|
10
|
+
//# sourceMappingURL=Player.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Player.d.ts","sourceRoot":"","sources":["../../../src/react/Player.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAY,MAAM,SAAS,CAAA;AAelE;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,sGA0QjB,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Quaternion, Vector3 } from 'three';
|
|
2
|
+
/**
|
|
3
|
+
* Pose/intents exposed to the Player's children via context.
|
|
4
|
+
*
|
|
5
|
+
* IMPORTANT: These objects are MUTATED each frame (via `.copy()`),
|
|
6
|
+
* so consumers should read them imperatively (e.g. inside `useFrame`)
|
|
7
|
+
* to avoid per-frame React re-renders.
|
|
8
|
+
*/
|
|
9
|
+
export interface PlayerPose {
|
|
10
|
+
/** Player position in world space (smoothed visual position) */
|
|
11
|
+
position: Vector3;
|
|
12
|
+
/** The quaternion applied to the Player's body group (world space) */
|
|
13
|
+
body: Quaternion;
|
|
14
|
+
/** Movement reference frame (world space) */
|
|
15
|
+
heading: Quaternion;
|
|
16
|
+
/** Aim/look direction (world space) */
|
|
17
|
+
aim: Quaternion;
|
|
18
|
+
/**
|
|
19
|
+
* Aim relative to the body group: `inverse(body) * aim`.
|
|
20
|
+
* Apply this to a child "head/gun" group to point it toward aim while the body rotates independently.
|
|
21
|
+
*/
|
|
22
|
+
aimLocal: Quaternion;
|
|
23
|
+
/** Movement intent relative to heading */
|
|
24
|
+
move: Vector3;
|
|
25
|
+
/** Standard action flags (bitmask of ACTION_* constants) */
|
|
26
|
+
actions: number;
|
|
27
|
+
}
|
|
28
|
+
declare const PlayerPoseContext: import("react").Context<PlayerPose | null>;
|
|
29
|
+
export declare function usePlayerPose(): PlayerPose;
|
|
30
|
+
export { PlayerPoseContext };
|
|
31
|
+
//# sourceMappingURL=PlayerPoseContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PlayerPoseContext.d.ts","sourceRoot":"","sources":["../../../src/react/PlayerPoseContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAEhD;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;IACzB,gEAAgE;IAChE,QAAQ,EAAE,OAAO,CAAA;IAEjB,sEAAsE;IACtE,IAAI,EAAE,UAAU,CAAA;IAEhB,6CAA6C;IAC7C,OAAO,EAAE,UAAU,CAAA;IAEnB,uCAAuC;IACvC,GAAG,EAAE,UAAU,CAAA;IAEf;;;OAGG;IACH,QAAQ,EAAE,UAAU,CAAA;IAEpB,0CAA0C;IAC1C,IAAI,EAAE,OAAO,CAAA;IAEb,4DAA4D;IAC5D,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,QAAA,MAAM,iBAAiB,4CAAyC,CAAA;AAEhE,wBAAgB,aAAa,IAAI,UAAU,CAM1C;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { useSession } from './useSession';
|
|
2
|
+
export { useFrame } from './useFrame';
|
|
3
|
+
export { useQuery, useQueryMask } from './useQuery';
|
|
4
|
+
export { usePlayers, useCurrentPlayer } from './usePlayers';
|
|
5
|
+
export { useEvent } from './useEvent';
|
|
6
|
+
export type { CapturedEvent, UseEventOptions } from './useEvent';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/react/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AACnD,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A captured event with timestamp and computed age
|
|
3
|
+
*/
|
|
4
|
+
export interface CapturedEvent<T> {
|
|
5
|
+
/** The event data */
|
|
6
|
+
data: T;
|
|
7
|
+
/** When the event was captured (performance.now()) */
|
|
8
|
+
timestamp: number;
|
|
9
|
+
/** Time since capture in ms (computed each render) */
|
|
10
|
+
age: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Options for useEvent hook
|
|
14
|
+
*/
|
|
15
|
+
export interface UseEventOptions {
|
|
16
|
+
/** Time-to-live in ms before events expire (default: 1000) */
|
|
17
|
+
ttl?: number;
|
|
18
|
+
/** Max concurrent events to track (default: 64) */
|
|
19
|
+
limit?: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Hook to capture and accumulate tick-scoped events from the simulation.
|
|
23
|
+
*
|
|
24
|
+
* Events in the simulation are tick-scoped - they exist for exactly one tick
|
|
25
|
+
* then get cleared. This hook captures events as they arrive and keeps them
|
|
26
|
+
* for a configurable duration (ttl), triggering React re-renders when events
|
|
27
|
+
* arrive or expire.
|
|
28
|
+
*
|
|
29
|
+
* Best for: UI notifications, sound triggers, non-animated effects.
|
|
30
|
+
* For animated effects that need per-frame updates, use the manual pool
|
|
31
|
+
* pattern with useFrame instead.
|
|
32
|
+
*
|
|
33
|
+
* @param iterator - Generator function that yields events from state (e.g., iterBulletHit)
|
|
34
|
+
* @param options - Configuration options
|
|
35
|
+
* @returns Array of captured events with timestamp and age
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```tsx
|
|
39
|
+
* const hits = useEvent(iterBulletHit, { ttl: 300, limit: 32 });
|
|
40
|
+
* return hits.map((e, i) => (
|
|
41
|
+
* <DamageNumber key={i} position={e.data} />
|
|
42
|
+
* ));
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare function useEvent<T>(iterator: (state: DataView) => Generator<T>, options?: UseEventOptions): CapturedEvent<T>[];
|
|
46
|
+
//# sourceMappingURL=useEvent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEvent.d.ts","sourceRoot":"","sources":["../../../../src/react/hooks/useEvent.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC;IAC9B,qBAAqB;IACrB,IAAI,EAAE,CAAC,CAAA;IACP,sDAAsD;IACtD,SAAS,EAAE,MAAM,CAAA;IACjB,sDAAsD;IACtD,GAAG,EAAE,MAAM,CAAA;CACZ;AAQD;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,8DAA8D;IAC9D,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,mDAAmD;IACnD,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EACxB,QAAQ,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAC3C,OAAO,CAAC,EAAE,eAAe,GACxB,aAAa,CAAC,CAAC,CAAC,EAAE,CA4DpB"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { UseSessionRenderCallback } from '../types/session';
|
|
2
|
+
/**
|
|
3
|
+
* useFrame wrapper that provides the current state snapshot to the callback
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* useFrame(({ state, players, clock, camera }, delta, frame) => {
|
|
7
|
+
* // read state using generated bindings
|
|
8
|
+
* const pos = getPosition(state, entity);
|
|
9
|
+
* obj.position.set(pos[0], pos[1], pos[2]);
|
|
10
|
+
*
|
|
11
|
+
* // get participant (player) info
|
|
12
|
+
* const player = players[playerIndex];
|
|
13
|
+
* player.entity // the state assigned entity ref
|
|
14
|
+
* player.slot // the playerindex / slot
|
|
15
|
+
* player.id // the participant id (pubkey)
|
|
16
|
+
* });
|
|
17
|
+
*
|
|
18
|
+
* @param callback - Called each frame with R3F state plus session state and players
|
|
19
|
+
* @param renderPriority - Optional render priority (lower runs first)
|
|
20
|
+
* @returns null
|
|
21
|
+
*/
|
|
22
|
+
export declare function useFrame(callback: UseSessionRenderCallback, renderPriority?: number): null;
|
|
23
|
+
//# sourceMappingURL=useFrame.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFrame.d.ts","sourceRoot":"","sources":["../../../../src/react/hooks/useFrame.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAA;AAEhE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,QAAQ,CACtB,QAAQ,EAAE,wBAAwB,EAClC,cAAc,CAAC,EAAE,MAAM,GACtB,IAAI,CAgBN"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Player } from '../types/session';
|
|
2
|
+
/**
|
|
3
|
+
* usePlayers returns a reactive list of current session participants
|
|
4
|
+
*
|
|
5
|
+
* The list is guaranteed to be in the same order as Player.index.
|
|
6
|
+
*
|
|
7
|
+
* WARNING: You should prefer reading participants from the useFrame hook instead of
|
|
8
|
+
* this, since that is guaranteed to be in sync with the state snapshot - this hook is not.
|
|
9
|
+
* This hook is however useful for things like HUDs etc where sync is not critical.
|
|
10
|
+
*
|
|
11
|
+
* @returns Array of Player objects
|
|
12
|
+
*/
|
|
13
|
+
export declare function usePlayers(): Player[];
|
|
14
|
+
/**
|
|
15
|
+
* useCurrentPlayer returns the current player if it is in the session
|
|
16
|
+
*
|
|
17
|
+
* WARNING: You should prefer reading participants from the useFrame hook instead of
|
|
18
|
+
* this, since that is guaranteed to be in sync with the state snapshot - this hook is not.
|
|
19
|
+
* This hook is however useful for things like HUDs etc where sync is not critical.
|
|
20
|
+
*
|
|
21
|
+
* @returns Current player or null if not in session
|
|
22
|
+
*/
|
|
23
|
+
export declare function useCurrentPlayer(): Player | null;
|
|
24
|
+
//# sourceMappingURL=usePlayers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePlayers.d.ts","sourceRoot":"","sources":["../../../../src/react/hooks/usePlayers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAE9C;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,IAAI,MAAM,EAAE,CAGrC;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAIhD"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type EntityRef } from '../../state';
|
|
2
|
+
/**
|
|
3
|
+
* useQuery hook that returns entities matching component requirements
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* // Find all entities with Position and Ship components
|
|
7
|
+
* const ships = useQuery(['Position', 'Ship']);
|
|
8
|
+
*
|
|
9
|
+
* // Find entities with Position but NOT RespawnTimer
|
|
10
|
+
* const activeShips = useQuery(['Position', 'Ship'], ['RespawnTimer']);
|
|
11
|
+
*
|
|
12
|
+
* @param include - Component names that entities must have
|
|
13
|
+
* @param exclude - Optional component names that entities must NOT have
|
|
14
|
+
* @returns Array of EntityRef matching the query
|
|
15
|
+
*/
|
|
16
|
+
export declare function useQuery(include: string[], exclude?: string[]): EntityRef[];
|
|
17
|
+
/**
|
|
18
|
+
* useQueryMask hook that returns entities matching pre-computed bitmasks.
|
|
19
|
+
*
|
|
20
|
+
* This is the type-safe version that works with generated bindings.
|
|
21
|
+
* Use this when you have access to generated component constants.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* import { Position, Ship, RespawnTimer, queryMask } from '../generated/state';
|
|
25
|
+
*
|
|
26
|
+
* // Define masks at module level (computed once)
|
|
27
|
+
* const SHIPS_MASK = queryMask([Position, Ship]);
|
|
28
|
+
* const RESPAWN_MASK = queryMask([RespawnTimer]);
|
|
29
|
+
*
|
|
30
|
+
* function Ships() {
|
|
31
|
+
* // Type-safe query using generated bindings
|
|
32
|
+
* const ships = useQueryMask(SHIPS_MASK, RESPAWN_MASK);
|
|
33
|
+
* return ships.map(entity => <Ship key={entity} entity={entity} />);
|
|
34
|
+
* }
|
|
35
|
+
*
|
|
36
|
+
* @param includeMask - Bigint bitmask of components that must be present
|
|
37
|
+
* @param excludeMask - Optional bigint bitmask of components that must NOT be present
|
|
38
|
+
* @returns Array of EntityRef matching the query
|
|
39
|
+
*/
|
|
40
|
+
export declare function useQueryMask(includeMask: bigint, excludeMask?: bigint): EntityRef[];
|
|
41
|
+
//# sourceMappingURL=useQuery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useQuery.d.ts","sourceRoot":"","sources":["../../../../src/react/hooks/useQuery.ts"],"names":[],"mappings":"AAIA,OAAO,EAAsB,KAAK,SAAS,EAAE,MAAM,aAAa,CAAA;AAuChE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,CAyB3E;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,EAAE,CAyBnF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SessionContextValue } from '../types/session';
|
|
2
|
+
/**
|
|
3
|
+
* Hook to access session context
|
|
4
|
+
*
|
|
5
|
+
* Must be used within a SessionProvider.
|
|
6
|
+
*
|
|
7
|
+
* @returns Session context with state ref, participants, input handling, etc.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useSession(): SessionContextValue;
|
|
10
|
+
//# sourceMappingURL=useSession.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSession.d.ts","sourceRoot":"","sources":["../../../../src/react/hooks/useSession.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAE3D;;;;;;GAMG;AACH,wBAAgB,UAAU,IAAI,mBAAmB,CAEhD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React components for Multitap games
|
|
3
|
+
*/
|
|
4
|
+
export { SessionProvider, SessionContext, useSessionContext } from './providers';
|
|
5
|
+
export { useSession, useFrame, useQuery, useQueryMask, usePlayers, useCurrentPlayer, useEvent } from './hooks';
|
|
6
|
+
export type { CapturedEvent, UseEventOptions } from './hooks';
|
|
7
|
+
export type { Player, PlayerStore, EntityStore, SessionContextValue, SessionProviderProps, ReactSessionInterface, ReactCreateSession, UseSessionRenderCallback, } from './types/session';
|
|
8
|
+
export { Player as UnicamPlayer, Player as PlayerController } from './Player';
|
|
9
|
+
export { Crosshair } from './Crosshair';
|
|
10
|
+
export type { PlayerProps, PlayerHandle, PlayerIntent, ViewType, Vector3Like, QuaternionLike, } from './types';
|
|
11
|
+
export { usePlayerPose } from './PlayerPoseContext';
|
|
12
|
+
export type { PlayerPose } from './PlayerPoseContext';
|
|
13
|
+
export { DesktopInputMapper } from './input';
|
|
14
|
+
export type { InputMapper, RawInput } from './input';
|
|
15
|
+
export { ACTION_ATTACK, ACTION_INTERACT, ACTION_JUMP, ACTION_CROUCH } from './input';
|
|
16
|
+
export { FirstPersonView, ThirdPersonView, ThirdPersonFixedView, TopDownView, TopDownFixedView, IsometricView, SideOnView, MapView, VehicleView, VehicleFixedView, TwinStickView, MobaView, AsteroidsView, getView, } from './views';
|
|
17
|
+
export type { CrosshairMode, View, ViewState, ViewContext } from './views';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/index.ts"],"names":[],"mappings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AAM,SAAS,CAAA"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type InputMapper, type RawInput } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Default input mapper for desktop (keyboard + mouse)
|
|
4
|
+
*
|
|
5
|
+
* Controls:
|
|
6
|
+
* - WASD / Arrow keys: Movement
|
|
7
|
+
* - Mouse: Look (when pointer locked)
|
|
8
|
+
*/
|
|
9
|
+
export declare class DesktopInputMapper implements InputMapper {
|
|
10
|
+
private keys;
|
|
11
|
+
private lookDelta;
|
|
12
|
+
private movement;
|
|
13
|
+
private mouseButtons;
|
|
14
|
+
private scrollDelta;
|
|
15
|
+
private boundHandlers;
|
|
16
|
+
private _pointerLockEnabled;
|
|
17
|
+
private _lookMode;
|
|
18
|
+
/**
|
|
19
|
+
* Enable/disable pointer lock behavior.
|
|
20
|
+
* When disabled, clicking won't request pointer lock (useful for RTS-style views).
|
|
21
|
+
*/
|
|
22
|
+
setPointerLockEnabled(enabled: boolean): void;
|
|
23
|
+
/**
|
|
24
|
+
* Configure how mouse movement is captured into RawInput.look.
|
|
25
|
+
*/
|
|
26
|
+
setLookMode(mode: 'pointerLock' | 'always' | 'drag'): void;
|
|
27
|
+
private onKeyDown;
|
|
28
|
+
private onKeyUp;
|
|
29
|
+
private onMouseMove;
|
|
30
|
+
private onMouseDown;
|
|
31
|
+
private onMouseUp;
|
|
32
|
+
private onWheel;
|
|
33
|
+
private onClick;
|
|
34
|
+
bind(): void;
|
|
35
|
+
unbind(): void;
|
|
36
|
+
poll(): RawInput;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=DesktopInputMapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DesktopInputMapper.d.ts","sourceRoot":"","sources":["../../../../src/react/input/DesktopInputMapper.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,WAAW,EAChB,KAAK,QAAQ,EACd,MAAM,SAAS,CAAA;AAEhB;;;;;;GAMG;AACH,qBAAa,kBAAmB,YAAW,WAAW;IACpD,OAAO,CAAC,IAAI,CAAoB;IAChC,OAAO,CAAC,SAAS,CAAgB;IACjC,OAAO,CAAC,QAAQ,CAAgB;IAChC,OAAO,CAAC,YAAY,CAAI;IACxB,OAAO,CAAC,WAAW,CAAI;IACvB,OAAO,CAAC,aAAa,CAAQ;IAC7B,OAAO,CAAC,mBAAmB,CAAO;IAClC,OAAO,CAAC,SAAS,CAAmD;IAEpE;;;OAGG;IACH,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAQ7C;;OAEG;IACH,WAAW,CAAC,IAAI,EAAE,aAAa,GAAG,QAAQ,GAAG,MAAM,GAAG,IAAI;IAU1D,OAAO,CAAC,SAAS,CAEhB;IAED,OAAO,CAAC,OAAO,CAEd;IAED,OAAO,CAAC,WAAW,CAUlB;IAED,OAAO,CAAC,WAAW,CAGlB;IAED,OAAO,CAAC,SAAS,CAGhB;IAED,OAAO,CAAC,OAAO,CAId;IAED,OAAO,CAAC,OAAO,CAQd;IAED,IAAI,IAAI,IAAI;IAcZ,MAAM,IAAI,IAAI;IAuBd,IAAI,IAAI,QAAQ;CA8CjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/react/input/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA"}
|