@directivegames/genesys.sdk 3.2.2

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 (181) hide show
  1. package/README.md +60 -0
  2. package/dist/src/asset-pack/eslint.config.js +43 -0
  3. package/dist/src/asset-pack/scripts/postinstall.js +64 -0
  4. package/dist/src/asset-pack/src/index.js +1 -0
  5. package/dist/src/core/cli.js +306 -0
  6. package/dist/src/core/common.js +324 -0
  7. package/dist/src/core/index.js +6 -0
  8. package/dist/src/core/tools/build-project.js +450 -0
  9. package/dist/src/core/tools/index.js +2 -0
  10. package/dist/src/core/tools/new-asset-pack.js +150 -0
  11. package/dist/src/core/tools/new-project.js +292 -0
  12. package/dist/src/core/types.js +1 -0
  13. package/dist/src/dependencies.js +82 -0
  14. package/dist/src/electron/IpcSerializableError.js +38 -0
  15. package/dist/src/electron/api.js +7 -0
  16. package/dist/src/electron/backend/actions.js +56 -0
  17. package/dist/src/electron/backend/handler.js +441 -0
  18. package/dist/src/electron/backend/logging.js +41 -0
  19. package/dist/src/electron/backend/main.js +315 -0
  20. package/dist/src/electron/backend/menu.js +208 -0
  21. package/dist/src/electron/backend/state.js +201 -0
  22. package/dist/src/electron/backend/tools/const.js +9 -0
  23. package/dist/src/electron/backend/tools/file-server.js +383 -0
  24. package/dist/src/electron/backend/tools/open-project.js +261 -0
  25. package/dist/src/electron/backend/window.js +161 -0
  26. package/dist/src/templates/eslint.config.js +43 -0
  27. package/dist/src/templates/scripts/genesys/build-project.js +42 -0
  28. package/dist/src/templates/scripts/genesys/calc-bounding-box.js +205 -0
  29. package/dist/src/templates/scripts/genesys/common.js +36 -0
  30. package/dist/src/templates/scripts/genesys/const.js +9 -0
  31. package/dist/src/templates/scripts/genesys/dev/dump-default-scene.js +8 -0
  32. package/dist/src/templates/scripts/genesys/dev/generate-manifest.js +116 -0
  33. package/dist/src/templates/scripts/genesys/dev/launcher.js +39 -0
  34. package/dist/src/templates/scripts/genesys/dev/storage-provider.js +188 -0
  35. package/dist/src/templates/scripts/genesys/dev/update-template-scenes.js +67 -0
  36. package/dist/src/templates/scripts/genesys/doc-server.js +12 -0
  37. package/dist/src/templates/scripts/genesys/genesys-mcp.js +413 -0
  38. package/dist/src/templates/scripts/genesys/mcp/doc-tools.js +70 -0
  39. package/dist/src/templates/scripts/genesys/mcp/editor-functions.js +123 -0
  40. package/dist/src/templates/scripts/genesys/mcp/editor-tools.js +51 -0
  41. package/dist/src/templates/scripts/genesys/mcp/get-scene-state.js +26 -0
  42. package/dist/src/templates/scripts/genesys/mcp/run-subprocess.js +23 -0
  43. package/dist/src/templates/scripts/genesys/mcp/search-actors.js +703 -0
  44. package/dist/src/templates/scripts/genesys/mcp/search-assets.js +296 -0
  45. package/dist/src/templates/scripts/genesys/mcp/utils.js +234 -0
  46. package/dist/src/templates/scripts/genesys/misc.js +32 -0
  47. package/dist/src/templates/scripts/genesys/mock.js +5 -0
  48. package/dist/src/templates/scripts/genesys/place-actors.js +112 -0
  49. package/dist/src/templates/scripts/genesys/post-install.js +25 -0
  50. package/dist/src/templates/scripts/genesys/remove-engine-comments.js +113 -0
  51. package/dist/src/templates/scripts/genesys/storageProvider.js +146 -0
  52. package/dist/src/templates/scripts/genesys/validate-prefabs.js +115 -0
  53. package/dist/src/templates/src/index.js +20 -0
  54. package/dist/src/templates/src/templates/firstPerson/src/auto-imports.js +1 -0
  55. package/dist/src/templates/src/templates/firstPerson/src/game.js +30 -0
  56. package/dist/src/templates/src/templates/firstPerson/src/player.js +60 -0
  57. package/dist/src/templates/src/templates/fps/src/auto-imports.js +1 -0
  58. package/dist/src/templates/src/templates/fps/src/game.js +30 -0
  59. package/dist/src/templates/src/templates/fps/src/player.js +64 -0
  60. package/dist/src/templates/src/templates/fps/src/weapon.js +62 -0
  61. package/dist/src/templates/src/templates/freeCamera/src/auto-imports.js +1 -0
  62. package/dist/src/templates/src/templates/freeCamera/src/game.js +30 -0
  63. package/dist/src/templates/src/templates/freeCamera/src/player.js +43 -0
  64. package/dist/src/templates/src/templates/sideScroller/src/auto-imports.js +1 -0
  65. package/dist/src/templates/src/templates/sideScroller/src/const.js +43 -0
  66. package/dist/src/templates/src/templates/sideScroller/src/game.js +103 -0
  67. package/dist/src/templates/src/templates/sideScroller/src/level-generator.js +249 -0
  68. package/dist/src/templates/src/templates/sideScroller/src/player.js +105 -0
  69. package/dist/src/templates/src/templates/thirdPerson/src/auto-imports.js +1 -0
  70. package/dist/src/templates/src/templates/thirdPerson/src/game.js +30 -0
  71. package/dist/src/templates/src/templates/thirdPerson/src/player.js +63 -0
  72. package/dist/src/templates/src/templates/vehicle/src/auto-imports.js +1 -0
  73. package/dist/src/templates/src/templates/vehicle/src/base-vehicle.js +122 -0
  74. package/dist/src/templates/src/templates/vehicle/src/game.js +33 -0
  75. package/dist/src/templates/src/templates/vehicle/src/mesh-vehicle.js +189 -0
  76. package/dist/src/templates/src/templates/vehicle/src/player.js +102 -0
  77. package/dist/src/templates/src/templates/vehicle/src/primitive-vehicle.js +259 -0
  78. package/dist/src/templates/src/templates/vehicle/src/ui-hints.js +100 -0
  79. package/dist/src/templates/src/templates/vr-game/src/auto-imports.js +1 -0
  80. package/dist/src/templates/src/templates/vr-game/src/game.js +55 -0
  81. package/dist/src/templates/src/templates/vr-game/src/sample-vr-actor.js +29 -0
  82. package/dist/src/templates/vite.config.js +46 -0
  83. package/package.json +176 -0
  84. package/scripts/post-install.ts +143 -0
  85. package/src/asset-pack/.gitattributes +89 -0
  86. package/src/asset-pack/eslint.config.js +45 -0
  87. package/src/asset-pack/gitignore +11 -0
  88. package/src/asset-pack/scripts/postinstall.ts +81 -0
  89. package/src/asset-pack/src/index.ts +0 -0
  90. package/src/asset-pack/tsconfig.json +34 -0
  91. package/src/templates/.cursor/mcp.json +20 -0
  92. package/src/templates/.cursorignore +2 -0
  93. package/src/templates/.gitattributes +89 -0
  94. package/src/templates/.vscode/settings.json +6 -0
  95. package/src/templates/AGENTS.md +86 -0
  96. package/src/templates/CLAUDE.md +1 -0
  97. package/src/templates/README.md +24 -0
  98. package/src/templates/eslint.config.js +45 -0
  99. package/src/templates/gitignore +11 -0
  100. package/src/templates/index.html +34 -0
  101. package/src/templates/pnpm-lock.yaml +3676 -0
  102. package/src/templates/scripts/genesys/build-project.ts +51 -0
  103. package/src/templates/scripts/genesys/calc-bounding-box.ts +272 -0
  104. package/src/templates/scripts/genesys/common.ts +46 -0
  105. package/src/templates/scripts/genesys/const.ts +9 -0
  106. package/src/templates/scripts/genesys/dev/dump-default-scene.ts +11 -0
  107. package/src/templates/scripts/genesys/dev/generate-manifest.ts +146 -0
  108. package/src/templates/scripts/genesys/dev/launcher.ts +46 -0
  109. package/src/templates/scripts/genesys/dev/storage-provider.ts +229 -0
  110. package/src/templates/scripts/genesys/dev/update-template-scenes.ts +84 -0
  111. package/src/templates/scripts/genesys/doc-server.ts +16 -0
  112. package/src/templates/scripts/genesys/genesys-mcp.ts +526 -0
  113. package/src/templates/scripts/genesys/mcp/doc-tools.ts +86 -0
  114. package/src/templates/scripts/genesys/mcp/editor-functions.ts +151 -0
  115. package/src/templates/scripts/genesys/mcp/editor-tools.ts +73 -0
  116. package/src/templates/scripts/genesys/mcp/get-scene-state.ts +35 -0
  117. package/src/templates/scripts/genesys/mcp/run-subprocess.ts +30 -0
  118. package/src/templates/scripts/genesys/mcp/search-actors.ts +858 -0
  119. package/src/templates/scripts/genesys/mcp/search-assets.ts +380 -0
  120. package/src/templates/scripts/genesys/mcp/utils.ts +281 -0
  121. package/src/templates/scripts/genesys/misc.ts +42 -0
  122. package/src/templates/scripts/genesys/mock.ts +6 -0
  123. package/src/templates/scripts/genesys/place-actors.ts +179 -0
  124. package/src/templates/scripts/genesys/post-install.ts +30 -0
  125. package/src/templates/scripts/genesys/prefab.schema.json +85 -0
  126. package/src/templates/scripts/genesys/remove-engine-comments.ts +135 -0
  127. package/src/templates/scripts/genesys/run-mcp-inspector.bat +5 -0
  128. package/src/templates/scripts/genesys/storageProvider.ts +182 -0
  129. package/src/templates/scripts/genesys/validate-prefabs.ts +138 -0
  130. package/src/templates/src/index.ts +22 -0
  131. package/src/templates/src/templates/firstPerson/assets/default.genesys-scene +166 -0
  132. package/src/templates/src/templates/firstPerson/src/auto-imports.ts +0 -0
  133. package/src/templates/src/templates/firstPerson/src/game.ts +39 -0
  134. package/src/templates/src/templates/firstPerson/src/player.ts +63 -0
  135. package/src/templates/src/templates/fps/assets/default.genesys-scene +9460 -0
  136. package/src/templates/src/templates/fps/assets/models/SM_Beam_400.glb +0 -0
  137. package/src/templates/src/templates/fps/assets/models/SM_ChamferCube.glb +0 -0
  138. package/src/templates/src/templates/fps/assets/models/SM_Floor_Thick_400x400.glb +0 -0
  139. package/src/templates/src/templates/fps/assets/models/SM_Floor_Thick_400x400_Orange.glb +0 -0
  140. package/src/templates/src/templates/fps/assets/models/SM_Floor_Thin_400x400.glb +0 -0
  141. package/src/templates/src/templates/fps/assets/models/SM_Floor_Thin_400x400_Orange.glb +0 -0
  142. package/src/templates/src/templates/fps/assets/models/SM_Ramp_400x400.glb +0 -0
  143. package/src/templates/src/templates/fps/assets/models/SM_Rifle.glb +0 -0
  144. package/src/templates/src/templates/fps/assets/models/SM_Wall_Thin_400x200.glb +0 -0
  145. package/src/templates/src/templates/fps/assets/models/SM_Wall_Thin_400x200_Orange.glb +0 -0
  146. package/src/templates/src/templates/fps/assets/models/SM_Wall_Thin_400x400.glb +0 -0
  147. package/src/templates/src/templates/fps/assets/models/SM_Wall_Thin_400x400_Orange.glb +0 -0
  148. package/src/templates/src/templates/fps/src/auto-imports.ts +0 -0
  149. package/src/templates/src/templates/fps/src/game.ts +39 -0
  150. package/src/templates/src/templates/fps/src/player.ts +69 -0
  151. package/src/templates/src/templates/fps/src/weapon.ts +54 -0
  152. package/src/templates/src/templates/freeCamera/assets/default.genesys-scene +166 -0
  153. package/src/templates/src/templates/freeCamera/src/auto-imports.ts +0 -0
  154. package/src/templates/src/templates/freeCamera/src/game.ts +39 -0
  155. package/src/templates/src/templates/freeCamera/src/player.ts +45 -0
  156. package/src/templates/src/templates/sideScroller/assets/default.genesys-scene +122 -0
  157. package/src/templates/src/templates/sideScroller/src/auto-imports.ts +0 -0
  158. package/src/templates/src/templates/sideScroller/src/const.ts +46 -0
  159. package/src/templates/src/templates/sideScroller/src/game.ts +122 -0
  160. package/src/templates/src/templates/sideScroller/src/level-generator.ts +361 -0
  161. package/src/templates/src/templates/sideScroller/src/player.ts +125 -0
  162. package/src/templates/src/templates/thirdPerson/assets/default.genesys-scene +166 -0
  163. package/src/templates/src/templates/thirdPerson/src/auto-imports.ts +0 -0
  164. package/src/templates/src/templates/thirdPerson/src/game.ts +39 -0
  165. package/src/templates/src/templates/thirdPerson/src/player.ts +61 -0
  166. package/src/templates/src/templates/vehicle/assets/default.genesys-scene +226 -0
  167. package/src/templates/src/templates/vehicle/assets/models/cyberTruck/chassis.glb +0 -0
  168. package/src/templates/src/templates/vehicle/assets/models/cyberTruck/wheel.glb +0 -0
  169. package/src/templates/src/templates/vehicle/src/auto-imports.ts +0 -0
  170. package/src/templates/src/templates/vehicle/src/base-vehicle.ts +145 -0
  171. package/src/templates/src/templates/vehicle/src/game.ts +43 -0
  172. package/src/templates/src/templates/vehicle/src/mesh-vehicle.ts +191 -0
  173. package/src/templates/src/templates/vehicle/src/player.ts +109 -0
  174. package/src/templates/src/templates/vehicle/src/primitive-vehicle.ts +266 -0
  175. package/src/templates/src/templates/vehicle/src/ui-hints.ts +101 -0
  176. package/src/templates/src/templates/vr-game/assets/default.genesys-scene +247 -0
  177. package/src/templates/src/templates/vr-game/src/auto-imports.ts +1 -0
  178. package/src/templates/src/templates/vr-game/src/game.ts +66 -0
  179. package/src/templates/src/templates/vr-game/src/sample-vr-actor.ts +26 -0
  180. package/src/templates/tsconfig.json +35 -0
  181. package/src/templates/vite.config.ts +52 -0
@@ -0,0 +1,259 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var PrimitiveVehicle_1;
8
+ import * as ENGINE from 'genesys.js';
9
+ import * as THREE from 'three';
10
+ import { BaseVehicle } from './base-vehicle.js';
11
+ /**
12
+ * A simple vehicle with a box geometry
13
+ *
14
+ * Key points:
15
+ * - Movement parameters configured in createVehicleMovementComponent
16
+ * - No component is persisted (root is transient) in order to support recreating all the components in code (which is desired)
17
+ * - Rely on the builtin feature to create the wheel mesh (createWheelMeshes = true), no need to create them manually
18
+ * - All decorative meshes have physics disabled won't mess with the handling
19
+ * - Find the tail light meshes after the constructor so it works with deserialized actor
20
+ * - Rely on the base vehicle class to handle the camera and player interaction
21
+ */
22
+ let PrimitiveVehicle = PrimitiveVehicle_1 = class PrimitiveVehicle extends BaseVehicle {
23
+ tailLightComponents = [];
24
+ constructor(options) {
25
+ // Create chassis mesh
26
+ const rootComponent = new ENGINE.MeshComponent({
27
+ geometry: new THREE.BoxGeometry(2, 1, 4),
28
+ material: new THREE.MeshStandardMaterial({
29
+ color: 0x4444FF,
30
+ roughness: 0.7,
31
+ metalness: 0.3,
32
+ }),
33
+ physicsOptions: {
34
+ enabled: true,
35
+ motionType: ENGINE.PhysicsMotionType.Dynamic,
36
+ generateCollisionEvents: true,
37
+ },
38
+ });
39
+ rootComponent.castShadow = true;
40
+ rootComponent.name = 'chassis';
41
+ // mark the component as transient, this prevents all the components from being saved since we're recreating them in code
42
+ rootComponent.setTransient(true);
43
+ options.rootComponent = rootComponent;
44
+ // create decorative meshes
45
+ PrimitiveVehicle_1.createDecorativeMeshes(rootComponent);
46
+ options.movementComponent = PrimitiveVehicle_1.createVehicleMovementComponent();
47
+ super(options);
48
+ this.tailLightComponents = this.getComponents(ENGINE.MeshComponent)
49
+ .filter((component) => component.name.includes('_taillight'));
50
+ }
51
+ tickPrePhysics(deltaTime) {
52
+ super.tickPrePhysics(deltaTime);
53
+ this.updateBrakeLights();
54
+ }
55
+ updateBrakeLights() {
56
+ if (!this.movementComponent || this.tailLightComponents.length === 0)
57
+ return;
58
+ const inputState = this.movementComponent.getInputState();
59
+ const isBraking = inputState.brakeInput > 0;
60
+ for (const tailLightComponent of this.tailLightComponents) {
61
+ const mesh = tailLightComponent.getMesh();
62
+ if (mesh && mesh.material) {
63
+ const material = mesh.material;
64
+ if (isBraking) {
65
+ material.color.setHex(0xFF0000);
66
+ }
67
+ else {
68
+ material.color.setHex(0xFFFFFF);
69
+ }
70
+ }
71
+ }
72
+ }
73
+ static createDecorativeMeshes(rootComponent) {
74
+ // Add windshield
75
+ const windshieldComponent = new ENGINE.MeshComponent({
76
+ geometry: new THREE.BoxGeometry(1.8, 1.8, 0.1),
77
+ material: new THREE.MeshStandardMaterial({
78
+ color: 0x87CEEB,
79
+ transparent: true,
80
+ opacity: 0.5,
81
+ roughness: 0.1,
82
+ metalness: 0.1,
83
+ }),
84
+ physicsOptions: {
85
+ enabled: false,
86
+ }
87
+ });
88
+ windshieldComponent.position.set(0, 0.4, -1.5);
89
+ windshieldComponent.rotation.x = Math.PI / 8; // Slight tilt
90
+ windshieldComponent.name = 'windshield';
91
+ rootComponent.add(windshieldComponent);
92
+ // Add left headlight
93
+ const leftHeadlightComponent = new ENGINE.MeshComponent({
94
+ geometry: new THREE.CylinderGeometry(0.15, 0.15, 0.1, 8),
95
+ material: new THREE.MeshStandardMaterial({
96
+ color: 0xFFFFFF,
97
+ emissive: 0xFFFFAA,
98
+ emissiveIntensity: 0.3,
99
+ }),
100
+ physicsOptions: {
101
+ enabled: false,
102
+ }
103
+ });
104
+ leftHeadlightComponent.position.set(-0.7, 0.1, -2.05);
105
+ leftHeadlightComponent.rotation.z = Math.PI / 2;
106
+ leftHeadlightComponent.name = 'left_headlight';
107
+ rootComponent.add(leftHeadlightComponent);
108
+ // Add right headlight
109
+ const rightHeadlightComponent = new ENGINE.MeshComponent({
110
+ geometry: new THREE.CylinderGeometry(0.15, 0.15, 0.1, 8),
111
+ material: new THREE.MeshStandardMaterial({
112
+ color: 0xFFFFFF,
113
+ emissive: 0xFFFFAA,
114
+ emissiveIntensity: 0.3,
115
+ }),
116
+ physicsOptions: {
117
+ enabled: false,
118
+ }
119
+ });
120
+ rightHeadlightComponent.position.set(0.7, 0.1, -2.05);
121
+ rightHeadlightComponent.rotation.z = Math.PI / 2;
122
+ rightHeadlightComponent.name = 'right_headlight';
123
+ rootComponent.add(rightHeadlightComponent);
124
+ // Add left tail light
125
+ const leftTaillightMaterial = new THREE.MeshStandardMaterial({
126
+ color: 0xFF0000,
127
+ emissive: 0x440000,
128
+ emissiveIntensity: 0.2,
129
+ });
130
+ const leftTaillightComponent = new ENGINE.MeshComponent({
131
+ geometry: new THREE.CylinderGeometry(0.1, 0.1, 0.1, 8),
132
+ material: leftTaillightMaterial,
133
+ physicsOptions: {
134
+ enabled: false,
135
+ }
136
+ });
137
+ leftTaillightComponent.position.set(-0.7, 0.1, 2.05);
138
+ leftTaillightComponent.rotation.z = Math.PI / 2;
139
+ leftTaillightComponent.name = 'left_taillight';
140
+ rootComponent.add(leftTaillightComponent);
141
+ // Add right tail light
142
+ const rightTaillightMaterial = new THREE.MeshStandardMaterial({
143
+ color: 0xFF0000,
144
+ emissive: 0x440000,
145
+ emissiveIntensity: 0.2,
146
+ });
147
+ const rightTaillightComponent = new ENGINE.MeshComponent({
148
+ geometry: new THREE.CylinderGeometry(0.1, 0.1, 0.1, 8),
149
+ material: rightTaillightMaterial,
150
+ physicsOptions: {
151
+ enabled: false,
152
+ }
153
+ });
154
+ rightTaillightComponent.position.set(0.7, 0.1, 2.05);
155
+ rightTaillightComponent.rotation.z = Math.PI / 2;
156
+ rightTaillightComponent.name = 'right_taillight';
157
+ rootComponent.add(rightTaillightComponent);
158
+ }
159
+ static createVehicleMovementComponent() {
160
+ const wheelBaseWidth = 2.6;
161
+ const wheelBaseLength = 3.0;
162
+ const wheelBaseHeight = 0;
163
+ const suspensionRestLength = 0.6;
164
+ const wheelRadius = 0.5;
165
+ const wheelWidth = 0.4;
166
+ const suspensionStiffness = 20;
167
+ const suspensionCompression = 0.83;
168
+ const suspensionRelaxation = 0.88;
169
+ const maxSuspensionForce = 6000.0;
170
+ const maxSuspensionTravel = 5.0;
171
+ const sideFrictionStiffness = 2;
172
+ const frictionSlip = 8;
173
+ const options = {
174
+ ...ENGINE.BasePawnMovementComponent.DEFAULT_OPTIONS,
175
+ maxEnginePower: 35,
176
+ maxSteeringAngle: Math.PI / 6, // 30 degrees
177
+ maxBrakeForce: 1,
178
+ engineResponseRate: 8.0,
179
+ steeringResponseRate: 12.0,
180
+ brakeResponseRate: 15.0,
181
+ createWheelMeshes: true,
182
+ wheelMaterialColor: 0x333333,
183
+ autoBreakWhenNotPossessed: 1,
184
+ autoStopBreak: 0.5,
185
+ wheels: [
186
+ // Default 4-wheel configuration
187
+ {
188
+ position: new THREE.Vector3(-wheelBaseWidth / 2, wheelBaseHeight, -wheelBaseLength / 2), // Front left
189
+ radius: wheelRadius,
190
+ width: wheelWidth,
191
+ canSteer: true,
192
+ isPowered: false,
193
+ canBrake: true,
194
+ suspensionRestLength,
195
+ suspensionStiffness,
196
+ suspensionCompression,
197
+ suspensionRelaxation,
198
+ maxSuspensionForce,
199
+ maxSuspensionTravel,
200
+ sideFrictionStiffness,
201
+ frictionSlip,
202
+ },
203
+ {
204
+ position: new THREE.Vector3(wheelBaseWidth / 2, wheelBaseHeight, -wheelBaseLength / 2), // Front right
205
+ radius: wheelRadius,
206
+ width: wheelWidth,
207
+ canSteer: true,
208
+ isPowered: false,
209
+ canBrake: true,
210
+ suspensionRestLength,
211
+ suspensionStiffness,
212
+ suspensionCompression,
213
+ suspensionRelaxation,
214
+ maxSuspensionForce,
215
+ maxSuspensionTravel,
216
+ sideFrictionStiffness,
217
+ frictionSlip,
218
+ },
219
+ {
220
+ position: new THREE.Vector3(-wheelBaseWidth / 2, wheelBaseHeight, wheelBaseLength / 2), // Rear left
221
+ radius: wheelRadius,
222
+ width: wheelWidth,
223
+ canSteer: false,
224
+ isPowered: true,
225
+ canBrake: true,
226
+ suspensionRestLength,
227
+ suspensionStiffness,
228
+ suspensionCompression,
229
+ suspensionRelaxation,
230
+ maxSuspensionForce,
231
+ maxSuspensionTravel,
232
+ sideFrictionStiffness,
233
+ frictionSlip,
234
+ },
235
+ {
236
+ position: new THREE.Vector3(wheelBaseWidth / 2, wheelBaseHeight, wheelBaseLength / 2), // Rear right
237
+ radius: wheelRadius,
238
+ width: wheelWidth,
239
+ canSteer: false,
240
+ isPowered: true,
241
+ canBrake: true,
242
+ suspensionRestLength,
243
+ suspensionStiffness,
244
+ suspensionCompression,
245
+ suspensionRelaxation,
246
+ maxSuspensionForce,
247
+ maxSuspensionTravel,
248
+ sideFrictionStiffness,
249
+ frictionSlip,
250
+ },
251
+ ],
252
+ };
253
+ return new ENGINE.VehicleMovementComponent(options);
254
+ }
255
+ };
256
+ PrimitiveVehicle = PrimitiveVehicle_1 = __decorate([
257
+ ENGINE.GameClass()
258
+ ], PrimitiveVehicle);
259
+ export { PrimitiveVehicle };
@@ -0,0 +1,100 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import * as ENGINE from 'genesys.js';
8
+ /**
9
+ * Dismissable UI component that displays control hints when the game starts
10
+ */
11
+ let UIHints = class UIHints extends ENGINE.Actor {
12
+ uiElement = null;
13
+ constructor(options = {}) {
14
+ super(options);
15
+ this.setTransient(true); // Don't save this UI element to the level
16
+ }
17
+ async doBeginPlay() {
18
+ await super.doBeginPlay();
19
+ this.createHUD();
20
+ }
21
+ doEndPlay() {
22
+ this.removeHUD();
23
+ super.doEndPlay();
24
+ }
25
+ createHUD() {
26
+ const uiManager = this.world.uiManager;
27
+ // Create the UI element using the engine's UI system
28
+ this.uiElement = uiManager.createElement('game-hints', {
29
+ style: {
30
+ position: 'absolute',
31
+ top: '50px',
32
+ right: '50px',
33
+ background: 'rgba(0, 0, 0, 0.9)',
34
+ color: 'white',
35
+ padding: '25px',
36
+ borderRadius: '12px',
37
+ fontFamily: 'Arial, sans-serif',
38
+ fontSize: '16px',
39
+ lineHeight: '1.5',
40
+ maxWidth: '400px',
41
+ border: '2px solid rgba(76, 175, 80, 0.6)',
42
+ boxShadow: '0 8px 32px rgba(0, 0, 0, 0.8)',
43
+ zIndex: '1001'
44
+ }
45
+ });
46
+ // Set the HTML content
47
+ this.uiElement.setHTML(`
48
+ <div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px;">
49
+ <div style="font-weight: bold; color: #4CAF50; font-size: 18px;">
50
+ 🎮 Vehicle Game Controls
51
+ </div>
52
+ <button id="closeHints" style="
53
+ background: #f44336;
54
+ color: white;
55
+ border: none;
56
+ border-radius: 50%;
57
+ width: 30px;
58
+ height: 30px;
59
+ cursor: pointer;
60
+ font-size: 16px;
61
+ font-weight: bold;
62
+ ">×</button>
63
+ </div>
64
+ <div style="margin-bottom: 12px;">
65
+ <span style="color: #FFA726; font-weight: bold;">Movement:</span>
66
+ <br>• WASD or Arrow Keys - Move/Drive
67
+ <br>• Mouse - Camera control
68
+ </div>
69
+ <div style="margin-bottom: 12px;">
70
+ <span style="color: #FFA726; font-weight: bold;">Vehicle Interaction:</span>
71
+ <br>• E - Enter/Exit vehicle (when nearby)
72
+ <br>• F - Flip vehicle (when inside)
73
+ </div>
74
+ <div style="font-size: 14px; color: #CCCCCC; margin-top: 15px; text-align: center; font-style: italic;">
75
+ 💡 Walk near a vehicle and press E to enter
76
+ </div>
77
+ `);
78
+ // Add close button functionality
79
+ const closeButton = this.uiElement.querySelector('#closeHints');
80
+ if (closeButton) {
81
+ closeButton.addEventListener('click', () => {
82
+ this.removeHUD();
83
+ });
84
+ }
85
+ // Auto-close after 10 seconds
86
+ setTimeout(() => {
87
+ this.removeHUD();
88
+ }, 10000);
89
+ }
90
+ removeHUD() {
91
+ if (this.uiElement) {
92
+ this.uiElement.remove();
93
+ this.uiElement = null;
94
+ }
95
+ }
96
+ };
97
+ UIHints = __decorate([
98
+ ENGINE.GameClass()
99
+ ], UIHints);
100
+ export { UIHints };
@@ -0,0 +1 @@
1
+ import './sample-vr-actor.ts';
@@ -0,0 +1,55 @@
1
+ import * as ENGINE from 'genesys.js';
2
+ import * as THREE from 'three';
3
+ import './auto-imports.js';
4
+ class MyGame extends ENGINE.BaseGameLoop {
5
+ pawn = null;
6
+ controller = null;
7
+ createLoadingScreen() {
8
+ // enable the default loading screen
9
+ return new ENGINE.DefaultLoadingScreen();
10
+ }
11
+ static get DEFAULT_OPTIONS() {
12
+ return {
13
+ ...ENGINE.BaseGameLoop.DEFAULT_OPTIONS,
14
+ xrEnabled: true,
15
+ vrSessionOptions: {
16
+ optionalFeatures: ['hand-tracking', 'local-floor'],
17
+ requiredFeatures: []
18
+ }
19
+ };
20
+ }
21
+ async preStart() {
22
+ // Disable tone mapping for VR because it breaks VR
23
+ this.world.postProcessManager.disablePasses(ENGINE.PostProcessPass.ToneMapping);
24
+ // create the vr pawn
25
+ this.pawn = new ENGINE.VRPawn({
26
+ position: new THREE.Vector3(0, 0, 0),
27
+ movementComponent: null,
28
+ camera: new THREE.PerspectiveCamera(ENGINE.CAMERA_FOV, 1, ENGINE.CAMERA_NEAR, ENGINE.CAMERA_FAR),
29
+ controllerOptions: {
30
+ rayVisualizationEnabled: true,
31
+ maxRayDistance: 10
32
+ },
33
+ enableTeleportation: true,
34
+ enableSnapTurn: true,
35
+ snapTurnAngle: 30,
36
+ maxTeleportDistance: 15
37
+ });
38
+ // create the controller and possess the pawn
39
+ this.controller = new ENGINE.PlayerController();
40
+ this.controller.possess(this.pawn);
41
+ this.pawn.addComponent(new ENGINE.VRGrabComponent({}));
42
+ this.pawn.addComponent(new ENGINE.VRSnapTurnComponent({ angleDeg: this.pawn.getSnapTurnAngleDegrees() }));
43
+ this.pawn.addComponent(new ENGINE.VRInteractComponent({ button: ENGINE.XRButton.Trigger }));
44
+ this.pawn.addComponent(new ENGINE.VRTeleportComponent({ maxDistance: 15 }));
45
+ // add both to the world
46
+ this.world.addActors(this.pawn, this.controller);
47
+ }
48
+ }
49
+ export function main(container, gameId) {
50
+ const game = new MyGame(container, {
51
+ ...MyGame.DEFAULT_OPTIONS,
52
+ gameId
53
+ });
54
+ return game;
55
+ }
@@ -0,0 +1,29 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import * as ENGINE from 'genesys.js';
8
+ /**
9
+ * Sample VR Actor - A simple actor that can be picked up and manipulated in VR
10
+ */
11
+ let SampleVRActor = class SampleVRActor extends ENGINE.Actor {
12
+ meshComponent = null;
13
+ grabbable = null;
14
+ doBeginPlay() {
15
+ super.doBeginPlay();
16
+ this.meshComponent = this.getComponent(ENGINE.MeshComponent);
17
+ this.grabbable = this.getComponent(ENGINE.VRGrabbableComponent);
18
+ this.grabbable?.onGrabStart.add((_hand) => {
19
+ this.meshComponent?.setPhysicsEnabled(false);
20
+ });
21
+ this.grabbable?.onGrabEnd.add((_hand, _dropVelocity) => {
22
+ this.meshComponent?.setPhysicsEnabled(true);
23
+ });
24
+ }
25
+ };
26
+ SampleVRActor = __decorate([
27
+ ENGINE.GameClass()
28
+ ], SampleVRActor);
29
+ export { SampleVRActor };
@@ -0,0 +1,46 @@
1
+ import { defineConfig } from 'vite';
2
+ import mkcert from 'vite-plugin-mkcert';
3
+ import { nodePolyfills } from 'vite-plugin-node-polyfills';
4
+ export default defineConfig({
5
+ // Enable TypeScript support
6
+ esbuild: {
7
+ target: 'es2021',
8
+ },
9
+ plugins: [
10
+ nodePolyfills({
11
+ include: ['path'],
12
+ }),
13
+ mkcert(),
14
+ ],
15
+ // Configure module resolution
16
+ resolve: {
17
+ extensions: ['.ts', '.tsx', '.js', '.jsx', '.json'],
18
+ },
19
+ // Configure the dev server
20
+ server: {
21
+ port: 3000,
22
+ host: '0.0.0.0',
23
+ open: true,
24
+ // Enable CORS for asset loading
25
+ cors: true,
26
+ // Serve source maps for debugging
27
+ fs: {
28
+ allow: ['..', '.']
29
+ }
30
+ },
31
+ // Configure build options
32
+ build: {
33
+ target: 'es2021',
34
+ outDir: 'dist',
35
+ sourcemap: true,
36
+ rollupOptions: {
37
+ input: {
38
+ main: 'index.html',
39
+ },
40
+ },
41
+ },
42
+ // Enable source maps for debugging in development
43
+ css: {
44
+ devSourcemap: true,
45
+ },
46
+ });
package/package.json ADDED
@@ -0,0 +1,176 @@
1
+ {
2
+ "name": "@directivegames/genesys.sdk",
3
+ "version": "3.2.2",
4
+ "description": "Genesys SDK - A development toolkit for game development",
5
+ "author": "Directive Games",
6
+ "main": "index.js",
7
+ "type": "module",
8
+ "pnpm": {
9
+ "onlyBuiltDependencies": [
10
+ "electron"
11
+ ]
12
+ },
13
+ "files": [
14
+ "dist/src",
15
+ "src/templates",
16
+ "src/asset-pack",
17
+ "scripts"
18
+ ],
19
+ "bin": {
20
+ "genesys-sdk": "./dist/src/core/cli.js"
21
+ },
22
+ "scripts": {
23
+ "postinstall": "pnpm exec tsx scripts/post-install.ts",
24
+ "dev:main": "tsc --watch -p tsconfig.json",
25
+ "dev:preload": "tsc --watch -p tsconfig.preload.json",
26
+ "dev:electron": "electron dist/src/electron/backend/main.js",
27
+ "dev:watch": "pnpm compile && concurrently -k -n MAIN,PRELOAD \"pnpm dev:main\" \"pnpm dev:preload\" nodemon",
28
+ "dev": "pnpm compile && concurrently -k -n MAIN,PRELOAD \"pnpm dev:main\" \"pnpm dev:preload\" \"pnpm dev:electron\"",
29
+ "dev:hosted": "pnpm compile && concurrently -k -n MAIN,PRELOAD \"pnpm dev:main\" \"pnpm dev:preload\" \"dotenv -v DEV_HOSTED=true pnpm dev:electron\"",
30
+ "dev:vite-old": "vite",
31
+ "dev-old": "pnpm compile && concurrently -k -n MAIN,PRELOAD,VITE \"pnpm dev:main\" \"pnpm dev:preload\" \"pnpm dev:vite-old\" \"pnpm dev:electron-old\"",
32
+ "compile": "tsc -p tsconfig.json && tsc -p tsconfig.preload.json",
33
+ "build": "vite build && pnpm compile",
34
+ "dist": "pnpm build && electron-builder",
35
+ "lint": "eslint . --fix --ext .ts,.tsx",
36
+ "pack": "pnpm build && pnpm pack",
37
+ "cli": "pnpm exec tsx src/core/cli.ts",
38
+ "cli:new": "pnpm exec tsx src/core/cli.ts new",
39
+ "cli:build": "pnpm exec tsx src/core/cli.ts build",
40
+ "cli:new-asset-pack": "pnpm exec tsx src/core/cli.ts new-asset-pack"
41
+ },
42
+ "build": {
43
+ "artifactName": "Genesys-Setup-${version}.${ext}",
44
+ "publish": [
45
+ {
46
+ "provider": "github",
47
+ "releaseType": "release",
48
+ "owner": "directivegames",
49
+ "repo": "genesys.sdk-release",
50
+ "private": true
51
+ }
52
+ ],
53
+ "asar": true,
54
+ "asarUnpack": [
55
+ "node_modules/@esbuild/**/*",
56
+ "node_modules/esbuild/**/*"
57
+ ],
58
+ "appId": "com.directivegames.genesys.sdk",
59
+ "productName": "Genesys",
60
+ "files": [
61
+ "dist/**/*",
62
+ {
63
+ "from": "node_modules/.pnpm/three@0.177.0/node_modules/three/examples",
64
+ "to": "node_modules/three/examples"
65
+ }
66
+ ],
67
+ "extraResources": [
68
+ {
69
+ "from": "src/templates",
70
+ "to": "vendor/src/templates"
71
+ },
72
+ {
73
+ "from": "src/asset-pack",
74
+ "to": "vendor/src/asset-pack"
75
+ }
76
+ ],
77
+ "directories": {
78
+ "buildResources": "build"
79
+ },
80
+ "extraMetadata": {
81
+ "main": "dist/src/electron/backend/main.js"
82
+ },
83
+ "protocols": [
84
+ {
85
+ "name": "genesys",
86
+ "schemes": [
87
+ "genesys"
88
+ ]
89
+ },
90
+ {
91
+ "name": "genesys-dev",
92
+ "schemes": [
93
+ "genesys-dev"
94
+ ]
95
+ }
96
+ ],
97
+ "win": {
98
+ "target": "nsis"
99
+ },
100
+ "mac": {
101
+ "target": "dmg",
102
+ "hardenedRuntime": true,
103
+ "gatekeeperAssess": false,
104
+ "entitlements": "build/entitlements.mac.plist",
105
+ "entitlementsInherit": "build/entitlements.mac.plist"
106
+ }
107
+ },
108
+ "dependencies": {
109
+ "@electron/rebuild": "^4.0.1",
110
+ "@emotion/react": "^11.14.0",
111
+ "@emotion/styled": "^11.14.0",
112
+ "@mui/icons-material": "^7.1.0",
113
+ "@mui/lab": "^7.0.0-beta.12",
114
+ "@mui/material": "^7.1.0",
115
+ "chokidar": "^4.0.3",
116
+ "commander": "^14.0.2",
117
+ "core-util-is": "^1.0.3",
118
+ "cors": "^2.8.5",
119
+ "electron-devtools-installer": "^4.0.0",
120
+ "electron-is-dev": "^3.0.1",
121
+ "electron-log": "^5.4.3",
122
+ "electron-store": "^11.0.2",
123
+ "electron-updater": "^6.6.2",
124
+ "esbuild": "^0.25.11",
125
+ "express": "^5.1.0",
126
+ "fix-path": "^4.0.0",
127
+ "genesys.js": "^3.1.24",
128
+ "jsdom": "^27.0.0",
129
+ "minimatch": "^10.0.1",
130
+ "multer": "^2.0.2",
131
+ "node-abi": "^4.14.0",
132
+ "react": "^19.2.0",
133
+ "react-dom": "^19.2.0",
134
+ "three": "^0.177.0",
135
+ "upath": "^2.0.1",
136
+ "ws": "^8.18.2",
137
+ "zod": "^3.24.4"
138
+ },
139
+ "devDependencies": {
140
+ "@electron/notarize": "^3.1.0",
141
+ "@modelcontextprotocol/sdk": "^1.22.0",
142
+ "@types/cors": "^2.8.18",
143
+ "@types/electron-store": "^1.3.1",
144
+ "@types/express": "^5.0.2",
145
+ "@types/jsdom": "^27.0.0",
146
+ "@types/minimatch": "^5.1.2",
147
+ "@types/multer": "^1.4.12",
148
+ "@types/react": "^19.2.0",
149
+ "@types/react-dom": "^19.2.0",
150
+ "@types/three": "^0.177.0",
151
+ "@types/ws": "^8.18.1",
152
+ "@typescript-eslint/eslint-plugin": "^8.29.1",
153
+ "@typescript-eslint/parser": "^8.29.1",
154
+ "@vitejs/plugin-react": "^4.4.1",
155
+ "ajv": "^8.17.1",
156
+ "concurrently": "^9.1.2",
157
+ "dotenv-cli": "^8.0.0",
158
+ "electron": "^39.2.3",
159
+ "electron-builder": "^26.0.12",
160
+ "eslint": "^9.24.0",
161
+ "eslint-plugin-import": "^2.31.0",
162
+ "get-port": "^7.1.0",
163
+ "nanoid": "^5.1.6",
164
+ "nodemon": "^3.1.10",
165
+ "ts-morph": "^27.0.2",
166
+ "tsc-watch": "^7.1.0",
167
+ "tsx": "^4.20.6",
168
+ "typescript": "^5.8.3",
169
+ "vite": "^6.3.5",
170
+ "vite-plugin-mkcert": "^1.17.9",
171
+ "vite-plugin-node-polyfills": "^0.24.0",
172
+ "wait-on": "^8.0.4",
173
+ "yaml": "^2.6.1",
174
+ "zod-to-json-schema": "^3.25.0"
175
+ }
176
+ }