@rpgjs/client 5.0.0-alpha.26 → 5.0.0-alpha.27

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.
Files changed (32) hide show
  1. package/dist/Game/Map.d.ts +1 -0
  2. package/dist/Game/Map.js +6 -2
  3. package/dist/Game/Map.js.map +1 -1
  4. package/dist/Gui/Gui.js +4 -4
  5. package/dist/RpgClientEngine.js +7 -2
  6. package/dist/RpgClientEngine.js.map +1 -1
  7. package/dist/Sound.js +1 -1
  8. package/dist/Sound.js.map +1 -1
  9. package/dist/components/gui/box.ce.js +3 -3
  10. package/dist/core/inject.js +1 -1
  11. package/dist/core/setup.js +1 -1
  12. package/dist/index.js +1 -1
  13. package/dist/module.js +1 -1
  14. package/dist/node_modules/.pnpm/{@signe_di@2.7.2 → @signe_di@2.7.3}/node_modules/@signe/di/dist/index.js.map +1 -1
  15. package/dist/node_modules/.pnpm/{@signe_reactive@2.7.2 → @signe_reactive@2.7.3}/node_modules/@signe/reactive/dist/index.js.map +1 -1
  16. package/dist/node_modules/.pnpm/{@signe_room@2.7.2 → @signe_room@2.7.3}/node_modules/@signe/room/dist/index.js +27 -6
  17. package/dist/node_modules/.pnpm/@signe_room@2.7.3/node_modules/@signe/room/dist/index.js.map +1 -0
  18. package/dist/node_modules/.pnpm/{@signe_sync@2.7.2 → @signe_sync@2.7.3}/node_modules/@signe/sync/dist/chunk-7QVYU63E.js.map +1 -1
  19. package/dist/node_modules/.pnpm/{@signe_sync@2.7.2 → @signe_sync@2.7.3}/node_modules/@signe/sync/dist/client/index.js.map +1 -1
  20. package/dist/node_modules/.pnpm/{@signe_sync@2.7.2 → @signe_sync@2.7.3}/node_modules/@signe/sync/dist/index.js +1 -1
  21. package/dist/node_modules/.pnpm/{@signe_sync@2.7.2 → @signe_sync@2.7.3}/node_modules/@signe/sync/dist/index.js.map +1 -1
  22. package/dist/services/loadMap.js +1 -1
  23. package/dist/services/mmorpg.js +1 -1
  24. package/dist/services/standalone.js +1 -1
  25. package/package.json +9 -9
  26. package/src/Game/Map.ts +10 -0
  27. package/src/RpgClientEngine.ts +6 -1
  28. package/dist/node_modules/.pnpm/@signe_room@2.7.2/node_modules/@signe/room/dist/index.js.map +0 -1
  29. /package/dist/node_modules/.pnpm/{@signe_di@2.7.2 → @signe_di@2.7.3}/node_modules/@signe/di/dist/index.js +0 -0
  30. /package/dist/node_modules/.pnpm/{@signe_reactive@2.7.2 → @signe_reactive@2.7.3}/node_modules/@signe/reactive/dist/index.js +0 -0
  31. /package/dist/node_modules/.pnpm/{@signe_sync@2.7.2 → @signe_sync@2.7.3}/node_modules/@signe/sync/dist/chunk-7QVYU63E.js +0 -0
  32. /package/dist/node_modules/.pnpm/{@signe_sync@2.7.2 → @signe_sync@2.7.3}/node_modules/@signe/sync/dist/client/index.js +0 -0
@@ -7,6 +7,7 @@ export declare class RpgClientMap extends RpgCommonMap<any> {
7
7
  players: import('canvasengine').WritableObjectSignal<Record<string, RpgClientPlayer>>;
8
8
  events: import('canvasengine').WritableObjectSignal<Record<string, RpgClientEvent>>;
9
9
  currentPlayer: import('canvasengine').ComputedSignal<RpgClientPlayer>;
10
+ constructor();
10
11
  getCurrentPlayer(): RpgClientPlayer;
11
12
  reset(): void;
12
13
  stepPredictionTick(): void;
package/dist/Game/Map.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { RpgCommonMap } from '@rpgjs/common';
2
- import { sync, users } from '../node_modules/.pnpm/@signe_sync@2.7.2/node_modules/@signe/sync/dist/index.js';
2
+ import { sync, users } from '../node_modules/.pnpm/@signe_sync@2.7.3/node_modules/@signe/sync/dist/index.js';
3
3
  import { RpgClientPlayer } from './Player.js';
4
4
  import { signal, computed } from 'canvasengine';
5
5
  import { RpgClientEvent } from './Event.js';
@@ -17,11 +17,15 @@ var __decorateClass = (decorators, target, key, kind) => {
17
17
  };
18
18
  class RpgClientMap extends RpgCommonMap {
19
19
  constructor() {
20
- super(...arguments);
20
+ super();
21
21
  this.engine = inject(RpgClientEngine);
22
22
  this.players = signal({});
23
23
  this.events = signal({});
24
24
  this.currentPlayer = computed(() => this.players()[this.engine.playerIdSignal()]);
25
+ const isTest = typeof process !== "undefined" && process.env?.TEST === "true" || typeof window !== "undefined" && window.__RPGJS_TEST__ === true;
26
+ if (isTest) {
27
+ this.autoTickEnabled = false;
28
+ }
25
29
  }
26
30
  getCurrentPlayer() {
27
31
  return this.currentPlayer();
@@ -1 +1 @@
1
- {"version":3,"file":"Map.js","sources":["../../src/Game/Map.ts"],"sourcesContent":["import { RpgCommonMap } from \"@rpgjs/common\";\nimport { sync, users } from \"@signe/sync\";\nimport { RpgClientPlayer } from \"./Player\";\nimport { Signal, signal, computed } from \"canvasengine\";\nimport { RpgClientEvent } from \"./Event\";\nimport { RpgClientEngine } from \"../RpgClientEngine\";\nimport { inject } from \"../core/inject\";\n\nexport class RpgClientMap extends RpgCommonMap<any> {\n engine: RpgClientEngine = inject(RpgClientEngine)\n @users(RpgClientPlayer) players = signal<Record<string, RpgClientPlayer>>({});\n @sync(RpgClientEvent) events = signal<Record<string, RpgClientEvent>>({});\n currentPlayer = computed(() => this.players()[this.engine.playerIdSignal()!])\n\n getCurrentPlayer() {\n return this.currentPlayer()\n }\n\n reset() {\n this.players.set({})\n this.events.set({})\n this.clearPhysic()\n }\n\n stepPredictionTick(): void {\n this.forceSingleTick();\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAQO,MAAM,qBAAqB,YAAA,CAAkB;AAAA,EAA7C,WAAA,GAAA;AAAA,IAAA,KAAA,CAAA,GAAA,SAAA,CAAA;AACL,IAAA,IAAA,CAAA,MAAA,GAA0B,OAAO,eAAe,CAAA;AACxB,IAAA,IAAA,CAAA,OAAA,GAAU,MAAA,CAAwC,EAAE,CAAA;AACtD,IAAA,IAAA,CAAA,MAAA,GAAS,MAAA,CAAuC,EAAE,CAAA;AACxE,IAAA,IAAA,CAAA,aAAA,GAAgB,QAAA,CAAS,MAAM,IAAA,CAAK,OAAA,GAAU,IAAA,CAAK,MAAA,CAAO,cAAA,EAAiB,CAAC,CAAA;AAAA,EAAA;AAAA,EAE5E,gBAAA,GAAmB;AACjB,IAAA,OAAO,KAAK,aAAA,EAAc;AAAA,EAC5B;AAAA,EAEA,KAAA,GAAQ;AACN,IAAA,IAAA,CAAK,OAAA,CAAQ,GAAA,CAAI,EAAE,CAAA;AACnB,IAAA,IAAA,CAAK,MAAA,CAAO,GAAA,CAAI,EAAE,CAAA;AAClB,IAAA,IAAA,CAAK,WAAA,EAAY;AAAA,EACnB;AAAA,EAEA,kBAAA,GAA2B;AACzB,IAAA,IAAA,CAAK,eAAA,EAAgB;AAAA,EACvB;AACF;AAjB0B,eAAA,CAAA;AAAA,EAAvB,MAAM,eAAe;AAAA,CAAA,EAFX,YAAA,CAEa,SAAA,EAAA,SAAA,CAAA;AACF,eAAA,CAAA;AAAA,EAArB,KAAK,cAAc;AAAA,CAAA,EAHT,YAAA,CAGW,SAAA,EAAA,QAAA,CAAA;;;;"}
1
+ {"version":3,"file":"Map.js","sources":["../../src/Game/Map.ts"],"sourcesContent":["import { RpgCommonMap } from \"@rpgjs/common\";\nimport { sync, users } from \"@signe/sync\";\nimport { RpgClientPlayer } from \"./Player\";\nimport { Signal, signal, computed } from \"canvasengine\";\nimport { RpgClientEvent } from \"./Event\";\nimport { RpgClientEngine } from \"../RpgClientEngine\";\nimport { inject } from \"../core/inject\";\n\nexport class RpgClientMap extends RpgCommonMap<any> {\n engine: RpgClientEngine = inject(RpgClientEngine)\n @users(RpgClientPlayer) players = signal<Record<string, RpgClientPlayer>>({});\n @sync(RpgClientEvent) events = signal<Record<string, RpgClientEvent>>({});\n currentPlayer = computed(() => this.players()[this.engine.playerIdSignal()!])\n\n constructor() {\n super();\n // Détecter l'environnement de test\n const isTest = (typeof process !== 'undefined' && process.env?.TEST === 'true') \n || (typeof window !== 'undefined' && (window as any).__RPGJS_TEST__ === true);\n if (isTest) {\n this.autoTickEnabled = false;\n }\n }\n\n getCurrentPlayer() {\n return this.currentPlayer()\n }\n\n reset() {\n this.players.set({})\n this.events.set({})\n this.clearPhysic()\n }\n\n stepPredictionTick(): void {\n this.forceSingleTick();\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAQO,MAAM,qBAAqB,YAAA,CAAkB;AAAA,EAMlD,WAAA,GAAc;AACZ,IAAA,KAAA,EAAM;AANR,IAAA,IAAA,CAAA,MAAA,GAA0B,OAAO,eAAe,CAAA;AACxB,IAAA,IAAA,CAAA,OAAA,GAAU,MAAA,CAAwC,EAAE,CAAA;AACtD,IAAA,IAAA,CAAA,MAAA,GAAS,MAAA,CAAuC,EAAE,CAAA;AACxE,IAAA,IAAA,CAAA,aAAA,GAAgB,QAAA,CAAS,MAAM,IAAA,CAAK,OAAA,GAAU,IAAA,CAAK,MAAA,CAAO,cAAA,EAAiB,CAAC,CAAA;AAK1E,IAAA,MAAM,MAAA,GAAU,OAAO,OAAA,KAAY,WAAA,IAAe,OAAA,CAAQ,GAAA,EAAK,IAAA,KAAS,MAAA,IAClE,OAAO,MAAA,KAAW,WAAA,IAAgB,MAAA,CAAe,cAAA,KAAmB,IAAA;AAC1E,IAAA,IAAI,MAAA,EAAQ;AACV,MAAA,IAAA,CAAK,eAAA,GAAkB,KAAA;AAAA,IACzB;AAAA,EACF;AAAA,EAEA,gBAAA,GAAmB;AACjB,IAAA,OAAO,KAAK,aAAA,EAAc;AAAA,EAC5B;AAAA,EAEA,KAAA,GAAQ;AACN,IAAA,IAAA,CAAK,OAAA,CAAQ,GAAA,CAAI,EAAE,CAAA;AACnB,IAAA,IAAA,CAAK,MAAA,CAAO,GAAA,CAAI,EAAE,CAAA;AAClB,IAAA,IAAA,CAAK,WAAA,EAAY;AAAA,EACnB;AAAA,EAEA,kBAAA,GAA2B;AACzB,IAAA,IAAA,CAAK,eAAA,EAAgB;AAAA,EACvB;AACF;AA3B0B,eAAA,CAAA;AAAA,EAAvB,MAAM,eAAe;AAAA,CAAA,EAFX,YAAA,CAEa,SAAA,EAAA,SAAA,CAAA;AACF,eAAA,CAAA;AAAA,EAArB,KAAK,cAAc;AAAA,CAAA,EAHT,YAAA,CAGW,SAAA,EAAA,QAAA,CAAA;;;;"}
package/dist/Gui/Gui.js CHANGED
@@ -1,4 +1,4 @@
1
- import { inject } from '../node_modules/.pnpm/@signe_di@2.7.2/node_modules/@signe/di/dist/index.js';
1
+ import { inject } from '../node_modules/.pnpm/@signe_di@2.7.3/node_modules/@signe/di/dist/index.js';
2
2
  import { signal } from 'canvasengine';
3
3
  import { WebSocketToken } from '../services/AbstractSocket.js';
4
4
  import component from '../components/gui/dialogbox/index.ce.js';
@@ -6,11 +6,11 @@ import { combineLatest } from 'rxjs';
6
6
  import '@rpgjs/common';
7
7
  import '../Sound.js';
8
8
  import '../Resource.js';
9
- import '../node_modules/.pnpm/@signe_sync@2.7.2/node_modules/@signe/sync/dist/index.js';
9
+ import '../node_modules/.pnpm/@signe_sync@2.7.3/node_modules/@signe/sync/dist/index.js';
10
10
  import '../Game/Map.js';
11
11
  import 'pixi.js';
12
- import '../node_modules/.pnpm/@signe_room@2.7.2/node_modules/@signe/room/dist/index.js';
13
- import '../node_modules/.pnpm/@signe_sync@2.7.2/node_modules/@signe/sync/dist/client/index.js';
12
+ import '../node_modules/.pnpm/@signe_room@2.7.3/node_modules/@signe/room/dist/index.js';
13
+ import '../node_modules/.pnpm/@signe_sync@2.7.3/node_modules/@signe/sync/dist/client/index.js';
14
14
  import '@canvasengine/presets';
15
15
 
16
16
  const throwError = (id) => {
@@ -6,7 +6,7 @@ import { LoadMapToken } from './services/loadMap.js';
6
6
  import { RpgSound } from './Sound.js';
7
7
  import { RpgResource } from './Resource.js';
8
8
  import { Direction, PredictionController, ModulesToken } from '@rpgjs/common';
9
- import { load } from './node_modules/.pnpm/@signe_sync@2.7.2/node_modules/@signe/sync/dist/index.js';
9
+ import { load } from './node_modules/.pnpm/@signe_sync@2.7.3/node_modules/@signe/sync/dist/index.js';
10
10
  import { RpgClientMap } from './Game/Map.js';
11
11
  import { RpgGui } from './Gui/Gui.js';
12
12
  import { AnimationManager } from './Game/AnimationManager.js';
@@ -121,7 +121,12 @@ class RpgClientEngine {
121
121
  async start() {
122
122
  this.sceneMap = new RpgClientMap();
123
123
  this.selector = document.body.querySelector("#rpg");
124
- const { app, canvasElement } = await bootstrapCanvas(this.selector, component);
124
+ const bootstrapOptions = this.globalConfig?.bootstrapCanvasOptions;
125
+ const { app, canvasElement } = await bootstrapCanvas(
126
+ this.selector,
127
+ component,
128
+ bootstrapOptions
129
+ );
125
130
  this.canvasApp = app;
126
131
  this.canvasElement = canvasElement;
127
132
  this.renderer = app.renderer;
@@ -1 +1 @@
1
- {"version":3,"file":"RpgClientEngine.js","sources":["../src/RpgClientEngine.ts"],"sourcesContent":["import Canvas from \"./components/scenes/canvas.ce\";\nimport { inject } from './core/inject'\nimport { signal, bootstrapCanvas, KeyboardControls, Howl, trigger } from \"canvasengine\";\nimport { AbstractWebsocket, WebSocketToken } from \"./services/AbstractSocket\";\nimport { LoadMapService, LoadMapToken } from \"./services/loadMap\";\nimport { RpgSound } from \"./Sound\";\nimport { RpgResource } from \"./Resource\";\nimport { Hooks, ModulesToken, Direction } from \"@rpgjs/common\";\n\ntype DirectionValue = \"up\" | \"down\" | \"left\" | \"right\";\nimport { load } from \"@signe/sync\";\nimport { RpgClientMap } from \"./Game/Map\"\nimport { RpgGui } from \"./Gui/Gui\";\nimport { AnimationManager } from \"./Game/AnimationManager\";\nimport { lastValueFrom, Observable, combineLatest, BehaviorSubject, filter, switchMap, take } from \"rxjs\";\nimport { GlobalConfigToken } from \"./module\";\nimport * as PIXI from \"pixi.js\";\nimport { PrebuiltComponentAnimations } from \"./components/animations\";\nimport {\n PredictionController,\n type PredictionState,\n} from \"@rpgjs/common\";\n\nexport class RpgClientEngine<T = any> {\n private guiService: RpgGui;\n private webSocket: AbstractWebsocket;\n private loadMapService: LoadMapService;\n private hooks: Hooks;\n private sceneMap: RpgClientMap\n private selector: HTMLElement;\n public globalConfig: T;\n public sceneComponent: any;\n stopProcessingInput = false;\n width = signal(\"100%\");\n height = signal(\"100%\");\n spritesheets: Map<string, any> = new Map();\n sounds: Map<string, any> = new Map();\n componentAnimations: any[] = [];\n private spritesheetResolver?: (id: string) => any | Promise<any>;\n private soundResolver?: (id: string) => any | Promise<any>;\n particleSettings: {\n emitters: any[]\n } = {\n emitters: []\n }\n renderer: PIXI.Renderer;\n tick: Observable<number>;\n private canvasApp?: any;\n private canvasElement?: any;\n playerIdSignal = signal<string | null>(null);\n spriteComponentsBehind = signal<any[]>([]);\n spriteComponentsInFront = signal<any[]>([]);\n /** ID of the sprite that the camera should follow. null means follow the current player */\n cameraFollowTargetId = signal<string | null>(null);\n /** Trigger for map shake animation */\n mapShakeTrigger = trigger();\n\n controlsReady = signal(undefined); \n\n private predictionEnabled = false;\n private prediction?: PredictionController<Direction>;\n private readonly SERVER_CORRECTION_THRESHOLD = 30;\n private inputFrameCounter = 0;\n private frameOffset = 0;\n // Ping/Pong for RTT measurement\n private rtt: number = 0; // Round-trip time in ms\n private pingInterval: any = null;\n private readonly PING_INTERVAL_MS = 5000; // Send ping every 5 seconds\n private lastInputTime = 0;\n // Track map loading state for onAfterLoading hook using RxJS\n private mapLoadCompleted$ = new BehaviorSubject<boolean>(false);\n private playerIdReceived$ = new BehaviorSubject<boolean>(false);\n private playersReceived$ = new BehaviorSubject<boolean>(false);\n private eventsReceived$ = new BehaviorSubject<boolean>(false);\n private onAfterLoadingSubscription?: any;\n \n // Store subscriptions and event listeners for cleanup\n private tickSubscriptions: any[] = [];\n private resizeHandler?: () => void;\n\n constructor(public context) {\n this.webSocket = inject(WebSocketToken);\n this.guiService = inject(RpgGui);\n this.loadMapService = inject(LoadMapToken);\n this.hooks = inject<Hooks>(ModulesToken);\n this.globalConfig = inject(GlobalConfigToken)\n\n if (!this.globalConfig) {\n this.globalConfig = {} as T\n }\n if (!(this.globalConfig as any).box) {\n (this.globalConfig as any).box = {\n styles: {\n backgroundColor: \"#1a1a2e\",\n backgroundOpacity: 0.9\n },\n sounds: {}\n }\n }\n\n this.addComponentAnimation({\n id: \"animation\",\n component: PrebuiltComponentAnimations.Animation\n })\n\n this.predictionEnabled = (this.globalConfig as any)?.prediction?.enabled !== false;\n this.initializePredictionController();\n }\n\n /**\n * Assigns a CanvasEngine KeyboardControls instance to the dependency injection context\n * \n * This method registers a KeyboardControls instance from CanvasEngine into the DI container,\n * making it available for injection throughout the application. The particularity is that\n * this method is automatically called when a sprite is displayed on the map, allowing the\n * controls to be automatically associated with the active sprite.\n * \n * ## Design\n * \n * - The instance is stored in the DI context under the `KeyboardControls` token\n * - It's automatically assigned when a sprite component mounts (in `character.ce`)\n * - The controls instance comes from the CanvasEngine component's directives\n * - Once registered, it can be retrieved using `inject(KeyboardControls)` from anywhere\n * \n * @param controlInstance - The CanvasEngine KeyboardControls instance to register\n * \n * @example\n * ```ts\n * // The method is automatically called when a sprite is displayed:\n * // client.setKeyboardControls(element.directives.controls)\n * \n * // Later, retrieve and use the controls instance:\n * import { Input, inject, KeyboardControls } from '@rpgjs/client'\n * \n * const controls = inject(KeyboardControls)\n * const control = controls.getControl(Input.Enter)\n * \n * if (control) {\n * console.log(control.actionName) // 'action'\n * }\n * ```\n */\n setKeyboardControls(controlInstance: any) {\n const currentValues = this.context.values['inject:' + 'KeyboardControls']\n this.context.values['inject:' + 'KeyboardControls'] = {\n ...currentValues,\n values: new Map([['__default__', controlInstance]])\n }\n this.controlsReady.set(undefined);\n }\n\n async start() {\n this.sceneMap = new RpgClientMap()\n this.selector = document.body.querySelector(\"#rpg\") as HTMLElement;\n\n const { app, canvasElement } = await bootstrapCanvas(this.selector, Canvas);\n this.canvasApp = app;\n this.canvasElement = canvasElement;\n this.renderer = app.renderer as PIXI.Renderer;\n this.tick = canvasElement?.propObservables?.context['tick'].observable\n\n const inputCheckSubscription = this.tick.subscribe(() => {\n if (Date.now() - this.lastInputTime > 100) {\n const player = this.getCurrentPlayer();\n if (!player) return;\n (this.sceneMap as any).stopMovement(player);\n }\n });\n this.tickSubscriptions.push(inputCheckSubscription);\n\n\n this.hooks.callHooks(\"client-spritesheets-load\", this).subscribe();\n this.hooks.callHooks(\"client-spritesheetResolver-load\", this).subscribe();\n this.hooks.callHooks(\"client-sounds-load\", this).subscribe();\n this.hooks.callHooks(\"client-soundResolver-load\", this).subscribe();\n \n RpgSound.init(this);\n RpgResource.init(this);\n this.hooks.callHooks(\"client-gui-load\", this).subscribe();\n this.hooks.callHooks(\"client-particles-load\", this).subscribe();\n this.hooks.callHooks(\"client-componentAnimations-load\", this).subscribe();\n this.hooks.callHooks(\"client-sprite-load\", this).subscribe();\n\n await lastValueFrom(this.hooks.callHooks(\"client-engine-onStart\", this));\n\n // wondow is resize\n this.resizeHandler = () => {\n this.hooks.callHooks(\"client-engine-onWindowResize\", this).subscribe();\n };\n window.addEventListener('resize', this.resizeHandler);\n\n const tickSubscription = this.tick.subscribe((tick) => {\n this.hooks.callHooks(\"client-engine-onStep\", this, tick).subscribe();\n\n // Clean up old prediction states and input history every 60 ticks (approximately every second at 60fps)\n if (tick % 60 === 0) {\n const now = Date.now();\n this.prediction?.cleanup(now);\n this.prediction?.tryApplyPendingSnapshot();\n }\n });\n this.tickSubscriptions.push(tickSubscription);\n\n await this.webSocket.connection(() => {\n this.initListeners()\n this.guiService._initialize()\n });\n }\n\n private initListeners() {\n this.webSocket.on(\"sync\", (data) => {\n if (data.pId) {\n this.playerIdSignal.set(data.pId);\n // Signal that player ID was received\n this.playerIdReceived$.next(true);\n }\n\n // Apply client-side prediction filtering and server reconciliation\n this.hooks.callHooks(\"client-sceneMap-onChanges\", this.sceneMap, { partial: data }).subscribe();\n\n load(this.sceneMap, data, true);\n \n // Check if players and events are present in sync data\n const players = data.players || this.sceneMap.players();\n if (players && Object.keys(players).length > 0) {\n this.playersReceived$.next(true);\n }\n \n const events = data.events || this.sceneMap.events();\n if (events !== undefined) {\n this.eventsReceived$.next(true);\n }\n });\n\n // Handle pong responses for RTT measurement\n this.webSocket.on(\"pong\", (data: { serverTick: number; clientFrame: number; clientTime: number }) => {\n const now = Date.now();\n this.rtt = now - data.clientTime;\n\n // Calculate frame offset: how many ticks ahead the server is compared to our frame counter\n // This helps us estimate which server tick corresponds to each client input frame\n const estimatedTicksInFlight = Math.floor(this.rtt / 2 / (1000 / 60)); // Estimate ticks during half RTT\n const estimatedServerTickNow = data.serverTick + estimatedTicksInFlight;\n\n // Update frame offset (only if we have inputs to calibrate with)\n if (this.inputFrameCounter > 0) {\n this.frameOffset = estimatedServerTickNow - data.clientFrame;\n }\n\n console.debug(`[Ping/Pong] RTT: ${this.rtt}ms, ServerTick: ${data.serverTick}, FrameOffset: ${this.frameOffset}`);\n });\n\n this.webSocket.on(\"changeMap\", (data) => {\n this.sceneMap.reset()\n // Reset camera follow to default (follow current player) when changing maps\n this.cameraFollowTargetId.set(null);\n this.loadScene(data.mapId);\n });\n\n this.webSocket.on(\"showComponentAnimation\", (data) => {\n const { params, object, position, id } = data;\n if (!object && position === undefined) {\n throw new Error(\"Please provide an object or x and y coordinates\");\n }\n const player = object ? this.sceneMap.getObjectById(object) : undefined;\n this.getComponentAnimation(id).displayEffect(params, player || position)\n });\n\n this.webSocket.on(\"setAnimation\", (data) => {\n const { animationName, nbTimes, object } = data;\n const player = this.sceneMap.getObjectById(object);\n player.setAnimation(animationName, nbTimes)\n })\n\n this.webSocket.on(\"playSound\", (data) => {\n const { soundId, volume, loop } = data;\n this.playSound(soundId, { volume, loop });\n });\n\n this.webSocket.on(\"stopSound\", (data) => {\n const { soundId } = data;\n this.stopSound(soundId);\n });\n\n this.webSocket.on(\"stopAllSounds\", () => {\n this.stopAllSounds();\n });\n\n this.webSocket.on(\"cameraFollow\", (data) => {\n const { targetId, smoothMove } = data;\n this.setCameraFollow(targetId, smoothMove);\n });\n\n this.webSocket.on(\"flash\", (data) => {\n const { object, type, duration, cycles, alpha, tint } = data;\n const sprite = object ? this.sceneMap.getObjectById(object) : undefined;\n if (sprite && typeof sprite.flash === 'function') {\n sprite.flash({ type, duration, cycles, alpha, tint });\n }\n });\n\n this.webSocket.on(\"shakeMap\", (data) => {\n const { intensity, duration, frequency, direction } = data || {};\n (this.mapShakeTrigger as any).start({\n intensity,\n duration,\n frequency,\n direction\n });\n });\n\n this.webSocket.on('open', () => {\n this.hooks.callHooks(\"client-engine-onConnected\", this, this.socket).subscribe();\n // Start ping/pong for synchronization\n })\n\n this.webSocket.on('close', () => {\n this.hooks.callHooks(\"client-engine-onDisconnected\", this, this.socket).subscribe();\n // Stop ping/pong when disconnected\n this.stopPingPong();\n })\n\n this.webSocket.on('error', (error) => {\n this.hooks.callHooks(\"client-engine-onConnectError\", this, error, this.socket).subscribe();\n })\n }\n\n /**\n * Start periodic ping/pong for client-server synchronization\n * \n * Sends ping requests to the server to measure round-trip time (RTT) and\n * calculate the frame offset between client and server ticks.\n * \n * ## Design\n * \n * - Sends ping every 5 seconds\n * - Measures RTT for latency compensation\n * - Calculates frame offset to map client frames to server ticks\n * - Used for accurate server reconciliation\n * \n * @example\n * ```ts\n * // Called automatically when connection opens\n * this.startPingPong();\n * ```\n */\n private startPingPong(): void {\n // Stop existing interval if any\n this.stopPingPong();\n\n // Send initial ping immediately\n this.sendPing();\n\n // Set up periodic pings\n this.pingInterval = setInterval(() => {\n this.sendPing();\n }, this.PING_INTERVAL_MS);\n }\n\n /**\n * Stop periodic ping/pong\n * \n * Stops the ping interval when disconnecting or changing maps.\n * \n * @example\n * ```ts\n * // Called automatically when connection closes\n * this.stopPingPong();\n * ```\n */\n private stopPingPong(): void {\n if (this.pingInterval) {\n clearInterval(this.pingInterval);\n this.pingInterval = null;\n }\n }\n\n /**\n * Send a ping request to the server\n * \n * Sends current client time and frame counter to the server,\n * which will respond with its server tick for synchronization.\n * \n * @example\n * ```ts\n * // Send a ping to measure RTT\n * this.sendPing();\n * ```\n */\n private sendPing(): void {\n const clientTime = Date.now();\n const clientFrame = this.getPhysicsTick();\n\n this.webSocket.emit('ping', {\n clientTime,\n clientFrame\n });\n }\n\n private async loadScene(mapId: string) {\n await lastValueFrom(this.hooks.callHooks(\"client-sceneMap-onBeforeLoading\", this.sceneMap));\n\n // Clear client prediction states when changing maps\n this.clearClientPredictionStates();\n\n // Reset all conditions for new map loading\n this.mapLoadCompleted$.next(false);\n this.playerIdReceived$.next(false);\n this.playersReceived$.next(false);\n this.eventsReceived$.next(false);\n\n // Unsubscribe previous subscription if exists\n if (this.onAfterLoadingSubscription) {\n this.onAfterLoadingSubscription.unsubscribe();\n }\n\n // Setup RxJS observable to wait for all conditions\n this.setupOnAfterLoadingObserver();\n\n this.webSocket.updateProperties({ room: mapId })\n await this.webSocket.reconnect(() => {\n this.initListeners()\n this.guiService._initialize()\n })\n const res = await this.loadMapService.load(mapId)\n this.sceneMap.data.set(res)\n \n // Check if playerId is already present\n if (this.playerIdSignal()) {\n this.playerIdReceived$.next(true);\n }\n \n // Check if players and events are already present in sceneMap\n const players = this.sceneMap.players();\n if (players && Object.keys(players).length > 0) {\n this.playersReceived$.next(true);\n }\n \n const events = this.sceneMap.events();\n if (events !== undefined) {\n this.eventsReceived$.next(true);\n }\n \n // Signal that map loading is completed (this should be last to ensure other checks are done)\n this.mapLoadCompleted$.next(true);\n this.sceneMap.loadPhysic()\n }\n\n addSpriteSheet<T = any>(spritesheetClass: any, id?: string): any {\n this.spritesheets.set(id || spritesheetClass.id, spritesheetClass);\n return spritesheetClass as any;\n }\n\n /**\n * Set a resolver function for spritesheets\n * \n * The resolver is called when a spritesheet is requested but not found in the cache.\n * It can be synchronous (returns directly) or asynchronous (returns a Promise).\n * The resolved spritesheet is automatically cached for future use.\n * \n * @param resolver - Function that takes a spritesheet ID and returns a spritesheet or Promise of spritesheet\n * \n * @example\n * ```ts\n * // Synchronous resolver\n * engine.setSpritesheetResolver((id) => {\n * if (id === 'dynamic-sprite') {\n * return { id: 'dynamic-sprite', image: 'path/to/image.png', framesWidth: 32, framesHeight: 32 };\n * }\n * return undefined;\n * });\n * \n * // Asynchronous resolver (loading from API)\n * engine.setSpritesheetResolver(async (id) => {\n * const response = await fetch(`/api/spritesheets/${id}`);\n * const data = await response.json();\n * return data;\n * });\n * ```\n */\n setSpritesheetResolver(resolver: (id: string) => any | Promise<any>): void {\n this.spritesheetResolver = resolver;\n }\n\n /**\n * Get a spritesheet by ID, using resolver if not found in cache\n * \n * This method first checks if the spritesheet exists in the cache.\n * If not found and a resolver is set, it calls the resolver to create the spritesheet.\n * The resolved spritesheet is automatically cached for future use.\n * \n * @param id - The spritesheet ID to retrieve\n * @returns The spritesheet if found or created, or undefined if not found and no resolver\n * @returns Promise<any> if the resolver is asynchronous\n * \n * @example\n * ```ts\n * // Synchronous usage\n * const spritesheet = engine.getSpriteSheet('my-sprite');\n * \n * // Asynchronous usage (when resolver returns Promise)\n * const spritesheet = await engine.getSpriteSheet('dynamic-sprite');\n * ```\n */\n getSpriteSheet(id: string): any | Promise<any> {\n // Check cache first\n if (this.spritesheets.has(id)) {\n return this.spritesheets.get(id);\n }\n\n // If not in cache and resolver exists, use it\n if (this.spritesheetResolver) {\n const result = this.spritesheetResolver(id);\n\n // Check if result is a Promise\n if (result instanceof Promise) {\n return result.then((spritesheet) => {\n if (spritesheet) {\n // Cache the resolved spritesheet\n this.spritesheets.set(id, spritesheet);\n }\n return spritesheet;\n });\n } else {\n // Synchronous result\n if (result) {\n // Cache the resolved spritesheet\n this.spritesheets.set(id, result);\n }\n return result;\n }\n }\n\n // No resolver and not in cache\n return undefined;\n }\n\n /**\n * Add a sound to the engine\n * \n * Adds a sound to the engine's sound cache. The sound can be:\n * - A simple object with `id` and `src` properties\n * - A Howler instance\n * - An object with a `play()` method\n * \n * If the sound has a `src` property, a Howler instance will be created automatically.\n * \n * @param sound - The sound object or Howler instance\n * @param id - Optional sound ID (if not provided, uses sound.id)\n * @returns The added sound\n * \n * @example\n * ```ts\n * // Simple sound object\n * engine.addSound({ id: 'click', src: 'click.mp3' });\n * \n * // With explicit ID\n * engine.addSound({ src: 'music.mp3' }, 'background-music');\n * ```\n */\n addSound(sound: any, id?: string): any {\n const soundId = id || sound.id;\n \n if (!soundId) {\n console.warn('Sound added without an ID. It will not be retrievable.');\n return sound;\n }\n\n // If sound has a src property, create a Howler instance\n if (sound.src && typeof sound.src === 'string') {\n const howlOptions: any = {\n src: [sound.src],\n loop: sound.loop || false,\n volume: sound.volume !== undefined ? sound.volume : 1.0,\n };\n\n const howl = new (Howl as any).Howl(howlOptions);\n this.sounds.set(soundId, howl);\n return howl;\n }\n\n // If sound already has a play method (Howler instance or custom), use it directly\n if (sound && typeof sound.play === 'function') {\n this.sounds.set(soundId, sound);\n return sound;\n }\n\n // Otherwise, store as-is\n this.sounds.set(soundId, sound);\n return sound;\n }\n\n /**\n * Set a resolver function for sounds\n * \n * The resolver is called when a sound is requested but not found in the cache.\n * It can be synchronous (returns directly) or asynchronous (returns a Promise).\n * The resolved sound is automatically cached for future use.\n * \n * @param resolver - Function that takes a sound ID and returns a sound or Promise of sound\n * \n * @example\n * ```ts\n * // Synchronous resolver\n * engine.setSoundResolver((id) => {\n * if (id === 'dynamic-sound') {\n * return { id: 'dynamic-sound', src: 'path/to/sound.mp3' };\n * }\n * return undefined;\n * });\n * \n * // Asynchronous resolver (loading from API)\n * engine.setSoundResolver(async (id) => {\n * const response = await fetch(`/api/sounds/${id}`);\n * const data = await response.json();\n * return data;\n * });\n * ```\n */\n setSoundResolver(resolver: (id: string) => any | Promise<any>): void {\n this.soundResolver = resolver;\n }\n\n /**\n * Get a sound by ID, using resolver if not found in cache\n * \n * This method first checks if the sound exists in the cache.\n * If not found and a resolver is set, it calls the resolver to create the sound.\n * The resolved sound is automatically cached for future use.\n * \n * @param id - The sound ID to retrieve\n * @returns The sound if found or created, or undefined if not found and no resolver\n * @returns Promise<any> if the resolver is asynchronous\n * \n * @example\n * ```ts\n * // Synchronous usage\n * const sound = engine.getSound('my-sound');\n * \n * // Asynchronous usage (when resolver returns Promise)\n * const sound = await engine.getSound('dynamic-sound');\n * ```\n */\n getSound(id: string): any | Promise<any> {\n // Check cache first\n if (this.sounds.has(id)) {\n return this.sounds.get(id);\n }\n\n // If not in cache and resolver exists, use it\n if (this.soundResolver) {\n const result = this.soundResolver(id);\n\n // Check if result is a Promise\n if (result instanceof Promise) {\n return result.then((sound) => {\n if (sound) {\n // Cache the resolved sound\n this.sounds.set(id, sound);\n }\n return sound;\n });\n } else {\n // Synchronous result\n if (result) {\n // Cache the resolved sound\n this.sounds.set(id, result);\n }\n return result;\n }\n }\n\n // No resolver and not in cache\n return undefined;\n }\n\n /**\n * Play a sound by its ID\n * \n * This method retrieves a sound from the cache or resolver and plays it.\n * If the sound is not found, it will attempt to resolve it using the soundResolver.\n * Uses Howler.js for audio playback instead of native Audio elements.\n * \n * @param soundId - The sound ID to play\n * @param options - Optional sound configuration\n * @param options.volume - Volume level (0.0 to 1.0, overrides sound default)\n * @param options.loop - Whether the sound should loop (overrides sound default)\n * \n * @example\n * ```ts\n * // Play a sound synchronously\n * engine.playSound('item-pickup');\n * \n * // Play a sound with volume and loop\n * engine.playSound('background-music', { volume: 0.5, loop: true });\n * \n * // Play a sound asynchronously (when resolver returns Promise)\n * await engine.playSound('dynamic-sound', { volume: 0.8 });\n * ```\n */\n async playSound(soundId: string, options?: { volume?: number; loop?: boolean }): Promise<void> {\n const sound = await this.getSound(soundId);\n if (sound && sound.play) {\n // Sound is already a Howler instance or has a play method\n const howlSoundId = sound._sounds?.[0]?._id;\n \n // Apply volume if provided\n if (options?.volume !== undefined) {\n if (howlSoundId !== undefined) {\n sound.volume(Math.max(0, Math.min(1, options.volume)), howlSoundId);\n } else {\n sound.volume(Math.max(0, Math.min(1, options.volume)));\n }\n }\n \n // Apply loop if provided\n if (options?.loop !== undefined) {\n if (howlSoundId !== undefined) {\n sound.loop(options.loop, howlSoundId);\n } else {\n sound.loop(options.loop);\n }\n }\n \n if (howlSoundId !== undefined) {\n sound.play(howlSoundId);\n } else {\n sound.play();\n }\n } else if (sound && sound.src) {\n // If sound is just a source URL, create a Howler instance and cache it\n const howlOptions: any = {\n src: [sound.src],\n loop: options?.loop !== undefined ? options.loop : (sound.loop || false),\n volume: options?.volume !== undefined ? Math.max(0, Math.min(1, options.volume)) : (sound.volume !== undefined ? sound.volume : 1.0),\n };\n\n const howl = new (Howl as any).Howl(howlOptions);\n \n // Cache the Howler instance for future use\n this.sounds.set(soundId, howl);\n \n // Play the sound\n howl.play();\n } else {\n console.warn(`Sound with id \"${soundId}\" not found or cannot be played`);\n }\n }\n\n /**\n * Stop a sound that is currently playing\n * \n * This method stops a sound that was previously started with `playSound()`.\n * \n * @param soundId - The sound ID to stop\n * \n * @example\n * ```ts\n * // Start a looping sound\n * engine.playSound('background-music', { loop: true });\n * \n * // Later, stop it\n * engine.stopSound('background-music');\n * ```\n */\n stopSound(soundId: string): void {\n const sound = this.sounds.get(soundId);\n if (sound && sound.stop) {\n sound.stop();\n } else {\n console.warn(`Sound with id \"${soundId}\" not found or cannot be stopped`);\n }\n }\n\n /**\n * Stop all currently playing sounds\n * \n * This method stops all sounds that are currently playing.\n * Useful when changing maps to prevent sound overlap.\n * \n * @example\n * ```ts\n * // Stop all sounds\n * engine.stopAllSounds();\n * ```\n */\n stopAllSounds(): void {\n this.sounds.forEach((sound) => {\n if (sound && sound.stop) {\n sound.stop();\n }\n });\n }\n\n /**\n * Set the camera to follow a specific sprite\n * \n * This method changes which sprite the camera viewport should follow.\n * The camera will smoothly animate to the target sprite if smoothMove options are provided.\n * \n * ## Design\n * \n * The camera follow target is stored in a signal that is read by sprite components.\n * Each sprite checks if it should be followed by comparing its ID with the target ID.\n * When smoothMove options are provided, the viewport animation is handled by CanvasEngine's\n * viewport system.\n * \n * @param targetId - The ID of the sprite to follow. Set to null to follow the current player\n * @param smoothMove - Animation options. Can be a boolean (default: true) or an object with time and ease\n * @param smoothMove.time - Duration of the animation in milliseconds (optional)\n * @param smoothMove.ease - Easing function name from https://easings.net (optional)\n * \n * @example\n * ```ts\n * // Follow another player with default smooth animation\n * engine.setCameraFollow(otherPlayerId, true);\n * \n * // Follow an event with custom smooth animation\n * engine.setCameraFollow(eventId, {\n * time: 1000,\n * ease: \"easeInOutQuad\"\n * });\n * \n * // Follow without animation (instant)\n * engine.setCameraFollow(targetId, false);\n * \n * // Return to following current player\n * engine.setCameraFollow(null);\n * ```\n */\n setCameraFollow(\n targetId: string | null,\n smoothMove?: boolean | { time?: number; ease?: string }\n ): void {\n // Store smoothMove options for potential future use with viewport animation\n // For now, we just set the target ID and let CanvasEngine handle the viewport follow\n // The smoothMove options could be used to configure viewport animation if CanvasEngine supports it\n this.cameraFollowTargetId.set(targetId);\n \n // If smoothMove is an object, we could store it for viewport configuration\n // This would require integration with CanvasEngine's viewport animation system\n if (typeof smoothMove === \"object\" && smoothMove !== null) {\n // Future: Apply smoothMove.time and smoothMove.ease to viewport animation\n // For now, CanvasEngine handles viewport following automatically\n }\n }\n\n addParticle(particle: any) {\n this.particleSettings.emitters.push(particle)\n return particle;\n }\n\n /**\n * Add a component to render behind sprites\n * Components added with this method will be displayed with a lower z-index than the sprite\n * \n * Supports multiple formats:\n * 1. Direct component: `ShadowComponent`\n * 2. Configuration object: `{ component: LightHalo, props: {...} }`\n * 3. With dynamic props: `{ component: LightHalo, props: (object) => {...} }`\n * 4. With dependencies: `{ component: HealthBar, dependencies: (object) => [object.hp, object.param.maxHp] }`\n * \n * Components with dependencies will only be displayed when all dependencies are resolved (!= undefined).\n * The object (sprite) is passed to the dependencies function to allow sprite-specific dependency resolution.\n * \n * @param component - The component to add behind sprites, or a configuration object\n * @param component.component - The component function to render\n * @param component.props - Static props object or function that receives the sprite object and returns props\n * @param component.dependencies - Function that receives the sprite object and returns an array of Signals\n * @returns The added component or configuration\n * \n * @example\n * ```ts\n * // Add a shadow component behind all sprites\n * engine.addSpriteComponentBehind(ShadowComponent);\n * \n * // Add a component with static props\n * engine.addSpriteComponentBehind({ \n * component: LightHalo, \n * props: { radius: 30 } \n * });\n * \n * // Add a component with dynamic props and dependencies\n * engine.addSpriteComponentBehind({ \n * component: HealthBar, \n * props: (object) => ({ hp: object.hp(), maxHp: object.param.maxHp() }),\n * dependencies: (object) => [object.hp, object.param.maxHp]\n * });\n * ```\n */\n addSpriteComponentBehind(component: any) {\n this.spriteComponentsBehind.update((components: any[]) => [...components, component])\n return component\n }\n\n /**\n * Add a component to render in front of sprites\n * Components added with this method will be displayed with a higher z-index than the sprite\n * \n * Supports multiple formats:\n * 1. Direct component: `HealthBarComponent`\n * 2. Configuration object: `{ component: StatusIndicator, props: {...} }`\n * 3. With dynamic props: `{ component: HealthBar, props: (object) => {...} }`\n * 4. With dependencies: `{ component: HealthBar, dependencies: (object) => [object.hp, object.param.maxHp] }`\n * \n * Components with dependencies will only be displayed when all dependencies are resolved (!= undefined).\n * The object (sprite) is passed to the dependencies function to allow sprite-specific dependency resolution.\n * \n * @param component - The component to add in front of sprites, or a configuration object\n * @param component.component - The component function to render\n * @param component.props - Static props object or function that receives the sprite object and returns props\n * @param component.dependencies - Function that receives the sprite object and returns an array of Signals\n * @returns The added component or configuration\n * \n * @example\n * ```ts\n * // Add a health bar component in front of all sprites\n * engine.addSpriteComponentInFront(HealthBarComponent);\n * \n * // Add a component with static props\n * engine.addSpriteComponentInFront({ \n * component: StatusIndicator, \n * props: { type: 'poison' } \n * });\n * \n * // Add a component with dynamic props and dependencies\n * engine.addSpriteComponentInFront({ \n * component: HealthBar, \n * props: (object) => ({ hp: object.hp(), maxHp: object.param.maxHp() }),\n * dependencies: (object) => [object.hp, object.param.maxHp]\n * });\n * ```\n */\n addSpriteComponentInFront(component: any | { component: any, props: (object: any) => any, dependencies?: (object: any) => any[] }) {\n this.spriteComponentsInFront.update((components: any[]) => [...components, component])\n return component\n }\n\n /**\n * Add a component animation to the engine\n * \n * Component animations are temporary visual effects that can be displayed\n * on sprites or objects, such as hit indicators, spell effects, or status animations.\n * \n * @param componentAnimation - The component animation configuration\n * @param componentAnimation.id - Unique identifier for the animation\n * @param componentAnimation.component - The component function to render\n * @returns The added component animation configuration\n * \n * @example\n * ```ts\n * // Add a hit animation component\n * engine.addComponentAnimation({\n * id: 'hit',\n * component: HitComponent\n * });\n * \n * // Add an explosion effect component\n * engine.addComponentAnimation({\n * id: 'explosion',\n * component: ExplosionComponent\n * });\n * ```\n */\n addComponentAnimation(componentAnimation: {\n component: any,\n id: string\n }) {\n const instance = new AnimationManager()\n this.componentAnimations.push({\n id: componentAnimation.id,\n component: componentAnimation.component,\n instance: instance,\n current: instance.current\n })\n return componentAnimation;\n }\n\n /**\n * Get a component animation by its ID\n * \n * Retrieves the EffectManager instance for a specific component animation,\n * which can be used to display the animation on sprites or objects.\n * \n * @param id - The unique identifier of the component animation\n * @returns The EffectManager instance for the animation\n * @throws Error if the component animation is not found\n * \n * @example\n * ```ts\n * // Get the hit animation and display it\n * const hitAnimation = engine.getComponentAnimation('hit');\n * hitAnimation.displayEffect({ text: \"Critical!\" }, player);\n * ```\n */\n getComponentAnimation(id: string): AnimationManager {\n const componentAnimation = this.componentAnimations.find((componentAnimation) => componentAnimation.id === id)\n if (!componentAnimation) {\n throw new Error(`Component animation with id ${id} not found`)\n }\n return componentAnimation.instance\n }\n\n /**\n * Start a transition\n * \n * Convenience method to display a transition by its ID using the GUI system.\n * \n * @param id - The unique identifier of the transition to start\n * @param props - Props to pass to the transition component\n * \n * @example\n * ```ts\n * // Start a fade transition\n * engine.startTransition('fade', { duration: 1000, color: 'black' });\n * \n * // Start with onFinish callback\n * engine.startTransition('fade', {\n * duration: 1000,\n * onFinish: () => console.log('Fade complete')\n * });\n * ```\n */\n startTransition(id: string, props: any = {}) {\n if (!this.guiService.exists(id)) {\n throw new Error(`Transition with id ${id} not found. Make sure to add it using engine.addTransition() or in your module's transitions property.`);\n }\n this.guiService.display(id, props);\n }\n\n async processInput({ input }: { input: Direction }) {\n const timestamp = Date.now();\n let frame: number;\n let tick: number;\n if (this.predictionEnabled && this.prediction) {\n const meta = this.prediction.recordInput(input, timestamp);\n frame = meta.frame;\n tick = meta.tick;\n } else {\n frame = ++this.inputFrameCounter;\n tick = this.getPhysicsTick();\n }\n this.hooks.callHooks(\"client-engine-onInput\", this, { input, playerId: this.playerId }).subscribe();\n\n this.webSocket.emit('move', {\n input,\n timestamp,\n frame,\n tick,\n });\n\n const currentPlayer = this.sceneMap.getCurrentPlayer();\n if (currentPlayer) {\n (this.sceneMap as any).moveBody(currentPlayer, input);\n }\n this.lastInputTime = Date.now();\n const myId = this.playerIdSignal();\n\n }\n\n processAction({ action }: { action: number }) {\n if (this.stopProcessingInput) return;\n this.hooks.callHooks(\"client-engine-onInput\", this, { input: 'action', playerId: this.playerId }).subscribe();\n this.webSocket.emit('action', { action })\n }\n\n get PIXI() {\n return PIXI\n }\n\n get socket() {\n return this.webSocket\n }\n\n get playerId() {\n return this.playerIdSignal()\n }\n\n get scene() {\n return this.sceneMap\n }\n\n private getPhysicsTick(): number {\n return this.sceneMap?.getTick?.() ?? 0;\n }\n\n private getLocalPlayerState(): PredictionState<Direction> {\n const currentPlayer = this.sceneMap?.getCurrentPlayer();\n if (!currentPlayer) {\n return { x: 0, y: 0, direction: Direction.Down };\n }\n const topLeft = this.sceneMap.getBodyPosition(currentPlayer.id, \"top-left\");\n const x = topLeft?.x ?? currentPlayer.x();\n const y = topLeft?.y ?? currentPlayer.y();\n const direction = currentPlayer.direction();\n return { x, y, direction };\n }\n\n private applyAuthoritativeState(state: PredictionState<Direction>): void {\n const player = this.sceneMap?.getCurrentPlayer();\n if (!player) return;\n const hitbox = typeof player.hitbox === \"function\" ? player.hitbox() : player.hitbox;\n const width = hitbox?.w ?? 0;\n const height = hitbox?.h ?? 0;\n const updated = this.sceneMap.updateHitbox(player.id, state.x, state.y, width, height);\n if (!updated) {\n this.sceneMap.setBodyPosition(player.id, state.x, state.y, \"top-left\");\n }\n player.x.set(Math.round(state.x));\n player.y.set(Math.round(state.y));\n if (state.direction) {\n player.changeDirection(state.direction);\n }\n }\n\n private initializePredictionController(): void {\n if (!this.predictionEnabled) {\n this.prediction = undefined;\n return;\n }\n this.prediction = new PredictionController<Direction>({\n correctionThreshold: (this.globalConfig as any)?.prediction?.correctionThreshold ?? this.SERVER_CORRECTION_THRESHOLD,\n historyTtlMs: (this.globalConfig as any)?.prediction?.historyTtlMs ?? 2000,\n getPhysicsTick: () => this.getPhysicsTick(),\n getCurrentState: () => this.getLocalPlayerState(),\n setAuthoritativeState: (state) => this.applyAuthoritativeState(state),\n });\n }\n\n getCurrentPlayer() {\n return this.sceneMap.getCurrentPlayer()\n }\n\n /**\n * Setup RxJS observer to wait for all conditions before calling onAfterLoading hook\n * \n * This method uses RxJS `combineLatest` to wait for all conditions to be met,\n * regardless of the order in which they arrive:\n * 1. The map loading is completed (loadMapService.load is finished)\n * 2. We received a player ID (pId)\n * 3. Players array has at least one element\n * 4. Events property is present in the sync data\n * \n * Once all conditions are met, it uses `switchMap` to call the onAfterLoading hook once.\n * \n * ## Design\n * \n * Uses BehaviorSubjects to track each condition state, allowing events to arrive\n * in any order. The `combineLatest` operator waits until all observables emit `true`,\n * then `take(1)` ensures the hook is called only once, and `switchMap` handles\n * the hook execution.\n * \n * @example\n * ```ts\n * // Called automatically in loadScene to setup the observer\n * this.setupOnAfterLoadingObserver();\n * ```\n */\n private setupOnAfterLoadingObserver(): void {\n this.onAfterLoadingSubscription = combineLatest([\n this.mapLoadCompleted$.pipe(filter(completed => completed === true)),\n this.playerIdReceived$.pipe(filter(received => received === true)),\n this.playersReceived$.pipe(filter(received => received === true)),\n this.eventsReceived$.pipe(filter(received => received === true))\n ]).pipe(\n take(1), // Only execute once when all conditions are met\n switchMap(() => {\n // Call the hook and return the observable\n return this.hooks.callHooks(\"client-sceneMap-onAfterLoading\", this.sceneMap);\n })\n ).subscribe();\n }\n\n /**\n * Clear client prediction states for cleanup\n * \n * Removes old prediction states and input history to prevent memory leaks.\n * Should be called when changing maps or disconnecting.\n * \n * @example\n * ```ts\n * // Clear prediction states when changing maps\n * engine.clearClientPredictionStates();\n * ```\n */\n clearClientPredictionStates() {\n this.initializePredictionController();\n this.frameOffset = 0;\n this.inputFrameCounter = 0;\n }\n\n /**\n * Trigger a flash animation on a sprite\n * \n * This method allows you to trigger a flash effect on any sprite from client-side code.\n * The flash can be configured with various options including type (alpha, tint, or both),\n * duration, cycles, and color.\n * \n * ## Design\n * \n * The flash is applied directly to the sprite object using its flash trigger.\n * This is useful for client-side visual feedback, UI interactions, or local effects\n * that don't need to be synchronized with the server.\n * \n * @param spriteId - The ID of the sprite to flash. If not provided, flashes the current player\n * @param options - Flash configuration options\n * @param options.type - Type of flash effect: 'alpha' (opacity), 'tint' (color), or 'both' (default: 'alpha')\n * @param options.duration - Duration of the flash animation in milliseconds (default: 300)\n * @param options.cycles - Number of flash cycles (flash on/off) (default: 1)\n * @param options.alpha - Alpha value when flashing, from 0 to 1 (default: 0.3)\n * @param options.tint - Tint color when flashing as hex value or color name (default: 0xffffff - white)\n * \n * @example\n * ```ts\n * // Flash the current player with default settings\n * engine.flash();\n * \n * // Flash a specific sprite with red tint\n * engine.flash('sprite-id', { type: 'tint', tint: 0xff0000 });\n * \n * // Flash with both alpha and tint for dramatic effect\n * engine.flash(undefined, { \n * type: 'both', \n * alpha: 0.5, \n * tint: 0xff0000,\n * duration: 200,\n * cycles: 2\n * });\n * \n * // Quick damage flash on current player\n * engine.flash(undefined, { \n * type: 'tint', \n * tint: 'red', \n * duration: 150,\n * cycles: 1\n * });\n * ```\n */\n flash(\n spriteId?: string,\n options?: {\n type?: 'alpha' | 'tint' | 'both';\n duration?: number;\n cycles?: number;\n alpha?: number;\n tint?: number | string;\n }\n ): void {\n const targetId = spriteId || this.playerId;\n if (!targetId) return;\n\n const sprite = this.sceneMap.getObjectById(targetId);\n if (sprite && typeof sprite.flash === 'function') {\n sprite.flash(options);\n }\n }\n\n private applyServerAck(ack: { frame: number; serverTick?: number; x?: number; y?: number; direction?: Direction }) {\n if (this.predictionEnabled && this.prediction) {\n this.prediction.applyServerAck({\n frame: ack.frame,\n serverTick: ack.serverTick,\n state:\n typeof ack.x === \"number\" && typeof ack.y === \"number\"\n ? { x: ack.x, y: ack.y, direction: ack.direction }\n : undefined,\n });\n return;\n }\n\n if (typeof ack.x !== \"number\" || typeof ack.y !== \"number\") {\n return;\n }\n const player = this.getCurrentPlayer();\n const myId = this.playerIdSignal();\n if (!player || !myId) {\n return;\n }\n const hitbox = typeof player.hitbox === \"function\" ? player.hitbox() : player.hitbox;\n const width = hitbox?.w ?? 0;\n const height = hitbox?.h ?? 0;\n const updated = this.sceneMap.updateHitbox(myId, ack.x, ack.y, width, height);\n if (!updated) {\n this.sceneMap.setBodyPosition(myId, ack.x, ack.y, \"top-left\");\n }\n player.x.set(Math.round(ack.x));\n player.y.set(Math.round(ack.y));\n if (ack.direction) {\n player.changeDirection(ack.direction);\n }\n }\n\n /**\n * Replay unacknowledged inputs from a given frame to resimulate client prediction\n * after applying server authority at a certain frame.\n * \n * @param startFrame - The last server-acknowledged frame\n * \n * @example\n * ```ts\n * // After applying a server correction at frame N\n * this.replayUnackedInputsFromFrame(N);\n * ```\n */\n private async replayUnackedInputsFromFrame(_startFrame: number): Promise<void> {\n // Prediction controller handles replay internally. Kept for backwards compatibility.\n }\n\n /**\n * Clear all client resources and reset state\n * \n * This method should be called to clean up all client-side resources when\n * shutting down or resetting the client engine. It:\n * - Destroys the PIXI renderer\n * - Stops all sounds\n * - Cleans up subscriptions and event listeners\n * - Resets scene map\n * - Stops ping/pong interval\n * - Clears prediction states\n * \n * ## Design\n * \n * This method is used primarily in testing environments to ensure clean\n * state between tests. In production, the client engine typically persists\n * for the lifetime of the application.\n * \n * @example\n * ```ts\n * // In test cleanup\n * afterEach(() => {\n * clientEngine.clear();\n * });\n * ```\n */\n clear(): void {\n try {\n // First, unsubscribe from all tick subscriptions to stop rendering attempts\n for (const subscription of this.tickSubscriptions) {\n if (subscription && typeof subscription.unsubscribe === 'function') {\n subscription.unsubscribe();\n }\n }\n this.tickSubscriptions = [];\n\n // Stop ping/pong interval\n if (this.pingInterval) {\n clearInterval(this.pingInterval);\n this.pingInterval = null;\n }\n\n // Clean up onAfterLoading subscription\n if (this.onAfterLoadingSubscription && typeof this.onAfterLoadingSubscription.unsubscribe === 'function') {\n this.onAfterLoadingSubscription.unsubscribe();\n this.onAfterLoadingSubscription = undefined;\n }\n\n // Clean up canvasElement (CanvasEngine) BEFORE destroying PIXI app\n // This prevents CanvasEngine from trying to render after PIXI is destroyed\n // CanvasEngine manages its own render loop which could try to access PIXI after destruction\n if (this.canvasElement) {\n try {\n // Try to stop or cleanup canvasElement if it has cleanup methods\n if (typeof (this.canvasElement as any).destroy === 'function') {\n (this.canvasElement as any).destroy();\n }\n // Clear the reference\n this.canvasElement = undefined;\n } catch (error) {\n // Ignore errors during canvasElement cleanup\n }\n }\n\n // Reset scene map if it exists (this should stop any ongoing animations/renders)\n if (this.sceneMap && typeof (this.sceneMap as any).reset === 'function') {\n (this.sceneMap as any).reset();\n }\n\n // Stop all sounds\n this.stopAllSounds();\n\n // Remove resize event listener\n if (this.resizeHandler && typeof window !== 'undefined') {\n window.removeEventListener('resize', this.resizeHandler);\n this.resizeHandler = undefined;\n }\n\n // Destroy PIXI app and renderer if they exist\n // Destroy the app first, which will destroy the renderer\n // Store renderer reference before destroying app (since app.destroy() will destroy the renderer)\n const rendererStillExists = this.renderer && typeof this.renderer.destroy === 'function';\n \n if (this.canvasApp && typeof this.canvasApp.destroy === 'function') {\n try {\n // Stop the ticker first to prevent any render calls during destruction\n if (this.canvasApp.ticker) {\n if (typeof this.canvasApp.ticker.stop === 'function') {\n this.canvasApp.ticker.stop();\n }\n // Also remove all listeners from ticker to prevent callbacks\n if (typeof this.canvasApp.ticker.removeAll === 'function') {\n this.canvasApp.ticker.removeAll();\n }\n }\n \n // Stop the renderer's ticker if it exists separately\n if (this.renderer && (this.renderer as any).ticker) {\n if (typeof (this.renderer as any).ticker.stop === 'function') {\n (this.renderer as any).ticker.stop();\n }\n if (typeof (this.renderer as any).ticker.removeAll === 'function') {\n (this.renderer as any).ticker.removeAll();\n }\n }\n \n // Remove the canvas from DOM before destroying to prevent render attempts\n if (this.canvasApp.canvas && this.canvasApp.canvas.parentNode) {\n this.canvasApp.canvas.parentNode.removeChild(this.canvasApp.canvas);\n }\n \n // Destroy with minimal options to avoid issues\n // Don't pass options that might trigger additional cleanup that could fail\n this.canvasApp.destroy(true);\n } catch (error) {\n // Ignore errors during destruction\n }\n this.canvasApp = undefined;\n // canvasApp.destroy() already destroyed the renderer, so just null it\n this.renderer = null as any;\n } else if (rendererStillExists) {\n // Fallback: destroy renderer directly only if app doesn't exist or wasn't destroyed\n try {\n // Stop the renderer's ticker if it has one\n if ((this.renderer as any).ticker) {\n if (typeof (this.renderer as any).ticker.stop === 'function') {\n (this.renderer as any).ticker.stop();\n }\n if (typeof (this.renderer as any).ticker.removeAll === 'function') {\n (this.renderer as any).ticker.removeAll();\n }\n }\n \n this.renderer.destroy(true);\n } catch (error) {\n // Ignore errors during destruction\n }\n this.renderer = null as any;\n }\n\n // Clean up prediction controller\n if (this.prediction) {\n // Prediction controller cleanup is handled internally when destroyed\n this.prediction = undefined;\n }\n\n // Reset signals\n this.playerIdSignal.set(null);\n this.cameraFollowTargetId.set(null);\n this.spriteComponentsBehind.set([]);\n this.spriteComponentsInFront.set([]);\n \n // Clear maps and arrays\n this.spritesheets.clear();\n this.sounds.clear();\n this.componentAnimations = [];\n this.particleSettings.emitters = [];\n\n // Reset state\n this.stopProcessingInput = false;\n this.lastInputTime = 0;\n this.inputFrameCounter = 0;\n this.frameOffset = 0;\n this.rtt = 0;\n\n // Reset behavior subjects\n this.mapLoadCompleted$.next(false);\n this.playerIdReceived$.next(false);\n this.playersReceived$.next(false);\n this.eventsReceived$.next(false);\n } catch (error) {\n console.warn('Error during client engine cleanup:', error);\n }\n }\n}\n"],"names":["Canvas","componentAnimation"],"mappings":";;;;;;;;;;;;;;;;;AAuBO,MAAM,eAAA,CAAyB;AAAA,EAyDpC,YAAmB,OAAA,EAAS;AAAT,IAAA,IAAA,CAAA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C;AAGlC,MAAA,IAAA,CAAK,mBAAA,GAAsB,KAAA;AAC3B,MAAA,IAAA,CAAK,aAAA,GAAgB,CAAA;AACrB,MAAA,IAAA,CAAK,iBAAA,GAAoB,CAAA;AACzB,MAAA,IAAA,CAAK,WAAA,GAAc,CAAA;AACnB,MAAA,IAAA,CAAK,GAAA,GAAM,CAAA;AAGX,MAAA,IAAA,CAAK,iBAAA,CAAkB,KAAK,KAAK,CAAA;AACjC,MAAA,IAAA,CAAK,iBAAA,CAAkB,KAAK,KAAK,CAAA;AACjC,MAAA,IAAA,CAAK,gBAAA,CAAiB,KAAK,KAAK,CAAA;AAChC,MAAA,IAAA,CAAK,eAAA,CAAgB,KAAK,KAAK,CAAA;AAAA,IACjC,SAAS,KAAA,EAAO;AACd,MAAA,OAAA,CAAQ,IAAA,CAAK,uCAAuC,KAAK,CAAA;AAAA,IAC3D;AAAA,EACF;AACF;;;;"}
1
+ {"version":3,"file":"RpgClientEngine.js","sources":["../src/RpgClientEngine.ts"],"sourcesContent":["import Canvas from \"./components/scenes/canvas.ce\";\nimport { inject } from './core/inject'\nimport { signal, bootstrapCanvas, KeyboardControls, Howl, trigger } from \"canvasengine\";\nimport { AbstractWebsocket, WebSocketToken } from \"./services/AbstractSocket\";\nimport { LoadMapService, LoadMapToken } from \"./services/loadMap\";\nimport { RpgSound } from \"./Sound\";\nimport { RpgResource } from \"./Resource\";\nimport { Hooks, ModulesToken, Direction } from \"@rpgjs/common\";\n\ntype DirectionValue = \"up\" | \"down\" | \"left\" | \"right\";\nimport { load } from \"@signe/sync\";\nimport { RpgClientMap } from \"./Game/Map\"\nimport { RpgGui } from \"./Gui/Gui\";\nimport { AnimationManager } from \"./Game/AnimationManager\";\nimport { lastValueFrom, Observable, combineLatest, BehaviorSubject, filter, switchMap, take } from \"rxjs\";\nimport { GlobalConfigToken } from \"./module\";\nimport * as PIXI from \"pixi.js\";\nimport { PrebuiltComponentAnimations } from \"./components/animations\";\nimport {\n PredictionController,\n type PredictionState,\n} from \"@rpgjs/common\";\n\nexport class RpgClientEngine<T = any> {\n private guiService: RpgGui;\n private webSocket: AbstractWebsocket;\n private loadMapService: LoadMapService;\n private hooks: Hooks;\n private sceneMap: RpgClientMap\n private selector: HTMLElement;\n public globalConfig: T;\n public sceneComponent: any;\n stopProcessingInput = false;\n width = signal(\"100%\");\n height = signal(\"100%\");\n spritesheets: Map<string, any> = new Map();\n sounds: Map<string, any> = new Map();\n componentAnimations: any[] = [];\n private spritesheetResolver?: (id: string) => any | Promise<any>;\n private soundResolver?: (id: string) => any | Promise<any>;\n particleSettings: {\n emitters: any[]\n } = {\n emitters: []\n }\n renderer: PIXI.Renderer;\n tick: Observable<number>;\n private canvasApp?: any;\n private canvasElement?: any;\n playerIdSignal = signal<string | null>(null);\n spriteComponentsBehind = signal<any[]>([]);\n spriteComponentsInFront = signal<any[]>([]);\n /** ID of the sprite that the camera should follow. null means follow the current player */\n cameraFollowTargetId = signal<string | null>(null);\n /** Trigger for map shake animation */\n mapShakeTrigger = trigger();\n\n controlsReady = signal(undefined); \n\n private predictionEnabled = false;\n private prediction?: PredictionController<Direction>;\n private readonly SERVER_CORRECTION_THRESHOLD = 30;\n private inputFrameCounter = 0;\n private frameOffset = 0;\n // Ping/Pong for RTT measurement\n private rtt: number = 0; // Round-trip time in ms\n private pingInterval: any = null;\n private readonly PING_INTERVAL_MS = 5000; // Send ping every 5 seconds\n private lastInputTime = 0;\n // Track map loading state for onAfterLoading hook using RxJS\n private mapLoadCompleted$ = new BehaviorSubject<boolean>(false);\n private playerIdReceived$ = new BehaviorSubject<boolean>(false);\n private playersReceived$ = new BehaviorSubject<boolean>(false);\n private eventsReceived$ = new BehaviorSubject<boolean>(false);\n private onAfterLoadingSubscription?: any;\n \n // Store subscriptions and event listeners for cleanup\n private tickSubscriptions: any[] = [];\n private resizeHandler?: () => void;\n\n constructor(public context) {\n this.webSocket = inject(WebSocketToken);\n this.guiService = inject(RpgGui);\n this.loadMapService = inject(LoadMapToken);\n this.hooks = inject<Hooks>(ModulesToken);\n this.globalConfig = inject(GlobalConfigToken)\n\n if (!this.globalConfig) {\n this.globalConfig = {} as T\n }\n if (!(this.globalConfig as any).box) {\n (this.globalConfig as any).box = {\n styles: {\n backgroundColor: \"#1a1a2e\",\n backgroundOpacity: 0.9\n },\n sounds: {}\n }\n }\n\n this.addComponentAnimation({\n id: \"animation\",\n component: PrebuiltComponentAnimations.Animation\n })\n\n this.predictionEnabled = (this.globalConfig as any)?.prediction?.enabled !== false;\n this.initializePredictionController();\n }\n\n /**\n * Assigns a CanvasEngine KeyboardControls instance to the dependency injection context\n * \n * This method registers a KeyboardControls instance from CanvasEngine into the DI container,\n * making it available for injection throughout the application. The particularity is that\n * this method is automatically called when a sprite is displayed on the map, allowing the\n * controls to be automatically associated with the active sprite.\n * \n * ## Design\n * \n * - The instance is stored in the DI context under the `KeyboardControls` token\n * - It's automatically assigned when a sprite component mounts (in `character.ce`)\n * - The controls instance comes from the CanvasEngine component's directives\n * - Once registered, it can be retrieved using `inject(KeyboardControls)` from anywhere\n * \n * @param controlInstance - The CanvasEngine KeyboardControls instance to register\n * \n * @example\n * ```ts\n * // The method is automatically called when a sprite is displayed:\n * // client.setKeyboardControls(element.directives.controls)\n * \n * // Later, retrieve and use the controls instance:\n * import { Input, inject, KeyboardControls } from '@rpgjs/client'\n * \n * const controls = inject(KeyboardControls)\n * const control = controls.getControl(Input.Enter)\n * \n * if (control) {\n * console.log(control.actionName) // 'action'\n * }\n * ```\n */\n setKeyboardControls(controlInstance: any) {\n const currentValues = this.context.values['inject:' + 'KeyboardControls']\n this.context.values['inject:' + 'KeyboardControls'] = {\n ...currentValues,\n values: new Map([['__default__', controlInstance]])\n }\n this.controlsReady.set(undefined);\n }\n\n async start() {\n this.sceneMap = new RpgClientMap()\n this.selector = document.body.querySelector(\"#rpg\") as HTMLElement;\n\n const bootstrapOptions = (this.globalConfig as any)?.bootstrapCanvasOptions;\n const { app, canvasElement } = await bootstrapCanvas(\n this.selector,\n Canvas,\n bootstrapOptions\n );\n this.canvasApp = app;\n this.canvasElement = canvasElement;\n this.renderer = app.renderer as PIXI.Renderer;\n this.tick = canvasElement?.propObservables?.context['tick'].observable\n\n const inputCheckSubscription = this.tick.subscribe(() => {\n if (Date.now() - this.lastInputTime > 100) {\n const player = this.getCurrentPlayer();\n if (!player) return;\n (this.sceneMap as any).stopMovement(player);\n }\n });\n this.tickSubscriptions.push(inputCheckSubscription);\n\n\n this.hooks.callHooks(\"client-spritesheets-load\", this).subscribe();\n this.hooks.callHooks(\"client-spritesheetResolver-load\", this).subscribe();\n this.hooks.callHooks(\"client-sounds-load\", this).subscribe();\n this.hooks.callHooks(\"client-soundResolver-load\", this).subscribe();\n \n RpgSound.init(this);\n RpgResource.init(this);\n this.hooks.callHooks(\"client-gui-load\", this).subscribe();\n this.hooks.callHooks(\"client-particles-load\", this).subscribe();\n this.hooks.callHooks(\"client-componentAnimations-load\", this).subscribe();\n this.hooks.callHooks(\"client-sprite-load\", this).subscribe();\n\n await lastValueFrom(this.hooks.callHooks(\"client-engine-onStart\", this));\n\n // wondow is resize\n this.resizeHandler = () => {\n this.hooks.callHooks(\"client-engine-onWindowResize\", this).subscribe();\n };\n window.addEventListener('resize', this.resizeHandler);\n\n const tickSubscription = this.tick.subscribe((tick) => {\n this.hooks.callHooks(\"client-engine-onStep\", this, tick).subscribe();\n\n // Clean up old prediction states and input history every 60 ticks (approximately every second at 60fps)\n if (tick % 60 === 0) {\n const now = Date.now();\n this.prediction?.cleanup(now);\n this.prediction?.tryApplyPendingSnapshot();\n }\n });\n this.tickSubscriptions.push(tickSubscription);\n\n await this.webSocket.connection(() => {\n this.initListeners()\n this.guiService._initialize()\n });\n }\n\n private initListeners() {\n this.webSocket.on(\"sync\", (data) => {\n if (data.pId) {\n this.playerIdSignal.set(data.pId);\n // Signal that player ID was received\n this.playerIdReceived$.next(true);\n }\n\n // Apply client-side prediction filtering and server reconciliation\n this.hooks.callHooks(\"client-sceneMap-onChanges\", this.sceneMap, { partial: data }).subscribe();\n\n load(this.sceneMap, data, true);\n \n // Check if players and events are present in sync data\n const players = data.players || this.sceneMap.players();\n if (players && Object.keys(players).length > 0) {\n this.playersReceived$.next(true);\n }\n \n const events = data.events || this.sceneMap.events();\n if (events !== undefined) {\n this.eventsReceived$.next(true);\n }\n });\n\n // Handle pong responses for RTT measurement\n this.webSocket.on(\"pong\", (data: { serverTick: number; clientFrame: number; clientTime: number }) => {\n const now = Date.now();\n this.rtt = now - data.clientTime;\n\n // Calculate frame offset: how many ticks ahead the server is compared to our frame counter\n // This helps us estimate which server tick corresponds to each client input frame\n const estimatedTicksInFlight = Math.floor(this.rtt / 2 / (1000 / 60)); // Estimate ticks during half RTT\n const estimatedServerTickNow = data.serverTick + estimatedTicksInFlight;\n\n // Update frame offset (only if we have inputs to calibrate with)\n if (this.inputFrameCounter > 0) {\n this.frameOffset = estimatedServerTickNow - data.clientFrame;\n }\n\n console.debug(`[Ping/Pong] RTT: ${this.rtt}ms, ServerTick: ${data.serverTick}, FrameOffset: ${this.frameOffset}`);\n });\n\n this.webSocket.on(\"changeMap\", (data) => {\n this.sceneMap.reset()\n // Reset camera follow to default (follow current player) when changing maps\n this.cameraFollowTargetId.set(null);\n this.loadScene(data.mapId);\n });\n\n this.webSocket.on(\"showComponentAnimation\", (data) => {\n const { params, object, position, id } = data;\n if (!object && position === undefined) {\n throw new Error(\"Please provide an object or x and y coordinates\");\n }\n const player = object ? this.sceneMap.getObjectById(object) : undefined;\n this.getComponentAnimation(id).displayEffect(params, player || position)\n });\n\n this.webSocket.on(\"setAnimation\", (data) => {\n const { animationName, nbTimes, object } = data;\n const player = this.sceneMap.getObjectById(object);\n player.setAnimation(animationName, nbTimes)\n })\n\n this.webSocket.on(\"playSound\", (data) => {\n const { soundId, volume, loop } = data;\n this.playSound(soundId, { volume, loop });\n });\n\n this.webSocket.on(\"stopSound\", (data) => {\n const { soundId } = data;\n this.stopSound(soundId);\n });\n\n this.webSocket.on(\"stopAllSounds\", () => {\n this.stopAllSounds();\n });\n\n this.webSocket.on(\"cameraFollow\", (data) => {\n const { targetId, smoothMove } = data;\n this.setCameraFollow(targetId, smoothMove);\n });\n\n this.webSocket.on(\"flash\", (data) => {\n const { object, type, duration, cycles, alpha, tint } = data;\n const sprite = object ? this.sceneMap.getObjectById(object) : undefined;\n if (sprite && typeof sprite.flash === 'function') {\n sprite.flash({ type, duration, cycles, alpha, tint });\n }\n });\n\n this.webSocket.on(\"shakeMap\", (data) => {\n const { intensity, duration, frequency, direction } = data || {};\n (this.mapShakeTrigger as any).start({\n intensity,\n duration,\n frequency,\n direction\n });\n });\n\n this.webSocket.on('open', () => {\n this.hooks.callHooks(\"client-engine-onConnected\", this, this.socket).subscribe();\n // Start ping/pong for synchronization\n })\n\n this.webSocket.on('close', () => {\n this.hooks.callHooks(\"client-engine-onDisconnected\", this, this.socket).subscribe();\n // Stop ping/pong when disconnected\n this.stopPingPong();\n })\n\n this.webSocket.on('error', (error) => {\n this.hooks.callHooks(\"client-engine-onConnectError\", this, error, this.socket).subscribe();\n })\n }\n\n /**\n * Start periodic ping/pong for client-server synchronization\n * \n * Sends ping requests to the server to measure round-trip time (RTT) and\n * calculate the frame offset between client and server ticks.\n * \n * ## Design\n * \n * - Sends ping every 5 seconds\n * - Measures RTT for latency compensation\n * - Calculates frame offset to map client frames to server ticks\n * - Used for accurate server reconciliation\n * \n * @example\n * ```ts\n * // Called automatically when connection opens\n * this.startPingPong();\n * ```\n */\n private startPingPong(): void {\n // Stop existing interval if any\n this.stopPingPong();\n\n // Send initial ping immediately\n this.sendPing();\n\n // Set up periodic pings\n this.pingInterval = setInterval(() => {\n this.sendPing();\n }, this.PING_INTERVAL_MS);\n }\n\n /**\n * Stop periodic ping/pong\n * \n * Stops the ping interval when disconnecting or changing maps.\n * \n * @example\n * ```ts\n * // Called automatically when connection closes\n * this.stopPingPong();\n * ```\n */\n private stopPingPong(): void {\n if (this.pingInterval) {\n clearInterval(this.pingInterval);\n this.pingInterval = null;\n }\n }\n\n /**\n * Send a ping request to the server\n * \n * Sends current client time and frame counter to the server,\n * which will respond with its server tick for synchronization.\n * \n * @example\n * ```ts\n * // Send a ping to measure RTT\n * this.sendPing();\n * ```\n */\n private sendPing(): void {\n const clientTime = Date.now();\n const clientFrame = this.getPhysicsTick();\n\n this.webSocket.emit('ping', {\n clientTime,\n clientFrame\n });\n }\n\n private async loadScene(mapId: string) {\n await lastValueFrom(this.hooks.callHooks(\"client-sceneMap-onBeforeLoading\", this.sceneMap));\n\n // Clear client prediction states when changing maps\n this.clearClientPredictionStates();\n\n // Reset all conditions for new map loading\n this.mapLoadCompleted$.next(false);\n this.playerIdReceived$.next(false);\n this.playersReceived$.next(false);\n this.eventsReceived$.next(false);\n\n // Unsubscribe previous subscription if exists\n if (this.onAfterLoadingSubscription) {\n this.onAfterLoadingSubscription.unsubscribe();\n }\n\n // Setup RxJS observable to wait for all conditions\n this.setupOnAfterLoadingObserver();\n\n this.webSocket.updateProperties({ room: mapId })\n await this.webSocket.reconnect(() => {\n this.initListeners()\n this.guiService._initialize()\n })\n const res = await this.loadMapService.load(mapId)\n this.sceneMap.data.set(res)\n \n // Check if playerId is already present\n if (this.playerIdSignal()) {\n this.playerIdReceived$.next(true);\n }\n \n // Check if players and events are already present in sceneMap\n const players = this.sceneMap.players();\n if (players && Object.keys(players).length > 0) {\n this.playersReceived$.next(true);\n }\n \n const events = this.sceneMap.events();\n if (events !== undefined) {\n this.eventsReceived$.next(true);\n }\n \n // Signal that map loading is completed (this should be last to ensure other checks are done)\n this.mapLoadCompleted$.next(true);\n this.sceneMap.loadPhysic()\n }\n\n addSpriteSheet<T = any>(spritesheetClass: any, id?: string): any {\n this.spritesheets.set(id || spritesheetClass.id, spritesheetClass);\n return spritesheetClass as any;\n }\n\n /**\n * Set a resolver function for spritesheets\n * \n * The resolver is called when a spritesheet is requested but not found in the cache.\n * It can be synchronous (returns directly) or asynchronous (returns a Promise).\n * The resolved spritesheet is automatically cached for future use.\n * \n * @param resolver - Function that takes a spritesheet ID and returns a spritesheet or Promise of spritesheet\n * \n * @example\n * ```ts\n * // Synchronous resolver\n * engine.setSpritesheetResolver((id) => {\n * if (id === 'dynamic-sprite') {\n * return { id: 'dynamic-sprite', image: 'path/to/image.png', framesWidth: 32, framesHeight: 32 };\n * }\n * return undefined;\n * });\n * \n * // Asynchronous resolver (loading from API)\n * engine.setSpritesheetResolver(async (id) => {\n * const response = await fetch(`/api/spritesheets/${id}`);\n * const data = await response.json();\n * return data;\n * });\n * ```\n */\n setSpritesheetResolver(resolver: (id: string) => any | Promise<any>): void {\n this.spritesheetResolver = resolver;\n }\n\n /**\n * Get a spritesheet by ID, using resolver if not found in cache\n * \n * This method first checks if the spritesheet exists in the cache.\n * If not found and a resolver is set, it calls the resolver to create the spritesheet.\n * The resolved spritesheet is automatically cached for future use.\n * \n * @param id - The spritesheet ID to retrieve\n * @returns The spritesheet if found or created, or undefined if not found and no resolver\n * @returns Promise<any> if the resolver is asynchronous\n * \n * @example\n * ```ts\n * // Synchronous usage\n * const spritesheet = engine.getSpriteSheet('my-sprite');\n * \n * // Asynchronous usage (when resolver returns Promise)\n * const spritesheet = await engine.getSpriteSheet('dynamic-sprite');\n * ```\n */\n getSpriteSheet(id: string): any | Promise<any> {\n // Check cache first\n if (this.spritesheets.has(id)) {\n return this.spritesheets.get(id);\n }\n\n // If not in cache and resolver exists, use it\n if (this.spritesheetResolver) {\n const result = this.spritesheetResolver(id);\n\n // Check if result is a Promise\n if (result instanceof Promise) {\n return result.then((spritesheet) => {\n if (spritesheet) {\n // Cache the resolved spritesheet\n this.spritesheets.set(id, spritesheet);\n }\n return spritesheet;\n });\n } else {\n // Synchronous result\n if (result) {\n // Cache the resolved spritesheet\n this.spritesheets.set(id, result);\n }\n return result;\n }\n }\n\n // No resolver and not in cache\n return undefined;\n }\n\n /**\n * Add a sound to the engine\n * \n * Adds a sound to the engine's sound cache. The sound can be:\n * - A simple object with `id` and `src` properties\n * - A Howler instance\n * - An object with a `play()` method\n * \n * If the sound has a `src` property, a Howler instance will be created automatically.\n * \n * @param sound - The sound object or Howler instance\n * @param id - Optional sound ID (if not provided, uses sound.id)\n * @returns The added sound\n * \n * @example\n * ```ts\n * // Simple sound object\n * engine.addSound({ id: 'click', src: 'click.mp3' });\n * \n * // With explicit ID\n * engine.addSound({ src: 'music.mp3' }, 'background-music');\n * ```\n */\n addSound(sound: any, id?: string): any {\n const soundId = id || sound.id;\n \n if (!soundId) {\n console.warn('Sound added without an ID. It will not be retrievable.');\n return sound;\n }\n\n // If sound has a src property, create a Howler instance\n if (sound.src && typeof sound.src === 'string') {\n const howlOptions: any = {\n src: [sound.src],\n loop: sound.loop || false,\n volume: sound.volume !== undefined ? sound.volume : 1.0,\n };\n\n const howl = new (Howl as any).Howl(howlOptions);\n this.sounds.set(soundId, howl);\n return howl;\n }\n\n // If sound already has a play method (Howler instance or custom), use it directly\n if (sound && typeof sound.play === 'function') {\n this.sounds.set(soundId, sound);\n return sound;\n }\n\n // Otherwise, store as-is\n this.sounds.set(soundId, sound);\n return sound;\n }\n\n /**\n * Set a resolver function for sounds\n * \n * The resolver is called when a sound is requested but not found in the cache.\n * It can be synchronous (returns directly) or asynchronous (returns a Promise).\n * The resolved sound is automatically cached for future use.\n * \n * @param resolver - Function that takes a sound ID and returns a sound or Promise of sound\n * \n * @example\n * ```ts\n * // Synchronous resolver\n * engine.setSoundResolver((id) => {\n * if (id === 'dynamic-sound') {\n * return { id: 'dynamic-sound', src: 'path/to/sound.mp3' };\n * }\n * return undefined;\n * });\n * \n * // Asynchronous resolver (loading from API)\n * engine.setSoundResolver(async (id) => {\n * const response = await fetch(`/api/sounds/${id}`);\n * const data = await response.json();\n * return data;\n * });\n * ```\n */\n setSoundResolver(resolver: (id: string) => any | Promise<any>): void {\n this.soundResolver = resolver;\n }\n\n /**\n * Get a sound by ID, using resolver if not found in cache\n * \n * This method first checks if the sound exists in the cache.\n * If not found and a resolver is set, it calls the resolver to create the sound.\n * The resolved sound is automatically cached for future use.\n * \n * @param id - The sound ID to retrieve\n * @returns The sound if found or created, or undefined if not found and no resolver\n * @returns Promise<any> if the resolver is asynchronous\n * \n * @example\n * ```ts\n * // Synchronous usage\n * const sound = engine.getSound('my-sound');\n * \n * // Asynchronous usage (when resolver returns Promise)\n * const sound = await engine.getSound('dynamic-sound');\n * ```\n */\n getSound(id: string): any | Promise<any> {\n // Check cache first\n if (this.sounds.has(id)) {\n return this.sounds.get(id);\n }\n\n // If not in cache and resolver exists, use it\n if (this.soundResolver) {\n const result = this.soundResolver(id);\n\n // Check if result is a Promise\n if (result instanceof Promise) {\n return result.then((sound) => {\n if (sound) {\n // Cache the resolved sound\n this.sounds.set(id, sound);\n }\n return sound;\n });\n } else {\n // Synchronous result\n if (result) {\n // Cache the resolved sound\n this.sounds.set(id, result);\n }\n return result;\n }\n }\n\n // No resolver and not in cache\n return undefined;\n }\n\n /**\n * Play a sound by its ID\n * \n * This method retrieves a sound from the cache or resolver and plays it.\n * If the sound is not found, it will attempt to resolve it using the soundResolver.\n * Uses Howler.js for audio playback instead of native Audio elements.\n * \n * @param soundId - The sound ID to play\n * @param options - Optional sound configuration\n * @param options.volume - Volume level (0.0 to 1.0, overrides sound default)\n * @param options.loop - Whether the sound should loop (overrides sound default)\n * \n * @example\n * ```ts\n * // Play a sound synchronously\n * engine.playSound('item-pickup');\n * \n * // Play a sound with volume and loop\n * engine.playSound('background-music', { volume: 0.5, loop: true });\n * \n * // Play a sound asynchronously (when resolver returns Promise)\n * await engine.playSound('dynamic-sound', { volume: 0.8 });\n * ```\n */\n async playSound(soundId: string, options?: { volume?: number; loop?: boolean }): Promise<void> {\n const sound = await this.getSound(soundId);\n if (sound && sound.play) {\n // Sound is already a Howler instance or has a play method\n const howlSoundId = sound._sounds?.[0]?._id;\n \n // Apply volume if provided\n if (options?.volume !== undefined) {\n if (howlSoundId !== undefined) {\n sound.volume(Math.max(0, Math.min(1, options.volume)), howlSoundId);\n } else {\n sound.volume(Math.max(0, Math.min(1, options.volume)));\n }\n }\n \n // Apply loop if provided\n if (options?.loop !== undefined) {\n if (howlSoundId !== undefined) {\n sound.loop(options.loop, howlSoundId);\n } else {\n sound.loop(options.loop);\n }\n }\n \n if (howlSoundId !== undefined) {\n sound.play(howlSoundId);\n } else {\n sound.play();\n }\n } else if (sound && sound.src) {\n // If sound is just a source URL, create a Howler instance and cache it\n const howlOptions: any = {\n src: [sound.src],\n loop: options?.loop !== undefined ? options.loop : (sound.loop || false),\n volume: options?.volume !== undefined ? Math.max(0, Math.min(1, options.volume)) : (sound.volume !== undefined ? sound.volume : 1.0),\n };\n\n const howl = new (Howl as any).Howl(howlOptions);\n \n // Cache the Howler instance for future use\n this.sounds.set(soundId, howl);\n \n // Play the sound\n howl.play();\n } else {\n console.warn(`Sound with id \"${soundId}\" not found or cannot be played`);\n }\n }\n\n /**\n * Stop a sound that is currently playing\n * \n * This method stops a sound that was previously started with `playSound()`.\n * \n * @param soundId - The sound ID to stop\n * \n * @example\n * ```ts\n * // Start a looping sound\n * engine.playSound('background-music', { loop: true });\n * \n * // Later, stop it\n * engine.stopSound('background-music');\n * ```\n */\n stopSound(soundId: string): void {\n const sound = this.sounds.get(soundId);\n if (sound && sound.stop) {\n sound.stop();\n } else {\n console.warn(`Sound with id \"${soundId}\" not found or cannot be stopped`);\n }\n }\n\n /**\n * Stop all currently playing sounds\n * \n * This method stops all sounds that are currently playing.\n * Useful when changing maps to prevent sound overlap.\n * \n * @example\n * ```ts\n * // Stop all sounds\n * engine.stopAllSounds();\n * ```\n */\n stopAllSounds(): void {\n this.sounds.forEach((sound) => {\n if (sound && sound.stop) {\n sound.stop();\n }\n });\n }\n\n /**\n * Set the camera to follow a specific sprite\n * \n * This method changes which sprite the camera viewport should follow.\n * The camera will smoothly animate to the target sprite if smoothMove options are provided.\n * \n * ## Design\n * \n * The camera follow target is stored in a signal that is read by sprite components.\n * Each sprite checks if it should be followed by comparing its ID with the target ID.\n * When smoothMove options are provided, the viewport animation is handled by CanvasEngine's\n * viewport system.\n * \n * @param targetId - The ID of the sprite to follow. Set to null to follow the current player\n * @param smoothMove - Animation options. Can be a boolean (default: true) or an object with time and ease\n * @param smoothMove.time - Duration of the animation in milliseconds (optional)\n * @param smoothMove.ease - Easing function name from https://easings.net (optional)\n * \n * @example\n * ```ts\n * // Follow another player with default smooth animation\n * engine.setCameraFollow(otherPlayerId, true);\n * \n * // Follow an event with custom smooth animation\n * engine.setCameraFollow(eventId, {\n * time: 1000,\n * ease: \"easeInOutQuad\"\n * });\n * \n * // Follow without animation (instant)\n * engine.setCameraFollow(targetId, false);\n * \n * // Return to following current player\n * engine.setCameraFollow(null);\n * ```\n */\n setCameraFollow(\n targetId: string | null,\n smoothMove?: boolean | { time?: number; ease?: string }\n ): void {\n // Store smoothMove options for potential future use with viewport animation\n // For now, we just set the target ID and let CanvasEngine handle the viewport follow\n // The smoothMove options could be used to configure viewport animation if CanvasEngine supports it\n this.cameraFollowTargetId.set(targetId);\n \n // If smoothMove is an object, we could store it for viewport configuration\n // This would require integration with CanvasEngine's viewport animation system\n if (typeof smoothMove === \"object\" && smoothMove !== null) {\n // Future: Apply smoothMove.time and smoothMove.ease to viewport animation\n // For now, CanvasEngine handles viewport following automatically\n }\n }\n\n addParticle(particle: any) {\n this.particleSettings.emitters.push(particle)\n return particle;\n }\n\n /**\n * Add a component to render behind sprites\n * Components added with this method will be displayed with a lower z-index than the sprite\n * \n * Supports multiple formats:\n * 1. Direct component: `ShadowComponent`\n * 2. Configuration object: `{ component: LightHalo, props: {...} }`\n * 3. With dynamic props: `{ component: LightHalo, props: (object) => {...} }`\n * 4. With dependencies: `{ component: HealthBar, dependencies: (object) => [object.hp, object.param.maxHp] }`\n * \n * Components with dependencies will only be displayed when all dependencies are resolved (!= undefined).\n * The object (sprite) is passed to the dependencies function to allow sprite-specific dependency resolution.\n * \n * @param component - The component to add behind sprites, or a configuration object\n * @param component.component - The component function to render\n * @param component.props - Static props object or function that receives the sprite object and returns props\n * @param component.dependencies - Function that receives the sprite object and returns an array of Signals\n * @returns The added component or configuration\n * \n * @example\n * ```ts\n * // Add a shadow component behind all sprites\n * engine.addSpriteComponentBehind(ShadowComponent);\n * \n * // Add a component with static props\n * engine.addSpriteComponentBehind({ \n * component: LightHalo, \n * props: { radius: 30 } \n * });\n * \n * // Add a component with dynamic props and dependencies\n * engine.addSpriteComponentBehind({ \n * component: HealthBar, \n * props: (object) => ({ hp: object.hp(), maxHp: object.param.maxHp() }),\n * dependencies: (object) => [object.hp, object.param.maxHp]\n * });\n * ```\n */\n addSpriteComponentBehind(component: any) {\n this.spriteComponentsBehind.update((components: any[]) => [...components, component])\n return component\n }\n\n /**\n * Add a component to render in front of sprites\n * Components added with this method will be displayed with a higher z-index than the sprite\n * \n * Supports multiple formats:\n * 1. Direct component: `HealthBarComponent`\n * 2. Configuration object: `{ component: StatusIndicator, props: {...} }`\n * 3. With dynamic props: `{ component: HealthBar, props: (object) => {...} }`\n * 4. With dependencies: `{ component: HealthBar, dependencies: (object) => [object.hp, object.param.maxHp] }`\n * \n * Components with dependencies will only be displayed when all dependencies are resolved (!= undefined).\n * The object (sprite) is passed to the dependencies function to allow sprite-specific dependency resolution.\n * \n * @param component - The component to add in front of sprites, or a configuration object\n * @param component.component - The component function to render\n * @param component.props - Static props object or function that receives the sprite object and returns props\n * @param component.dependencies - Function that receives the sprite object and returns an array of Signals\n * @returns The added component or configuration\n * \n * @example\n * ```ts\n * // Add a health bar component in front of all sprites\n * engine.addSpriteComponentInFront(HealthBarComponent);\n * \n * // Add a component with static props\n * engine.addSpriteComponentInFront({ \n * component: StatusIndicator, \n * props: { type: 'poison' } \n * });\n * \n * // Add a component with dynamic props and dependencies\n * engine.addSpriteComponentInFront({ \n * component: HealthBar, \n * props: (object) => ({ hp: object.hp(), maxHp: object.param.maxHp() }),\n * dependencies: (object) => [object.hp, object.param.maxHp]\n * });\n * ```\n */\n addSpriteComponentInFront(component: any | { component: any, props: (object: any) => any, dependencies?: (object: any) => any[] }) {\n this.spriteComponentsInFront.update((components: any[]) => [...components, component])\n return component\n }\n\n /**\n * Add a component animation to the engine\n * \n * Component animations are temporary visual effects that can be displayed\n * on sprites or objects, such as hit indicators, spell effects, or status animations.\n * \n * @param componentAnimation - The component animation configuration\n * @param componentAnimation.id - Unique identifier for the animation\n * @param componentAnimation.component - The component function to render\n * @returns The added component animation configuration\n * \n * @example\n * ```ts\n * // Add a hit animation component\n * engine.addComponentAnimation({\n * id: 'hit',\n * component: HitComponent\n * });\n * \n * // Add an explosion effect component\n * engine.addComponentAnimation({\n * id: 'explosion',\n * component: ExplosionComponent\n * });\n * ```\n */\n addComponentAnimation(componentAnimation: {\n component: any,\n id: string\n }) {\n const instance = new AnimationManager()\n this.componentAnimations.push({\n id: componentAnimation.id,\n component: componentAnimation.component,\n instance: instance,\n current: instance.current\n })\n return componentAnimation;\n }\n\n /**\n * Get a component animation by its ID\n * \n * Retrieves the EffectManager instance for a specific component animation,\n * which can be used to display the animation on sprites or objects.\n * \n * @param id - The unique identifier of the component animation\n * @returns The EffectManager instance for the animation\n * @throws Error if the component animation is not found\n * \n * @example\n * ```ts\n * // Get the hit animation and display it\n * const hitAnimation = engine.getComponentAnimation('hit');\n * hitAnimation.displayEffect({ text: \"Critical!\" }, player);\n * ```\n */\n getComponentAnimation(id: string): AnimationManager {\n const componentAnimation = this.componentAnimations.find((componentAnimation) => componentAnimation.id === id)\n if (!componentAnimation) {\n throw new Error(`Component animation with id ${id} not found`)\n }\n return componentAnimation.instance\n }\n\n /**\n * Start a transition\n * \n * Convenience method to display a transition by its ID using the GUI system.\n * \n * @param id - The unique identifier of the transition to start\n * @param props - Props to pass to the transition component\n * \n * @example\n * ```ts\n * // Start a fade transition\n * engine.startTransition('fade', { duration: 1000, color: 'black' });\n * \n * // Start with onFinish callback\n * engine.startTransition('fade', {\n * duration: 1000,\n * onFinish: () => console.log('Fade complete')\n * });\n * ```\n */\n startTransition(id: string, props: any = {}) {\n if (!this.guiService.exists(id)) {\n throw new Error(`Transition with id ${id} not found. Make sure to add it using engine.addTransition() or in your module's transitions property.`);\n }\n this.guiService.display(id, props);\n }\n\n async processInput({ input }: { input: Direction }) {\n const timestamp = Date.now();\n let frame: number;\n let tick: number;\n if (this.predictionEnabled && this.prediction) {\n const meta = this.prediction.recordInput(input, timestamp);\n frame = meta.frame;\n tick = meta.tick;\n } else {\n frame = ++this.inputFrameCounter;\n tick = this.getPhysicsTick();\n }\n this.hooks.callHooks(\"client-engine-onInput\", this, { input, playerId: this.playerId }).subscribe();\n\n this.webSocket.emit('move', {\n input,\n timestamp,\n frame,\n tick,\n });\n\n const currentPlayer = this.sceneMap.getCurrentPlayer();\n if (currentPlayer) {\n (this.sceneMap as any).moveBody(currentPlayer, input);\n }\n this.lastInputTime = Date.now();\n const myId = this.playerIdSignal();\n\n }\n\n processAction({ action }: { action: number }) {\n if (this.stopProcessingInput) return;\n this.hooks.callHooks(\"client-engine-onInput\", this, { input: 'action', playerId: this.playerId }).subscribe();\n this.webSocket.emit('action', { action })\n }\n\n get PIXI() {\n return PIXI\n }\n\n get socket() {\n return this.webSocket\n }\n\n get playerId() {\n return this.playerIdSignal()\n }\n\n get scene() {\n return this.sceneMap\n }\n\n private getPhysicsTick(): number {\n return this.sceneMap?.getTick?.() ?? 0;\n }\n\n private getLocalPlayerState(): PredictionState<Direction> {\n const currentPlayer = this.sceneMap?.getCurrentPlayer();\n if (!currentPlayer) {\n return { x: 0, y: 0, direction: Direction.Down };\n }\n const topLeft = this.sceneMap.getBodyPosition(currentPlayer.id, \"top-left\");\n const x = topLeft?.x ?? currentPlayer.x();\n const y = topLeft?.y ?? currentPlayer.y();\n const direction = currentPlayer.direction();\n return { x, y, direction };\n }\n\n private applyAuthoritativeState(state: PredictionState<Direction>): void {\n const player = this.sceneMap?.getCurrentPlayer();\n if (!player) return;\n const hitbox = typeof player.hitbox === \"function\" ? player.hitbox() : player.hitbox;\n const width = hitbox?.w ?? 0;\n const height = hitbox?.h ?? 0;\n const updated = this.sceneMap.updateHitbox(player.id, state.x, state.y, width, height);\n if (!updated) {\n this.sceneMap.setBodyPosition(player.id, state.x, state.y, \"top-left\");\n }\n player.x.set(Math.round(state.x));\n player.y.set(Math.round(state.y));\n if (state.direction) {\n player.changeDirection(state.direction);\n }\n }\n\n private initializePredictionController(): void {\n if (!this.predictionEnabled) {\n this.prediction = undefined;\n return;\n }\n this.prediction = new PredictionController<Direction>({\n correctionThreshold: (this.globalConfig as any)?.prediction?.correctionThreshold ?? this.SERVER_CORRECTION_THRESHOLD,\n historyTtlMs: (this.globalConfig as any)?.prediction?.historyTtlMs ?? 2000,\n getPhysicsTick: () => this.getPhysicsTick(),\n getCurrentState: () => this.getLocalPlayerState(),\n setAuthoritativeState: (state) => this.applyAuthoritativeState(state),\n });\n }\n\n getCurrentPlayer() {\n return this.sceneMap.getCurrentPlayer()\n }\n\n /**\n * Setup RxJS observer to wait for all conditions before calling onAfterLoading hook\n * \n * This method uses RxJS `combineLatest` to wait for all conditions to be met,\n * regardless of the order in which they arrive:\n * 1. The map loading is completed (loadMapService.load is finished)\n * 2. We received a player ID (pId)\n * 3. Players array has at least one element\n * 4. Events property is present in the sync data\n * \n * Once all conditions are met, it uses `switchMap` to call the onAfterLoading hook once.\n * \n * ## Design\n * \n * Uses BehaviorSubjects to track each condition state, allowing events to arrive\n * in any order. The `combineLatest` operator waits until all observables emit `true`,\n * then `take(1)` ensures the hook is called only once, and `switchMap` handles\n * the hook execution.\n * \n * @example\n * ```ts\n * // Called automatically in loadScene to setup the observer\n * this.setupOnAfterLoadingObserver();\n * ```\n */\n private setupOnAfterLoadingObserver(): void {\n this.onAfterLoadingSubscription = combineLatest([\n this.mapLoadCompleted$.pipe(filter(completed => completed === true)),\n this.playerIdReceived$.pipe(filter(received => received === true)),\n this.playersReceived$.pipe(filter(received => received === true)),\n this.eventsReceived$.pipe(filter(received => received === true))\n ]).pipe(\n take(1), // Only execute once when all conditions are met\n switchMap(() => {\n // Call the hook and return the observable\n return this.hooks.callHooks(\"client-sceneMap-onAfterLoading\", this.sceneMap);\n })\n ).subscribe();\n }\n\n /**\n * Clear client prediction states for cleanup\n * \n * Removes old prediction states and input history to prevent memory leaks.\n * Should be called when changing maps or disconnecting.\n * \n * @example\n * ```ts\n * // Clear prediction states when changing maps\n * engine.clearClientPredictionStates();\n * ```\n */\n clearClientPredictionStates() {\n this.initializePredictionController();\n this.frameOffset = 0;\n this.inputFrameCounter = 0;\n }\n\n /**\n * Trigger a flash animation on a sprite\n * \n * This method allows you to trigger a flash effect on any sprite from client-side code.\n * The flash can be configured with various options including type (alpha, tint, or both),\n * duration, cycles, and color.\n * \n * ## Design\n * \n * The flash is applied directly to the sprite object using its flash trigger.\n * This is useful for client-side visual feedback, UI interactions, or local effects\n * that don't need to be synchronized with the server.\n * \n * @param spriteId - The ID of the sprite to flash. If not provided, flashes the current player\n * @param options - Flash configuration options\n * @param options.type - Type of flash effect: 'alpha' (opacity), 'tint' (color), or 'both' (default: 'alpha')\n * @param options.duration - Duration of the flash animation in milliseconds (default: 300)\n * @param options.cycles - Number of flash cycles (flash on/off) (default: 1)\n * @param options.alpha - Alpha value when flashing, from 0 to 1 (default: 0.3)\n * @param options.tint - Tint color when flashing as hex value or color name (default: 0xffffff - white)\n * \n * @example\n * ```ts\n * // Flash the current player with default settings\n * engine.flash();\n * \n * // Flash a specific sprite with red tint\n * engine.flash('sprite-id', { type: 'tint', tint: 0xff0000 });\n * \n * // Flash with both alpha and tint for dramatic effect\n * engine.flash(undefined, { \n * type: 'both', \n * alpha: 0.5, \n * tint: 0xff0000,\n * duration: 200,\n * cycles: 2\n * });\n * \n * // Quick damage flash on current player\n * engine.flash(undefined, { \n * type: 'tint', \n * tint: 'red', \n * duration: 150,\n * cycles: 1\n * });\n * ```\n */\n flash(\n spriteId?: string,\n options?: {\n type?: 'alpha' | 'tint' | 'both';\n duration?: number;\n cycles?: number;\n alpha?: number;\n tint?: number | string;\n }\n ): void {\n const targetId = spriteId || this.playerId;\n if (!targetId) return;\n\n const sprite = this.sceneMap.getObjectById(targetId);\n if (sprite && typeof sprite.flash === 'function') {\n sprite.flash(options);\n }\n }\n\n private applyServerAck(ack: { frame: number; serverTick?: number; x?: number; y?: number; direction?: Direction }) {\n if (this.predictionEnabled && this.prediction) {\n this.prediction.applyServerAck({\n frame: ack.frame,\n serverTick: ack.serverTick,\n state:\n typeof ack.x === \"number\" && typeof ack.y === \"number\"\n ? { x: ack.x, y: ack.y, direction: ack.direction }\n : undefined,\n });\n return;\n }\n\n if (typeof ack.x !== \"number\" || typeof ack.y !== \"number\") {\n return;\n }\n const player = this.getCurrentPlayer();\n const myId = this.playerIdSignal();\n if (!player || !myId) {\n return;\n }\n const hitbox = typeof player.hitbox === \"function\" ? player.hitbox() : player.hitbox;\n const width = hitbox?.w ?? 0;\n const height = hitbox?.h ?? 0;\n const updated = this.sceneMap.updateHitbox(myId, ack.x, ack.y, width, height);\n if (!updated) {\n this.sceneMap.setBodyPosition(myId, ack.x, ack.y, \"top-left\");\n }\n player.x.set(Math.round(ack.x));\n player.y.set(Math.round(ack.y));\n if (ack.direction) {\n player.changeDirection(ack.direction);\n }\n }\n\n /**\n * Replay unacknowledged inputs from a given frame to resimulate client prediction\n * after applying server authority at a certain frame.\n * \n * @param startFrame - The last server-acknowledged frame\n * \n * @example\n * ```ts\n * // After applying a server correction at frame N\n * this.replayUnackedInputsFromFrame(N);\n * ```\n */\n private async replayUnackedInputsFromFrame(_startFrame: number): Promise<void> {\n // Prediction controller handles replay internally. Kept for backwards compatibility.\n }\n\n /**\n * Clear all client resources and reset state\n * \n * This method should be called to clean up all client-side resources when\n * shutting down or resetting the client engine. It:\n * - Destroys the PIXI renderer\n * - Stops all sounds\n * - Cleans up subscriptions and event listeners\n * - Resets scene map\n * - Stops ping/pong interval\n * - Clears prediction states\n * \n * ## Design\n * \n * This method is used primarily in testing environments to ensure clean\n * state between tests. In production, the client engine typically persists\n * for the lifetime of the application.\n * \n * @example\n * ```ts\n * // In test cleanup\n * afterEach(() => {\n * clientEngine.clear();\n * });\n * ```\n */\n clear(): void {\n try {\n // First, unsubscribe from all tick subscriptions to stop rendering attempts\n for (const subscription of this.tickSubscriptions) {\n if (subscription && typeof subscription.unsubscribe === 'function') {\n subscription.unsubscribe();\n }\n }\n this.tickSubscriptions = [];\n\n // Stop ping/pong interval\n if (this.pingInterval) {\n clearInterval(this.pingInterval);\n this.pingInterval = null;\n }\n\n // Clean up onAfterLoading subscription\n if (this.onAfterLoadingSubscription && typeof this.onAfterLoadingSubscription.unsubscribe === 'function') {\n this.onAfterLoadingSubscription.unsubscribe();\n this.onAfterLoadingSubscription = undefined;\n }\n\n // Clean up canvasElement (CanvasEngine) BEFORE destroying PIXI app\n // This prevents CanvasEngine from trying to render after PIXI is destroyed\n // CanvasEngine manages its own render loop which could try to access PIXI after destruction\n if (this.canvasElement) {\n try {\n // Try to stop or cleanup canvasElement if it has cleanup methods\n if (typeof (this.canvasElement as any).destroy === 'function') {\n (this.canvasElement as any).destroy();\n }\n // Clear the reference\n this.canvasElement = undefined;\n } catch (error) {\n // Ignore errors during canvasElement cleanup\n }\n }\n\n // Reset scene map if it exists (this should stop any ongoing animations/renders)\n if (this.sceneMap && typeof (this.sceneMap as any).reset === 'function') {\n (this.sceneMap as any).reset();\n }\n\n // Stop all sounds\n this.stopAllSounds();\n\n // Remove resize event listener\n if (this.resizeHandler && typeof window !== 'undefined') {\n window.removeEventListener('resize', this.resizeHandler);\n this.resizeHandler = undefined;\n }\n\n // Destroy PIXI app and renderer if they exist\n // Destroy the app first, which will destroy the renderer\n // Store renderer reference before destroying app (since app.destroy() will destroy the renderer)\n const rendererStillExists = this.renderer && typeof this.renderer.destroy === 'function';\n \n if (this.canvasApp && typeof this.canvasApp.destroy === 'function') {\n try {\n // Stop the ticker first to prevent any render calls during destruction\n if (this.canvasApp.ticker) {\n if (typeof this.canvasApp.ticker.stop === 'function') {\n this.canvasApp.ticker.stop();\n }\n // Also remove all listeners from ticker to prevent callbacks\n if (typeof this.canvasApp.ticker.removeAll === 'function') {\n this.canvasApp.ticker.removeAll();\n }\n }\n \n // Stop the renderer's ticker if it exists separately\n if (this.renderer && (this.renderer as any).ticker) {\n if (typeof (this.renderer as any).ticker.stop === 'function') {\n (this.renderer as any).ticker.stop();\n }\n if (typeof (this.renderer as any).ticker.removeAll === 'function') {\n (this.renderer as any).ticker.removeAll();\n }\n }\n \n // Remove the canvas from DOM before destroying to prevent render attempts\n if (this.canvasApp.canvas && this.canvasApp.canvas.parentNode) {\n this.canvasApp.canvas.parentNode.removeChild(this.canvasApp.canvas);\n }\n \n // Destroy with minimal options to avoid issues\n // Don't pass options that might trigger additional cleanup that could fail\n this.canvasApp.destroy(true);\n } catch (error) {\n // Ignore errors during destruction\n }\n this.canvasApp = undefined;\n // canvasApp.destroy() already destroyed the renderer, so just null it\n this.renderer = null as any;\n } else if (rendererStillExists) {\n // Fallback: destroy renderer directly only if app doesn't exist or wasn't destroyed\n try {\n // Stop the renderer's ticker if it has one\n if ((this.renderer as any).ticker) {\n if (typeof (this.renderer as any).ticker.stop === 'function') {\n (this.renderer as any).ticker.stop();\n }\n if (typeof (this.renderer as any).ticker.removeAll === 'function') {\n (this.renderer as any).ticker.removeAll();\n }\n }\n \n this.renderer.destroy(true);\n } catch (error) {\n // Ignore errors during destruction\n }\n this.renderer = null as any;\n }\n\n // Clean up prediction controller\n if (this.prediction) {\n // Prediction controller cleanup is handled internally when destroyed\n this.prediction = undefined;\n }\n\n // Reset signals\n this.playerIdSignal.set(null);\n this.cameraFollowTargetId.set(null);\n this.spriteComponentsBehind.set([]);\n this.spriteComponentsInFront.set([]);\n \n // Clear maps and arrays\n this.spritesheets.clear();\n this.sounds.clear();\n this.componentAnimations = [];\n this.particleSettings.emitters = [];\n\n // Reset state\n this.stopProcessingInput = false;\n this.lastInputTime = 0;\n this.inputFrameCounter = 0;\n this.frameOffset = 0;\n this.rtt = 0;\n\n // Reset behavior subjects\n this.mapLoadCompleted$.next(false);\n this.playerIdReceived$.next(false);\n this.playersReceived$.next(false);\n this.eventsReceived$.next(false);\n } catch (error) {\n console.warn('Error during client engine cleanup:', error);\n }\n }\n}\n"],"names":["Canvas","componentAnimation"],"mappings":";;;;;;;;;;;;;;;;;AAuBO,MAAM,eAAA,CAAyB;AAAA,EAyDpC,YAAmB,OAAA,EAAS;AAAT,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AAhDnB,IAAA,IAAA,CAAA,mBAAA,GAAsB,KAAA;AACtB,IAAA,IAAA,CAAA,KAAA,GAAQ,OAAO,MAAM,CAAA;AACrB,IAAA,IAAA,CAAA,MAAA,GAAS,OAAO,MAAM,CAAA;AACtB,IAAA,IAAA,CAAA,YAAA,uBAAqC,GAAA,EAAI;AACzC,IAAA,IAAA,CAAA,MAAA,uBAA+B,GAAA,EAAI;AACnC,IAAA,IAAA,CAAA,mBAAA,GAA6B,EAAC;AAG9B,IAAA,IAAA,CAAA,gBAAA,GAEI;AAAA,MACA,UAAU;AAAC,KACb;AAKF,IAAA,IAAA,CAAA,cAAA,GAAiB,OAAsB,IAAI,CAAA;AAC3C,IAAA,IAAA,CAAA,sBAAA,GAAyB,MAAA,CAAc,EAAE,CAAA;AACzC,IAAA,IAAA,CAAA,uBAAA,GAA0B,MAAA,CAAc,EAAE,CAAA;AAE1C;AAAA,IAAA,IAAA,CAAA,oBAAA,GAAuB,OAAsB,IAAI,CAAA;AAEjD;AAAA,IAAA,IAAA,CAAA,eAAA,GAAkB,OAAA,EAAQ;AAE1B,IAAA,IAAA,CAAA,aAAA,GAAgB,OAAO,MAAS,CAAA;AAEhC,IAAA,IAAA,CAAQ,iBAAA,GAAoB,KAAA;AAE5B,IAAA,IAAA,CAAiB,2BAAA,GAA8B,EAAA;AAC/C,IAAA,IAAA,CAAQ,iBAAA,GAAoB,CAAA;AAC5B,IAAA,IAAA,CAAQ,WAAA,GAAc,CAAA;AAEtB;AAAA,IAAA,IAAA,CAAQ,GAAA,GAAc,CAAA;AACtB;AAAA,IAAA,IAAA,CAAQ,YAAA,GAAoB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AClC,MAAA,IAAA,CAAK,sBAAA,CAAuB,GAAA,CAAI,EAAE,CAAA;AAClC,MAAA,IAAA,CAAK,uBAAA,CAAwB,GAAA,CAAI,EAAE,CAAA;AAGnC,MAAA,IAAA,CAAK,aAAa,KAAA,EAAM;AACxB,MAAA,IAAA,CAAK,OAAO,KAAA,EAAM;AAClB,MAAA,IAAA,CAAK,sBAAsB,EAAC;AAC5B,MAAA,IAAA,CAAK,gBAAA,CAAiB,WAAW,EAAC;AAGlC,MAAA,IAAA,CAAK,mBAAA,GAAsB,KAAA;AAC3B,MAAA,IAAA,CAAK,aAAA,GAAgB,CAAA;AACrB,MAAA,IAAA,CAAK,iBAAA,GAAoB,CAAA;AACzB,MAAA,IAAA,CAAK,WAAA,GAAc,CAAA;AACnB,MAAA,IAAA,CAAK,GAAA,GAAM,CAAA;AAGX,MAAA,IAAA,CAAK,iBAAA,CAAkB,KAAK,KAAK,CAAA;AACjC,MAAA,IAAA,CAAK,iBAAA,CAAkB,KAAK,KAAK,CAAA;AACjC,MAAA,IAAA,CAAK,gBAAA,CAAiB,KAAK,KAAK,CAAA;AAChC,MAAA,IAAA,CAAK,eAAA,CAAgB,KAAK,KAAK,CAAA;AAAA,IACjC,SAAS,KAAA,EAAO;AACd,MAAA,OAAA,CAAQ,IAAA,CAAK,uCAAuC,KAAK,CAAA;AAAA,IAC3D;AAAA,EACF;AACF;;;;"}
package/dist/Sound.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Howler } from 'canvasengine';
2
2
 
3
- const SOUND_METADATA_KEY = Symbol("rpgjs:sound");
3
+ const SOUND_METADATA_KEY = /* @__PURE__ */ Symbol("rpgjs:sound");
4
4
  function Sound(options) {
5
5
  return function(constructor) {
6
6
  const metadata = {
package/dist/Sound.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Sound.js","sources":["../src/Sound.ts"],"sourcesContent":["import { Howler } from 'canvasengine';\nimport { RpgClientEngine } from './RpgClientEngine';\nimport { inject } from './core/inject';\n\n/**\n * Sound decorator options\n * \n * Defines the configuration for a sound that can be played in the game.\n * The sound can be a single file or multiple files (for different formats).\n * \n * @interface SoundOptions\n */\nexport interface SoundOptions {\n /**\n * Sound identifier. Used to retrieve the sound later with RpgSound.get()\n * \n * @type {string}\n */\n id?: string;\n\n /**\n * Single sound file path. Use require() to wrap the path.\n * \n * @type {string}\n * @example\n * sound: require('./assets/sound.ogg')\n */\n sound?: string;\n\n /**\n * Multiple sounds with different IDs. The key is the sound ID and the value is the file path.\n * Use require() to wrap each path.\n * \n * @type {{ [id: string]: string }}\n * @example\n * sounds: {\n * hero: require('./assets/hero.ogg'),\n * monster: require('./assets/monster.ogg')\n * }\n */\n sounds?: { [id: string]: string };\n\n /**\n * Whether the sound should loop when it finishes playing.\n * \n * @type {boolean}\n * @default false\n */\n loop?: boolean;\n\n /**\n * Volume level (0.0 to 1.0).\n * \n * @type {number}\n * @default 1.0\n */\n volume?: number;\n}\n\n/**\n * Metadata stored on the class decorated with @Sound\n * \n * @interface SoundMetadata\n */\ninterface SoundMetadata {\n id?: string;\n sound?: string;\n sounds?: { [id: string]: string };\n loop?: boolean;\n volume?: number;\n}\n\nconst SOUND_METADATA_KEY = Symbol('rpgjs:sound');\n\n/**\n * Sound decorator\n * \n * Decorates a class to define a sound configuration. The decorated class can be\n * added to the RpgClient module configuration, and the sound will be automatically\n * registered and available through RpgSound.get().\n * \n * ## Design\n * \n * The decorator stores metadata on the class that is later used by the module loader\n * to register sounds with the engine. The sound is created using Howler.js for\n * advanced audio features like looping, volume control, and cross-browser compatibility.\n * \n * @param options - Sound configuration options\n * \n * @example\n * ```ts\n * import { Sound } from '@rpgjs/client'\n * \n * @Sound({\n * id: 'town-music',\n * sound: require('./sound/town.ogg'),\n * loop: true,\n * volume: 0.5\n * })\n * export class TownMusic {}\n * \n * // Multiple sounds in one class\n * @Sound({\n * sounds: {\n * hero: require('./assets/hero.ogg'),\n * monster: require('./assets/monster.ogg')\n * },\n * loop: true\n * })\n * export class CharacterSounds {}\n * ```\n */\nexport function Sound(options: SoundOptions) {\n return function <T extends { new (...args: any[]): {} }>(constructor: T) {\n const metadata: SoundMetadata = {\n id: options.id,\n sound: options.sound,\n sounds: options.sounds,\n loop: options.loop,\n volume: options.volume,\n };\n\n // Store metadata on the class\n (constructor as any)[SOUND_METADATA_KEY] = metadata;\n\n return constructor;\n };\n}\n\n/**\n * Get sound metadata from a decorated class\n * \n * @param soundClass - The class decorated with @Sound\n * @returns The sound metadata or undefined\n */\nexport function getSoundMetadata(soundClass: any): SoundMetadata | undefined {\n return (soundClass as any)[SOUND_METADATA_KEY];\n}\n\n/**\n * RpgSound class\n * \n * Provides a unified API to manage sounds in the game. Uses Howler.js internally\n * for advanced audio features. Sounds can be retrieved by ID and controlled\n * using Howler.js methods.\n * \n * ## Design\n * \n * RpgSound acts as a facade over Howler.js, providing easy access to sounds\n * registered in the engine. It supports both individual sound control and\n * global sound management (volume, mute, etc.).\n * \n * @example\n * ```ts\n * import { RpgSound } from '@rpgjs/client'\n * \n * // Play a sound\n * RpgSound.get('town-music').play()\n * \n * // Control volume\n * RpgSound.get('town-music').volume(0.5)\n * \n * // Stop a sound\n * RpgSound.get('town-music').stop()\n * \n * // Global volume control\n * RpgSound.global.volume(0.2)\n * ```\n */\nexport class RpgSound {\n private static engine: RpgClientEngine | null = null;\n\n /**\n * Initialize RpgSound with the engine instance\n * \n * This is called automatically by the engine during initialization.\n * \n * @param engine - The RpgClientEngine instance\n */\n static init(engine: RpgClientEngine): void {\n RpgSound.engine = engine;\n }\n\n /**\n * Get a sound by its ID\n * \n * Retrieves a Howler sound instance from the engine's sound cache.\n * The sound must be registered beforehand (via @Sound decorator or manually).\n * \n * @param id - The sound identifier\n * @returns The Howler sound instance, or undefined if not found\n * \n * @example\n * ```ts\n * // Get and play a sound\n * const sound = RpgSound.get('town-music');\n * if (sound) {\n * sound.play();\n * }\n * \n * // Chain methods\n * RpgSound.get('battle-theme')?.volume(0.8).play();\n * ```\n */\n static get(id: string): any {\n if (!RpgSound.engine) {\n console.warn('RpgSound not initialized. Make sure the engine has started.');\n return undefined;\n }\n\n const sound = RpgSound.engine.sounds.get(id);\n if (!sound) {\n console.warn(`Sound with id \"${id}\" not found`);\n return undefined;\n }\n\n // If the sound is a Howler instance, return it directly\n if (sound && typeof sound.play === 'function') {\n return sound;\n }\n\n // If the sound has a src property, try to create a Howler instance\n if (sound && sound.src) {\n // This should have been handled during addSound, but just in case\n return sound;\n }\n\n return sound;\n }\n\n /**\n * Global Howler instance for managing all sounds\n * \n * Provides access to Howler.js global methods for controlling all sounds\n * at once (volume, mute, etc.).\n * \n * @example\n * ```ts\n * // Set global volume to 20%\n * RpgSound.global.volume(0.2)\n * \n * // Mute all sounds\n * RpgSound.global.mute(true)\n * \n * // Unmute all sounds\n * RpgSound.global.mute(false)\n * ```\n */\n static get global(): typeof Howler {\n return Howler;\n }\n}\n\n"],"names":[],"mappings":";;AAwEA,MAAM,kBAAA,GAAqB,OAAO,aAAa,CAAA;AAwCxC,SAAS,MAAM,OAAA,EAAuB;AAC3C,EAAA,OAAO,SAAkD,WAAA,EAAgB;AACvE,IAAA,MAAM,QAAA,GAA0B;AAAA,MAC9B,IAAI,OAAA,CAAQ,EAAA;AAAA,MACZ,OAAO,OAAA,CAAQ,KAAA;AAAA,MACf,QAAQ,OAAA,CAAQ,MAAA;AAAA,MAChB,MAAM,OAAA,CAAQ,IAAA;AAAA,MACd,QAAQ,OAAA,CAAQ;AAAA,KAClB;AAGA,IAAC,WAAA,CAAoB,kBAAkB,CAAA,GAAI,QAAA;AAE3C,IAAA,OAAO,WAAA;AAAA,EACT,CAAA;AACF;AAQO,SAAS,iBAAiB,UAAA,EAA4C;AAC3E,EAAA,OAAQ,WAAmB,kBAAkB,CAAA;AAC/C;AAgCO,MAAM,QAAA,CAAS;AAAA,EACpB;AAAA,IAAA,IAAA,CAAe,MAAA,GAAiC,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAShD,OAAO,KAAK,MAAA,EAA+B;AACzC,IAAA,QAAA,CAAS,MAAA,GAAS,MAAA;AAAA,EACpB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAuBA,OAAO,IAAI,EAAA,EAAiB;AAC1B,IAAA,IAAI,CAAC,SAAS,MAAA,EAAQ;AACpB,MAAA,OAAA,CAAQ,KAAK,6DAA6D,CAAA;AAC1E,MAAA,OAAO,MAAA;AAAA,IACT;AAEA,IAAA,MAAM,KAAA,GAAQ,QAAA,CAAS,MAAA,CAAO,MAAA,CAAO,IAAI,EAAE,CAAA;AAC3C,IAAA,IAAI,CAAC,KAAA,EAAO;AACV,MAAA,OAAA,CAAQ,IAAA,CAAK,CAAA,eAAA,EAAkB,EAAE,CAAA,WAAA,CAAa,CAAA;AAC9C,MAAA,OAAO,MAAA;AAAA,IACT;AAGA,IAAA,IAAI,KAAA,IAAS,OAAO,KAAA,CAAM,IAAA,KAAS,UAAA,EAAY;AAC7C,MAAA,OAAO,KAAA;AAAA,IACT;AAGA,IAAA,IAAI,KAAA,IAAS,MAAM,GAAA,EAAK;AAEtB,MAAA,OAAO,KAAA;AAAA,IACT;AAEA,IAAA,OAAO,KAAA;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoBA,WAAW,MAAA,GAAwB;AACjC,IAAA,OAAO,MAAA;AAAA,EACT;AACF;;;;"}
1
+ {"version":3,"file":"Sound.js","sources":["../src/Sound.ts"],"sourcesContent":["import { Howler } from 'canvasengine';\nimport { RpgClientEngine } from './RpgClientEngine';\nimport { inject } from './core/inject';\n\n/**\n * Sound decorator options\n * \n * Defines the configuration for a sound that can be played in the game.\n * The sound can be a single file or multiple files (for different formats).\n * \n * @interface SoundOptions\n */\nexport interface SoundOptions {\n /**\n * Sound identifier. Used to retrieve the sound later with RpgSound.get()\n * \n * @type {string}\n */\n id?: string;\n\n /**\n * Single sound file path. Use require() to wrap the path.\n * \n * @type {string}\n * @example\n * sound: require('./assets/sound.ogg')\n */\n sound?: string;\n\n /**\n * Multiple sounds with different IDs. The key is the sound ID and the value is the file path.\n * Use require() to wrap each path.\n * \n * @type {{ [id: string]: string }}\n * @example\n * sounds: {\n * hero: require('./assets/hero.ogg'),\n * monster: require('./assets/monster.ogg')\n * }\n */\n sounds?: { [id: string]: string };\n\n /**\n * Whether the sound should loop when it finishes playing.\n * \n * @type {boolean}\n * @default false\n */\n loop?: boolean;\n\n /**\n * Volume level (0.0 to 1.0).\n * \n * @type {number}\n * @default 1.0\n */\n volume?: number;\n}\n\n/**\n * Metadata stored on the class decorated with @Sound\n * \n * @interface SoundMetadata\n */\ninterface SoundMetadata {\n id?: string;\n sound?: string;\n sounds?: { [id: string]: string };\n loop?: boolean;\n volume?: number;\n}\n\nconst SOUND_METADATA_KEY = Symbol('rpgjs:sound');\n\n/**\n * Sound decorator\n * \n * Decorates a class to define a sound configuration. The decorated class can be\n * added to the RpgClient module configuration, and the sound will be automatically\n * registered and available through RpgSound.get().\n * \n * ## Design\n * \n * The decorator stores metadata on the class that is later used by the module loader\n * to register sounds with the engine. The sound is created using Howler.js for\n * advanced audio features like looping, volume control, and cross-browser compatibility.\n * \n * @param options - Sound configuration options\n * \n * @example\n * ```ts\n * import { Sound } from '@rpgjs/client'\n * \n * @Sound({\n * id: 'town-music',\n * sound: require('./sound/town.ogg'),\n * loop: true,\n * volume: 0.5\n * })\n * export class TownMusic {}\n * \n * // Multiple sounds in one class\n * @Sound({\n * sounds: {\n * hero: require('./assets/hero.ogg'),\n * monster: require('./assets/monster.ogg')\n * },\n * loop: true\n * })\n * export class CharacterSounds {}\n * ```\n */\nexport function Sound(options: SoundOptions) {\n return function <T extends { new (...args: any[]): {} }>(constructor: T) {\n const metadata: SoundMetadata = {\n id: options.id,\n sound: options.sound,\n sounds: options.sounds,\n loop: options.loop,\n volume: options.volume,\n };\n\n // Store metadata on the class\n (constructor as any)[SOUND_METADATA_KEY] = metadata;\n\n return constructor;\n };\n}\n\n/**\n * Get sound metadata from a decorated class\n * \n * @param soundClass - The class decorated with @Sound\n * @returns The sound metadata or undefined\n */\nexport function getSoundMetadata(soundClass: any): SoundMetadata | undefined {\n return (soundClass as any)[SOUND_METADATA_KEY];\n}\n\n/**\n * RpgSound class\n * \n * Provides a unified API to manage sounds in the game. Uses Howler.js internally\n * for advanced audio features. Sounds can be retrieved by ID and controlled\n * using Howler.js methods.\n * \n * ## Design\n * \n * RpgSound acts as a facade over Howler.js, providing easy access to sounds\n * registered in the engine. It supports both individual sound control and\n * global sound management (volume, mute, etc.).\n * \n * @example\n * ```ts\n * import { RpgSound } from '@rpgjs/client'\n * \n * // Play a sound\n * RpgSound.get('town-music').play()\n * \n * // Control volume\n * RpgSound.get('town-music').volume(0.5)\n * \n * // Stop a sound\n * RpgSound.get('town-music').stop()\n * \n * // Global volume control\n * RpgSound.global.volume(0.2)\n * ```\n */\nexport class RpgSound {\n private static engine: RpgClientEngine | null = null;\n\n /**\n * Initialize RpgSound with the engine instance\n * \n * This is called automatically by the engine during initialization.\n * \n * @param engine - The RpgClientEngine instance\n */\n static init(engine: RpgClientEngine): void {\n RpgSound.engine = engine;\n }\n\n /**\n * Get a sound by its ID\n * \n * Retrieves a Howler sound instance from the engine's sound cache.\n * The sound must be registered beforehand (via @Sound decorator or manually).\n * \n * @param id - The sound identifier\n * @returns The Howler sound instance, or undefined if not found\n * \n * @example\n * ```ts\n * // Get and play a sound\n * const sound = RpgSound.get('town-music');\n * if (sound) {\n * sound.play();\n * }\n * \n * // Chain methods\n * RpgSound.get('battle-theme')?.volume(0.8).play();\n * ```\n */\n static get(id: string): any {\n if (!RpgSound.engine) {\n console.warn('RpgSound not initialized. Make sure the engine has started.');\n return undefined;\n }\n\n const sound = RpgSound.engine.sounds.get(id);\n if (!sound) {\n console.warn(`Sound with id \"${id}\" not found`);\n return undefined;\n }\n\n // If the sound is a Howler instance, return it directly\n if (sound && typeof sound.play === 'function') {\n return sound;\n }\n\n // If the sound has a src property, try to create a Howler instance\n if (sound && sound.src) {\n // This should have been handled during addSound, but just in case\n return sound;\n }\n\n return sound;\n }\n\n /**\n * Global Howler instance for managing all sounds\n * \n * Provides access to Howler.js global methods for controlling all sounds\n * at once (volume, mute, etc.).\n * \n * @example\n * ```ts\n * // Set global volume to 20%\n * RpgSound.global.volume(0.2)\n * \n * // Mute all sounds\n * RpgSound.global.mute(true)\n * \n * // Unmute all sounds\n * RpgSound.global.mute(false)\n * ```\n */\n static get global(): typeof Howler {\n return Howler;\n }\n}\n\n"],"names":[],"mappings":";;AAwEA,MAAM,kBAAA,0BAA4B,aAAa,CAAA;AAwCxC,SAAS,MAAM,OAAA,EAAuB;AAC3C,EAAA,OAAO,SAAkD,WAAA,EAAgB;AACvE,IAAA,MAAM,QAAA,GAA0B;AAAA,MAC9B,IAAI,OAAA,CAAQ,EAAA;AAAA,MACZ,OAAO,OAAA,CAAQ,KAAA;AAAA,MACf,QAAQ,OAAA,CAAQ,MAAA;AAAA,MAChB,MAAM,OAAA,CAAQ,IAAA;AAAA,MACd,QAAQ,OAAA,CAAQ;AAAA,KAClB;AAGA,IAAC,WAAA,CAAoB,kBAAkB,CAAA,GAAI,QAAA;AAE3C,IAAA,OAAO,WAAA;AAAA,EACT,CAAA;AACF;AAQO,SAAS,iBAAiB,UAAA,EAA4C;AAC3E,EAAA,OAAQ,WAAmB,kBAAkB,CAAA;AAC/C;AAgCO,MAAM,QAAA,CAAS;AAAA,EACpB;AAAA,IAAA,IAAA,CAAe,MAAA,GAAiC,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAShD,OAAO,KAAK,MAAA,EAA+B;AACzC,IAAA,QAAA,CAAS,MAAA,GAAS,MAAA;AAAA,EACpB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAuBA,OAAO,IAAI,EAAA,EAAiB;AAC1B,IAAA,IAAI,CAAC,SAAS,MAAA,EAAQ;AACpB,MAAA,OAAA,CAAQ,KAAK,6DAA6D,CAAA;AAC1E,MAAA,OAAO,MAAA;AAAA,IACT;AAEA,IAAA,MAAM,KAAA,GAAQ,QAAA,CAAS,MAAA,CAAO,MAAA,CAAO,IAAI,EAAE,CAAA;AAC3C,IAAA,IAAI,CAAC,KAAA,EAAO;AACV,MAAA,OAAA,CAAQ,IAAA,CAAK,CAAA,eAAA,EAAkB,EAAE,CAAA,WAAA,CAAa,CAAA;AAC9C,MAAA,OAAO,MAAA;AAAA,IACT;AAGA,IAAA,IAAI,KAAA,IAAS,OAAO,KAAA,CAAM,IAAA,KAAS,UAAA,EAAY;AAC7C,MAAA,OAAO,KAAA;AAAA,IACT;AAGA,IAAA,IAAI,KAAA,IAAS,MAAM,GAAA,EAAK;AAEtB,MAAA,OAAO,KAAA;AAAA,IACT;AAEA,IAAA,OAAO,KAAA;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoBA,WAAW,MAAA,GAAwB;AACjC,IAAA,OAAO,MAAA;AAAA,EACT;AACF;;;;"}
@@ -1,11 +1,11 @@
1
1
  import { useProps, useDefineProps, computed, h, Container, Rect } from 'canvasengine';
2
2
  import { RpgClientEngine } from '../../RpgClientEngine.js';
3
- import '../../node_modules/.pnpm/@signe_room@2.7.2/node_modules/@signe/room/dist/index.js';
3
+ import '../../node_modules/.pnpm/@signe_room@2.7.3/node_modules/@signe/room/dist/index.js';
4
4
  import '@rpgjs/common';
5
- import '../../node_modules/.pnpm/@signe_di@2.7.2/node_modules/@signe/di/dist/index.js';
5
+ import '../../node_modules/.pnpm/@signe_di@2.7.3/node_modules/@signe/di/dist/index.js';
6
6
  import { inject } from '../../core/inject.js';
7
7
  import 'rxjs';
8
- import '../../node_modules/.pnpm/@signe_sync@2.7.2/node_modules/@signe/sync/dist/client/index.js';
8
+ import '../../node_modules/.pnpm/@signe_sync@2.7.3/node_modules/@signe/sync/dist/client/index.js';
9
9
  import '../../Sound.js';
10
10
  import 'pixi.js';
11
11
  import '@canvasengine/presets';
@@ -1,4 +1,4 @@
1
- import { inject as inject$1 } from '../node_modules/.pnpm/@signe_di@2.7.2/node_modules/@signe/di/dist/index.js';
1
+ import { inject as inject$1 } from '../node_modules/.pnpm/@signe_di@2.7.3/node_modules/@signe/di/dist/index.js';
2
2
 
3
3
  let context = null;
4
4
  function inject(service, _context) {
@@ -1,4 +1,4 @@
1
- import { Context, injector, inject } from '../node_modules/.pnpm/@signe_di@2.7.2/node_modules/@signe/di/dist/index.js';
1
+ import { Context, injector, inject } from '../node_modules/.pnpm/@signe_di@2.7.3/node_modules/@signe/di/dist/index.js';
2
2
  import { RpgClientEngine } from '../RpgClientEngine.js';
3
3
  import { setInject } from './inject.js';
4
4
 
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@ export { default as EventLayerComponent } from './components/scenes/event-layer.
16
16
  export { default as CharacterComponent } from './components/character.ce.js';
17
17
  export { RpgSound, Sound, getSoundMetadata } from './Sound.js';
18
18
  export { RpgResource } from './Resource.js';
19
- export { Context } from './node_modules/.pnpm/@signe_di@2.7.2/node_modules/@signe/di/dist/index.js';
19
+ export { Context } from './node_modules/.pnpm/@signe_di@2.7.3/node_modules/@signe/di/dist/index.js';
20
20
  export { Input, KeyboardControls } from 'canvasengine';
21
21
  export { Control } from './services/keyboardControls.js';
22
22
  export { RpgClientObject } from './Game/Object.js';
package/dist/module.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { provideModules, findModules } from '@rpgjs/common';
2
- import { inject } from './node_modules/.pnpm/@signe_di@2.7.2/node_modules/@signe/di/dist/index.js';
2
+ import { inject } from './node_modules/.pnpm/@signe_di@2.7.3/node_modules/@signe/di/dist/index.js';
3
3
  import { RpgGui } from './Gui/Gui.js';
4
4
  import { getSoundMetadata } from './Sound.js';
5
5