hytopia 0.8.6-dev3 → 0.8.6-dev5

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/server.d.ts CHANGED
@@ -5,12 +5,11 @@ 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';
8
9
  import protocol from '@hytopia.com/server-protocol';
9
10
  import RAPIER from '@dimforge/rapier3d-simd-compat';
10
11
  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';
14
13
  import { WebSocket as WebSocket_2 } from 'ws';
15
14
 
16
15
  /**
@@ -280,8 +279,6 @@ export declare class AudioManager {
280
279
  * Retrieves all loaded audio instances attached to a specific entity.
281
280
  *
282
281
  * @param entity - The entity to get attached audio instances for.
283
- * the allocated array at the end of the current tick. false by default.
284
-
285
282
  * @returns An array of audio instances.
286
283
  */
287
284
  getAllEntityAttachedAudios(entity: Entity): Audio[];
@@ -998,18 +995,12 @@ export declare class ChunkLattice extends EventRouter {
998
995
 
999
996
  /** Event types a ChunkLattice instance can emit. See {@link ChunkLatticeEventPayloads} for the payloads. @public */
1000
997
  export declare enum ChunkLatticeEvent {
1001
- ADD_CHUNK = "CHUNK_LATTICE.ADD_CHUNK",
1002
998
  REMOVE_CHUNK = "CHUNK_LATTICE.REMOVE_CHUNK",
1003
999
  SET_BLOCK = "CHUNK_LATTICE.SET_BLOCK"
1004
1000
  }
1005
1001
 
1006
1002
  /** Event payloads for ChunkLattice emitted events. @public */
1007
1003
  export declare interface ChunkLatticeEventPayloads {
1008
- /** Emitted when a chunk is added to the lattice. */
1009
- [ChunkLatticeEvent.ADD_CHUNK]: {
1010
- chunkLattice: ChunkLattice;
1011
- chunk: Chunk;
1012
- };
1013
1004
  /** Emitted when a chunk is removed from the lattice. */
1014
1005
  [ChunkLatticeEvent.REMOVE_CHUNK]: {
1015
1006
  chunkLattice: ChunkLattice;
@@ -3870,12 +3861,6 @@ export declare class ParticleEmitter extends EventRouter implements protocol.Ser
3870
3861
  * @param velocityVariance - The velocity variance of an emitted particle.
3871
3862
  */
3872
3863
  setVelocityVariance(velocityVariance: Vector3Like): void;
3873
- /**
3874
- * Creates a burst of particles, regardless of pause state.
3875
- *
3876
- * @param count - The number of particles to burst.
3877
- */
3878
- burst(count: number): void;
3879
3864
  /**
3880
3865
  * Despawns the ParticleEmitter from the world.
3881
3866
  */
@@ -3899,7 +3884,6 @@ export declare class ParticleEmitter extends EventRouter implements protocol.Ser
3899
3884
 
3900
3885
  /** Event types a ParticleEmitter instance can emit. See {@link ParticleEmitterEventPayloads} @public */
3901
3886
  export declare enum ParticleEmitterEvent {
3902
- BURST = "PARTICLE_EMITTER.BURST",
3903
3887
  DESPAWN = "PARTICLE_EMITTER.DESPAWN",
3904
3888
  SET_ALPHA_TEST = "PARTICLE_EMITTER.SET_ALPHA_TEST",
3905
3889
  SET_ATTACHED_TO_ENTITY = "PARTICLE_EMITTER.SET_ATTACHED_TO_ENTITY",
@@ -3935,11 +3919,6 @@ export declare enum ParticleEmitterEvent {
3935
3919
 
3936
3920
  /** Event payloads for ParticleEmitter emitted events. @public */
3937
3921
  export declare interface ParticleEmitterEventPayloads {
3938
- /** Emitted when a ParticleEmitter bursts the specified number of particles. */
3939
- [ParticleEmitterEvent.BURST]: {
3940
- particleEmitter: ParticleEmitter;
3941
- count: number;
3942
- };
3943
3922
  /** Emitted when a ParticleEmitter is despawned. */
3944
3923
  [ParticleEmitterEvent.DESPAWN]: {
3945
3924
  particleEmitter: ParticleEmitter;
@@ -5213,7 +5192,7 @@ export declare type RaycastOptions = {
5213
5192
  solidMode?: boolean;
5214
5193
  } & FilterOptions;
5215
5194
 
5216
- /** A RGB color. r, g and b expect a value between 0 and 255. @public */
5195
+ /** A RGB color. @public */
5217
5196
  export declare interface RgbColor {
5218
5197
  r: number;
5219
5198
  g: number;
@@ -6092,130 +6071,6 @@ export declare function startServer(init: ((() => void) | ((world: World) => voi
6092
6071
  /** The input keys that are included in the PlayerInput. @public */
6093
6072
  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"];
6094
6073
 
6095
- /**
6096
- * Manages performance telemetry and error tracking through your Sentry.io account.
6097
- *
6098
- * @remarks
6099
- * The Telemetry class provides low-overhead performance monitoring
6100
- * and error tracking through Sentry (https://sentry.io) integration
6101
- * and your provided Sentry DSN. It automatically tracks critical game loop
6102
- * operations like physics simulation, entity updates, network synchronization,
6103
- * and more. The system only sends telemetry data when errors or slow-tick
6104
- * performance issues are detected, minimizing bandwidth and storage costs.
6105
- *
6106
- * @example
6107
- * ```typescript
6108
- * // Initialize Sentry for production telemetry
6109
- * Telemetry.initializeSentry('MY_SENTRY_PROJECT_DSN');
6110
- *
6111
- * // Wrap performance-critical code in spans
6112
- * Telemetry.startSpan({
6113
- * operation: TelemetrySpanOperation.CUSTOM_OPERATION,
6114
- * attributes: { // any arbitrary attributes you want to attach to the span
6115
- * playerCount: world.playerManager.connectedPlayers.length,
6116
- * entityCount: world.entityManager.entityCount,
6117
- * },
6118
- * }, () => {
6119
- * // Your performance-critical code here
6120
- * performExpensiveOperation();
6121
- * });
6122
- *
6123
- * // Get current process statistics
6124
- * const stats = Telemetry.getProcessStats();
6125
- * console.log(`Heap usage: ${stats.jsHeapUsagePercent * 100}%`);
6126
- * ```
6127
- *
6128
- * @public
6129
- */
6130
- export declare class Telemetry {
6131
- /**
6132
- * Gets current process memory and performance statistics.
6133
- *
6134
- * @param asMeasurement - Whether to return data in Sentry measurement format with units.
6135
- * @returns Process statistics including heap usage, RSS memory, and capacity metrics.
6136
- */
6137
- static getProcessStats(asMeasurement?: boolean): Record<string, any>;
6138
- /**
6139
- * Initializes Sentry telemetry with the provided DSN.
6140
- *
6141
- * @remarks
6142
- * This method configures Sentry for error tracking and performance monitoring.
6143
- * It sets up filtering to only send performance spans that exceed the
6144
- * provided threshold duration, reducing noise and costs. The initialization
6145
- * includes game-specific tags and process statistics attachment.
6146
- *
6147
- * @param sentryDsn - The Sentry Data Source Name (DSN) for your project.
6148
- * @param tickTimeMsThreshold - The tick duration that must be exceeded to
6149
- * send a performance span to Sentry for a given tick. Defaults to 50ms.
6150
- */
6151
- static initializeSentry(sentryDsn: string, tickTimeMsThreshold?: number): void;
6152
- /**
6153
- * Executes a callback function within a performance monitoring span.
6154
- *
6155
- * @remarks
6156
- * This method provides zero-overhead performance monitoring in development
6157
- * environments. In production with Sentry enabled and `SENTRY_ENABLE_TRACING=true`,
6158
- * it creates performance spans for monitoring. The span data is only transmitted
6159
- * to Sentry when performance issues are detected.
6160
- *
6161
- * @param options - Configuration for the telemetry span including operation type and attributes.
6162
- * @param callback - The function to execute within the performance span.
6163
- * @returns The return value of the callback function.
6164
- *
6165
- * @example
6166
- * ```typescript
6167
- * const result = Telemetry.startSpan({
6168
- * operation: TelemetrySpanOperation.ENTITIES_TICK,
6169
- * attributes: {
6170
- * entityCount: entities.length,
6171
- * worldId: world.id,
6172
- * },
6173
- * }, () => {
6174
- * return processEntities(entities);
6175
- * });
6176
- * ```
6177
- */
6178
- static startSpan<T>(options: TelemetrySpanOptions, callback: (span?: Sentry.Span) => T): T;
6179
- /**
6180
- * Gets the Sentry SDK instance for advanced telemetry operations.
6181
- *
6182
- * @remarks
6183
- * This method provides direct access to the Sentry SDK for operations
6184
- * not covered by the Telemetry wrapper, such as custom error reporting,
6185
- * user context setting, or advanced span manipulation.
6186
- *
6187
- * @returns The Sentry SDK instance.
6188
- */
6189
- static sentry(): typeof Sentry;
6190
- }
6191
-
6192
- /** Performance telemetry span operation types. @public */
6193
- export declare enum TelemetrySpanOperation {
6194
- BUILD_PACKETS = "build_packets",
6195
- ENTITIES_EMIT_UPDATES = "entities_emit_updates",
6196
- ENTITIES_TICK = "entities_tick",
6197
- NETWORK_SYNCHRONIZE = "network_synchronize",
6198
- NETWORK_SYNCHRONIZE_CLEANUP = "network_synchronize_cleanup",
6199
- PHYSICS_CLEANUP = "physics_cleanup",
6200
- PHYSICS_STEP = "physics_step",
6201
- SEND_ALL_PACKETS = "send_all_packets",
6202
- SEND_PACKETS = "send_packets",
6203
- SERIALIZE_FREE_BUFFERS = "serialize_free_buffers",
6204
- SERIALIZE_PACKETS = "serialize_packets",
6205
- SERIALIZE_PACKETS_ENCODE = "serialize_packets_encode",
6206
- SIMULATION_STEP = "simulation_step",
6207
- TICKER_TICK = "ticker_tick",
6208
- WORLD_TICK = "world_tick"
6209
- }
6210
-
6211
- /** Options for creating a telemetry span. @public */
6212
- export declare type TelemetrySpanOptions = {
6213
- /** The operation being measured. */
6214
- operation: TelemetrySpanOperation | string;
6215
- /** Additional attributes to attach to the span for context. */
6216
- attributes?: Record<string, string | number>;
6217
- };
6218
-
6219
6074
  /** The options for a trimesh collider. @public */
6220
6075
  export declare interface TrimeshColliderOptions extends BaseColliderOptions {
6221
6076
  shape: ColliderShape.TRIMESH;
@@ -1,16 +0,0 @@
1
- <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
-
3
- [Home](./index.md) &gt; [server](./server.md) &gt; [ChunkLatticeEventPayloads](./server.chunklatticeeventpayloads.md) &gt; ["CHUNK\_LATTICE.ADD\_CHUNK"](./server.chunklatticeeventpayloads._chunk_lattice.add_chunk_.md)
4
-
5
- ## ChunkLatticeEventPayloads."CHUNK\_LATTICE.ADD\_CHUNK" property
6
-
7
- Emitted when a chunk is added to the lattice.
8
-
9
- **Signature:**
10
-
11
- ```typescript
12
- [ChunkLatticeEvent.ADD_CHUNK]: {
13
- chunkLattice: ChunkLattice;
14
- chunk: Chunk;
15
- };
16
- ```
@@ -1,54 +0,0 @@
1
- <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
-
3
- [Home](./index.md) &gt; [server](./server.md) &gt; [ParticleEmitter](./server.particleemitter.md) &gt; [burst](./server.particleemitter.burst.md)
4
-
5
- ## ParticleEmitter.burst() method
6
-
7
- Creates a burst of particles, regardless of pause state.
8
-
9
- **Signature:**
10
-
11
- ```typescript
12
- burst(count: number): void;
13
- ```
14
-
15
- ## Parameters
16
-
17
- <table><thead><tr><th>
18
-
19
- Parameter
20
-
21
-
22
- </th><th>
23
-
24
- Type
25
-
26
-
27
- </th><th>
28
-
29
- Description
30
-
31
-
32
- </th></tr></thead>
33
- <tbody><tr><td>
34
-
35
- count
36
-
37
-
38
- </td><td>
39
-
40
- number
41
-
42
-
43
- </td><td>
44
-
45
- The number of particles to burst.
46
-
47
-
48
- </td></tr>
49
- </tbody></table>
50
-
51
- **Returns:**
52
-
53
- void
54
-
@@ -1,16 +0,0 @@
1
- <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
-
3
- [Home](./index.md) &gt; [server](./server.md) &gt; [ParticleEmitterEventPayloads](./server.particleemittereventpayloads.md) &gt; ["PARTICLE\_EMITTER.BURST"](./server.particleemittereventpayloads._particle_emitter.burst_.md)
4
-
5
- ## ParticleEmitterEventPayloads."PARTICLE\_EMITTER.BURST" property
6
-
7
- Emitted when a ParticleEmitter bursts the specified number of particles.
8
-
9
- **Signature:**
10
-
11
- ```typescript
12
- [ParticleEmitterEvent.BURST]: {
13
- particleEmitter: ParticleEmitter;
14
- count: number;
15
- };
16
- ```
@@ -1,56 +0,0 @@
1
- <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
-
3
- [Home](./index.md) &gt; [server](./server.md) &gt; [Telemetry](./server.telemetry.md) &gt; [getProcessStats](./server.telemetry.getprocessstats.md)
4
-
5
- ## Telemetry.getProcessStats() method
6
-
7
- Gets current process memory and performance statistics.
8
-
9
- **Signature:**
10
-
11
- ```typescript
12
- static getProcessStats(asMeasurement?: boolean): Record<string, any>;
13
- ```
14
-
15
- ## Parameters
16
-
17
- <table><thead><tr><th>
18
-
19
- Parameter
20
-
21
-
22
- </th><th>
23
-
24
- Type
25
-
26
-
27
- </th><th>
28
-
29
- Description
30
-
31
-
32
- </th></tr></thead>
33
- <tbody><tr><td>
34
-
35
- asMeasurement
36
-
37
-
38
- </td><td>
39
-
40
- boolean
41
-
42
-
43
- </td><td>
44
-
45
- _(Optional)_ Whether to return data in Sentry measurement format with units.
46
-
47
-
48
- </td></tr>
49
- </tbody></table>
50
-
51
- **Returns:**
52
-
53
- Record&lt;string, any&gt;
54
-
55
- Process statistics including heap usage, RSS memory, and capacity metrics.
56
-
@@ -1,74 +0,0 @@
1
- <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
-
3
- [Home](./index.md) &gt; [server](./server.md) &gt; [Telemetry](./server.telemetry.md) &gt; [initializeSentry](./server.telemetry.initializesentry.md)
4
-
5
- ## Telemetry.initializeSentry() method
6
-
7
- Initializes Sentry telemetry with the provided DSN.
8
-
9
- **Signature:**
10
-
11
- ```typescript
12
- static initializeSentry(sentryDsn: string, tickTimeMsThreshold?: number): void;
13
- ```
14
-
15
- ## Parameters
16
-
17
- <table><thead><tr><th>
18
-
19
- Parameter
20
-
21
-
22
- </th><th>
23
-
24
- Type
25
-
26
-
27
- </th><th>
28
-
29
- Description
30
-
31
-
32
- </th></tr></thead>
33
- <tbody><tr><td>
34
-
35
- sentryDsn
36
-
37
-
38
- </td><td>
39
-
40
- string
41
-
42
-
43
- </td><td>
44
-
45
- The Sentry Data Source Name (DSN) for your project.
46
-
47
-
48
- </td></tr>
49
- <tr><td>
50
-
51
- tickTimeMsThreshold
52
-
53
-
54
- </td><td>
55
-
56
- number
57
-
58
-
59
- </td><td>
60
-
61
- _(Optional)_ The tick duration that must be exceeded to send a performance span to Sentry for a given tick. Defaults to 50ms.
62
-
63
-
64
- </td></tr>
65
- </tbody></table>
66
-
67
- **Returns:**
68
-
69
- void
70
-
71
- ## Remarks
72
-
73
- This method configures Sentry for error tracking and performance monitoring. It sets up filtering to only send performance spans that exceed the provided threshold duration, reducing noise and costs. The initialization includes game-specific tags and process statistics attachment.
74
-
@@ -1,126 +0,0 @@
1
- <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
-
3
- [Home](./index.md) &gt; [server](./server.md) &gt; [Telemetry](./server.telemetry.md)
4
-
5
- ## Telemetry class
6
-
7
- Manages performance telemetry and error tracking through your Sentry.io account.
8
-
9
- **Signature:**
10
-
11
- ```typescript
12
- export default class Telemetry
13
- ```
14
-
15
- ## Remarks
16
-
17
- The Telemetry class provides low-overhead performance monitoring and error tracking through Sentry (https://sentry.io) integration and your provided Sentry DSN. It automatically tracks critical game loop operations like physics simulation, entity updates, network synchronization, and more. The system only sends telemetry data when errors or slow-tick performance issues are detected, minimizing bandwidth and storage costs.
18
-
19
- ## Example
20
-
21
-
22
- ```typescript
23
- // Initialize Sentry for production telemetry
24
- Telemetry.initializeSentry('MY_SENTRY_PROJECT_DSN');
25
-
26
- // Wrap performance-critical code in spans
27
- Telemetry.startSpan({
28
- operation: TelemetrySpanOperation.CUSTOM_OPERATION,
29
- attributes: { // any arbitrary attributes you want to attach to the span
30
- playerCount: world.playerManager.connectedPlayers.length,
31
- entityCount: world.entityManager.entityCount,
32
- },
33
- }, () => {
34
- // Your performance-critical code here
35
- performExpensiveOperation();
36
- });
37
-
38
- // Get current process statistics
39
- const stats = Telemetry.getProcessStats();
40
- console.log(`Heap usage: ${stats.jsHeapUsagePercent * 100}%`);
41
- ```
42
-
43
- ## Methods
44
-
45
- <table><thead><tr><th>
46
-
47
- Method
48
-
49
-
50
- </th><th>
51
-
52
- Modifiers
53
-
54
-
55
- </th><th>
56
-
57
- Description
58
-
59
-
60
- </th></tr></thead>
61
- <tbody><tr><td>
62
-
63
- [getProcessStats(asMeasurement)](./server.telemetry.getprocessstats.md)
64
-
65
-
66
- </td><td>
67
-
68
- `static`
69
-
70
-
71
- </td><td>
72
-
73
- Gets current process memory and performance statistics.
74
-
75
-
76
- </td></tr>
77
- <tr><td>
78
-
79
- [initializeSentry(sentryDsn, tickTimeMsThreshold)](./server.telemetry.initializesentry.md)
80
-
81
-
82
- </td><td>
83
-
84
- `static`
85
-
86
-
87
- </td><td>
88
-
89
- Initializes Sentry telemetry with the provided DSN.
90
-
91
-
92
- </td></tr>
93
- <tr><td>
94
-
95
- [sentry()](./server.telemetry.sentry.md)
96
-
97
-
98
- </td><td>
99
-
100
- `static`
101
-
102
-
103
- </td><td>
104
-
105
- Gets the Sentry SDK instance for advanced telemetry operations.
106
-
107
-
108
- </td></tr>
109
- <tr><td>
110
-
111
- [startSpan(options, callback)](./server.telemetry.startspan.md)
112
-
113
-
114
- </td><td>
115
-
116
- `static`
117
-
118
-
119
- </td><td>
120
-
121
- Executes a callback function within a performance monitoring span.
122
-
123
-
124
- </td></tr>
125
- </tbody></table>
126
-
@@ -1,23 +0,0 @@
1
- <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
-
3
- [Home](./index.md) &gt; [server](./server.md) &gt; [Telemetry](./server.telemetry.md) &gt; [sentry](./server.telemetry.sentry.md)
4
-
5
- ## Telemetry.sentry() method
6
-
7
- Gets the Sentry SDK instance for advanced telemetry operations.
8
-
9
- **Signature:**
10
-
11
- ```typescript
12
- static sentry(): typeof Sentry;
13
- ```
14
- **Returns:**
15
-
16
- typeof Sentry
17
-
18
- The Sentry SDK instance.
19
-
20
- ## Remarks
21
-
22
- This method provides direct access to the Sentry SDK for operations not covered by the Telemetry wrapper, such as custom error reporting, user context setting, or advanced span manipulation.
23
-
@@ -1,91 +0,0 @@
1
- <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
-
3
- [Home](./index.md) &gt; [server](./server.md) &gt; [Telemetry](./server.telemetry.md) &gt; [startSpan](./server.telemetry.startspan.md)
4
-
5
- ## Telemetry.startSpan() method
6
-
7
- Executes a callback function within a performance monitoring span.
8
-
9
- **Signature:**
10
-
11
- ```typescript
12
- static startSpan<T>(options: TelemetrySpanOptions, callback: (span?: Sentry.Span) => T): T;
13
- ```
14
-
15
- ## Parameters
16
-
17
- <table><thead><tr><th>
18
-
19
- Parameter
20
-
21
-
22
- </th><th>
23
-
24
- Type
25
-
26
-
27
- </th><th>
28
-
29
- Description
30
-
31
-
32
- </th></tr></thead>
33
- <tbody><tr><td>
34
-
35
- options
36
-
37
-
38
- </td><td>
39
-
40
- [TelemetrySpanOptions](./server.telemetryspanoptions.md)
41
-
42
-
43
- </td><td>
44
-
45
- Configuration for the telemetry span including operation type and attributes.
46
-
47
-
48
- </td></tr>
49
- <tr><td>
50
-
51
- callback
52
-
53
-
54
- </td><td>
55
-
56
- (span?: Sentry.Span) =&gt; T
57
-
58
-
59
- </td><td>
60
-
61
- The function to execute within the performance span.
62
-
63
-
64
- </td></tr>
65
- </tbody></table>
66
-
67
- **Returns:**
68
-
69
- T
70
-
71
- The return value of the callback function.
72
-
73
- ## Remarks
74
-
75
- This method provides zero-overhead performance monitoring in development environments. In production with Sentry enabled and `SENTRY_ENABLE_TRACING=true`<!-- -->, it creates performance spans for monitoring. The span data is only transmitted to Sentry when performance issues are detected.
76
-
77
- ## Example
78
-
79
-
80
- ```typescript
81
- const result = Telemetry.startSpan({
82
- operation: TelemetrySpanOperation.ENTITIES_TICK,
83
- attributes: {
84
- entityCount: entities.length,
85
- worldId: world.id,
86
- },
87
- }, () => {
88
- return processEntities(entities);
89
- });
90
- ```
91
-