hytopia 0.8.6-devtrace-41ce1a9 → 0.8.6-devtrace-allocs
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/bun-server.mjs +168 -166
- package/docs/server.array3number.md +13 -0
- package/docs/server.array4number.md +13 -0
- package/docs/server.audiomanager.getallaudios.md +38 -1
- package/docs/server.audiomanager.getallentityattachedaudios.md +17 -1
- package/docs/server.audiomanager.getallloopedaudios.md +38 -1
- package/docs/server.audiomanager.getalloneshotaudios.md +38 -1
- package/docs/server.audiomanager.md +4 -4
- package/docs/server.blocktype._constructor_.md +15 -1
- package/docs/server.blocktype.blocktyperegistry.md +13 -0
- package/docs/server.blocktype.md +22 -1
- package/docs/server.blocktyperegistry.getallblocktypes.md +38 -1
- package/docs/server.blocktyperegistry.md +1 -1
- package/docs/server.chunk._constructor_.md +15 -1
- package/docs/server.chunk.chunklattice.md +13 -0
- package/docs/server.chunk.md +22 -1
- package/docs/server.chunklattice.getallchunks.md +38 -1
- package/docs/server.chunklattice.md +22 -1
- package/docs/server.chunklattice.world.md +13 -0
- package/docs/server.chunklatticeevent.md +14 -0
- package/docs/server.chunklatticeeventpayloads._chunk_lattice.add_chunk_.md +16 -0
- package/docs/server.chunklatticeeventpayloads.md +19 -0
- package/docs/server.entitymanager.getallentities.md +38 -1
- package/docs/server.entitymanager.md +1 -1
- package/docs/server.lightmanager.getalllights.md +38 -1
- package/docs/server.lightmanager.md +1 -1
- package/docs/server.md +67 -1
- package/docs/server.particleemitter.burst.md +54 -0
- package/docs/server.particleemitter.md +14 -0
- package/docs/server.particleemitterevent.md +14 -0
- package/docs/server.particleemittereventpayloads._particle_emitter.burst_.md +16 -0
- package/docs/server.particleemittereventpayloads.md +19 -0
- package/docs/server.particleemittermanager.getallparticleemitters.md +38 -1
- package/docs/server.particleemittermanager.md +1 -1
- package/docs/server.rgbcolor.md +1 -1
- package/docs/server.sceneuimanager.getallsceneuis.md +38 -1
- package/docs/server.sceneuimanager.md +1 -1
- package/docs/server.telemetry.getprocessstats.md +56 -0
- package/docs/server.telemetry.initializesentry.md +74 -0
- package/docs/server.telemetry.md +126 -0
- package/docs/server.telemetry.sentry.md +23 -0
- package/docs/server.telemetry.startspan.md +91 -0
- package/docs/server.telemetryspanoperation.md +258 -0
- package/docs/server.telemetryspanoptions.md +18 -0
- package/docs/server.tickallocator.filter.md +72 -0
- package/docs/server.tickallocator.getarray.md +72 -0
- package/docs/server.tickallocator.getarray3number.md +56 -0
- package/docs/server.tickallocator.getarray4number.md +56 -0
- package/docs/server.tickallocator.getobject.md +72 -0
- package/docs/server.tickallocator.getset.md +72 -0
- package/docs/server.tickallocator.map.md +72 -0
- package/docs/server.tickallocator.md +163 -0
- package/docs/server.tickallocator.reset.md +17 -0
- package/docs/server.world.md +21 -0
- package/docs/server.world.tickallocator.md +13 -0
- package/node-server.mjs +173 -171
- package/package.json +1 -1
- package/server.api.json +2175 -312
- package/server.d.ts +328 -32
package/server.d.ts
CHANGED
|
@@ -5,13 +5,20 @@ import http from 'http';
|
|
|
5
5
|
import type { IncomingMessage } from 'http';
|
|
6
6
|
import type { InputSchema } from '@hytopia.com/server-protocol';
|
|
7
7
|
import type { LobbyMembershipDto } from '@hytopia.com/creative-lib/dist/impl/getSession';
|
|
8
|
-
import mediasoup from 'mediasoup';
|
|
9
8
|
import protocol from '@hytopia.com/server-protocol';
|
|
10
9
|
import RAPIER from '@dimforge/rapier3d-simd-compat';
|
|
11
10
|
import { SdpMatrix3 } from '@dimforge/rapier3d-simd-compat';
|
|
11
|
+
import * as Sentry from '@sentry/node';
|
|
12
12
|
import type { Socket } from 'net';
|
|
13
|
+
import type { types } from 'mediasoup';
|
|
13
14
|
import { WebSocket as WebSocket_2 } from 'ws';
|
|
14
15
|
|
|
16
|
+
/** A 3-element number array. @public */
|
|
17
|
+
export declare type Array3Number = [number, number, number];
|
|
18
|
+
|
|
19
|
+
/** A 4-element number array. @public */
|
|
20
|
+
export declare type Array4Number = [number, number, number, number];
|
|
21
|
+
|
|
15
22
|
/**
|
|
16
23
|
* Represents a audio playback in a world.
|
|
17
24
|
*
|
|
@@ -272,28 +279,40 @@ export declare class AudioManager {
|
|
|
272
279
|
/**
|
|
273
280
|
* Retrieves all loaded audio instances for the world.
|
|
274
281
|
*
|
|
282
|
+
* @param tickAllocated - If true, uses the tick allocator and frees
|
|
283
|
+
* the allocated array at the end of the current tick. false by default.
|
|
284
|
+
*
|
|
275
285
|
* @returns An array of audio instances.
|
|
276
286
|
*/
|
|
277
|
-
getAllAudios(): Audio[];
|
|
287
|
+
getAllAudios(tickAllocated?: boolean): Audio[];
|
|
278
288
|
/**
|
|
279
289
|
* Retrieves all loaded audio instances attached to a specific entity.
|
|
280
290
|
*
|
|
281
291
|
* @param entity - The entity to get attached audio instances for.
|
|
292
|
+
* @param tickAllocated - If true, uses the tick allocator and frees
|
|
293
|
+
* the allocated array at the end of the current tick. false by default.
|
|
294
|
+
|
|
282
295
|
* @returns An array of audio instances.
|
|
283
296
|
*/
|
|
284
|
-
getAllEntityAttachedAudios(entity: Entity): Audio[];
|
|
297
|
+
getAllEntityAttachedAudios(entity: Entity, tickAllocated?: boolean): Audio[];
|
|
285
298
|
/**
|
|
286
299
|
* Retrieves all looped audio instances for the world.
|
|
287
300
|
*
|
|
301
|
+
* @param tickAllocated - If true, uses the tick allocator and frees
|
|
302
|
+
* the allocated array at the end of the current tick. false by default.
|
|
303
|
+
*
|
|
288
304
|
* @returns An array of audio instances.
|
|
289
305
|
*/
|
|
290
|
-
getAllLoopedAudios(): Audio[];
|
|
306
|
+
getAllLoopedAudios(tickAllocated?: boolean): Audio[];
|
|
291
307
|
/**
|
|
292
308
|
* Retrieves all oneshot (non-looped) audio instances for the world.
|
|
293
309
|
*
|
|
310
|
+
* @param tickAllocated - If true, uses the tick allocator and frees
|
|
311
|
+
* the allocated array at the end of the current tick. false by default.
|
|
312
|
+
*
|
|
294
313
|
* @returns An array of audio instances.
|
|
295
314
|
*/
|
|
296
|
-
getAllOneshotAudios(): Audio[];
|
|
315
|
+
getAllOneshotAudios(tickAllocated?: boolean): Audio[];
|
|
297
316
|
|
|
298
317
|
/**
|
|
299
318
|
* Unregisters and stops an audio instance from the audio manager.
|
|
@@ -603,14 +622,17 @@ export declare class BlockType extends EventRouter implements protocol.Serializa
|
|
|
603
622
|
|
|
604
623
|
|
|
605
624
|
|
|
625
|
+
|
|
606
626
|
/**
|
|
607
627
|
* Creates a new block type instance.
|
|
608
628
|
* @param world - The world the block type is for.
|
|
609
629
|
* @param options - The options for the block type.
|
|
610
630
|
*/
|
|
611
|
-
constructor(options?: BlockTypeOptions);
|
|
631
|
+
constructor(blockTypeRegistry: BlockTypeRegistry, options?: BlockTypeOptions);
|
|
612
632
|
/** The unique identifier for the block type. */
|
|
613
633
|
get id(): number;
|
|
634
|
+
/** The block type registry that the block type belongs to. */
|
|
635
|
+
get blockTypeRegistry(): BlockTypeRegistry;
|
|
614
636
|
/** The collider options for the block type. */
|
|
615
637
|
get colliderOptions(): VoxelsColliderOptions;
|
|
616
638
|
/** The half extents size of the block type. */
|
|
@@ -702,9 +724,15 @@ export declare class BlockTypeRegistry extends EventRouter implements protocol.S
|
|
|
702
724
|
get world(): World;
|
|
703
725
|
/**
|
|
704
726
|
* Get all registered block types.
|
|
727
|
+
*
|
|
728
|
+
* @param tickAllocated - Whether to use the tick allocator to allocate the
|
|
729
|
+
* returned array of BlockType instances. The allocated array will be collected
|
|
730
|
+
* and released at the end of the current tick if true. Only use this if
|
|
731
|
+
* you know what you're doing.
|
|
732
|
+
*
|
|
705
733
|
* @returns An array of all registered block types.
|
|
706
734
|
*/
|
|
707
|
-
getAllBlockTypes(): BlockType[];
|
|
735
|
+
getAllBlockTypes(tickAllocated?: boolean): BlockType[];
|
|
708
736
|
/**
|
|
709
737
|
* Get a registered block type by its id.
|
|
710
738
|
* @param id - The id of the block type to get.
|
|
@@ -862,12 +890,15 @@ export declare class ChatManager extends EventRouter {
|
|
|
862
890
|
export declare class Chunk implements protocol.Serializable {
|
|
863
891
|
|
|
864
892
|
|
|
893
|
+
|
|
865
894
|
/**
|
|
866
895
|
* Creates a new chunk instance.
|
|
867
896
|
*/
|
|
868
|
-
constructor(originCoordinate: Vector3Like);
|
|
897
|
+
constructor(chunkLattice: ChunkLattice, originCoordinate: Vector3Like);
|
|
869
898
|
/** The blocks in the chunk as a flat Uint8Array[4096], each index as 0 or a block type id. */
|
|
870
899
|
get blocks(): Readonly<Uint8Array>;
|
|
900
|
+
/** The chunk lattice that the chunk belongs to. */
|
|
901
|
+
get chunkLattice(): ChunkLattice;
|
|
871
902
|
/** The origin coordinate of the chunk. */
|
|
872
903
|
get originCoordinate(): Vector3Like;
|
|
873
904
|
/**
|
|
@@ -928,6 +959,8 @@ export declare class ChunkLattice extends EventRouter {
|
|
|
928
959
|
constructor(world: World);
|
|
929
960
|
/** The number of chunks in the lattice. */
|
|
930
961
|
get chunkCount(): number;
|
|
962
|
+
/** The world that the chunk lattice belongs to. */
|
|
963
|
+
get world(): World;
|
|
931
964
|
/**
|
|
932
965
|
* Removes and clears all chunks and their blocks from the lattice.
|
|
933
966
|
*/
|
|
@@ -966,9 +999,15 @@ export declare class ChunkLattice extends EventRouter {
|
|
|
966
999
|
getOrCreateChunk(globalCoordinate: Vector3Like): Chunk;
|
|
967
1000
|
/**
|
|
968
1001
|
* Get all chunks in the lattice.
|
|
1002
|
+
*
|
|
1003
|
+
* @param tickAllocated - Whether to use the tick allocator to allocate the
|
|
1004
|
+
* returned array of Chunk instances. The allocated array will be collected
|
|
1005
|
+
* and released at the end of the current tick if true. Only use this if
|
|
1006
|
+
* you know what you're doing.
|
|
1007
|
+
*
|
|
969
1008
|
* @returns An array of all chunks in the lattice.
|
|
970
1009
|
*/
|
|
971
|
-
getAllChunks(): Chunk[];
|
|
1010
|
+
getAllChunks(tickAllocated?: boolean): Chunk[];
|
|
972
1011
|
/**
|
|
973
1012
|
* Check if a block exists at a specific global coordinate.
|
|
974
1013
|
* @param globalCoordinate - The global coordinate of the block to check.
|
|
@@ -995,12 +1034,18 @@ export declare class ChunkLattice extends EventRouter {
|
|
|
995
1034
|
|
|
996
1035
|
/** Event types a ChunkLattice instance can emit. See {@link ChunkLatticeEventPayloads} for the payloads. @public */
|
|
997
1036
|
export declare enum ChunkLatticeEvent {
|
|
1037
|
+
ADD_CHUNK = "CHUNK_LATTICE.ADD_CHUNK",
|
|
998
1038
|
REMOVE_CHUNK = "CHUNK_LATTICE.REMOVE_CHUNK",
|
|
999
1039
|
SET_BLOCK = "CHUNK_LATTICE.SET_BLOCK"
|
|
1000
1040
|
}
|
|
1001
1041
|
|
|
1002
1042
|
/** Event payloads for ChunkLattice emitted events. @public */
|
|
1003
1043
|
export declare interface ChunkLatticeEventPayloads {
|
|
1044
|
+
/** Emitted when a chunk is added to the lattice. */
|
|
1045
|
+
[ChunkLatticeEvent.ADD_CHUNK]: {
|
|
1046
|
+
chunkLattice: ChunkLattice;
|
|
1047
|
+
chunk: Chunk;
|
|
1048
|
+
};
|
|
1004
1049
|
/** Emitted when a chunk is removed from the lattice. */
|
|
1005
1050
|
[ChunkLatticeEvent.REMOVE_CHUNK]: {
|
|
1006
1051
|
chunkLattice: ChunkLattice;
|
|
@@ -2108,9 +2153,15 @@ export declare class EntityManager {
|
|
|
2108
2153
|
|
|
2109
2154
|
/**
|
|
2110
2155
|
* Gets all spawned entities in the world.
|
|
2156
|
+
*
|
|
2157
|
+
* @param tickAllocated - Whether to use the tick allocator to allocate the
|
|
2158
|
+
* returned array of Entity instances. The allocated array will be collected
|
|
2159
|
+
* and released at the end of the current tick if true. Only use this if
|
|
2160
|
+
* you know what you're doing.
|
|
2161
|
+
*
|
|
2111
2162
|
* @returns All spawned entities in the world.
|
|
2112
2163
|
*/
|
|
2113
|
-
getAllEntities(): Entity[];
|
|
2164
|
+
getAllEntities(tickAllocated?: boolean): Entity[];
|
|
2114
2165
|
/**
|
|
2115
2166
|
* Gets all spawned player entities in the world.
|
|
2116
2167
|
* @returns All spawned player entities in the world.
|
|
@@ -2760,9 +2811,14 @@ export declare class LightManager {
|
|
|
2760
2811
|
/**
|
|
2761
2812
|
* Retrieves all spawned Light instances for the world.
|
|
2762
2813
|
*
|
|
2814
|
+
* @param tickAllocated - Whether to use the tick allocator to allocate the
|
|
2815
|
+
* returned array of Light instances. The allocated array will be collected
|
|
2816
|
+
* and released at the end of the current tick if true. Only use this if
|
|
2817
|
+
* you know what you're doing.
|
|
2818
|
+
*
|
|
2763
2819
|
* @returns An array of Light instances.
|
|
2764
2820
|
*/
|
|
2765
|
-
getAllLights(): Light[];
|
|
2821
|
+
getAllLights(tickAllocated?: boolean): Light[];
|
|
2766
2822
|
/**
|
|
2767
2823
|
* Retrieves all spawned Light instances attached to a specific entity.
|
|
2768
2824
|
*
|
|
@@ -3861,6 +3917,12 @@ export declare class ParticleEmitter extends EventRouter implements protocol.Ser
|
|
|
3861
3917
|
* @param velocityVariance - The velocity variance of an emitted particle.
|
|
3862
3918
|
*/
|
|
3863
3919
|
setVelocityVariance(velocityVariance: Vector3Like): void;
|
|
3920
|
+
/**
|
|
3921
|
+
* Creates a burst of particles, regardless of pause state.
|
|
3922
|
+
*
|
|
3923
|
+
* @param count - The number of particles to burst.
|
|
3924
|
+
*/
|
|
3925
|
+
burst(count: number): void;
|
|
3864
3926
|
/**
|
|
3865
3927
|
* Despawns the ParticleEmitter from the world.
|
|
3866
3928
|
*/
|
|
@@ -3884,6 +3946,7 @@ export declare class ParticleEmitter extends EventRouter implements protocol.Ser
|
|
|
3884
3946
|
|
|
3885
3947
|
/** Event types a ParticleEmitter instance can emit. See {@link ParticleEmitterEventPayloads} @public */
|
|
3886
3948
|
export declare enum ParticleEmitterEvent {
|
|
3949
|
+
BURST = "PARTICLE_EMITTER.BURST",
|
|
3887
3950
|
DESPAWN = "PARTICLE_EMITTER.DESPAWN",
|
|
3888
3951
|
SET_ALPHA_TEST = "PARTICLE_EMITTER.SET_ALPHA_TEST",
|
|
3889
3952
|
SET_ATTACHED_TO_ENTITY = "PARTICLE_EMITTER.SET_ATTACHED_TO_ENTITY",
|
|
@@ -3919,6 +3982,11 @@ export declare enum ParticleEmitterEvent {
|
|
|
3919
3982
|
|
|
3920
3983
|
/** Event payloads for ParticleEmitter emitted events. @public */
|
|
3921
3984
|
export declare interface ParticleEmitterEventPayloads {
|
|
3985
|
+
/** Emitted when a ParticleEmitter bursts the specified number of particles. */
|
|
3986
|
+
[ParticleEmitterEvent.BURST]: {
|
|
3987
|
+
particleEmitter: ParticleEmitter;
|
|
3988
|
+
count: number;
|
|
3989
|
+
};
|
|
3922
3990
|
/** Emitted when a ParticleEmitter is despawned. */
|
|
3923
3991
|
[ParticleEmitterEvent.DESPAWN]: {
|
|
3924
3992
|
particleEmitter: ParticleEmitter;
|
|
@@ -4096,9 +4164,14 @@ export declare class ParticleEmitterManager {
|
|
|
4096
4164
|
/**
|
|
4097
4165
|
* Retrieves all spawned ParticleEmitter instances for the world.
|
|
4098
4166
|
*
|
|
4167
|
+
* @param tickAllocated - Whether to use the tick allocator to allocate the
|
|
4168
|
+
* returned array of ParticleEmitter instances. The allocated array will be collected
|
|
4169
|
+
* and released at the end of the current tick if true. Only use this if
|
|
4170
|
+
* you know what you're doing.
|
|
4171
|
+
*
|
|
4099
4172
|
* @returns An array of ParticleEmitter instances.
|
|
4100
4173
|
*/
|
|
4101
|
-
getAllParticleEmitters(): ParticleEmitter[];
|
|
4174
|
+
getAllParticleEmitters(tickAllocated?: boolean): ParticleEmitter[];
|
|
4102
4175
|
/**
|
|
4103
4176
|
* Retrieves all spawned ParticleEmitter instances attached to a specific entity.
|
|
4104
4177
|
*
|
|
@@ -5192,7 +5265,7 @@ export declare type RaycastOptions = {
|
|
|
5192
5265
|
solidMode?: boolean;
|
|
5193
5266
|
} & FilterOptions;
|
|
5194
5267
|
|
|
5195
|
-
/** A RGB color. @public */
|
|
5268
|
+
/** A RGB color. r, g and b expect a value between 0 and 255. @public */
|
|
5196
5269
|
export declare interface RgbColor {
|
|
5197
5270
|
r: number;
|
|
5198
5271
|
g: number;
|
|
@@ -5729,9 +5802,14 @@ export declare class SceneUIManager {
|
|
|
5729
5802
|
/**
|
|
5730
5803
|
* Retrieves all loaded SceneUI instances for the world.
|
|
5731
5804
|
*
|
|
5805
|
+
* @param tickAllocated - Whether to use the tick allocator to allocate the
|
|
5806
|
+
* returned array of SceneUI instances. The allocated array will be collected
|
|
5807
|
+
* and released at the end of the current tick if true. Only use this if
|
|
5808
|
+
* you know what you're doing.
|
|
5809
|
+
*
|
|
5732
5810
|
* @returns An array of SceneUI instances.
|
|
5733
5811
|
*/
|
|
5734
|
-
getAllSceneUIs(): SceneUI[];
|
|
5812
|
+
getAllSceneUIs(tickAllocated?: boolean): SceneUI[];
|
|
5735
5813
|
/**
|
|
5736
5814
|
* Retrieves all loaded SceneUI instances attached to a specific entity.
|
|
5737
5815
|
*
|
|
@@ -6071,6 +6149,221 @@ export declare function startServer(init: ((() => void) | ((world: World) => voi
|
|
|
6071
6149
|
/** The input keys that are included in the PlayerInput. @public */
|
|
6072
6150
|
export declare const SUPPORTED_INPUT_KEYS: readonly ["w", "a", "s", "d", "sp", "sh", "tb", "ml", "mr", "q", "e", "r", "f", "z", "x", "c", "v", "u", "i", "o", "j", "k", "l", "n", "m", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0"];
|
|
6073
6151
|
|
|
6152
|
+
/**
|
|
6153
|
+
* Manages performance telemetry and error tracking through your Sentry.io account.
|
|
6154
|
+
*
|
|
6155
|
+
* @remarks
|
|
6156
|
+
* The Telemetry class provides low-overhead performance monitoring
|
|
6157
|
+
* and error tracking through Sentry (https://sentry.io) integration
|
|
6158
|
+
* and your provided Sentry DSN. It automatically tracks critical game loop
|
|
6159
|
+
* operations like physics simulation, entity updates, network synchronization,
|
|
6160
|
+
* and more. The system only sends telemetry data when errors or slow-tick
|
|
6161
|
+
* performance issues are detected, minimizing bandwidth and storage costs.
|
|
6162
|
+
*
|
|
6163
|
+
* @example
|
|
6164
|
+
* ```typescript
|
|
6165
|
+
* // Initialize Sentry for production telemetry
|
|
6166
|
+
* Telemetry.initializeSentry('MY_SENTRY_PROJECT_DSN');
|
|
6167
|
+
*
|
|
6168
|
+
* // Wrap performance-critical code in spans
|
|
6169
|
+
* Telemetry.startSpan({
|
|
6170
|
+
* operation: TelemetrySpanOperation.CUSTOM_OPERATION,
|
|
6171
|
+
* attributes: { // any arbitrary attributes you want to attach to the span
|
|
6172
|
+
* playerCount: world.playerManager.connectedPlayers.length,
|
|
6173
|
+
* entityCount: world.entityManager.entityCount,
|
|
6174
|
+
* },
|
|
6175
|
+
* }, () => {
|
|
6176
|
+
* // Your performance-critical code here
|
|
6177
|
+
* performExpensiveOperation();
|
|
6178
|
+
* });
|
|
6179
|
+
*
|
|
6180
|
+
* // Get current process statistics
|
|
6181
|
+
* const stats = Telemetry.getProcessStats();
|
|
6182
|
+
* console.log(`Heap usage: ${stats.jsHeapUsagePercent * 100}%`);
|
|
6183
|
+
* ```
|
|
6184
|
+
*
|
|
6185
|
+
* @public
|
|
6186
|
+
*/
|
|
6187
|
+
export declare class Telemetry {
|
|
6188
|
+
/**
|
|
6189
|
+
* Gets current process memory and performance statistics.
|
|
6190
|
+
*
|
|
6191
|
+
* @param asMeasurement - Whether to return data in Sentry measurement format with units.
|
|
6192
|
+
* @returns Process statistics including heap usage, RSS memory, and capacity metrics.
|
|
6193
|
+
*/
|
|
6194
|
+
static getProcessStats(asMeasurement?: boolean): Record<string, any>;
|
|
6195
|
+
/**
|
|
6196
|
+
* Initializes Sentry telemetry with the provided DSN.
|
|
6197
|
+
*
|
|
6198
|
+
* @remarks
|
|
6199
|
+
* This method configures Sentry for error tracking and performance monitoring.
|
|
6200
|
+
* It sets up filtering to only send performance spans that exceed the
|
|
6201
|
+
* provided threshold duration, reducing noise and costs. The initialization
|
|
6202
|
+
* includes game-specific tags and process statistics attachment.
|
|
6203
|
+
*
|
|
6204
|
+
* @param sentryDsn - The Sentry Data Source Name (DSN) for your project.
|
|
6205
|
+
* @param tickTimeMsThreshold - The tick duration that must be exceeded to
|
|
6206
|
+
* send a performance span to Sentry for a given tick. Defaults to 50ms.
|
|
6207
|
+
*/
|
|
6208
|
+
static initializeSentry(sentryDsn: string, tickTimeMsThreshold?: number): void;
|
|
6209
|
+
/**
|
|
6210
|
+
* Executes a callback function within a performance monitoring span.
|
|
6211
|
+
*
|
|
6212
|
+
* @remarks
|
|
6213
|
+
* This method provides zero-overhead performance monitoring in development
|
|
6214
|
+
* environments. In production with Sentry enabled and `SENTRY_ENABLE_TRACING=true`,
|
|
6215
|
+
* it creates performance spans for monitoring. The span data is only transmitted
|
|
6216
|
+
* to Sentry when performance issues are detected.
|
|
6217
|
+
*
|
|
6218
|
+
* @param options - Configuration for the telemetry span including operation type and attributes.
|
|
6219
|
+
* @param callback - The function to execute within the performance span.
|
|
6220
|
+
* @returns The return value of the callback function.
|
|
6221
|
+
*
|
|
6222
|
+
* @example
|
|
6223
|
+
* ```typescript
|
|
6224
|
+
* const result = Telemetry.startSpan({
|
|
6225
|
+
* operation: TelemetrySpanOperation.ENTITIES_TICK,
|
|
6226
|
+
* attributes: {
|
|
6227
|
+
* entityCount: entities.length,
|
|
6228
|
+
* worldId: world.id,
|
|
6229
|
+
* },
|
|
6230
|
+
* }, () => {
|
|
6231
|
+
* return processEntities(entities);
|
|
6232
|
+
* });
|
|
6233
|
+
* ```
|
|
6234
|
+
*/
|
|
6235
|
+
static startSpan<T>(options: TelemetrySpanOptions, callback: (span?: Sentry.Span) => T): T;
|
|
6236
|
+
/**
|
|
6237
|
+
* Gets the Sentry SDK instance for advanced telemetry operations.
|
|
6238
|
+
*
|
|
6239
|
+
* @remarks
|
|
6240
|
+
* This method provides direct access to the Sentry SDK for operations
|
|
6241
|
+
* not covered by the Telemetry wrapper, such as custom error reporting,
|
|
6242
|
+
* user context setting, or advanced span manipulation.
|
|
6243
|
+
*
|
|
6244
|
+
* @returns The Sentry SDK instance.
|
|
6245
|
+
*/
|
|
6246
|
+
static sentry(): typeof Sentry;
|
|
6247
|
+
}
|
|
6248
|
+
|
|
6249
|
+
/** Performance telemetry span operation types. @public */
|
|
6250
|
+
export declare enum TelemetrySpanOperation {
|
|
6251
|
+
BUILD_PACKETS = "build_packets",
|
|
6252
|
+
ENTITIES_EMIT_UPDATES = "entities_emit_updates",
|
|
6253
|
+
ENTITIES_TICK = "entities_tick",
|
|
6254
|
+
NETWORK_SYNCHRONIZE = "network_synchronize",
|
|
6255
|
+
NETWORK_SYNCHRONIZE_CLEANUP = "network_synchronize_cleanup",
|
|
6256
|
+
PHYSICS_CLEANUP = "physics_cleanup",
|
|
6257
|
+
PHYSICS_STEP = "physics_step",
|
|
6258
|
+
RELEASE_TICK_ALLOCATION = "release_tick_allocation",
|
|
6259
|
+
SEND_ALL_PACKETS = "send_all_packets",
|
|
6260
|
+
SEND_PACKETS = "send_packets",
|
|
6261
|
+
SERIALIZE_FREE_BUFFERS = "serialize_free_buffers",
|
|
6262
|
+
SERIALIZE_PACKETS = "serialize_packets",
|
|
6263
|
+
SERIALIZE_PACKETS_ENCODE = "serialize_packets_encode",
|
|
6264
|
+
SIMULATION_STEP = "simulation_step",
|
|
6265
|
+
TICKER_TICK = "ticker_tick",
|
|
6266
|
+
WORLD_TICK = "world_tick"
|
|
6267
|
+
}
|
|
6268
|
+
|
|
6269
|
+
/** Options for creating a telemetry span. @public */
|
|
6270
|
+
export declare type TelemetrySpanOptions = {
|
|
6271
|
+
/** The operation being measured. */
|
|
6272
|
+
operation: TelemetrySpanOperation | string;
|
|
6273
|
+
/** Additional attributes to attach to the span for context. */
|
|
6274
|
+
attributes?: Record<string, string | number>;
|
|
6275
|
+
};
|
|
6276
|
+
|
|
6277
|
+
/**
|
|
6278
|
+
* High-performance tick-scoped allocator for temporary objects, arrays, and buffers.
|
|
6279
|
+
* All allocations are automatically bulk-released when reset() is called.
|
|
6280
|
+
*
|
|
6281
|
+
* @remarks
|
|
6282
|
+
* TickAllocator maintains separate pools for different data types and tracks all
|
|
6283
|
+
* allocations made during a tick cycle. Objects are reused across ticks to eliminate
|
|
6284
|
+
* garbage collection overhead in hot paths like network synchronization.
|
|
6285
|
+
*
|
|
6286
|
+
* @example
|
|
6287
|
+
* ```typescript
|
|
6288
|
+
* // Allocate during tick
|
|
6289
|
+
* const position = tickAllocator.getArray3Number();
|
|
6290
|
+
* const rotation = tickAllocator.getArray4Number();
|
|
6291
|
+
* const data = tickAllocator.getObject<EntitySchema>();
|
|
6292
|
+
*
|
|
6293
|
+
* // At end of tick - bulk release everything
|
|
6294
|
+
* tickAllocator.reset();
|
|
6295
|
+
* ```
|
|
6296
|
+
*
|
|
6297
|
+
* @public
|
|
6298
|
+
*/
|
|
6299
|
+
export declare class TickAllocator {
|
|
6300
|
+
|
|
6301
|
+
|
|
6302
|
+
|
|
6303
|
+
|
|
6304
|
+
|
|
6305
|
+
|
|
6306
|
+
|
|
6307
|
+
|
|
6308
|
+
|
|
6309
|
+
|
|
6310
|
+
/**
|
|
6311
|
+
* Filters an array using a callback function.
|
|
6312
|
+
* @typeParam T - The type of the array.
|
|
6313
|
+
* @param array - The array to filter.
|
|
6314
|
+
* @param callback - The callback function to filter the array.
|
|
6315
|
+
* @returns A new array with the filtered values.
|
|
6316
|
+
*/
|
|
6317
|
+
filter<T>(array: T[], callback: (value: T, index: number, array: T[]) => boolean): T[];
|
|
6318
|
+
/**
|
|
6319
|
+
* Gets a generic array from the pool.
|
|
6320
|
+
* Array is reset to empty state and ready for use.
|
|
6321
|
+
* @typeParam T - The array type.
|
|
6322
|
+
* @returns A reusable array.
|
|
6323
|
+
*/
|
|
6324
|
+
getArray<T extends unknown[] = unknown[]>(copyFromA?: Iterable<unknown>, copyFromB?: Iterable<unknown>): T;
|
|
6325
|
+
/**
|
|
6326
|
+
* Gets a 3-element number array from the pool.
|
|
6327
|
+
* Array is reset to [0, 0, 0] and ready for use.
|
|
6328
|
+
* @returns A reusable 3-element array.
|
|
6329
|
+
*/
|
|
6330
|
+
getArray3Number(copyFrom?: Array3Number | Set<number>): Array3Number;
|
|
6331
|
+
/**
|
|
6332
|
+
* Gets a 4-element number array from the pool.
|
|
6333
|
+
* Array is reset to [0, 0, 0, 0] and ready for use.
|
|
6334
|
+
* @returns A reusable 4-element array.
|
|
6335
|
+
*/
|
|
6336
|
+
getArray4Number(copyFrom?: Array4Number | Set<number>): Array4Number;
|
|
6337
|
+
/**
|
|
6338
|
+
* Gets a plain object from the pool.
|
|
6339
|
+
* Object is reset to empty state and ready for use.
|
|
6340
|
+
* @typeParam T - The type interface for the object.
|
|
6341
|
+
* @returns A reusable plain object.
|
|
6342
|
+
*/
|
|
6343
|
+
getObject<T extends Record<string, unknown> = Record<string, unknown>>(copyFromA?: T, copyFromB?: T): T;
|
|
6344
|
+
/**
|
|
6345
|
+
* Gets a set from the pool.
|
|
6346
|
+
* Set is reset to empty state and ready for use.
|
|
6347
|
+
* @typeParam T - The type of the set.
|
|
6348
|
+
* @returns A reusable set.
|
|
6349
|
+
*/
|
|
6350
|
+
getSet<T>(copyFromA?: Set<T> | T[], copyFromB?: Set<T> | T[]): Set<T>;
|
|
6351
|
+
/**
|
|
6352
|
+
* Maps an array to a new array using a callback function.
|
|
6353
|
+
* @typeParam T - The type of the array.
|
|
6354
|
+
* @typeParam U - The type of the resulting array.
|
|
6355
|
+
* @param array - The array to map.
|
|
6356
|
+
* @param callback - The callback function to map the array.
|
|
6357
|
+
* @returns A new array with the mapped values.
|
|
6358
|
+
*/
|
|
6359
|
+
map<T, U>(array: T[], callback: (value: T, index: number, array: T[]) => U): U[];
|
|
6360
|
+
/**
|
|
6361
|
+
* Releases all allocated objects back to their respective pools.
|
|
6362
|
+
* This is intended to be called at the end of a tick.
|
|
6363
|
+
*/
|
|
6364
|
+
reset(): void;
|
|
6365
|
+
}
|
|
6366
|
+
|
|
6074
6367
|
/** The options for a trimesh collider. @public */
|
|
6075
6368
|
export declare interface TrimeshColliderOptions extends BaseColliderOptions {
|
|
6076
6369
|
shape: ColliderShape.TRIMESH;
|
|
@@ -6685,6 +6978,7 @@ export declare class World extends EventRouter implements protocol.Serializable
|
|
|
6685
6978
|
|
|
6686
6979
|
|
|
6687
6980
|
|
|
6981
|
+
|
|
6688
6982
|
|
|
6689
6983
|
|
|
6690
6984
|
/**
|
|
@@ -6697,40 +6991,32 @@ export declare class World extends EventRouter implements protocol.Serializable
|
|
|
6697
6991
|
get ambientLightColor(): RgbColor;
|
|
6698
6992
|
/** The intensity of the ambient light. */
|
|
6699
6993
|
get ambientLightIntensity(): number;
|
|
6994
|
+
/** The block type registry for the world. */
|
|
6995
|
+
get blockTypeRegistry(): BlockTypeRegistry;
|
|
6996
|
+
/** The chat manager for the world. */
|
|
6997
|
+
get chatManager(): ChatManager;
|
|
6998
|
+
/** The chunk lattice for the world. */
|
|
6999
|
+
get chunkLattice(): ChunkLattice;
|
|
6700
7000
|
/** The color of the directional light. */
|
|
6701
7001
|
get directionalLightColor(): RgbColor;
|
|
6702
7002
|
/** The intensity of the directional light. */
|
|
6703
7003
|
get directionalLightIntensity(): number;
|
|
6704
7004
|
/** The position the directional light originates from. */
|
|
6705
7005
|
get directionalLightPosition(): Vector3Like;
|
|
7006
|
+
/** The entity manager for the world. */
|
|
7007
|
+
get entityManager(): EntityManager;
|
|
6706
7008
|
/** The color of the fog, if not explicitly set, defaults to ambient light color. */
|
|
6707
7009
|
get fogColor(): RgbColor | undefined;
|
|
6708
7010
|
/** The maximum distance from the camera at which fog stops being applied. */
|
|
6709
7011
|
get fogFar(): number;
|
|
6710
7012
|
/** The minimum distance from the camera to start applying fog. */
|
|
6711
7013
|
get fogNear(): number;
|
|
6712
|
-
/** The name of the world. */
|
|
6713
|
-
get name(): string;
|
|
6714
|
-
/** The intensity of the world's skybox brightness. */
|
|
6715
|
-
get skyboxIntensity(): number;
|
|
6716
|
-
/** The URI of the skybox cubemap for the world. */
|
|
6717
|
-
get skyboxUri(): string;
|
|
6718
|
-
/** The audio manager for the world. */
|
|
6719
|
-
get audioManager(): AudioManager;
|
|
6720
|
-
/** An arbitrary identifier tag of the world. Useful for your own logic. */
|
|
6721
|
-
get tag(): string | undefined;
|
|
6722
|
-
/** The block type registry for the world. */
|
|
6723
|
-
get blockTypeRegistry(): BlockTypeRegistry;
|
|
6724
|
-
/** The chat manager for the world. */
|
|
6725
|
-
get chatManager(): ChatManager;
|
|
6726
|
-
/** The chunk lattice for the world. */
|
|
6727
|
-
get chunkLattice(): ChunkLattice;
|
|
6728
|
-
/** The entity manager for the world. */
|
|
6729
|
-
get entityManager(): EntityManager;
|
|
6730
7014
|
/** The light manager for the world. */
|
|
6731
7015
|
get lightManager(): LightManager;
|
|
6732
7016
|
/** The world loop for the world. */
|
|
6733
7017
|
get loop(): WorldLoop;
|
|
7018
|
+
/** The name of the world. */
|
|
7019
|
+
get name(): string;
|
|
6734
7020
|
|
|
6735
7021
|
/** The particle emitter manager for the world. */
|
|
6736
7022
|
get particleEmitterManager(): ParticleEmitterManager;
|
|
@@ -6738,6 +7024,16 @@ export declare class World extends EventRouter implements protocol.Serializable
|
|
|
6738
7024
|
get sceneUIManager(): SceneUIManager;
|
|
6739
7025
|
/** The simulation for the world. */
|
|
6740
7026
|
get simulation(): Simulation;
|
|
7027
|
+
/** The intensity of the world's skybox brightness. */
|
|
7028
|
+
get skyboxIntensity(): number;
|
|
7029
|
+
/** The URI of the skybox cubemap for the world. */
|
|
7030
|
+
get skyboxUri(): string;
|
|
7031
|
+
/** The audio manager for the world. */
|
|
7032
|
+
get audioManager(): AudioManager;
|
|
7033
|
+
/** An arbitrary identifier tag of the world. Useful for your own logic. */
|
|
7034
|
+
get tag(): string | undefined;
|
|
7035
|
+
/** The tick allocator for the world. */
|
|
7036
|
+
get tickAllocator(): TickAllocator;
|
|
6741
7037
|
/**
|
|
6742
7038
|
* Loads a map into the world, clearing any prior map.
|
|
6743
7039
|
* @param map - The map to load.
|