@directivegames/genesys.js 3.1.24 → 3.1.25

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 (281) hide show
  1. package/dist/games/animation-demo.d.ts +1 -1
  2. package/dist/games/animation-demo.js +2 -2
  3. package/dist/games/animation-retarget-demo.d.ts +1 -1
  4. package/dist/games/animation-retarget-demo.js +3 -3
  5. package/dist/games/behavior-tree-demo.d.ts +1 -1
  6. package/dist/games/behavior-tree-demo.js +2 -2
  7. package/dist/games/character_animation.d.ts +1 -1
  8. package/dist/games/character_animation.js +2 -2
  9. package/dist/games/collision-demo.d.ts +1 -1
  10. package/dist/games/collision-demo.js +2 -2
  11. package/dist/games/deprecated/advanced-grid-demo.d.ts +1 -1
  12. package/dist/games/deprecated/advanced-grid-demo.js +2 -2
  13. package/dist/games/deprecated/airplane-demo.d.ts +1 -1
  14. package/dist/games/deprecated/airplane-demo.js +2 -2
  15. package/dist/games/deprecated/character-controller.d.ts +1 -1
  16. package/dist/games/deprecated/character-controller.js +2 -2
  17. package/dist/games/deprecated/chase-game.d.ts +1 -1
  18. package/dist/games/deprecated/chase-game.js +2 -2
  19. package/dist/games/deprecated/collision-config.d.ts +1 -1
  20. package/dist/games/deprecated/collision-config.js +2 -2
  21. package/dist/games/deprecated/door-demo.d.ts +1 -1
  22. package/dist/games/deprecated/door-demo.js +2 -2
  23. package/dist/games/deprecated/fps-demo.d.ts +1 -1
  24. package/dist/games/deprecated/fps-demo.js +2 -2
  25. package/dist/games/deprecated/fps-shotgun-demo.d.ts +1 -1
  26. package/dist/games/deprecated/fps-shotgun-demo.js +2 -2
  27. package/dist/games/deprecated/lightmapping-demo.d.ts +1 -1
  28. package/dist/games/deprecated/lightmapping-demo.js +2 -2
  29. package/dist/games/deprecated/lights-demo.d.ts +1 -1
  30. package/dist/games/deprecated/lights-demo.js +2 -2
  31. package/dist/games/deprecated/matcap-demo.d.ts +1 -1
  32. package/dist/games/deprecated/matcap-demo.js +2 -2
  33. package/dist/games/deprecated/material-demo-2.d.ts +1 -1
  34. package/dist/games/deprecated/material-demo-2.js +2 -2
  35. package/dist/games/deprecated/material-demo.d.ts +1 -1
  36. package/dist/games/deprecated/material-demo.js +2 -2
  37. package/dist/games/deprecated/memory-leak-test.d.ts +1 -1
  38. package/dist/games/deprecated/memory-leak-test.js +2 -2
  39. package/dist/games/deprecated/model-stress-test.d.ts +1 -1
  40. package/dist/games/deprecated/model-stress-test.js +2 -2
  41. package/dist/games/deprecated/multiplayer-demo.d.ts +1 -1
  42. package/dist/games/deprecated/multiplayer-demo.js +2 -2
  43. package/dist/games/deprecated/physics-demo.d.ts +1 -1
  44. package/dist/games/deprecated/physics-demo.js +2 -2
  45. package/dist/games/deprecated/shadow-demo.d.ts +1 -1
  46. package/dist/games/deprecated/shadow-demo.js +2 -2
  47. package/dist/games/deprecated/shooting-demo.d.ts +1 -1
  48. package/dist/games/deprecated/shooting-demo.js +2 -2
  49. package/dist/games/deprecated/skybox-demo.d.ts +1 -1
  50. package/dist/games/deprecated/skybox-demo.js +2 -2
  51. package/dist/games/deprecated/sound-demo.d.ts +1 -1
  52. package/dist/games/deprecated/sound-demo.js +2 -2
  53. package/dist/games/deprecated/timer-demo.d.ts +1 -1
  54. package/dist/games/deprecated/timer-demo.js +2 -2
  55. package/dist/games/deprecated/voxel-demo.d.ts +1 -1
  56. package/dist/games/deprecated/voxel-demo.js +2 -2
  57. package/dist/games/deprecated/world-commands.d.ts +1 -1
  58. package/dist/games/deprecated/world-commands.js +2 -2
  59. package/dist/games/deprecated/world-loading.d.ts +1 -1
  60. package/dist/games/deprecated/world-loading.js +2 -2
  61. package/dist/games/examples/fps-advanced/enemies.d.ts +1 -1
  62. package/dist/games/examples/fps-advanced/enemies.js +2 -2
  63. package/dist/games/examples/fps-advanced/game-mode.d.ts +1 -1
  64. package/dist/games/examples/fps-advanced/game-mode.js +2 -2
  65. package/dist/games/examples/fps-advanced/game.d.ts +1 -1
  66. package/dist/games/examples/fps-advanced/game.js +2 -2
  67. package/dist/games/examples/fps-advanced/pickups.d.ts +1 -1
  68. package/dist/games/examples/fps-advanced/pickups.js +2 -2
  69. package/dist/games/examples/fps-advanced/player.d.ts +1 -1
  70. package/dist/games/examples/fps-advanced/player.js +2 -2
  71. package/dist/games/examples/fps-advanced/ui/endgame-ui.d.ts +1 -1
  72. package/dist/games/examples/fps-advanced/ui/endgame-ui.js +2 -2
  73. package/dist/games/examples/fps-advanced/ui/menu-ui.d.ts +1 -1
  74. package/dist/games/examples/fps-advanced/ui/menu-ui.js +2 -2
  75. package/dist/games/examples/fps-advanced/ui/weapon-hud.d.ts +1 -1
  76. package/dist/games/examples/fps-advanced/weapons.d.ts +1 -1
  77. package/dist/games/examples/fps-advanced/weapons.js +2 -2
  78. package/dist/games/examples/plugin-demo/game.d.ts +1 -1
  79. package/dist/games/examples/plugin-demo/game.js +3 -3
  80. package/dist/games/examples/plugin-demo/plugins/dynamic-lighting.d.ts +1 -1
  81. package/dist/games/examples/plugin-demo/plugins/dynamic-lighting.js +2 -2
  82. package/dist/games/examples/plugin-demo/plugins/instanced-forest.d.ts +1 -1
  83. package/dist/games/examples/plugin-demo/plugins/instanced-forest.js +2 -2
  84. package/dist/games/examples/plugin-demo/plugins/particle-fountain.d.ts +1 -1
  85. package/dist/games/examples/plugin-demo/plugins/particle-fountain.js +2 -2
  86. package/dist/games/examples/plugin-demo/plugins/physics-playground.d.ts +1 -1
  87. package/dist/games/examples/plugin-demo/plugins/physics-playground.js +2 -2
  88. package/dist/games/examples/plugin-demo/plugins/robot-follower.d.ts +1 -1
  89. package/dist/games/examples/plugin-demo/plugins/robot-follower.js +2 -2
  90. package/dist/games/examples/plugin-demo/plugins/scatter-models.d.ts +1 -1
  91. package/dist/games/examples/plugin-demo/plugins/scatter-models.js +2 -2
  92. package/dist/games/examples/plugin-demo/plugins/simple-cube.d.ts +1 -1
  93. package/dist/games/examples/plugin-demo/plugins/simple-cube.js +2 -2
  94. package/dist/games/examples/plugin-demo/plugins/tic-tac-toe.d.ts +1 -1
  95. package/dist/games/examples/plugin-demo/plugins/tic-tac-toe.js +2 -2
  96. package/dist/games/examples/plugin-demo/plugins/wobbling-sphere.d.ts +1 -1
  97. package/dist/games/examples/plugin-demo/plugins/wobbling-sphere.js +2 -2
  98. package/dist/games/examples/side-scroller-advanced/game-mode.d.ts +1 -1
  99. package/dist/games/examples/side-scroller-advanced/game-mode.js +2 -2
  100. package/dist/games/examples/side-scroller-advanced/game.d.ts +1 -1
  101. package/dist/games/examples/side-scroller-advanced/game.js +2 -2
  102. package/dist/games/examples/side-scroller-advanced/level-generator.d.ts +1 -1
  103. package/dist/games/examples/side-scroller-advanced/level-generator.js +2 -2
  104. package/dist/games/examples/side-scroller-advanced/pickups.d.ts +1 -1
  105. package/dist/games/examples/side-scroller-advanced/pickups.js +2 -2
  106. package/dist/games/examples/side-scroller-advanced/player.d.ts +1 -1
  107. package/dist/games/examples/side-scroller-advanced/player.js +2 -2
  108. package/dist/games/examples/side-scroller-advanced/ui/endgame-ui.d.ts +1 -1
  109. package/dist/games/examples/side-scroller-advanced/ui/endgame-ui.js +2 -2
  110. package/dist/games/examples/side-scroller-advanced/ui/menu-ui.d.ts +1 -1
  111. package/dist/games/examples/side-scroller-advanced/ui/menu-ui.js +2 -2
  112. package/dist/games/examples/vehicle/base-vehicle.d.ts +1 -1
  113. package/dist/games/examples/vehicle/base-vehicle.js +2 -2
  114. package/dist/games/examples/vehicle/game.d.ts +1 -1
  115. package/dist/games/examples/vehicle/game.js +2 -2
  116. package/dist/games/examples/vehicle/mesh-vehicle.d.ts +1 -1
  117. package/dist/games/examples/vehicle/mesh-vehicle.js +2 -2
  118. package/dist/games/examples/vehicle/player.d.ts +1 -1
  119. package/dist/games/examples/vehicle/player.js +2 -2
  120. package/dist/games/examples/vehicle/primitive-vehicle.d.ts +1 -1
  121. package/dist/games/examples/vehicle/primitive-vehicle.js +2 -2
  122. package/dist/games/examples/vr-game/VRAttachableCube.d.ts +1 -1
  123. package/dist/games/examples/vr-game/VRAttachableCube.js +2 -2
  124. package/dist/games/examples/vr-game/VRInteractableCylinder.d.ts +1 -1
  125. package/dist/games/examples/vr-game/VRInteractableCylinder.js +2 -2
  126. package/dist/games/examples/vr-game/VRPressableButton.d.ts +1 -1
  127. package/dist/games/examples/vr-game/VRPressableButton.js +2 -2
  128. package/dist/games/examples/vr-game/VRProjectileActor.d.ts +1 -1
  129. package/dist/games/examples/vr-game/VRProjectileActor.js +2 -2
  130. package/dist/games/examples/vr-game/VRRifleActor.d.ts +1 -1
  131. package/dist/games/examples/vr-game/VRRifleActor.js +2 -2
  132. package/dist/games/examples/vr-game/game.d.ts +1 -1
  133. package/dist/games/examples/vr-game/game.js +2 -2
  134. package/dist/games/examples/vr-game/scene.d.ts +1 -1
  135. package/dist/games/examples/vr-game/scene.js +2 -2
  136. package/dist/games/instanced-mesh-demo.d.ts +1 -1
  137. package/dist/games/instanced-mesh-demo.js +2 -2
  138. package/dist/games/manifold-demo.d.ts +1 -1
  139. package/dist/games/manifold-demo.js +2 -2
  140. package/dist/games/navigation-demo.d.ts +1 -1
  141. package/dist/games/navigation-demo.js +2 -2
  142. package/dist/games/navmesh-primitives-demo.d.ts +1 -1
  143. package/dist/games/navmesh-primitives-demo.js +2 -2
  144. package/dist/games/postprocess-demo.d.ts +1 -1
  145. package/dist/games/postprocess-demo.js +3 -3
  146. package/dist/games/ragdoll-demo-simple.d.ts +1 -1
  147. package/dist/games/ragdoll-demo-simple.js +2 -2
  148. package/dist/games/ragdoll-demo.d.ts +1 -1
  149. package/dist/games/ragdoll-demo.js +2 -2
  150. package/dist/games/swipe-tap-demo.d.ts +1 -1
  151. package/dist/games/swipe-tap-demo.js +2 -2
  152. package/dist/games/tween-demo.d.ts +1 -1
  153. package/dist/games/tween-demo.js +2 -2
  154. package/dist/games/ui-demo.d.ts +1 -1
  155. package/dist/games/ui-demo.js +2 -2
  156. package/dist/games/vfx-demo.d.ts +1 -1
  157. package/dist/games/vfx-demo.js +2 -2
  158. package/dist/games/vfx-wawa-demo.d.ts +1 -1
  159. package/dist/games/vfx-wawa-demo.js +2 -2
  160. package/dist/games/vr-ui-demo-minimal.d.ts +1 -1
  161. package/dist/games/vr-ui-demo-minimal.js +2 -2
  162. package/dist/games/vr-ui-demo.d.ts +1 -1
  163. package/dist/games/vr-ui-demo.js +2 -2
  164. package/dist/launcher.js +2 -2
  165. package/dist/scripts/dump-templates.js +2 -2
  166. package/dist/test/absolute-transform.test.js +2 -2
  167. package/dist/test/asset-path.test.js +2 -2
  168. package/dist/test/component.test.js +2 -2
  169. package/dist/test/construction.test.js +2 -2
  170. package/dist/test/default-options-validation.test.js +2 -2
  171. package/dist/test/metadata.test.js +2 -2
  172. package/dist/test/nodeStorage.d.ts +2 -2
  173. package/dist/test/nodeStorage.js +3 -3
  174. package/dist/test/prefab.test.js +2 -2
  175. package/dist/test/scene-component.test.js +2 -2
  176. package/dist/test/scene-graph.test.js +2 -2
  177. package/dist/test/serialization-v1.test.d.ts +1 -1
  178. package/dist/test/serialization-v1.test.js +3 -3
  179. package/dist/test/serialization.test.js +2 -2
  180. package/dist/test/spawn.test.js +2 -2
  181. package/dist/test/utils.d.ts +1 -1
  182. package/dist/test/utils.js +2 -2
  183. package/docs/guides/15-global-audio-manager.md +1 -1
  184. package/docs/guides/16-ragdoll-physics.md +1 -1
  185. package/docs/guides/18-lightmapping-system.md +3 -3
  186. package/docs/guides/19-webxr-virtual-reality.md +1 -1
  187. package/docs/guides/4-visuals-and-rendering.md +5 -5
  188. package/docs/guides/6-ai-and-behavior-trees.md +4 -4
  189. package/games/animation-demo.ts +1 -1
  190. package/games/animation-retarget-demo.ts +2 -2
  191. package/games/behavior-tree-demo.ts +1 -1
  192. package/games/character_animation.ts +1 -1
  193. package/games/collision-demo.ts +1 -1
  194. package/games/deprecated/advanced-grid-demo.ts +1 -1
  195. package/games/deprecated/airplane-demo.ts +1 -1
  196. package/games/deprecated/character-controller.ts +1 -1
  197. package/games/deprecated/chase-game.ts +1 -1
  198. package/games/deprecated/collision-config.ts +1 -1
  199. package/games/deprecated/door-demo.ts +1 -1
  200. package/games/deprecated/fps-demo.ts +1 -1
  201. package/games/deprecated/fps-shotgun-demo.ts +1 -1
  202. package/games/deprecated/index.ts +25 -25
  203. package/games/deprecated/lightmapping-demo.ts +1 -1
  204. package/games/deprecated/lights-demo.ts +1 -1
  205. package/games/deprecated/matcap-demo.ts +1 -1
  206. package/games/deprecated/material-demo-2.ts +1 -1
  207. package/games/deprecated/material-demo.ts +1 -1
  208. package/games/deprecated/memory-leak-test.ts +1 -1
  209. package/games/deprecated/model-stress-test.ts +1 -1
  210. package/games/deprecated/multiplayer-demo.ts +1 -1
  211. package/games/deprecated/physics-demo.ts +1 -1
  212. package/games/deprecated/shadow-demo.ts +1 -1
  213. package/games/deprecated/shooting-demo.ts +1 -1
  214. package/games/deprecated/skybox-demo.ts +1 -1
  215. package/games/deprecated/sound-demo.ts +1 -1
  216. package/games/deprecated/timer-demo.ts +1 -1
  217. package/games/deprecated/voxel-demo.ts +1 -1
  218. package/games/deprecated/world-commands.ts +1 -1
  219. package/games/deprecated/world-loading.ts +1 -1
  220. package/games/examples/fps-advanced/enemies.ts +1 -1
  221. package/games/examples/fps-advanced/game-mode.ts +1 -1
  222. package/games/examples/fps-advanced/game.ts +1 -1
  223. package/games/examples/fps-advanced/pickups.ts +1 -1
  224. package/games/examples/fps-advanced/player.ts +1 -1
  225. package/games/examples/fps-advanced/ui/endgame-ui.ts +1 -1
  226. package/games/examples/fps-advanced/ui/menu-ui.ts +1 -1
  227. package/games/examples/fps-advanced/ui/weapon-hud.ts +253 -253
  228. package/games/examples/fps-advanced/weapons.ts +1 -1
  229. package/games/examples/index.ts +5 -5
  230. package/games/examples/plugin-demo/game.ts +2 -2
  231. package/games/examples/plugin-demo/plugins/dynamic-lighting.ts +1 -1
  232. package/games/examples/plugin-demo/plugins/instanced-forest.ts +1 -1
  233. package/games/examples/plugin-demo/plugins/particle-fountain.ts +1 -1
  234. package/games/examples/plugin-demo/plugins/physics-playground.ts +1 -1
  235. package/games/examples/plugin-demo/plugins/robot-follower.ts +1 -1
  236. package/games/examples/plugin-demo/plugins/scatter-models.ts +1 -1
  237. package/games/examples/plugin-demo/plugins/simple-cube.ts +1 -1
  238. package/games/examples/plugin-demo/plugins/tic-tac-toe.ts +1 -1
  239. package/games/examples/plugin-demo/plugins/wobbling-sphere.ts +1 -1
  240. package/games/examples/side-scroller-advanced/game-mode.ts +1 -1
  241. package/games/examples/side-scroller-advanced/game.ts +1 -1
  242. package/games/examples/side-scroller-advanced/level-generator.ts +1 -1
  243. package/games/examples/side-scroller-advanced/pickups.ts +1 -1
  244. package/games/examples/side-scroller-advanced/player.ts +1 -1
  245. package/games/examples/side-scroller-advanced/ui/endgame-ui.ts +1 -1
  246. package/games/examples/side-scroller-advanced/ui/menu-ui.ts +1 -1
  247. package/games/examples/vehicle/base-vehicle.ts +1 -1
  248. package/games/examples/vehicle/game.ts +1 -1
  249. package/games/examples/vehicle/mesh-vehicle.ts +1 -1
  250. package/games/examples/vehicle/player.ts +1 -1
  251. package/games/examples/vehicle/primitive-vehicle.ts +1 -1
  252. package/games/examples/vr-game/VRAttachableCube.ts +1 -1
  253. package/games/examples/vr-game/VRInteractableCylinder.ts +1 -1
  254. package/games/examples/vr-game/VRPressableButton.ts +1 -1
  255. package/games/examples/vr-game/VRProjectileActor.ts +1 -1
  256. package/games/examples/vr-game/VRRifleActor.ts +1 -1
  257. package/games/examples/vr-game/game.ts +1 -1
  258. package/games/examples/vr-game/scene.ts +1 -1
  259. package/games/instanced-mesh-demo.ts +1 -1
  260. package/games/manifold-demo.ts +1 -1
  261. package/games/navigation-demo.ts +1 -1
  262. package/games/navmesh-primitives-demo.ts +1 -1
  263. package/games/postprocess-demo.ts +2 -2
  264. package/games/ragdoll-demo-simple.ts +1 -1
  265. package/games/ragdoll-demo.ts +1 -1
  266. package/games/swipe-tap-demo.ts +1 -1
  267. package/games/tween-demo.ts +1 -1
  268. package/games/ui-demo.ts +1 -1
  269. package/games/vfx-demo.ts +1 -1
  270. package/games/vfx-wawa-demo.ts +1 -1
  271. package/games/vr-ui-demo-minimal.ts +1 -1
  272. package/games/vr-ui-demo.ts +1 -1
  273. package/package.json +1 -1
  274. package/scripts/dump-templates.ts +1 -1
  275. package/src/global.d.ts +11 -11
  276. package/src/multiplayer/MovementPrediction.ts +202 -202
  277. package/src/templates/MyActor.ts +1 -1
  278. package/src/templates/MySceneComponent.ts +1 -1
  279. package/src/ui/UIResource.ts +20 -20
  280. package/src/utils/browser-polyfills/module.ts +35 -35
  281. package/src/utils/browser-polyfills/path.ts +231 -231
@@ -1,4 +1,4 @@
1
- import * as ENGINE from 'genesys.js';
1
+ import * as ENGINE from '@directivegames/genesys.js';
2
2
  import * as THREE from 'three';
3
3
 
4
4
  import { VehicleGamePlayer } from './player.js';
@@ -1,4 +1,4 @@
1
- import * as ENGINE from 'genesys.js';
1
+ import * as ENGINE from '@directivegames/genesys.js';
2
2
  import * as THREE from 'three';
3
3
 
4
4
  import { MeshVehicle } from './mesh-vehicle.js';
@@ -1,4 +1,4 @@
1
- import * as ENGINE from 'genesys.js';
1
+ import * as ENGINE from '@directivegames/genesys.js';
2
2
  import * as THREE from 'three';
3
3
 
4
4
  import { BaseVehicle } from './base-vehicle.js';
@@ -1,4 +1,4 @@
1
- import * as ENGINE from 'genesys.js';
1
+ import * as ENGINE from '@directivegames/genesys.js';
2
2
  import * as THREE from 'three';
3
3
 
4
4
  import { BaseVehicle } from './base-vehicle.js';
@@ -1,4 +1,4 @@
1
- import * as ENGINE from 'genesys.js';
1
+ import * as ENGINE from '@directivegames/genesys.js';
2
2
  import * as THREE from 'three';
3
3
 
4
4
  import { BaseVehicle } from './base-vehicle.js';
@@ -1,4 +1,4 @@
1
- import * as ENGINE from 'genesys.js';
1
+ import * as ENGINE from '@directivegames/genesys.js';
2
2
  import * as THREE from 'three';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import * as ENGINE from 'genesys.js';
1
+ import * as ENGINE from '@directivegames/genesys.js';
2
2
  import * as THREE from 'three';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import * as ENGINE from 'genesys.js';
1
+ import * as ENGINE from '@directivegames/genesys.js';
2
2
  import * as THREE from 'three';
3
3
 
4
4
  export interface VRPressableButtonOptions {
@@ -1,4 +1,4 @@
1
- import * as ENGINE from 'genesys.js';
1
+ import * as ENGINE from '@directivegames/genesys.js';
2
2
  import * as THREE from 'three';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import * as ENGINE from 'genesys.js';
1
+ import * as ENGINE from '@directivegames/genesys.js';
2
2
  import * as THREE from 'three';
3
3
 
4
4
  import { VRProjectileActor } from './VRProjectileActor.js';
@@ -1,4 +1,4 @@
1
- import * as ENGINE from 'genesys.js';
1
+ import * as ENGINE from '@directivegames/genesys.js';
2
2
  import * as THREE from 'three';
3
3
 
4
4
  import { createVRScene } from './scene.js';
@@ -1,4 +1,4 @@
1
- import * as ENGINE from 'genesys.js';
1
+ import * as ENGINE from '@directivegames/genesys.js';
2
2
  import * as THREE from 'three';
3
3
 
4
4
  import { VRAttachableCube } from './VRAttachableCube.js';
@@ -4,7 +4,7 @@
4
4
  * A comparison test between regular mesh components and instanced mesh components
5
5
  * with a toggle button to switch between them
6
6
  */
7
- import * as ENGINE from 'genesys.js';
7
+ import * as ENGINE from '@directivegames/genesys.js';
8
8
  import * as THREE from 'three';
9
9
 
10
10
  const MIN_SCALE = 0.03;
@@ -1,4 +1,4 @@
1
- import * as ENGINE from 'genesys.js';
1
+ import * as ENGINE from '@directivegames/genesys.js';
2
2
  import * as THREE from 'three';
3
3
 
4
4
  export class ManifoldDemo extends ENGINE.BaseGameLoop {
@@ -1,5 +1,5 @@
1
+ import * as ENGINE from '@directivegames/genesys.js';
1
2
  import * as dat from 'dat.gui';
2
- import * as ENGINE from 'genesys.js';
3
3
  import * as THREE from 'three';
4
4
 
5
5
 
@@ -1,4 +1,4 @@
1
- import * as ENGINE from 'genesys.js';
1
+ import * as ENGINE from '@directivegames/genesys.js';
2
2
  import * as THREE from 'three';
3
3
  import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
4
4
  import * as SkeletonUtils from 'three/examples/jsm/utils/SkeletonUtils.js';
@@ -1,6 +1,6 @@
1
+ import * as ENGINE from '@directivegames/genesys.js';
2
+ import { ObjectOutlineEffect } from '@directivegames/genesys.js';
1
3
  import * as dat from 'dat.gui';
2
- import * as ENGINE from 'genesys.js';
3
- import { ObjectOutlineEffect } from 'genesys.js';
4
4
  import * as THREE from 'three';
5
5
 
6
6
  /**
@@ -14,7 +14,7 @@
14
14
  * - F: Apply random force to character (when ragdoll is active)
15
15
  */
16
16
 
17
- import * as ENGINE from 'genesys.js';
17
+ import * as ENGINE from '@directivegames/genesys.js';
18
18
  import * as THREE from 'three';
19
19
 
20
20
 
@@ -15,7 +15,7 @@
15
15
  * - F: Apply random force to character (when ragdoll is active)
16
16
  */
17
17
 
18
- import * as ENGINE from 'genesys.js';
18
+ import * as ENGINE from '@directivegames/genesys.js';
19
19
  import * as THREE from 'three';
20
20
 
21
21
 
@@ -1,4 +1,4 @@
1
- import * as ENGINE from 'genesys.js';
1
+ import * as ENGINE from '@directivegames/genesys.js';
2
2
  import * as THREE from 'three';
3
3
 
4
4
  /**
@@ -1,5 +1,5 @@
1
+ import * as ENGINE from '@directivegames/genesys.js';
1
2
  import * as TWEEN from '@tweenjs/tween.js';
2
- import * as ENGINE from 'genesys.js';
3
3
  import * as THREE from 'three';
4
4
 
5
5
  /**
package/games/ui-demo.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as ENGINE from 'genesys.js';
1
+ import * as ENGINE from '@directivegames/genesys.js';
2
2
  import * as THREE from 'three';
3
3
 
4
4
 
package/games/vfx-demo.ts CHANGED
@@ -1,5 +1,5 @@
1
+ import * as ENGINE from '@directivegames/genesys.js';
1
2
  import * as dat from 'dat.gui';
2
- import * as ENGINE from 'genesys.js';
3
3
  import * as THREE from 'three';
4
4
 
5
5
 
@@ -1,4 +1,4 @@
1
- import * as ENGINE from 'genesys.js';
1
+ import * as ENGINE from '@directivegames/genesys.js';
2
2
  import * as THREE from 'three';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import * as ENGINE from 'genesys.js';
1
+ import * as ENGINE from '@directivegames/genesys.js';
2
2
  import * as THREE from 'three';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import * as ENGINE from 'genesys.js';
1
+ import * as ENGINE from '@directivegames/genesys.js';
2
2
  import * as THREE from 'three';
3
3
 
4
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@directivegames/genesys.js",
3
- "version": "3.1.24",
3
+ "version": "3.1.25",
4
4
  "description": "Mini game engine built on top of three.js",
5
5
  "license": "UNLICENSED",
6
6
  "main": "./dist/src/index.js",
@@ -6,7 +6,7 @@ import { generateClassTemplate } from '../src/world-commands/generate-code.js';
6
6
 
7
7
  function fixUpTemplate(template: string): string {
8
8
  return template
9
- .replace('genesys.js', '../index.js') // fix import path
9
+ .replace('@directivegames/genesys.js', '../index.js') // fix import path
10
10
  .replace('@ENGINE.GameClass()', '// @ENGINE.GameClass()'); // skip registering as that's not really needed
11
11
  }
12
12
 
package/src/global.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- // src/env.d.ts
2
-
3
- /// <reference types="vite/client" />
4
-
5
- interface ImportMetaEnv {
6
- readonly [key: string]: any;
7
- }
8
-
9
- interface ImportMeta {
10
- readonly env: ImportMetaEnv;
11
- }
1
+ // src/env.d.ts
2
+
3
+ /// <reference types="vite/client" />
4
+
5
+ interface ImportMetaEnv {
6
+ readonly [key: string]: any;
7
+ }
8
+
9
+ interface ImportMeta {
10
+ readonly env: ImportMetaEnv;
11
+ }
@@ -1,202 +1,202 @@
1
- import type * as THREE from 'three';
2
-
3
- type NetTransform = {
4
- position: THREE.Vector3;
5
- rotation: THREE.Quaternion;
6
- scale: THREE.Vector3;
7
- };
8
-
9
- type TimedTransform = NetTransform & {
10
- timestamp: number;
11
- };
12
-
13
- export class NetMovementPredictor {
14
- public static PredictionEnabled: boolean = true;
15
- public static LerpAlpha: number = 0.1;
16
- private remoteBuffer: TimedTransform[] = [];
17
- private localBuffer: TimedTransform[] = [];
18
- constructor(private maxCachedFrames: number = 100) {}
19
-
20
- public static currentTime(): number {
21
- return Date.now();
22
- }
23
-
24
- /*
25
- * Returns current * (1 - alpha) + desired * alpha
26
- */
27
- public static lerpTransform(current: NetTransform, desired: NetTransform, alpha: number = NetMovementPredictor.LerpAlpha): NetTransform {
28
- return {
29
- position: current.position.clone().lerp(desired.position, alpha),
30
- rotation: current.rotation.clone().slerp(desired.rotation, alpha),
31
- scale: current.scale.clone().lerp(desired.scale, alpha),
32
- };
33
- }
34
-
35
- public addRemoteTransform(transform: TimedTransform): void {
36
- this.remoteBuffer.push(transform);
37
- if (this.remoteBuffer.length > this.maxCachedFrames) {
38
- this.remoteBuffer.shift();
39
- }
40
- }
41
-
42
- public addLocalTransform(transform: TimedTransform): void {
43
- this.localBuffer.push(transform);
44
- if (this.localBuffer.length > this.maxCachedFrames) {
45
- this.localBuffer.shift();
46
- }
47
- }
48
-
49
- // Interpolates/extrapolates the local buffer to find the transform at a given timestamp
50
- private getLocalAtTimestamp(targetTimestamp: number): TimedTransform | null {
51
- const buf = this.localBuffer;
52
- if (buf.length === 0) return null;
53
- if (targetTimestamp <= buf[0].timestamp) return buf[0];
54
- if (targetTimestamp >= buf[buf.length - 1].timestamp) return buf[buf.length - 1];
55
- for (let i = 0; i < buf.length - 1; ++i) {
56
- const a = buf[i], b = buf[i + 1];
57
- if (targetTimestamp >= a.timestamp && targetTimestamp <= b.timestamp) {
58
- const t = (targetTimestamp - a.timestamp) / (b.timestamp - a.timestamp);
59
- return {
60
- timestamp: targetTimestamp,
61
- position: a.position.clone().lerp(b.position, t),
62
- rotation: a.rotation.clone().slerp(b.rotation, t),
63
- scale: a.scale.clone().lerp(b.scale, t),
64
- };
65
- }
66
- }
67
- return buf[buf.length - 1];
68
- }
69
-
70
- public predictCurrentTransform(): {
71
- position: THREE.Vector3,
72
- rotation: THREE.Quaternion,
73
- scale: THREE.Vector3
74
- } | null {
75
- if (this.remoteBuffer.length === 0 || this.localBuffer.length === 0) {
76
- return null;
77
- }
78
-
79
- if (!NetMovementPredictor.PredictionEnabled) {
80
- return this.remoteBuffer[this.remoteBuffer.length - 1];
81
- }
82
-
83
- const latestRemote = this.remoteBuffer[this.remoteBuffer.length - 1];
84
- const latestLocal = this.localBuffer[this.localBuffer.length - 1];
85
- const clockDiff = latestLocal.timestamp - latestRemote.timestamp;
86
-
87
- // 1. Target local timestamp that matches latest remote, shifted by clock diff
88
- const localAnchorTime = latestRemote.timestamp + clockDiff;
89
-
90
- // 2. Interpolate/extrapolate local buffer to get transform at that anchor time
91
- const localAtAnchor = this.getLocalAtTimestamp(localAnchorTime);
92
- if (!localAtAnchor) {
93
- // Should not happen, fallback to latest local
94
- return {
95
- position: latestLocal.position.clone(),
96
- rotation: latestLocal.rotation.clone(),
97
- scale: latestLocal.scale.clone(),
98
- };
99
- }
100
-
101
- // 3. Calculate local movement since anchor
102
- const deltaPos = latestLocal.position.clone().sub(localAtAnchor.position);
103
- const deltaRot = latestLocal.rotation.clone().multiply(localAtAnchor.rotation.clone().invert());
104
- const deltaScale = latestLocal.scale.clone().divide(localAtAnchor.scale);
105
-
106
- // 4. Apply delta to latest remote
107
- return {
108
- position: latestRemote.position.clone().add(deltaPos),
109
- rotation: latestRemote.rotation.clone().multiply(deltaRot),
110
- scale: latestRemote.scale.clone().multiply(deltaScale),
111
- };
112
- }
113
- }
114
-
115
- /*
116
- export class NetMovementPredictor {
117
- private remoteBuffer: TimedTransform[] = [];
118
- private localBuffer: TimedTransform[] = [];
119
- constructor(private maxCachedFrames: number = 100) {}
120
-
121
- public static currentTime(): number {
122
- return Date.now();
123
- }
124
-
125
- public addRemoteTransform(transform: TimedTransform): void {
126
- this.remoteBuffer.push(transform);
127
- if (this.remoteBuffer.length > this.maxCachedFrames) {
128
- this.remoteBuffer.shift();
129
- }
130
- }
131
-
132
- public addLocalTransform(transform: TimedTransform): void {
133
- this.localBuffer.push(transform);
134
- if (this.localBuffer.length > this.maxCachedFrames) {
135
- this.localBuffer.shift();
136
- }
137
- }
138
-
139
- public predictCurrentTransform(): {
140
- position: THREE.Vector3,
141
- rotation: THREE.Quaternion,
142
- scale: THREE.Vector3
143
- } | null {
144
- if (this.remoteBuffer.length === 0 || this.localBuffer.length === 0) {
145
- return null;
146
- }
147
-
148
- const latestRemote = this.remoteBuffer[this.remoteBuffer.length - 1];
149
- const latestLocal = this.localBuffer[this.localBuffer.length - 1];
150
- const clockDiff = latestLocal.timestamp - latestRemote.timestamp;
151
-
152
- // Walk both buffers, find best pair with (local.timestamp - remote.timestamp) closest to clockDiff
153
- let localIdx = 0;
154
- let bestPair: { remote: TimedTransform; local: TimedTransform } | null = null;
155
- let minAbsDiff = Number.POSITIVE_INFINITY;
156
-
157
- for (let remoteIdx = 0; remoteIdx < this.remoteBuffer.length; remoteIdx++) {
158
- const remote = this.remoteBuffer[remoteIdx];
159
- const idealLocalTimestamp = remote.timestamp + clockDiff;
160
-
161
- // Advance localIdx until local.timestamp >= remote.timestamp + clockDiff, or end of buffer
162
- while (
163
- localIdx + 1 < this.localBuffer.length &&
164
- this.localBuffer[localIdx + 1].timestamp <= idealLocalTimestamp
165
- ) {
166
- localIdx++;
167
- }
168
-
169
- // Check current local
170
- const local = this.localBuffer[localIdx];
171
- const absDiff = Math.abs(local.timestamp - idealLocalTimestamp);
172
- if (absDiff < minAbsDiff) {
173
- minAbsDiff = absDiff;
174
- bestPair = { remote, local };
175
- }
176
-
177
- if (localIdx + 1 < this.localBuffer.length) {
178
- const nextLocal = this.localBuffer[localIdx + 1];
179
- const nextAbsDiff = Math.abs(nextLocal.timestamp - idealLocalTimestamp);
180
- if (nextAbsDiff < minAbsDiff) {
181
- minAbsDiff = nextAbsDiff;
182
- bestPair = { remote, local: nextLocal };
183
- }
184
- }
185
- }
186
-
187
- if (!bestPair) {
188
- return null;
189
- }
190
-
191
- const deltaPos = bestPair.local.position.clone().sub(bestPair.remote.position);
192
- const deltaRot = bestPair.local.rotation.clone().multiply(bestPair.remote.rotation.clone().invert());
193
- const deltaScale = bestPair.local.scale.clone().divide(bestPair.remote.scale);
194
-
195
- return {
196
- position: latestRemote.position.clone().add(deltaPos),
197
- rotation: latestRemote.rotation.clone().multiply(deltaRot),
198
- scale: latestRemote.scale.clone().multiply(deltaScale),
199
- };
200
- }
201
- }
202
- */
1
+ import type * as THREE from 'three';
2
+
3
+ type NetTransform = {
4
+ position: THREE.Vector3;
5
+ rotation: THREE.Quaternion;
6
+ scale: THREE.Vector3;
7
+ };
8
+
9
+ type TimedTransform = NetTransform & {
10
+ timestamp: number;
11
+ };
12
+
13
+ export class NetMovementPredictor {
14
+ public static PredictionEnabled: boolean = true;
15
+ public static LerpAlpha: number = 0.1;
16
+ private remoteBuffer: TimedTransform[] = [];
17
+ private localBuffer: TimedTransform[] = [];
18
+ constructor(private maxCachedFrames: number = 100) {}
19
+
20
+ public static currentTime(): number {
21
+ return Date.now();
22
+ }
23
+
24
+ /*
25
+ * Returns current * (1 - alpha) + desired * alpha
26
+ */
27
+ public static lerpTransform(current: NetTransform, desired: NetTransform, alpha: number = NetMovementPredictor.LerpAlpha): NetTransform {
28
+ return {
29
+ position: current.position.clone().lerp(desired.position, alpha),
30
+ rotation: current.rotation.clone().slerp(desired.rotation, alpha),
31
+ scale: current.scale.clone().lerp(desired.scale, alpha),
32
+ };
33
+ }
34
+
35
+ public addRemoteTransform(transform: TimedTransform): void {
36
+ this.remoteBuffer.push(transform);
37
+ if (this.remoteBuffer.length > this.maxCachedFrames) {
38
+ this.remoteBuffer.shift();
39
+ }
40
+ }
41
+
42
+ public addLocalTransform(transform: TimedTransform): void {
43
+ this.localBuffer.push(transform);
44
+ if (this.localBuffer.length > this.maxCachedFrames) {
45
+ this.localBuffer.shift();
46
+ }
47
+ }
48
+
49
+ // Interpolates/extrapolates the local buffer to find the transform at a given timestamp
50
+ private getLocalAtTimestamp(targetTimestamp: number): TimedTransform | null {
51
+ const buf = this.localBuffer;
52
+ if (buf.length === 0) return null;
53
+ if (targetTimestamp <= buf[0].timestamp) return buf[0];
54
+ if (targetTimestamp >= buf[buf.length - 1].timestamp) return buf[buf.length - 1];
55
+ for (let i = 0; i < buf.length - 1; ++i) {
56
+ const a = buf[i], b = buf[i + 1];
57
+ if (targetTimestamp >= a.timestamp && targetTimestamp <= b.timestamp) {
58
+ const t = (targetTimestamp - a.timestamp) / (b.timestamp - a.timestamp);
59
+ return {
60
+ timestamp: targetTimestamp,
61
+ position: a.position.clone().lerp(b.position, t),
62
+ rotation: a.rotation.clone().slerp(b.rotation, t),
63
+ scale: a.scale.clone().lerp(b.scale, t),
64
+ };
65
+ }
66
+ }
67
+ return buf[buf.length - 1];
68
+ }
69
+
70
+ public predictCurrentTransform(): {
71
+ position: THREE.Vector3,
72
+ rotation: THREE.Quaternion,
73
+ scale: THREE.Vector3
74
+ } | null {
75
+ if (this.remoteBuffer.length === 0 || this.localBuffer.length === 0) {
76
+ return null;
77
+ }
78
+
79
+ if (!NetMovementPredictor.PredictionEnabled) {
80
+ return this.remoteBuffer[this.remoteBuffer.length - 1];
81
+ }
82
+
83
+ const latestRemote = this.remoteBuffer[this.remoteBuffer.length - 1];
84
+ const latestLocal = this.localBuffer[this.localBuffer.length - 1];
85
+ const clockDiff = latestLocal.timestamp - latestRemote.timestamp;
86
+
87
+ // 1. Target local timestamp that matches latest remote, shifted by clock diff
88
+ const localAnchorTime = latestRemote.timestamp + clockDiff;
89
+
90
+ // 2. Interpolate/extrapolate local buffer to get transform at that anchor time
91
+ const localAtAnchor = this.getLocalAtTimestamp(localAnchorTime);
92
+ if (!localAtAnchor) {
93
+ // Should not happen, fallback to latest local
94
+ return {
95
+ position: latestLocal.position.clone(),
96
+ rotation: latestLocal.rotation.clone(),
97
+ scale: latestLocal.scale.clone(),
98
+ };
99
+ }
100
+
101
+ // 3. Calculate local movement since anchor
102
+ const deltaPos = latestLocal.position.clone().sub(localAtAnchor.position);
103
+ const deltaRot = latestLocal.rotation.clone().multiply(localAtAnchor.rotation.clone().invert());
104
+ const deltaScale = latestLocal.scale.clone().divide(localAtAnchor.scale);
105
+
106
+ // 4. Apply delta to latest remote
107
+ return {
108
+ position: latestRemote.position.clone().add(deltaPos),
109
+ rotation: latestRemote.rotation.clone().multiply(deltaRot),
110
+ scale: latestRemote.scale.clone().multiply(deltaScale),
111
+ };
112
+ }
113
+ }
114
+
115
+ /*
116
+ export class NetMovementPredictor {
117
+ private remoteBuffer: TimedTransform[] = [];
118
+ private localBuffer: TimedTransform[] = [];
119
+ constructor(private maxCachedFrames: number = 100) {}
120
+
121
+ public static currentTime(): number {
122
+ return Date.now();
123
+ }
124
+
125
+ public addRemoteTransform(transform: TimedTransform): void {
126
+ this.remoteBuffer.push(transform);
127
+ if (this.remoteBuffer.length > this.maxCachedFrames) {
128
+ this.remoteBuffer.shift();
129
+ }
130
+ }
131
+
132
+ public addLocalTransform(transform: TimedTransform): void {
133
+ this.localBuffer.push(transform);
134
+ if (this.localBuffer.length > this.maxCachedFrames) {
135
+ this.localBuffer.shift();
136
+ }
137
+ }
138
+
139
+ public predictCurrentTransform(): {
140
+ position: THREE.Vector3,
141
+ rotation: THREE.Quaternion,
142
+ scale: THREE.Vector3
143
+ } | null {
144
+ if (this.remoteBuffer.length === 0 || this.localBuffer.length === 0) {
145
+ return null;
146
+ }
147
+
148
+ const latestRemote = this.remoteBuffer[this.remoteBuffer.length - 1];
149
+ const latestLocal = this.localBuffer[this.localBuffer.length - 1];
150
+ const clockDiff = latestLocal.timestamp - latestRemote.timestamp;
151
+
152
+ // Walk both buffers, find best pair with (local.timestamp - remote.timestamp) closest to clockDiff
153
+ let localIdx = 0;
154
+ let bestPair: { remote: TimedTransform; local: TimedTransform } | null = null;
155
+ let minAbsDiff = Number.POSITIVE_INFINITY;
156
+
157
+ for (let remoteIdx = 0; remoteIdx < this.remoteBuffer.length; remoteIdx++) {
158
+ const remote = this.remoteBuffer[remoteIdx];
159
+ const idealLocalTimestamp = remote.timestamp + clockDiff;
160
+
161
+ // Advance localIdx until local.timestamp >= remote.timestamp + clockDiff, or end of buffer
162
+ while (
163
+ localIdx + 1 < this.localBuffer.length &&
164
+ this.localBuffer[localIdx + 1].timestamp <= idealLocalTimestamp
165
+ ) {
166
+ localIdx++;
167
+ }
168
+
169
+ // Check current local
170
+ const local = this.localBuffer[localIdx];
171
+ const absDiff = Math.abs(local.timestamp - idealLocalTimestamp);
172
+ if (absDiff < minAbsDiff) {
173
+ minAbsDiff = absDiff;
174
+ bestPair = { remote, local };
175
+ }
176
+
177
+ if (localIdx + 1 < this.localBuffer.length) {
178
+ const nextLocal = this.localBuffer[localIdx + 1];
179
+ const nextAbsDiff = Math.abs(nextLocal.timestamp - idealLocalTimestamp);
180
+ if (nextAbsDiff < minAbsDiff) {
181
+ minAbsDiff = nextAbsDiff;
182
+ bestPair = { remote, local: nextLocal };
183
+ }
184
+ }
185
+ }
186
+
187
+ if (!bestPair) {
188
+ return null;
189
+ }
190
+
191
+ const deltaPos = bestPair.local.position.clone().sub(bestPair.remote.position);
192
+ const deltaRot = bestPair.local.rotation.clone().multiply(bestPair.remote.rotation.clone().invert());
193
+ const deltaScale = bestPair.local.scale.clone().divide(bestPair.remote.scale);
194
+
195
+ return {
196
+ position: latestRemote.position.clone().add(deltaPos),
197
+ rotation: latestRemote.rotation.clone().multiply(deltaRot),
198
+ scale: latestRemote.scale.clone().multiply(deltaScale),
199
+ };
200
+ }
201
+ }
202
+ */