hytopia 0.8.6-dev5 → 0.8.6-dev6nopool
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 +167 -165
- package/docs/server.audiomanager.getallentityattachedaudios.md +1 -1
- 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.md +34 -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.rgbcolor.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 +244 -0
- package/docs/server.telemetryspanoptions.md +18 -0
- package/node-server.mjs +173 -171
- package/package.json +1 -1
- package/server.api.json +826 -2
- package/server.d.ts +147 -2
package/server.d.ts
CHANGED
|
@@ -5,11 +5,12 @@ 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
|
|
|
15
16
|
/**
|
|
@@ -279,6 +280,8 @@ export declare class AudioManager {
|
|
|
279
280
|
* Retrieves all loaded audio instances attached to a specific entity.
|
|
280
281
|
*
|
|
281
282
|
* @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
|
+
|
|
282
285
|
* @returns An array of audio instances.
|
|
283
286
|
*/
|
|
284
287
|
getAllEntityAttachedAudios(entity: Entity): Audio[];
|
|
@@ -995,12 +998,18 @@ export declare class ChunkLattice extends EventRouter {
|
|
|
995
998
|
|
|
996
999
|
/** Event types a ChunkLattice instance can emit. See {@link ChunkLatticeEventPayloads} for the payloads. @public */
|
|
997
1000
|
export declare enum ChunkLatticeEvent {
|
|
1001
|
+
ADD_CHUNK = "CHUNK_LATTICE.ADD_CHUNK",
|
|
998
1002
|
REMOVE_CHUNK = "CHUNK_LATTICE.REMOVE_CHUNK",
|
|
999
1003
|
SET_BLOCK = "CHUNK_LATTICE.SET_BLOCK"
|
|
1000
1004
|
}
|
|
1001
1005
|
|
|
1002
1006
|
/** Event payloads for ChunkLattice emitted events. @public */
|
|
1003
1007
|
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
|
+
};
|
|
1004
1013
|
/** Emitted when a chunk is removed from the lattice. */
|
|
1005
1014
|
[ChunkLatticeEvent.REMOVE_CHUNK]: {
|
|
1006
1015
|
chunkLattice: ChunkLattice;
|
|
@@ -3861,6 +3870,12 @@ export declare class ParticleEmitter extends EventRouter implements protocol.Ser
|
|
|
3861
3870
|
* @param velocityVariance - The velocity variance of an emitted particle.
|
|
3862
3871
|
*/
|
|
3863
3872
|
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;
|
|
3864
3879
|
/**
|
|
3865
3880
|
* Despawns the ParticleEmitter from the world.
|
|
3866
3881
|
*/
|
|
@@ -3884,6 +3899,7 @@ export declare class ParticleEmitter extends EventRouter implements protocol.Ser
|
|
|
3884
3899
|
|
|
3885
3900
|
/** Event types a ParticleEmitter instance can emit. See {@link ParticleEmitterEventPayloads} @public */
|
|
3886
3901
|
export declare enum ParticleEmitterEvent {
|
|
3902
|
+
BURST = "PARTICLE_EMITTER.BURST",
|
|
3887
3903
|
DESPAWN = "PARTICLE_EMITTER.DESPAWN",
|
|
3888
3904
|
SET_ALPHA_TEST = "PARTICLE_EMITTER.SET_ALPHA_TEST",
|
|
3889
3905
|
SET_ATTACHED_TO_ENTITY = "PARTICLE_EMITTER.SET_ATTACHED_TO_ENTITY",
|
|
@@ -3919,6 +3935,11 @@ export declare enum ParticleEmitterEvent {
|
|
|
3919
3935
|
|
|
3920
3936
|
/** Event payloads for ParticleEmitter emitted events. @public */
|
|
3921
3937
|
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
|
+
};
|
|
3922
3943
|
/** Emitted when a ParticleEmitter is despawned. */
|
|
3923
3944
|
[ParticleEmitterEvent.DESPAWN]: {
|
|
3924
3945
|
particleEmitter: ParticleEmitter;
|
|
@@ -5192,7 +5213,7 @@ export declare type RaycastOptions = {
|
|
|
5192
5213
|
solidMode?: boolean;
|
|
5193
5214
|
} & FilterOptions;
|
|
5194
5215
|
|
|
5195
|
-
/** A RGB color. @public */
|
|
5216
|
+
/** A RGB color. r, g and b expect a value between 0 and 255. @public */
|
|
5196
5217
|
export declare interface RgbColor {
|
|
5197
5218
|
r: number;
|
|
5198
5219
|
g: number;
|
|
@@ -6071,6 +6092,130 @@ export declare function startServer(init: ((() => void) | ((world: World) => voi
|
|
|
6071
6092
|
/** The input keys that are included in the PlayerInput. @public */
|
|
6072
6093
|
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
6094
|
|
|
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
|
+
|
|
6074
6219
|
/** The options for a trimesh collider. @public */
|
|
6075
6220
|
export declare interface TrimeshColliderOptions extends BaseColliderOptions {
|
|
6076
6221
|
shape: ColliderShape.TRIMESH;
|