@directivegames/genesys.sdk 3.2.2 → 3.2.4

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 (82) hide show
  1. package/README.md +60 -60
  2. package/dist/src/core/cli.js +22 -22
  3. package/dist/src/templates/scripts/genesys/genesys-mcp.js +25 -25
  4. package/dist/src/templates/scripts/genesys/mcp/editor-functions.js +4 -4
  5. package/dist/src/templates/src/templates/vehicle/src/ui-hints.js +30 -30
  6. package/package.json +176 -176
  7. package/scripts/post-install.ts +143 -143
  8. package/src/asset-pack/.gitattributes +88 -88
  9. package/src/asset-pack/eslint.config.js +45 -45
  10. package/src/asset-pack/gitignore +11 -11
  11. package/src/asset-pack/scripts/postinstall.ts +81 -81
  12. package/src/asset-pack/tsconfig.json +33 -33
  13. package/src/templates/.cursor/mcp.json +20 -20
  14. package/src/templates/.cursorignore +2 -2
  15. package/src/templates/.gitattributes +88 -88
  16. package/src/templates/.vscode/settings.json +6 -6
  17. package/src/templates/AGENTS.md +86 -86
  18. package/src/templates/README.md +24 -24
  19. package/src/templates/eslint.config.js +45 -45
  20. package/src/templates/gitignore +11 -11
  21. package/src/templates/index.html +34 -34
  22. package/src/templates/pnpm-lock.yaml +3676 -3676
  23. package/src/templates/scripts/genesys/build-project.ts +51 -51
  24. package/src/templates/scripts/genesys/calc-bounding-box.ts +272 -272
  25. package/src/templates/scripts/genesys/common.ts +46 -46
  26. package/src/templates/scripts/genesys/const.ts +9 -9
  27. package/src/templates/scripts/genesys/dev/dump-default-scene.ts +11 -11
  28. package/src/templates/scripts/genesys/dev/generate-manifest.ts +146 -146
  29. package/src/templates/scripts/genesys/dev/launcher.ts +46 -46
  30. package/src/templates/scripts/genesys/dev/storage-provider.ts +229 -229
  31. package/src/templates/scripts/genesys/dev/update-template-scenes.ts +84 -84
  32. package/src/templates/scripts/genesys/doc-server.ts +16 -16
  33. package/src/templates/scripts/genesys/genesys-mcp.ts +526 -526
  34. package/src/templates/scripts/genesys/mcp/doc-tools.ts +86 -86
  35. package/src/templates/scripts/genesys/mcp/editor-functions.ts +151 -151
  36. package/src/templates/scripts/genesys/mcp/editor-tools.ts +73 -73
  37. package/src/templates/scripts/genesys/mcp/get-scene-state.ts +35 -35
  38. package/src/templates/scripts/genesys/mcp/run-subprocess.ts +30 -30
  39. package/src/templates/scripts/genesys/mcp/search-actors.ts +858 -858
  40. package/src/templates/scripts/genesys/mcp/search-assets.ts +380 -380
  41. package/src/templates/scripts/genesys/mcp/utils.ts +281 -281
  42. package/src/templates/scripts/genesys/misc.ts +42 -42
  43. package/src/templates/scripts/genesys/mock.ts +6 -6
  44. package/src/templates/scripts/genesys/place-actors.ts +179 -179
  45. package/src/templates/scripts/genesys/post-install.ts +30 -30
  46. package/src/templates/scripts/genesys/prefab.schema.json +84 -84
  47. package/src/templates/scripts/genesys/remove-engine-comments.ts +134 -134
  48. package/src/templates/scripts/genesys/run-mcp-inspector.bat +4 -4
  49. package/src/templates/scripts/genesys/storageProvider.ts +182 -182
  50. package/src/templates/scripts/genesys/validate-prefabs.ts +138 -138
  51. package/src/templates/src/index.ts +22 -22
  52. package/src/templates/src/templates/firstPerson/assets/default.genesys-scene +165 -165
  53. package/src/templates/src/templates/firstPerson/src/game.ts +39 -39
  54. package/src/templates/src/templates/firstPerson/src/player.ts +63 -63
  55. package/src/templates/src/templates/fps/assets/default.genesys-scene +9459 -9459
  56. package/src/templates/src/templates/fps/src/game.ts +39 -39
  57. package/src/templates/src/templates/fps/src/player.ts +69 -69
  58. package/src/templates/src/templates/fps/src/weapon.ts +54 -54
  59. package/src/templates/src/templates/freeCamera/assets/default.genesys-scene +165 -165
  60. package/src/templates/src/templates/freeCamera/src/game.ts +39 -39
  61. package/src/templates/src/templates/freeCamera/src/player.ts +45 -45
  62. package/src/templates/src/templates/sideScroller/assets/default.genesys-scene +121 -121
  63. package/src/templates/src/templates/sideScroller/src/const.ts +45 -45
  64. package/src/templates/src/templates/sideScroller/src/game.ts +122 -122
  65. package/src/templates/src/templates/sideScroller/src/level-generator.ts +361 -361
  66. package/src/templates/src/templates/sideScroller/src/player.ts +125 -125
  67. package/src/templates/src/templates/thirdPerson/assets/default.genesys-scene +165 -165
  68. package/src/templates/src/templates/thirdPerson/src/game.ts +39 -39
  69. package/src/templates/src/templates/thirdPerson/src/player.ts +61 -61
  70. package/src/templates/src/templates/vehicle/assets/default.genesys-scene +225 -225
  71. package/src/templates/src/templates/vehicle/src/base-vehicle.ts +145 -145
  72. package/src/templates/src/templates/vehicle/src/game.ts +43 -43
  73. package/src/templates/src/templates/vehicle/src/mesh-vehicle.ts +191 -191
  74. package/src/templates/src/templates/vehicle/src/player.ts +109 -109
  75. package/src/templates/src/templates/vehicle/src/primitive-vehicle.ts +266 -266
  76. package/src/templates/src/templates/vehicle/src/ui-hints.ts +101 -101
  77. package/src/templates/src/templates/vr-game/assets/default.genesys-scene +246 -246
  78. package/src/templates/src/templates/vr-game/src/auto-imports.ts +1 -1
  79. package/src/templates/src/templates/vr-game/src/game.ts +66 -66
  80. package/src/templates/src/templates/vr-game/src/sample-vr-actor.ts +26 -26
  81. package/src/templates/tsconfig.json +34 -34
  82. package/src/templates/vite.config.ts +52 -52
@@ -1,122 +1,122 @@
1
-
2
- import * as ENGINE from 'genesys.js';
3
- import * as THREE from 'three';
4
- import './auto-imports.js';
5
-
6
- import { SideScrollerLevelGenerator } from './level-generator.js';
7
- import { SideScrollerPlayer } from './player.js';
8
-
9
- // ============================================================================
10
- // SIDE SCROLLER GAME
11
- // ============================================================================
12
-
13
- // A side-scroller game with animated character and infinite level generation
14
- class SideScrollerGame extends ENGINE.BaseGameLoop {
15
- private player: SideScrollerPlayer | null = null;
16
- private playerController: ENGINE.PlayerController | null = null;
17
- private levelGenerator: SideScrollerLevelGenerator | null = null;
18
-
19
- protected override createLoadingScreen(): ENGINE.ILoadingScreen | null {
20
- // enable the default loading screen
21
- return new ENGINE.DefaultLoadingScreen();
22
- }
23
-
24
- protected override async preStart(): Promise<void> {
25
- this.createLevel();
26
- this.createPlayer();
27
- }
28
-
29
- protected override tick(tickTime: ENGINE.TickTime): void {
30
- super.tick(tickTime);
31
-
32
- // Update level generation based on player position
33
- if (this.player && this.levelGenerator) {
34
- const playerPosition = this.player.getWorldPosition();
35
- this.levelGenerator.updateLevel(playerPosition.x);
36
- }
37
- }
38
-
39
- private createPlayer(): void {
40
- const spawnX = 1;
41
- // Create the side-scroller player with animated character
42
- this.player = new SideScrollerPlayer({
43
- position: new THREE.Vector3(spawnX, ENGINE.CHARACTER_HEIGHT / 2, 0),
44
- });
45
-
46
- // Create the controller and possess the player
47
- this.playerController = new ENGINE.PlayerController();
48
- this.playerController.possess(this.player);
49
-
50
- // Add both to the world
51
- this.world.addActors(this.player, this.playerController);
52
- this.setInitialPlayerPosition(spawnX);
53
- }
54
-
55
- /**
56
- * Sets the initial position of the player.
57
- * @param spawnX - The X coordinate to spawn the player at.
58
- */
59
- private setInitialPlayerPosition(spawnX: number): void {
60
- const groundHeight = this.findGroundHeightAtX(spawnX);
61
- if (groundHeight !== null) {
62
- this.player?.setWorldPosition(new THREE.Vector3(spawnX, groundHeight + ENGINE.CHARACTER_HEIGHT / 2, 0));
63
- } else {
64
- this.world.runInNextTick(() => {
65
- this.setInitialPlayerPosition(spawnX);
66
- });
67
- }
68
- }
69
-
70
- /**
71
- * Performs a hit test to find the ground height at a given X coordinate
72
- * @param x - The X coordinate to test
73
- * @returns The Y coordinate of the ground surface, or 0 if no ground is found
74
- */
75
- private findGroundHeightAtX(x: number): number | null {
76
- // Start from a high position and cast downward
77
- const rayOrigin = new THREE.Vector3(x, 50, 0);
78
- const rayDirection = new THREE.Vector3(0, -1, 0); // Downward
79
-
80
- const hitResults = this.world.getPhysicsEngine()?.performHitTest({
81
- origin: rayOrigin,
82
- direction: rayDirection,
83
- maxDistance: 100, // Cast ray down 100 units
84
- stopOnFirstHit: true,
85
- });
86
-
87
- if (hitResults && hitResults.length > 0) {
88
- // Return the Y coordinate of the hit location (top surface of ground)
89
- return hitResults[0].hitLocation.y;
90
- }
91
-
92
- return null;
93
- }
94
-
95
- private createLevel(): void {
96
- // Create the level generator
97
- this.levelGenerator = new SideScrollerLevelGenerator(this.world, {
98
- enableDebugVisualization: false,
99
- createGroundMesh: true
100
- });
101
-
102
- // Generate initial level chunks
103
- this.levelGenerator.updateLevel(0);
104
- }
105
-
106
- public override destroy(): void {
107
- // Clean up level generator
108
- if (this.levelGenerator) {
109
- this.levelGenerator.cleanup();
110
- this.levelGenerator = null;
111
- }
112
- super.destroy();
113
- }
114
- }
115
-
116
- export function main(container: HTMLElement, gameId: string): ENGINE.IGameLoop {
117
- const game = new SideScrollerGame(container, {
118
- ...ENGINE.BaseGameLoop.DEFAULT_OPTIONS,
119
- gameId
120
- });
121
- return game;
122
- }
1
+
2
+ import * as ENGINE from 'genesys.js';
3
+ import * as THREE from 'three';
4
+ import './auto-imports.js';
5
+
6
+ import { SideScrollerLevelGenerator } from './level-generator.js';
7
+ import { SideScrollerPlayer } from './player.js';
8
+
9
+ // ============================================================================
10
+ // SIDE SCROLLER GAME
11
+ // ============================================================================
12
+
13
+ // A side-scroller game with animated character and infinite level generation
14
+ class SideScrollerGame extends ENGINE.BaseGameLoop {
15
+ private player: SideScrollerPlayer | null = null;
16
+ private playerController: ENGINE.PlayerController | null = null;
17
+ private levelGenerator: SideScrollerLevelGenerator | null = null;
18
+
19
+ protected override createLoadingScreen(): ENGINE.ILoadingScreen | null {
20
+ // enable the default loading screen
21
+ return new ENGINE.DefaultLoadingScreen();
22
+ }
23
+
24
+ protected override async preStart(): Promise<void> {
25
+ this.createLevel();
26
+ this.createPlayer();
27
+ }
28
+
29
+ protected override tick(tickTime: ENGINE.TickTime): void {
30
+ super.tick(tickTime);
31
+
32
+ // Update level generation based on player position
33
+ if (this.player && this.levelGenerator) {
34
+ const playerPosition = this.player.getWorldPosition();
35
+ this.levelGenerator.updateLevel(playerPosition.x);
36
+ }
37
+ }
38
+
39
+ private createPlayer(): void {
40
+ const spawnX = 1;
41
+ // Create the side-scroller player with animated character
42
+ this.player = new SideScrollerPlayer({
43
+ position: new THREE.Vector3(spawnX, ENGINE.CHARACTER_HEIGHT / 2, 0),
44
+ });
45
+
46
+ // Create the controller and possess the player
47
+ this.playerController = new ENGINE.PlayerController();
48
+ this.playerController.possess(this.player);
49
+
50
+ // Add both to the world
51
+ this.world.addActors(this.player, this.playerController);
52
+ this.setInitialPlayerPosition(spawnX);
53
+ }
54
+
55
+ /**
56
+ * Sets the initial position of the player.
57
+ * @param spawnX - The X coordinate to spawn the player at.
58
+ */
59
+ private setInitialPlayerPosition(spawnX: number): void {
60
+ const groundHeight = this.findGroundHeightAtX(spawnX);
61
+ if (groundHeight !== null) {
62
+ this.player?.setWorldPosition(new THREE.Vector3(spawnX, groundHeight + ENGINE.CHARACTER_HEIGHT / 2, 0));
63
+ } else {
64
+ this.world.runInNextTick(() => {
65
+ this.setInitialPlayerPosition(spawnX);
66
+ });
67
+ }
68
+ }
69
+
70
+ /**
71
+ * Performs a hit test to find the ground height at a given X coordinate
72
+ * @param x - The X coordinate to test
73
+ * @returns The Y coordinate of the ground surface, or 0 if no ground is found
74
+ */
75
+ private findGroundHeightAtX(x: number): number | null {
76
+ // Start from a high position and cast downward
77
+ const rayOrigin = new THREE.Vector3(x, 50, 0);
78
+ const rayDirection = new THREE.Vector3(0, -1, 0); // Downward
79
+
80
+ const hitResults = this.world.getPhysicsEngine()?.performHitTest({
81
+ origin: rayOrigin,
82
+ direction: rayDirection,
83
+ maxDistance: 100, // Cast ray down 100 units
84
+ stopOnFirstHit: true,
85
+ });
86
+
87
+ if (hitResults && hitResults.length > 0) {
88
+ // Return the Y coordinate of the hit location (top surface of ground)
89
+ return hitResults[0].hitLocation.y;
90
+ }
91
+
92
+ return null;
93
+ }
94
+
95
+ private createLevel(): void {
96
+ // Create the level generator
97
+ this.levelGenerator = new SideScrollerLevelGenerator(this.world, {
98
+ enableDebugVisualization: false,
99
+ createGroundMesh: true
100
+ });
101
+
102
+ // Generate initial level chunks
103
+ this.levelGenerator.updateLevel(0);
104
+ }
105
+
106
+ public override destroy(): void {
107
+ // Clean up level generator
108
+ if (this.levelGenerator) {
109
+ this.levelGenerator.cleanup();
110
+ this.levelGenerator = null;
111
+ }
112
+ super.destroy();
113
+ }
114
+ }
115
+
116
+ export function main(container: HTMLElement, gameId: string): ENGINE.IGameLoop {
117
+ const game = new SideScrollerGame(container, {
118
+ ...ENGINE.BaseGameLoop.DEFAULT_OPTIONS,
119
+ gameId
120
+ });
121
+ return game;
122
+ }