@rpgjs/client 5.0.0-alpha.9 → 5.0.0-beta.10

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 (347) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/LICENSE +19 -0
  3. package/dist/Game/AnimationManager.d.ts +8 -0
  4. package/dist/Game/AnimationManager.js +35 -0
  5. package/dist/Game/AnimationManager.js.map +1 -0
  6. package/dist/Game/AnimationManager.spec.d.ts +1 -0
  7. package/dist/Game/Event.d.ts +1 -1
  8. package/dist/Game/Event.js +12 -0
  9. package/dist/Game/Event.js.map +1 -0
  10. package/dist/Game/Map.d.ts +31 -2
  11. package/dist/Game/Map.js +138 -0
  12. package/dist/Game/Map.js.map +1 -0
  13. package/dist/Game/Object.d.ts +189 -0
  14. package/dist/Game/Object.js +255 -0
  15. package/dist/Game/Object.js.map +1 -0
  16. package/dist/Game/Player.d.ts +1 -1
  17. package/dist/Game/Player.js +12 -0
  18. package/dist/Game/Player.js.map +1 -0
  19. package/dist/Gui/Gui.d.ts +192 -7
  20. package/dist/Gui/Gui.js +475 -0
  21. package/dist/Gui/Gui.js.map +1 -0
  22. package/dist/Gui/Gui.spec.d.ts +1 -0
  23. package/dist/Gui/NotificationManager.d.ts +23 -0
  24. package/dist/Gui/NotificationManager.js +49 -0
  25. package/dist/Gui/NotificationManager.js.map +1 -0
  26. package/dist/Resource.d.ts +97 -0
  27. package/dist/Resource.js +133 -0
  28. package/dist/Resource.js.map +1 -0
  29. package/dist/RpgClient.d.ts +295 -13
  30. package/dist/RpgClientEngine.d.ts +671 -15
  31. package/dist/RpgClientEngine.js +1442 -0
  32. package/dist/RpgClientEngine.js.map +1 -0
  33. package/dist/Sound.d.ts +199 -0
  34. package/dist/Sound.js +167 -0
  35. package/dist/Sound.js.map +1 -0
  36. package/dist/_virtual/_@oxc-project_runtime@0.130.0/helpers/decorate.js +9 -0
  37. package/dist/_virtual/_@oxc-project_runtime@0.130.0/helpers/decorateMetadata.js +6 -0
  38. package/dist/components/animations/animation.ce.js +23 -0
  39. package/dist/components/animations/animation.ce.js.map +1 -0
  40. package/dist/components/animations/hit.ce.js +64 -0
  41. package/dist/components/animations/hit.ce.js.map +1 -0
  42. package/dist/components/animations/index.d.ts +4 -0
  43. package/dist/components/animations/index.js +11 -0
  44. package/dist/components/animations/index.js.map +1 -0
  45. package/dist/components/character.ce.js +572 -0
  46. package/dist/components/character.ce.js.map +1 -0
  47. package/dist/components/dynamics/bar.ce.js +96 -0
  48. package/dist/components/dynamics/bar.ce.js.map +1 -0
  49. package/dist/components/dynamics/image.ce.js +23 -0
  50. package/dist/components/dynamics/image.ce.js.map +1 -0
  51. package/dist/components/dynamics/parse-value.d.ts +4 -0
  52. package/dist/components/dynamics/parse-value.js +63 -0
  53. package/dist/components/dynamics/parse-value.js.map +1 -0
  54. package/dist/components/dynamics/parse-value.spec.d.ts +1 -0
  55. package/dist/components/dynamics/shape-utils.d.ts +16 -0
  56. package/dist/components/dynamics/shape-utils.js +73 -0
  57. package/dist/components/dynamics/shape-utils.js.map +1 -0
  58. package/dist/components/dynamics/shape-utils.spec.d.ts +1 -0
  59. package/dist/components/dynamics/shape.ce.js +83 -0
  60. package/dist/components/dynamics/shape.ce.js.map +1 -0
  61. package/dist/components/dynamics/text.ce.js +50 -0
  62. package/dist/components/dynamics/text.ce.js.map +1 -0
  63. package/dist/components/gui/box.ce.js +26 -0
  64. package/dist/components/gui/box.ce.js.map +1 -0
  65. package/dist/components/gui/dialogbox/index.ce.js +198 -0
  66. package/dist/components/gui/dialogbox/index.ce.js.map +1 -0
  67. package/dist/components/gui/gameover.ce.js +169 -0
  68. package/dist/components/gui/gameover.ce.js.map +1 -0
  69. package/dist/components/gui/hud/hud.ce.js +83 -0
  70. package/dist/components/gui/hud/hud.ce.js.map +1 -0
  71. package/dist/components/gui/index.d.ts +15 -3
  72. package/dist/components/gui/index.js +14 -0
  73. package/dist/components/gui/menu/equip-menu.ce.js +427 -0
  74. package/dist/components/gui/menu/equip-menu.ce.js.map +1 -0
  75. package/dist/components/gui/menu/exit-menu.ce.js +55 -0
  76. package/dist/components/gui/menu/exit-menu.ce.js.map +1 -0
  77. package/dist/components/gui/menu/items-menu.ce.js +326 -0
  78. package/dist/components/gui/menu/items-menu.ce.js.map +1 -0
  79. package/dist/components/gui/menu/main-menu.ce.js +399 -0
  80. package/dist/components/gui/menu/main-menu.ce.js.map +1 -0
  81. package/dist/components/gui/menu/options-menu.ce.js +49 -0
  82. package/dist/components/gui/menu/options-menu.ce.js.map +1 -0
  83. package/dist/components/gui/menu/skills-menu.ce.js +102 -0
  84. package/dist/components/gui/menu/skills-menu.ce.js.map +1 -0
  85. package/dist/components/gui/mobile/index.d.ts +8 -0
  86. package/dist/components/gui/mobile/index.js +21 -0
  87. package/dist/components/gui/mobile/index.js.map +1 -0
  88. package/dist/components/gui/mobile/mobile.ce.js +79 -0
  89. package/dist/components/gui/mobile/mobile.ce.js.map +1 -0
  90. package/dist/components/gui/notification/notification.ce.js +62 -0
  91. package/dist/components/gui/notification/notification.ce.js.map +1 -0
  92. package/dist/components/gui/save-load.ce.js +211 -0
  93. package/dist/components/gui/save-load.ce.js.map +1 -0
  94. package/dist/components/gui/shop/shop.ce.js +614 -0
  95. package/dist/components/gui/shop/shop.ce.js.map +1 -0
  96. package/dist/components/gui/title-screen.ce.js +164 -0
  97. package/dist/components/gui/title-screen.ce.js.map +1 -0
  98. package/dist/components/index.d.ts +1 -0
  99. package/dist/components/index.js +4 -0
  100. package/dist/components/player-components-utils.d.ts +67 -0
  101. package/dist/components/player-components-utils.js +162 -0
  102. package/dist/components/player-components-utils.js.map +1 -0
  103. package/dist/components/player-components-utils.spec.d.ts +1 -0
  104. package/dist/components/player-components.ce.js +188 -0
  105. package/dist/components/player-components.ce.js.map +1 -0
  106. package/dist/components/prebuilt/hp-bar.ce.js +113 -0
  107. package/dist/components/prebuilt/hp-bar.ce.js.map +1 -0
  108. package/dist/components/prebuilt/index.d.ts +19 -0
  109. package/dist/components/prebuilt/index.js +2 -0
  110. package/dist/components/prebuilt/light-halo.ce.js +70 -0
  111. package/dist/components/prebuilt/light-halo.ce.js.map +1 -0
  112. package/dist/components/scenes/canvas.ce.js +196 -0
  113. package/dist/components/scenes/canvas.ce.js.map +1 -0
  114. package/dist/components/scenes/draw-map.ce.js +79 -0
  115. package/dist/components/scenes/draw-map.ce.js.map +1 -0
  116. package/dist/components/scenes/event-layer.ce.js +29 -0
  117. package/dist/components/scenes/event-layer.ce.js.map +1 -0
  118. package/dist/core/inject.js +18 -0
  119. package/dist/core/inject.js.map +1 -0
  120. package/dist/core/setup.js +16 -0
  121. package/dist/core/setup.js.map +1 -0
  122. package/dist/decorators/spritesheet.d.ts +1 -0
  123. package/dist/decorators/spritesheet.js +11 -0
  124. package/dist/decorators/spritesheet.js.map +1 -0
  125. package/dist/index.d.ts +16 -1
  126. package/dist/index.js +45 -14
  127. package/dist/module.d.ts +43 -4
  128. package/dist/module.js +179 -0
  129. package/dist/module.js.map +1 -0
  130. package/dist/node_modules/.pnpm/@signe_di@3.0.1/node_modules/@signe/di/dist/index.js +167 -0
  131. package/dist/node_modules/.pnpm/@signe_di@3.0.1/node_modules/@signe/di/dist/index.js.map +1 -0
  132. package/dist/node_modules/.pnpm/@signe_reactive@3.0.1/node_modules/@signe/reactive/dist/index.js +239 -0
  133. package/dist/node_modules/.pnpm/@signe_reactive@3.0.1/node_modules/@signe/reactive/dist/index.js.map +1 -0
  134. package/dist/node_modules/.pnpm/@signe_room@3.0.1/node_modules/@signe/room/dist/chunk-EUXUH3YW.js +13 -0
  135. package/dist/node_modules/.pnpm/@signe_room@3.0.1/node_modules/@signe/room/dist/chunk-EUXUH3YW.js.map +1 -0
  136. package/dist/node_modules/.pnpm/@signe_room@3.0.1/node_modules/@signe/room/dist/index.js +696 -0
  137. package/dist/node_modules/.pnpm/@signe_room@3.0.1/node_modules/@signe/room/dist/index.js.map +1 -0
  138. package/dist/node_modules/.pnpm/@signe_sync@3.0.1/node_modules/@signe/sync/dist/client/index.js +44 -0
  139. package/dist/node_modules/.pnpm/@signe_sync@3.0.1/node_modules/@signe/sync/dist/client/index.js.map +1 -0
  140. package/dist/node_modules/.pnpm/@signe_sync@3.0.1/node_modules/@signe/sync/dist/index.js +241 -0
  141. package/dist/node_modules/.pnpm/@signe_sync@3.0.1/node_modules/@signe/sync/dist/index.js.map +1 -0
  142. package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-HAC622V3.js +115 -0
  143. package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-HAC622V3.js.map +1 -0
  144. package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-S74YV6PU.js +401 -0
  145. package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-S74YV6PU.js.map +1 -0
  146. package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/index.js +2 -0
  147. package/dist/node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.js +3756 -0
  148. package/dist/node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.js.map +1 -0
  149. package/dist/presets/animation.d.ts +31 -0
  150. package/dist/presets/animation.js +39 -0
  151. package/dist/presets/animation.js.map +1 -0
  152. package/dist/presets/faceset.d.ts +30 -0
  153. package/dist/presets/faceset.js +51 -0
  154. package/dist/presets/faceset.js.map +1 -0
  155. package/dist/presets/icon.d.ts +20 -0
  156. package/dist/presets/icon.js +15 -0
  157. package/dist/presets/icon.js.map +1 -0
  158. package/dist/presets/index.d.ts +123 -0
  159. package/dist/presets/index.js +17 -0
  160. package/dist/presets/index.js.map +1 -0
  161. package/dist/presets/lpc.d.ts +89 -0
  162. package/dist/presets/lpc.js +98 -0
  163. package/dist/presets/lpc.js.map +1 -0
  164. package/dist/presets/rmspritesheet.js +42 -0
  165. package/dist/presets/rmspritesheet.js.map +1 -0
  166. package/dist/services/AbstractSocket.d.ts +9 -5
  167. package/dist/services/AbstractSocket.js +11 -0
  168. package/dist/services/AbstractSocket.js.map +1 -0
  169. package/dist/services/keyboardControls.d.ts +15 -0
  170. package/dist/services/keyboardControls.js +23 -0
  171. package/dist/services/keyboardControls.js.map +1 -0
  172. package/dist/services/loadMap.d.ts +6 -0
  173. package/dist/services/loadMap.js +123 -0
  174. package/dist/services/loadMap.js.map +1 -0
  175. package/dist/services/mmorpg.d.ts +21 -9
  176. package/dist/services/mmorpg.js +136 -0
  177. package/dist/services/mmorpg.js.map +1 -0
  178. package/dist/services/save.d.ts +19 -0
  179. package/dist/services/save.js +77 -0
  180. package/dist/services/save.js.map +1 -0
  181. package/dist/services/save.spec.d.ts +1 -0
  182. package/dist/services/standalone.d.ts +67 -7
  183. package/dist/services/standalone.js +168 -0
  184. package/dist/services/standalone.js.map +1 -0
  185. package/dist/utils/getEntityProp.d.ts +39 -0
  186. package/dist/utils/getEntityProp.js +53 -0
  187. package/dist/utils/getEntityProp.js.map +1 -0
  188. package/dist/utils/getEntityProp.spec.d.ts +1 -0
  189. package/dist/utils/readPropValue.d.ts +2 -0
  190. package/dist/utils/readPropValue.js +13 -0
  191. package/dist/utils/readPropValue.js.map +1 -0
  192. package/package.json +14 -11
  193. package/src/Game/AnimationManager.spec.ts +30 -0
  194. package/src/Game/AnimationManager.ts +33 -0
  195. package/src/Game/Event.ts +1 -1
  196. package/src/Game/Map.ts +184 -3
  197. package/src/Game/Object.ts +409 -14
  198. package/src/Game/Player.ts +1 -1
  199. package/src/Gui/Gui.spec.ts +273 -0
  200. package/src/Gui/Gui.ts +566 -23
  201. package/src/Gui/NotificationManager.ts +69 -0
  202. package/src/Resource.ts +149 -0
  203. package/src/RpgClient.ts +309 -14
  204. package/src/RpgClientEngine.ts +1790 -63
  205. package/src/Sound.ts +253 -0
  206. package/src/components/{effects → animations}/animation.ce +3 -6
  207. package/src/components/{effects → animations}/index.ts +1 -1
  208. package/src/components/character.ce +801 -59
  209. package/src/components/dynamics/bar.ce +87 -0
  210. package/src/components/dynamics/image.ce +20 -0
  211. package/src/components/dynamics/parse-value.spec.ts +83 -0
  212. package/src/components/dynamics/parse-value.ts +154 -0
  213. package/src/components/dynamics/shape-utils.spec.ts +46 -0
  214. package/src/components/dynamics/shape-utils.ts +61 -0
  215. package/src/components/dynamics/shape.ce +89 -0
  216. package/src/components/dynamics/text.ce +68 -0
  217. package/src/components/gui/box.ce +17 -0
  218. package/src/components/gui/dialogbox/index.ce +213 -187
  219. package/src/components/gui/gameover.ce +158 -0
  220. package/src/components/gui/hud/hud.ce +61 -0
  221. package/src/components/gui/index.ts +30 -4
  222. package/src/components/gui/menu/equip-menu.ce +410 -0
  223. package/src/components/gui/menu/exit-menu.ce +41 -0
  224. package/src/components/gui/menu/items-menu.ce +317 -0
  225. package/src/components/gui/menu/main-menu.ce +294 -0
  226. package/src/components/gui/menu/options-menu.ce +35 -0
  227. package/src/components/gui/menu/skills-menu.ce +83 -0
  228. package/src/components/gui/mobile/index.ts +24 -0
  229. package/src/components/gui/mobile/mobile.ce +80 -0
  230. package/src/components/gui/notification/notification.ce +51 -0
  231. package/src/components/gui/save-load.ce +208 -0
  232. package/src/components/gui/shop/shop.ce +493 -0
  233. package/src/components/gui/title-screen.ce +163 -0
  234. package/src/components/index.ts +3 -0
  235. package/src/components/player-components-utils.spec.ts +109 -0
  236. package/src/components/player-components-utils.ts +205 -0
  237. package/src/components/player-components.ce +221 -0
  238. package/src/components/prebuilt/hp-bar.ce +255 -0
  239. package/src/components/prebuilt/index.ts +24 -0
  240. package/src/components/prebuilt/light-halo.ce +148 -0
  241. package/src/components/scenes/canvas.ce +185 -21
  242. package/src/components/scenes/draw-map.ce +55 -21
  243. package/src/components/scenes/event-layer.ce +8 -2
  244. package/src/components/scenes/transition.ce +60 -0
  245. package/src/core/setup.ts +2 -2
  246. package/src/decorators/spritesheet.ts +8 -0
  247. package/src/index.ts +17 -2
  248. package/src/module.ts +132 -10
  249. package/src/presets/animation.ts +46 -0
  250. package/src/presets/faceset.ts +60 -0
  251. package/src/presets/icon.ts +17 -0
  252. package/src/presets/index.ts +9 -1
  253. package/src/presets/lpc.ts +108 -0
  254. package/src/services/AbstractSocket.ts +10 -2
  255. package/src/services/keyboardControls.ts +20 -0
  256. package/src/services/loadMap.ts +3 -1
  257. package/src/services/mmorpg.ts +106 -12
  258. package/src/services/save.spec.ts +127 -0
  259. package/src/services/save.ts +103 -0
  260. package/src/services/standalone.ts +110 -18
  261. package/src/utils/getEntityProp.spec.ts +96 -0
  262. package/src/utils/getEntityProp.ts +88 -0
  263. package/src/utils/readPropValue.ts +16 -0
  264. package/vite.config.ts +4 -2
  265. package/dist/Game/EffectManager.d.ts +0 -5
  266. package/dist/components/effects/index.d.ts +0 -4
  267. package/dist/index.js.map +0 -1
  268. package/dist/index10.js +0 -8
  269. package/dist/index10.js.map +0 -1
  270. package/dist/index11.js +0 -10
  271. package/dist/index11.js.map +0 -1
  272. package/dist/index12.js +0 -8
  273. package/dist/index12.js.map +0 -1
  274. package/dist/index13.js +0 -17
  275. package/dist/index13.js.map +0 -1
  276. package/dist/index14.js +0 -107
  277. package/dist/index14.js.map +0 -1
  278. package/dist/index15.js +0 -50
  279. package/dist/index15.js.map +0 -1
  280. package/dist/index16.js +0 -191
  281. package/dist/index16.js.map +0 -1
  282. package/dist/index17.js +0 -9
  283. package/dist/index17.js.map +0 -1
  284. package/dist/index18.js +0 -387
  285. package/dist/index18.js.map +0 -1
  286. package/dist/index19.js +0 -31
  287. package/dist/index19.js.map +0 -1
  288. package/dist/index2.js +0 -181
  289. package/dist/index2.js.map +0 -1
  290. package/dist/index20.js +0 -24
  291. package/dist/index20.js.map +0 -1
  292. package/dist/index21.js +0 -2421
  293. package/dist/index21.js.map +0 -1
  294. package/dist/index22.js +0 -114
  295. package/dist/index22.js.map +0 -1
  296. package/dist/index23.js +0 -109
  297. package/dist/index23.js.map +0 -1
  298. package/dist/index24.js +0 -71
  299. package/dist/index24.js.map +0 -1
  300. package/dist/index25.js +0 -21
  301. package/dist/index25.js.map +0 -1
  302. package/dist/index26.js +0 -41
  303. package/dist/index26.js.map +0 -1
  304. package/dist/index27.js +0 -5
  305. package/dist/index27.js.map +0 -1
  306. package/dist/index28.js +0 -322
  307. package/dist/index28.js.map +0 -1
  308. package/dist/index29.js +0 -27
  309. package/dist/index29.js.map +0 -1
  310. package/dist/index3.js +0 -87
  311. package/dist/index3.js.map +0 -1
  312. package/dist/index30.js +0 -11
  313. package/dist/index30.js.map +0 -1
  314. package/dist/index31.js +0 -11
  315. package/dist/index31.js.map +0 -1
  316. package/dist/index32.js +0 -174
  317. package/dist/index32.js.map +0 -1
  318. package/dist/index33.js +0 -501
  319. package/dist/index33.js.map +0 -1
  320. package/dist/index34.js +0 -12
  321. package/dist/index34.js.map +0 -1
  322. package/dist/index35.js +0 -4403
  323. package/dist/index35.js.map +0 -1
  324. package/dist/index36.js +0 -316
  325. package/dist/index36.js.map +0 -1
  326. package/dist/index37.js +0 -61
  327. package/dist/index37.js.map +0 -1
  328. package/dist/index38.js +0 -20
  329. package/dist/index38.js.map +0 -1
  330. package/dist/index39.js +0 -20
  331. package/dist/index39.js.map +0 -1
  332. package/dist/index4.js +0 -67
  333. package/dist/index4.js.map +0 -1
  334. package/dist/index5.js +0 -16
  335. package/dist/index5.js.map +0 -1
  336. package/dist/index6.js +0 -17
  337. package/dist/index6.js.map +0 -1
  338. package/dist/index7.js +0 -39
  339. package/dist/index7.js.map +0 -1
  340. package/dist/index8.js +0 -108
  341. package/dist/index8.js.map +0 -1
  342. package/dist/index9.js +0 -76
  343. package/dist/index9.js.map +0 -1
  344. package/src/Game/EffectManager.ts +0 -20
  345. package/src/components/gui/dialogbox/itemMenu.ce +0 -23
  346. package/src/components/gui/dialogbox/selection.ce +0 -67
  347. /package/src/components/{effects → animations}/hit.ce +0 -0
@@ -1,10 +1,21 @@
1
- import { Context } from '@signe/di';
1
+ import { Trigger } from 'canvasengine';
2
2
  import { AbstractWebsocket } from './services/AbstractSocket';
3
- import { EffectManager } from './Game/EffectManager';
3
+ import { Direction } from '@rpgjs/common';
4
+ import { RpgClientMap } from './Game/Map';
5
+ import { AnimationManager } from './Game/AnimationManager';
4
6
  import { Observable } from 'rxjs';
5
7
  import * as PIXI from "pixi.js";
8
+ type ConfigurableTrigger<T> = Omit<Trigger<T>, "start"> & {
9
+ start(config?: T): Promise<void>;
10
+ };
11
+ type MapShakeOptions = {
12
+ intensity?: number;
13
+ duration?: number;
14
+ frequency?: number;
15
+ direction?: string;
16
+ };
6
17
  export declare class RpgClientEngine<T = any> {
7
- context: Context;
18
+ context: any;
8
19
  private guiService;
9
20
  private webSocket;
10
21
  private loadMapService;
@@ -16,35 +27,395 @@ export declare class RpgClientEngine<T = any> {
16
27
  stopProcessingInput: boolean;
17
28
  width: import('canvasengine').WritableSignal<string>;
18
29
  height: import('canvasengine').WritableSignal<string>;
19
- spritesheets: Map<string, any>;
30
+ spritesheets: Map<string | number, any>;
20
31
  sounds: Map<string, any>;
21
- effects: any[];
32
+ componentAnimations: any[];
33
+ private spritesheetResolver?;
34
+ private soundResolver?;
22
35
  particleSettings: {
23
36
  emitters: any[];
24
37
  };
25
38
  renderer: PIXI.Renderer;
26
39
  tick: Observable<number>;
40
+ private canvasApp?;
41
+ private canvasElement?;
27
42
  playerIdSignal: import('canvasengine').WritableSignal<string | null>;
28
43
  spriteComponentsBehind: import('canvasengine').WritableArraySignal<any[]>;
29
44
  spriteComponentsInFront: import('canvasengine').WritableArraySignal<any[]>;
30
- constructor(context: Context);
45
+ spriteComponents: Map<string, any>;
46
+ /** ID of the sprite that the camera should follow. null means follow the current player */
47
+ cameraFollowTargetId: import('canvasengine').WritableSignal<string | null>;
48
+ /** Trigger for map shake animation */
49
+ mapShakeTrigger: ConfigurableTrigger<MapShakeOptions>;
50
+ controlsReady: import('canvasengine').WritableSignal<undefined>;
51
+ gamePause: import('canvasengine').WritableSignal<boolean>;
52
+ private predictionEnabled;
53
+ private prediction?;
54
+ private readonly SERVER_CORRECTION_THRESHOLD;
55
+ private inputFrameCounter;
56
+ private pendingPredictionFrames;
57
+ private lastClientPhysicsStepAt;
58
+ private frameOffset;
59
+ private rtt;
60
+ private pingInterval;
61
+ private readonly PING_INTERVAL_MS;
62
+ private lastInputTime;
63
+ private readonly MOVE_PATH_RESEND_INTERVAL_MS;
64
+ private readonly MAX_MOVE_TRAJECTORY_POINTS;
65
+ private lastMovePathSentAt;
66
+ private lastMovePathSentFrame;
67
+ private mapLoadCompleted$;
68
+ private playerIdReceived$;
69
+ private playersReceived$;
70
+ private eventsReceived$;
71
+ private onAfterLoadingSubscription?;
72
+ private sceneResetQueued;
73
+ private tickSubscriptions;
74
+ private resizeHandler?;
75
+ private notificationManager;
76
+ constructor(context: any);
77
+ /**
78
+ * Assigns a CanvasEngine KeyboardControls instance to the dependency injection context
79
+ *
80
+ * This method registers a KeyboardControls instance from CanvasEngine into the DI container,
81
+ * making it available for injection throughout the application. The particularity is that
82
+ * this method is automatically called when a sprite is displayed on the map, allowing the
83
+ * controls to be automatically associated with the active sprite.
84
+ *
85
+ * ## Design
86
+ *
87
+ * - The instance is stored in the DI context under the `KeyboardControls` token
88
+ * - It's automatically assigned when a sprite component mounts (in `character.ce`)
89
+ * - The controls instance comes from the CanvasEngine component's directives
90
+ * - Once registered, it can be retrieved using `inject(KeyboardControls)` from anywhere
91
+ *
92
+ * @param controlInstance - The CanvasEngine KeyboardControls instance to register
93
+ *
94
+ * @example
95
+ * ```ts
96
+ * // The method is automatically called when a sprite is displayed:
97
+ * // client.setKeyboardControls(element.directives.controls)
98
+ *
99
+ * // Later, retrieve and use the controls instance:
100
+ * import { Input, inject, KeyboardControls } from '@rpgjs/client'
101
+ *
102
+ * const controls = inject(KeyboardControls)
103
+ * const control = controls.getControl(Input.Enter)
104
+ *
105
+ * if (control) {
106
+ * console.log(control.actionName) // 'action'
107
+ * }
108
+ * ```
109
+ */
110
+ setKeyboardControls(controlInstance: any): void;
31
111
  start(): Promise<void>;
112
+ private prepareSyncPayload;
113
+ private normalizeAckWithSyncState;
32
114
  private initListeners;
115
+ /**
116
+ * Start periodic ping/pong for client-server synchronization
117
+ *
118
+ * Sends ping requests to the server to measure round-trip time (RTT) and
119
+ * calculate the frame offset between client and server ticks.
120
+ *
121
+ * ## Design
122
+ *
123
+ * - Sends ping every 5 seconds
124
+ * - Measures RTT for latency compensation
125
+ * - Calculates frame offset to map client frames to server ticks
126
+ * - Used for accurate server reconciliation
127
+ *
128
+ * @example
129
+ * ```ts
130
+ * // Called automatically when connection opens
131
+ * this.startPingPong();
132
+ * ```
133
+ */
134
+ private startPingPong;
135
+ /**
136
+ * Stop periodic ping/pong
137
+ *
138
+ * Stops the ping interval when disconnecting or changing maps.
139
+ *
140
+ * @example
141
+ * ```ts
142
+ * // Called automatically when connection closes
143
+ * this.stopPingPong();
144
+ * ```
145
+ */
146
+ private stopPingPong;
147
+ /**
148
+ * Send a ping request to the server
149
+ *
150
+ * Sends current client time and frame counter to the server,
151
+ * which will respond with its server tick for synchronization.
152
+ *
153
+ * @example
154
+ * ```ts
155
+ * // Send a ping to measure RTT
156
+ * this.sendPing();
157
+ * ```
158
+ */
159
+ private sendPing;
33
160
  private loadScene;
34
161
  addSpriteSheet<T = any>(spritesheetClass: any, id?: string): any;
162
+ /**
163
+ * Set a resolver function for spritesheets
164
+ *
165
+ * The resolver is called when a spritesheet is requested but not found in the cache.
166
+ * It can be synchronous (returns directly) or asynchronous (returns a Promise).
167
+ * The resolved spritesheet is automatically cached for future use.
168
+ *
169
+ * @param resolver - Function that takes a spritesheet ID and returns a spritesheet or Promise of spritesheet
170
+ *
171
+ * @example
172
+ * ```ts
173
+ * // Synchronous resolver
174
+ * engine.setSpritesheetResolver((id) => {
175
+ * if (id === 'dynamic-sprite') {
176
+ * return { id: 'dynamic-sprite', image: 'path/to/image.png', framesWidth: 32, framesHeight: 32 };
177
+ * }
178
+ * return undefined;
179
+ * });
180
+ *
181
+ * // Asynchronous resolver (loading from API)
182
+ * engine.setSpritesheetResolver(async (id) => {
183
+ * const response = await fetch(`/api/spritesheets/${id}`);
184
+ * const data = await response.json();
185
+ * return data;
186
+ * });
187
+ * ```
188
+ */
189
+ setSpritesheetResolver(resolver: (id: string | number) => any | Promise<any>): void;
190
+ /**
191
+ * Get a spritesheet by ID, using resolver if not found in cache
192
+ *
193
+ * This method first checks if the spritesheet exists in the cache.
194
+ * If not found and a resolver is set, it calls the resolver to create the spritesheet.
195
+ * The resolved spritesheet is automatically cached for future use.
196
+ *
197
+ * @param id - The spritesheet ID or legacy tile ID to retrieve
198
+ * @returns The spritesheet if found or created, or undefined if not found and no resolver
199
+ * @returns Promise<any> if the resolver is asynchronous
200
+ *
201
+ * @example
202
+ * ```ts
203
+ * // Synchronous usage
204
+ * const spritesheet = engine.getSpriteSheet('my-sprite');
205
+ *
206
+ * // Asynchronous usage (when resolver returns Promise)
207
+ * const spritesheet = await engine.getSpriteSheet('dynamic-sprite');
208
+ * ```
209
+ */
210
+ getSpriteSheet(id: string | number): any | Promise<any>;
211
+ /**
212
+ * Add a sound to the engine
213
+ *
214
+ * Adds a sound to the engine's sound cache. The sound can be:
215
+ * - A simple object with `id` and `src` properties
216
+ * - A Howler instance
217
+ * - An object with a `play()` method
218
+ *
219
+ * If the sound has a `src` property, a Howler instance will be created automatically.
220
+ *
221
+ * @param sound - The sound object or Howler instance
222
+ * @param id - Optional sound ID (if not provided, uses sound.id)
223
+ * @returns The added sound
224
+ *
225
+ * @example
226
+ * ```ts
227
+ * // Simple sound object
228
+ * engine.addSound({ id: 'click', src: 'click.mp3' });
229
+ *
230
+ * // With explicit ID
231
+ * engine.addSound({ src: 'music.mp3' }, 'background-music');
232
+ * ```
233
+ */
35
234
  addSound(sound: any, id?: string): any;
235
+ /**
236
+ * Set a resolver function for sounds
237
+ *
238
+ * The resolver is called when a sound is requested but not found in the cache.
239
+ * It can be synchronous (returns directly) or asynchronous (returns a Promise).
240
+ * The resolved sound is automatically cached for future use.
241
+ *
242
+ * @param resolver - Function that takes a sound ID and returns a sound or Promise of sound
243
+ *
244
+ * @example
245
+ * ```ts
246
+ * // Synchronous resolver
247
+ * engine.setSoundResolver((id) => {
248
+ * if (id === 'dynamic-sound') {
249
+ * return { id: 'dynamic-sound', src: 'path/to/sound.mp3' };
250
+ * }
251
+ * return undefined;
252
+ * });
253
+ *
254
+ * // Asynchronous resolver (loading from API)
255
+ * engine.setSoundResolver(async (id) => {
256
+ * const response = await fetch(`/api/sounds/${id}`);
257
+ * const data = await response.json();
258
+ * return data;
259
+ * });
260
+ * ```
261
+ */
262
+ setSoundResolver(resolver: (id: string) => any | Promise<any>): void;
263
+ /**
264
+ * Get a sound by ID, using resolver if not found in cache
265
+ *
266
+ * This method first checks if the sound exists in the cache.
267
+ * If not found and a resolver is set, it calls the resolver to create the sound.
268
+ * The resolved sound is automatically cached for future use.
269
+ *
270
+ * @param id - The sound ID to retrieve
271
+ * @returns The sound if found or created, or undefined if not found and no resolver
272
+ * @returns Promise<any> if the resolver is asynchronous
273
+ *
274
+ * @example
275
+ * ```ts
276
+ * // Synchronous usage
277
+ * const sound = engine.getSound('my-sound');
278
+ *
279
+ * // Asynchronous usage (when resolver returns Promise)
280
+ * const sound = await engine.getSound('dynamic-sound');
281
+ * ```
282
+ */
283
+ getSound(id: string): any | Promise<any>;
284
+ /**
285
+ * Play a sound by its ID
286
+ *
287
+ * This method retrieves a sound from the cache or resolver and plays it.
288
+ * If the sound is not found, it will attempt to resolve it using the soundResolver.
289
+ * Uses Howler.js for audio playback instead of native Audio elements.
290
+ *
291
+ * @param soundId - The sound ID to play
292
+ * @param options - Optional sound configuration
293
+ * @param options.volume - Volume level (0.0 to 1.0, overrides sound default)
294
+ * @param options.loop - Whether the sound should loop (overrides sound default)
295
+ *
296
+ * @example
297
+ * ```ts
298
+ * // Play a sound synchronously
299
+ * engine.playSound('item-pickup');
300
+ *
301
+ * // Play a sound with volume and loop
302
+ * engine.playSound('background-music', { volume: 0.5, loop: true });
303
+ *
304
+ * // Play a sound asynchronously (when resolver returns Promise)
305
+ * await engine.playSound('dynamic-sound', { volume: 0.8 });
306
+ * ```
307
+ */
308
+ playSound(soundId: string, options?: {
309
+ volume?: number;
310
+ loop?: boolean;
311
+ }): Promise<void>;
312
+ /**
313
+ * Stop a sound that is currently playing
314
+ *
315
+ * This method stops a sound that was previously started with `playSound()`.
316
+ *
317
+ * @param soundId - The sound ID to stop
318
+ *
319
+ * @example
320
+ * ```ts
321
+ * // Start a looping sound
322
+ * engine.playSound('background-music', { loop: true });
323
+ *
324
+ * // Later, stop it
325
+ * engine.stopSound('background-music');
326
+ * ```
327
+ */
328
+ stopSound(soundId: string): void;
329
+ /**
330
+ * Stop all currently playing sounds
331
+ *
332
+ * This method stops all sounds that are currently playing.
333
+ * Useful when changing maps to prevent sound overlap.
334
+ *
335
+ * @example
336
+ * ```ts
337
+ * // Stop all sounds
338
+ * engine.stopAllSounds();
339
+ * ```
340
+ */
341
+ stopAllSounds(): void;
342
+ /**
343
+ * Set the camera to follow a specific sprite
344
+ *
345
+ * This method changes which sprite the camera viewport should follow.
346
+ * The camera will smoothly animate to the target sprite if smoothMove options are provided.
347
+ *
348
+ * ## Design
349
+ *
350
+ * The camera follow target is stored in a signal that is read by sprite components.
351
+ * Each sprite checks if it should be followed by comparing its ID with the target ID.
352
+ * When smoothMove options are provided, the viewport animation is handled by CanvasEngine's
353
+ * viewport system.
354
+ *
355
+ * @param targetId - The ID of the sprite to follow. Set to null to follow the current player
356
+ * @param smoothMove - Animation options. Can be a boolean (default: true) or an object with time and ease
357
+ * @param smoothMove.time - Duration of the animation in milliseconds (optional)
358
+ * @param smoothMove.ease - Easing function name from https://easings.net (optional)
359
+ *
360
+ * @example
361
+ * ```ts
362
+ * // Follow another player with default smooth animation
363
+ * engine.setCameraFollow(otherPlayerId, true);
364
+ *
365
+ * // Follow an event with custom smooth animation
366
+ * engine.setCameraFollow(eventId, {
367
+ * time: 1000,
368
+ * ease: "easeInOutQuad"
369
+ * });
370
+ *
371
+ * // Follow without animation (instant)
372
+ * engine.setCameraFollow(targetId, false);
373
+ *
374
+ * // Return to following current player
375
+ * engine.setCameraFollow(null);
376
+ * ```
377
+ */
378
+ setCameraFollow(targetId: string | null, smoothMove?: boolean | {
379
+ time?: number;
380
+ ease?: string;
381
+ }): void;
36
382
  addParticle(particle: any): any;
37
383
  /**
38
384
  * Add a component to render behind sprites
39
385
  * Components added with this method will be displayed with a lower z-index than the sprite
40
386
  *
41
- * @param component - The component to add behind sprites
42
- * @returns The added component
387
+ * Supports multiple formats:
388
+ * 1. Direct component: `ShadowComponent`
389
+ * 2. Configuration object: `{ component: LightHalo, props: {...} }`
390
+ * 3. With dynamic props: `{ component: LightHalo, props: (object) => {...} }`
391
+ * 4. With dependencies: `{ component: HealthBar, dependencies: (object) => [object.hp, object.param.maxHp] }`
392
+ *
393
+ * Components with dependencies will only be displayed when all dependencies are resolved (!= undefined).
394
+ * The object (sprite) is passed to the dependencies function to allow sprite-specific dependency resolution.
395
+ *
396
+ * @param component - The component to add behind sprites, or a configuration object
397
+ * @param component.component - The component function to render
398
+ * @param component.props - Static props object or function that receives the sprite object and returns props
399
+ * @param component.dependencies - Function that receives the sprite object and returns an array of Signals
400
+ * @returns The added component or configuration
43
401
  *
44
402
  * @example
45
403
  * ```ts
46
404
  * // Add a shadow component behind all sprites
47
405
  * engine.addSpriteComponentBehind(ShadowComponent);
406
+ *
407
+ * // Add a component with static props
408
+ * engine.addSpriteComponentBehind({
409
+ * component: LightHalo,
410
+ * props: { radius: 30 }
411
+ * });
412
+ *
413
+ * // Add a component with dynamic props and dependencies
414
+ * engine.addSpriteComponentBehind({
415
+ * component: HealthBar,
416
+ * props: (object) => ({ hp: object.hp(), maxHp: object.param.maxHp() }),
417
+ * dependencies: (object) => [object.hp, object.param.maxHp]
418
+ * });
48
419
  * ```
49
420
  */
50
421
  addSpriteComponentBehind(component: any): any;
@@ -52,31 +423,316 @@ export declare class RpgClientEngine<T = any> {
52
423
  * Add a component to render in front of sprites
53
424
  * Components added with this method will be displayed with a higher z-index than the sprite
54
425
  *
55
- * @param component - The component to add in front of sprites
56
- * @returns The added component
426
+ * Supports multiple formats:
427
+ * 1. Direct component: `HealthBarComponent`
428
+ * 2. Configuration object: `{ component: StatusIndicator, props: {...} }`
429
+ * 3. With dynamic props: `{ component: HealthBar, props: (object) => {...} }`
430
+ * 4. With dependencies: `{ component: HealthBar, dependencies: (object) => [object.hp, object.param.maxHp] }`
431
+ *
432
+ * Components with dependencies will only be displayed when all dependencies are resolved (!= undefined).
433
+ * The object (sprite) is passed to the dependencies function to allow sprite-specific dependency resolution.
434
+ *
435
+ * @param component - The component to add in front of sprites, or a configuration object
436
+ * @param component.component - The component function to render
437
+ * @param component.props - Static props object or function that receives the sprite object and returns props
438
+ * @param component.dependencies - Function that receives the sprite object and returns an array of Signals
439
+ * @returns The added component or configuration
57
440
  *
58
441
  * @example
59
442
  * ```ts
60
443
  * // Add a health bar component in front of all sprites
61
444
  * engine.addSpriteComponentInFront(HealthBarComponent);
445
+ *
446
+ * // Add a component with static props
447
+ * engine.addSpriteComponentInFront({
448
+ * component: StatusIndicator,
449
+ * props: { type: 'poison' }
450
+ * });
451
+ *
452
+ * // Add a component with dynamic props and dependencies
453
+ * engine.addSpriteComponentInFront({
454
+ * component: HealthBar,
455
+ * props: (object) => ({ hp: object.hp(), maxHp: object.param.maxHp() }),
456
+ * dependencies: (object) => [object.hp, object.param.maxHp]
457
+ * });
458
+ * ```
459
+ */
460
+ addSpriteComponentInFront(component: any | {
461
+ component: any;
462
+ props: (object: any) => any;
463
+ dependencies?: (object: any) => any[];
464
+ }): any;
465
+ /**
466
+ * Register a reusable sprite component that can be addressed by the server.
467
+ *
468
+ * Server-side component definitions only carry the component id and
469
+ * serializable props. The client registry maps that id to the CanvasEngine
470
+ * component that performs the actual rendering.
471
+ *
472
+ * @param id - Stable component id used by server component definitions
473
+ * @param component - CanvasEngine component to render for this id
474
+ * @returns The registered component
475
+ *
476
+ * @example
477
+ * ```ts
478
+ * engine.registerSpriteComponent('guildBadge', GuildBadgeComponent);
479
+ * ```
480
+ */
481
+ registerSpriteComponent(id: string, component: any): any;
482
+ /**
483
+ * Get a reusable sprite component by id.
484
+ *
485
+ * @param id - Component id registered on the client
486
+ * @returns The CanvasEngine component, or undefined when missing
487
+ */
488
+ getSpriteComponent(id: string): any;
489
+ /**
490
+ * Add a component animation to the engine
491
+ *
492
+ * Component animations are temporary visual effects that can be displayed
493
+ * on sprites or objects, such as hit indicators, spell effects, or status animations.
494
+ *
495
+ * @param componentAnimation - The component animation configuration
496
+ * @param componentAnimation.id - Unique identifier for the animation
497
+ * @param componentAnimation.component - The component function to render
498
+ * @returns The added component animation configuration
499
+ *
500
+ * @example
501
+ * ```ts
502
+ * // Add a hit animation component
503
+ * engine.addComponentAnimation({
504
+ * id: 'hit',
505
+ * component: HitComponent
506
+ * });
507
+ *
508
+ * // Add an explosion effect component
509
+ * engine.addComponentAnimation({
510
+ * id: 'explosion',
511
+ * component: ExplosionComponent
512
+ * });
62
513
  * ```
63
514
  */
64
- addSpriteComponentInFront(component: any): any;
65
- addEffect(effect: {
515
+ addComponentAnimation(componentAnimation: {
66
516
  component: any;
67
517
  id: string;
68
518
  }): {
69
519
  component: any;
70
520
  id: string;
71
521
  };
72
- getEffect(id: string): EffectManager;
522
+ /**
523
+ * Get a component animation by its ID
524
+ *
525
+ * Retrieves the EffectManager instance for a specific component animation,
526
+ * which can be used to display the animation on sprites or objects.
527
+ *
528
+ * @param id - The unique identifier of the component animation
529
+ * @returns The EffectManager instance for the animation
530
+ * @throws Error if the component animation is not found
531
+ *
532
+ * @example
533
+ * ```ts
534
+ * // Get the hit animation and display it
535
+ * const hitAnimation = engine.getComponentAnimation('hit');
536
+ * hitAnimation.displayEffect({ text: "Critical!" }, player);
537
+ * ```
538
+ */
539
+ getComponentAnimation(id: string): AnimationManager;
540
+ /**
541
+ * Start a transition
542
+ *
543
+ * Convenience method to display a transition by its ID using the GUI system.
544
+ *
545
+ * @param id - The unique identifier of the transition to start
546
+ * @param props - Props to pass to the transition component
547
+ *
548
+ * @example
549
+ * ```ts
550
+ * // Start a fade transition
551
+ * engine.startTransition('fade', { duration: 1000, color: 'black' });
552
+ *
553
+ * // Start with onFinish callback
554
+ * engine.startTransition('fade', {
555
+ * duration: 1000,
556
+ * onFinish: () => console.log('Fade complete')
557
+ * });
558
+ *
559
+ * // Wait until the transition component calls onFinish
560
+ * await engine.startTransition('fade', { duration: 1000 });
561
+ * ```
562
+ */
563
+ startTransition(id: string, props?: any): Promise<void>;
73
564
  processInput({ input }: {
74
- input: number;
75
- }): void;
565
+ input: Direction;
566
+ }): Promise<void>;
76
567
  processAction({ action }: {
77
568
  action: number;
78
569
  }): void;
79
570
  get PIXI(): typeof PIXI;
80
571
  get socket(): AbstractWebsocket;
81
572
  get playerId(): string | null;
573
+ get scene(): RpgClientMap;
574
+ private getPhysicsTick;
575
+ private ensureCurrentPlayerBody;
576
+ private stepClientPhysicsTick;
577
+ private flushPendingPredictedStates;
578
+ private buildPendingMoveTrajectory;
579
+ private emitMovePacket;
580
+ private flushPendingMovePath;
581
+ private getLocalPlayerState;
582
+ private applyAuthoritativeState;
583
+ private initializePredictionController;
584
+ getCurrentPlayer(): import('.').RpgClientPlayer;
585
+ emitSceneMapHook(hookName: string, ...args: any[]): void;
586
+ /**
587
+ * Setup RxJS observer to wait for all conditions before calling onAfterLoading hook
588
+ *
589
+ * This method uses RxJS `combineLatest` to wait for all conditions to be met,
590
+ * regardless of the order in which they arrive:
591
+ * 1. The map loading is completed (loadMapService.load is finished)
592
+ * 2. We received a player ID (pId)
593
+ * 3. Players array has at least one element
594
+ * 4. Events property is present in the sync data
595
+ *
596
+ * Once all conditions are met, it uses `switchMap` to call the onAfterLoading hook once.
597
+ *
598
+ * ## Design
599
+ *
600
+ * Uses BehaviorSubjects to track each condition state, allowing events to arrive
601
+ * in any order. The `combineLatest` operator waits until all observables emit `true`,
602
+ * then `take(1)` ensures the hook is called only once, and `switchMap` handles
603
+ * the hook execution.
604
+ *
605
+ * @example
606
+ * ```ts
607
+ * // Called automatically in loadScene to setup the observer
608
+ * this.setupOnAfterLoadingObserver();
609
+ * ```
610
+ */
611
+ private setupOnAfterLoadingObserver;
612
+ /**
613
+ * Clear client prediction states for cleanup
614
+ *
615
+ * Removes old prediction states and input history to prevent memory leaks.
616
+ * Should be called when changing maps or disconnecting.
617
+ *
618
+ * @example
619
+ * ```ts
620
+ * // Clear prediction states when changing maps
621
+ * engine.clearClientPredictionStates();
622
+ * ```
623
+ */
624
+ clearClientPredictionStates(): void;
625
+ /**
626
+ * Stop local movement immediately and discard pending predicted movement.
627
+ *
628
+ * Use this before a blocking action such as an A-RPG attack, dialog, dash
629
+ * startup, or any client-side state where already buffered movement inputs
630
+ * must not be replayed after server reconciliation.
631
+ *
632
+ * @param player - Player object to stop. Defaults to the current player.
633
+ * @returns `true` when a player was found and interrupted.
634
+ *
635
+ * @example
636
+ * ```ts
637
+ * engine.interruptCurrentPlayerMovement();
638
+ * ```
639
+ */
640
+ interruptCurrentPlayerMovement(player?: any): boolean;
641
+ /**
642
+ * Trigger a flash animation on a sprite
643
+ *
644
+ * This method allows you to trigger a flash effect on any sprite from client-side code.
645
+ * The flash can be configured with various options including type (alpha, tint, or both),
646
+ * duration, cycles, and color.
647
+ *
648
+ * ## Design
649
+ *
650
+ * The flash is applied directly to the sprite object using its flash trigger.
651
+ * This is useful for client-side visual feedback, UI interactions, or local effects
652
+ * that don't need to be synchronized with the server.
653
+ *
654
+ * @param spriteId - The ID of the sprite to flash. If not provided, flashes the current player
655
+ * @param options - Flash configuration options
656
+ * @param options.type - Type of flash effect: 'alpha' (opacity), 'tint' (color), or 'both' (default: 'alpha')
657
+ * @param options.duration - Duration of the flash animation in milliseconds (default: 300)
658
+ * @param options.cycles - Number of flash cycles (flash on/off) (default: 1)
659
+ * @param options.alpha - Alpha value when flashing, from 0 to 1 (default: 0.3)
660
+ * @param options.tint - Tint color when flashing as hex value or color name (default: 0xffffff - white)
661
+ *
662
+ * @example
663
+ * ```ts
664
+ * // Flash the current player with default settings
665
+ * engine.flash();
666
+ *
667
+ * // Flash a specific sprite with red tint
668
+ * engine.flash('sprite-id', { type: 'tint', tint: 0xff0000 });
669
+ *
670
+ * // Flash with both alpha and tint for dramatic effect
671
+ * engine.flash(undefined, {
672
+ * type: 'both',
673
+ * alpha: 0.5,
674
+ * tint: 0xff0000,
675
+ * duration: 200,
676
+ * cycles: 2
677
+ * });
678
+ *
679
+ * // Quick damage flash on current player
680
+ * engine.flash(undefined, {
681
+ * type: 'tint',
682
+ * tint: 'red',
683
+ * duration: 150,
684
+ * cycles: 1
685
+ * });
686
+ * ```
687
+ */
688
+ flash(spriteId?: string, options?: {
689
+ type?: 'alpha' | 'tint' | 'both';
690
+ duration?: number;
691
+ cycles?: number;
692
+ alpha?: number;
693
+ tint?: number | string;
694
+ }): void;
695
+ private applyServerAck;
696
+ private reconcilePrediction;
697
+ /**
698
+ * Replay unacknowledged inputs from a given frame to resimulate client prediction
699
+ * after applying server authority at a certain frame.
700
+ *
701
+ * @param startFrame - The last server-acknowledged frame
702
+ *
703
+ * @example
704
+ * ```ts
705
+ * // After applying a server correction at frame N
706
+ * this.replayUnackedInputsFromFrame(N);
707
+ * ```
708
+ */
709
+ private replayUnackedInputsFromFrame;
710
+ /**
711
+ * Clear all client resources and reset state
712
+ *
713
+ * This method should be called to clean up all client-side resources when
714
+ * shutting down or resetting the client engine. It:
715
+ * - Destroys the PIXI renderer
716
+ * - Stops all sounds
717
+ * - Cleans up subscriptions and event listeners
718
+ * - Resets scene map
719
+ * - Stops ping/pong interval
720
+ * - Clears prediction states
721
+ *
722
+ * ## Design
723
+ *
724
+ * This method is used primarily in testing environments to ensure clean
725
+ * state between tests. In production, the client engine typically persists
726
+ * for the lifetime of the application.
727
+ *
728
+ * @example
729
+ * ```ts
730
+ * // In test cleanup
731
+ * afterEach(() => {
732
+ * clientEngine.clear();
733
+ * });
734
+ * ```
735
+ */
736
+ clear(): void;
82
737
  }
738
+ export {};