@directivegames/genesys.sdk 3.2.2 → 3.2.5

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 (125) hide show
  1. package/README.md +60 -60
  2. package/dist/src/asset-pack/eslint.config.js +4 -4
  3. package/dist/src/core/cli.js +22 -22
  4. package/dist/src/core/common.js +2 -2
  5. package/dist/src/core/tools/build-project.js +1 -1
  6. package/dist/src/core/tools/new-asset-pack.js +1 -1
  7. package/dist/src/core/tools/new-project.js +1 -1
  8. package/dist/src/dependencies.js +1 -1
  9. package/dist/src/electron/backend/tools/const.js +1 -1
  10. package/dist/src/electron/backend/tools/open-project.js +1 -1
  11. package/dist/src/templates/eslint.config.js +4 -4
  12. package/dist/src/templates/scripts/genesys/calc-bounding-box.js +2 -2
  13. package/dist/src/templates/scripts/genesys/dev/dump-default-scene.js +1 -1
  14. package/dist/src/templates/scripts/genesys/dev/generate-manifest.js +1 -1
  15. package/dist/src/templates/scripts/genesys/dev/launcher.js +1 -1
  16. package/dist/src/templates/scripts/genesys/dev/storage-provider.js +4 -4
  17. package/dist/src/templates/scripts/genesys/genesys-mcp.js +26 -26
  18. package/dist/src/templates/scripts/genesys/mcp/doc-tools.js +2 -2
  19. package/dist/src/templates/scripts/genesys/mcp/editor-functions.js +5 -5
  20. package/dist/src/templates/scripts/genesys/mcp/search-actors.js +1 -1
  21. package/dist/src/templates/scripts/genesys/mcp/search-assets.js +1 -1
  22. package/dist/src/templates/scripts/genesys/mcp/utils.js +1 -1
  23. package/dist/src/templates/scripts/genesys/misc.js +1 -1
  24. package/dist/src/templates/scripts/genesys/mock.js +1 -1
  25. package/dist/src/templates/scripts/genesys/place-actors.js +1 -1
  26. package/dist/src/templates/scripts/genesys/post-install.js +1 -1
  27. package/dist/src/templates/scripts/genesys/storageProvider.js +2 -2
  28. package/dist/src/templates/src/index.js +1 -1
  29. package/dist/src/templates/src/templates/firstPerson/src/game.js +1 -1
  30. package/dist/src/templates/src/templates/firstPerson/src/player.js +1 -1
  31. package/dist/src/templates/src/templates/fps/src/game.js +1 -1
  32. package/dist/src/templates/src/templates/fps/src/player.js +1 -1
  33. package/dist/src/templates/src/templates/fps/src/weapon.js +1 -1
  34. package/dist/src/templates/src/templates/freeCamera/src/game.js +1 -1
  35. package/dist/src/templates/src/templates/freeCamera/src/player.js +1 -1
  36. package/dist/src/templates/src/templates/sideScroller/src/game.js +1 -1
  37. package/dist/src/templates/src/templates/sideScroller/src/level-generator.js +1 -1
  38. package/dist/src/templates/src/templates/sideScroller/src/player.js +1 -1
  39. package/dist/src/templates/src/templates/thirdPerson/src/game.js +1 -1
  40. package/dist/src/templates/src/templates/thirdPerson/src/player.js +1 -1
  41. package/dist/src/templates/src/templates/vehicle/src/base-vehicle.js +1 -1
  42. package/dist/src/templates/src/templates/vehicle/src/game.js +1 -1
  43. package/dist/src/templates/src/templates/vehicle/src/mesh-vehicle.js +1 -1
  44. package/dist/src/templates/src/templates/vehicle/src/player.js +1 -1
  45. package/dist/src/templates/src/templates/vehicle/src/primitive-vehicle.js +1 -1
  46. package/dist/src/templates/src/templates/vehicle/src/ui-hints.js +31 -31
  47. package/dist/src/templates/src/templates/vr-game/src/game.js +1 -1
  48. package/dist/src/templates/src/templates/vr-game/src/sample-vr-actor.js +1 -1
  49. package/package.json +176 -176
  50. package/scripts/post-install.ts +143 -143
  51. package/src/asset-pack/.gitattributes +88 -88
  52. package/src/asset-pack/eslint.config.js +45 -45
  53. package/src/asset-pack/gitignore +11 -11
  54. package/src/asset-pack/scripts/postinstall.ts +81 -81
  55. package/src/asset-pack/tsconfig.json +33 -33
  56. package/src/templates/.cursor/mcp.json +20 -20
  57. package/src/templates/.cursorignore +2 -2
  58. package/src/templates/.gitattributes +88 -88
  59. package/src/templates/.vscode/settings.json +6 -6
  60. package/src/templates/AGENTS.md +86 -86
  61. package/src/templates/README.md +24 -24
  62. package/src/templates/eslint.config.js +45 -45
  63. package/src/templates/gitignore +11 -11
  64. package/src/templates/index.html +34 -34
  65. package/src/templates/pnpm-lock.yaml +3676 -3676
  66. package/src/templates/scripts/genesys/build-project.ts +51 -51
  67. package/src/templates/scripts/genesys/calc-bounding-box.ts +272 -272
  68. package/src/templates/scripts/genesys/common.ts +46 -46
  69. package/src/templates/scripts/genesys/const.ts +9 -9
  70. package/src/templates/scripts/genesys/dev/dump-default-scene.ts +11 -11
  71. package/src/templates/scripts/genesys/dev/generate-manifest.ts +146 -146
  72. package/src/templates/scripts/genesys/dev/launcher.ts +46 -46
  73. package/src/templates/scripts/genesys/dev/storage-provider.ts +229 -229
  74. package/src/templates/scripts/genesys/dev/update-template-scenes.ts +84 -84
  75. package/src/templates/scripts/genesys/doc-server.ts +16 -16
  76. package/src/templates/scripts/genesys/genesys-mcp.ts +526 -526
  77. package/src/templates/scripts/genesys/mcp/doc-tools.ts +86 -86
  78. package/src/templates/scripts/genesys/mcp/editor-functions.ts +151 -151
  79. package/src/templates/scripts/genesys/mcp/editor-tools.ts +73 -73
  80. package/src/templates/scripts/genesys/mcp/get-scene-state.ts +35 -35
  81. package/src/templates/scripts/genesys/mcp/run-subprocess.ts +30 -30
  82. package/src/templates/scripts/genesys/mcp/search-actors.ts +858 -858
  83. package/src/templates/scripts/genesys/mcp/search-assets.ts +380 -380
  84. package/src/templates/scripts/genesys/mcp/utils.ts +281 -281
  85. package/src/templates/scripts/genesys/misc.ts +42 -42
  86. package/src/templates/scripts/genesys/mock.ts +6 -6
  87. package/src/templates/scripts/genesys/place-actors.ts +179 -179
  88. package/src/templates/scripts/genesys/post-install.ts +30 -30
  89. package/src/templates/scripts/genesys/prefab.schema.json +84 -84
  90. package/src/templates/scripts/genesys/remove-engine-comments.ts +134 -134
  91. package/src/templates/scripts/genesys/run-mcp-inspector.bat +4 -4
  92. package/src/templates/scripts/genesys/storageProvider.ts +182 -182
  93. package/src/templates/scripts/genesys/validate-prefabs.ts +138 -138
  94. package/src/templates/src/index.ts +22 -22
  95. package/src/templates/src/templates/firstPerson/assets/default.genesys-scene +165 -165
  96. package/src/templates/src/templates/firstPerson/src/game.ts +39 -39
  97. package/src/templates/src/templates/firstPerson/src/player.ts +63 -63
  98. package/src/templates/src/templates/fps/assets/default.genesys-scene +9459 -9459
  99. package/src/templates/src/templates/fps/src/game.ts +39 -39
  100. package/src/templates/src/templates/fps/src/player.ts +69 -69
  101. package/src/templates/src/templates/fps/src/weapon.ts +54 -54
  102. package/src/templates/src/templates/freeCamera/assets/default.genesys-scene +165 -165
  103. package/src/templates/src/templates/freeCamera/src/game.ts +39 -39
  104. package/src/templates/src/templates/freeCamera/src/player.ts +45 -45
  105. package/src/templates/src/templates/sideScroller/assets/default.genesys-scene +121 -121
  106. package/src/templates/src/templates/sideScroller/src/const.ts +45 -45
  107. package/src/templates/src/templates/sideScroller/src/game.ts +122 -122
  108. package/src/templates/src/templates/sideScroller/src/level-generator.ts +361 -361
  109. package/src/templates/src/templates/sideScroller/src/player.ts +125 -125
  110. package/src/templates/src/templates/thirdPerson/assets/default.genesys-scene +165 -165
  111. package/src/templates/src/templates/thirdPerson/src/game.ts +39 -39
  112. package/src/templates/src/templates/thirdPerson/src/player.ts +61 -61
  113. package/src/templates/src/templates/vehicle/assets/default.genesys-scene +225 -225
  114. package/src/templates/src/templates/vehicle/src/base-vehicle.ts +145 -145
  115. package/src/templates/src/templates/vehicle/src/game.ts +43 -43
  116. package/src/templates/src/templates/vehicle/src/mesh-vehicle.ts +191 -191
  117. package/src/templates/src/templates/vehicle/src/player.ts +109 -109
  118. package/src/templates/src/templates/vehicle/src/primitive-vehicle.ts +266 -266
  119. package/src/templates/src/templates/vehicle/src/ui-hints.ts +101 -101
  120. package/src/templates/src/templates/vr-game/assets/default.genesys-scene +246 -246
  121. package/src/templates/src/templates/vr-game/src/auto-imports.ts +1 -1
  122. package/src/templates/src/templates/vr-game/src/game.ts +66 -66
  123. package/src/templates/src/templates/vr-game/src/sample-vr-actor.ts +26 -26
  124. package/src/templates/tsconfig.json +34 -34
  125. package/src/templates/vite.config.ts +52 -52
@@ -1,125 +1,125 @@
1
- import * as ENGINE from 'genesys.js';
2
- import * as THREE from 'three';
3
-
4
- import { CAMERA_SETTINGS, PLAYER_MOVEMENT } from './const.js';
5
-
6
- // ============================================================================
7
- // PLAYER PAWN
8
- // ============================================================================
9
-
10
- // The side-scroller player pawn class using animated character.
11
- @ENGINE.GameClass()
12
- export class SideScrollerPlayer extends ENGINE.ThirdPersonCharacterPawn {
13
- camera: THREE.PerspectiveCamera;
14
- characterMesh: ENGINE.GLTFMeshComponent | null = null;
15
- smoothedCameraHeight: number | null = null;
16
- smoothedLookAtHeight: number | null = null;
17
-
18
- constructor(options: Omit<ENGINE.ThirdPersonCharacterPawnOptions, 'movementComponent' | 'camera' | 'rootComponent'>) {
19
- // Create directional movement component for side-scrolling
20
- const movementComponent = new ENGINE.DirectionalCharacterMovementComponent({
21
- ...ENGINE.DirectionalCharacterMovementComponent.DEFAULT_OPTIONS,
22
- direction: ENGINE.CharacterMovementDirection.LeftRight, // Move left and right
23
- autoMove: false, // Player controls movement manually
24
- jumpSpeed: PLAYER_MOVEMENT.JUMP_SPEED,
25
- maxSpeed: PLAYER_MOVEMENT.MAX_SPEED,
26
- maxMidAirJumps: PLAYER_MOVEMENT.MAX_MID_AIR_JUMPS, // Allow double jump
27
- // Physics and movement settings for platformer feel
28
- accelerationLambda: PLAYER_MOVEMENT.ACCELERATION_LAMBDA,
29
- decelerationLambda: PLAYER_MOVEMENT.DECELERATION_LAMBDA,
30
- midAirAccelerationLambda: PLAYER_MOVEMENT.MID_AIR_ACCELERATION_LAMBDA,
31
- midAirDecelerationLambda: PLAYER_MOVEMENT.MID_AIR_DECELERATION_LAMBDA,
32
- });
33
-
34
- // Physics options for the player
35
- const physicsOptions: ENGINE.ComponentPhysicsOptions = {
36
- enabled: true,
37
- motionType: ENGINE.PhysicsMotionType.KinematicVelocityBased,
38
- collisionProfile: ENGINE.DefaultCollisionProfile.Character,
39
- generateCollisionEvents: true,
40
- };
41
-
42
- // Create root component with physics (invisible capsule for collision)
43
- const rootComponent = new ENGINE.MeshComponent({
44
- geometry: new THREE.CapsuleGeometry(
45
- ENGINE.CHARACTER_WIDTH / 2,
46
- ENGINE.CHARACTER_HEIGHT - ENGINE.CHARACTER_WIDTH
47
- ),
48
- material: new THREE.MeshStandardMaterial({
49
- color: 0xffff00,
50
- visible: false, // Make invisible since we'll have the animated character mesh
51
- transparent: true,
52
- opacity: 0.5
53
- }),
54
- physicsOptions,
55
- });
56
-
57
- super({
58
- ...options,
59
- // Use default character model from engine assets
60
- modelUrl: '@engine/assets/character/mannequinG.glb',
61
- configUrl: '@engine/assets/character/config/mannequin-anim.json',
62
- meshPosition: new THREE.Vector3(0, -ENGINE.CHARACTER_HEIGHT / 2, 0),
63
- meshRotation: new THREE.Euler(0, Math.PI, 0), // Face right initially
64
- meshScale: new THREE.Vector3(1, 1, 1),
65
- movementComponent,
66
- camera: null, // Do not attach the camera to the player directly
67
- rootComponent,
68
- enableDirectionalLightFollowing: true,
69
- });
70
-
71
- // Enable shadow casting for the character
72
- this.rootComponent.castShadow = true;
73
- this.camera = new THREE.PerspectiveCamera(CAMERA_SETTINGS.FOV, 1, CAMERA_SETTINGS.NEAR, CAMERA_SETTINGS.FAR);
74
- }
75
-
76
- public override async doBeginPlay(): Promise<void> {
77
- await super.doBeginPlay();
78
- this.getWorld()?.setOverrideCamera(this.camera);
79
- }
80
-
81
- public override tickPrePhysics(deltaTime: number): void {
82
- super.tickPrePhysics(deltaTime);
83
-
84
- // manually update the camera position
85
- const desiredCameraPosition = this.rootComponent.localToWorld(new THREE.Vector3(
86
- CAMERA_SETTINGS.POSITION.x,
87
- CAMERA_SETTINGS.POSITION.y,
88
- CAMERA_SETTINGS.POSITION.z
89
- ));
90
- const desiredCameraLookAt = this.rootComponent.localToWorld(new THREE.Vector3(
91
- CAMERA_SETTINGS.LOOK_AT.x,
92
- CAMERA_SETTINGS.LOOK_AT.y,
93
- CAMERA_SETTINGS.LOOK_AT.z
94
- ));
95
- this.smoothedCameraHeight ??= desiredCameraPosition.y;
96
- this.smoothedLookAtHeight ??= desiredCameraLookAt.y;
97
-
98
- this.smoothedCameraHeight = THREE.MathUtils.damp(this.smoothedCameraHeight, desiredCameraPosition.y, CAMERA_SETTINGS.DAMP_FACTOR, deltaTime);
99
- this.smoothedLookAtHeight = THREE.MathUtils.damp(this.smoothedLookAtHeight, desiredCameraLookAt.y, CAMERA_SETTINGS.DAMP_FACTOR, deltaTime);
100
-
101
- this.camera.position.x = desiredCameraPosition.x;
102
- this.camera.position.y = this.smoothedCameraHeight;
103
- this.camera.position.z = desiredCameraPosition.z;
104
-
105
- this.camera.lookAt(new THREE.Vector3(
106
- desiredCameraLookAt.x,
107
- this.smoothedLookAtHeight,
108
- desiredCameraLookAt.z
109
- ));
110
-
111
- // change the direction of the character mesh based on the movement direction
112
- this.characterMesh ??= this.getComponent(ENGINE.GLTFMeshComponent);
113
- if (this.characterMesh && this.movementComponent) {
114
- const movementComponent = this.movementComponent as ENGINE.DirectionalCharacterMovementComponent;
115
- const velocity = movementComponent.getVelocities();
116
- if (velocity.right > 0.1) {
117
- // Moving right - face right (90 degrees)
118
- this.characterMesh.rotation.set(0, Math.PI / 2, 0);
119
- } else if (velocity.right < -0.1) {
120
- // Moving left - face left (-90 degrees)
121
- this.characterMesh.rotation.set(0, -Math.PI / 2, 0);
122
- }
123
- }
124
- }
125
- }
1
+ import * as ENGINE from '@directivegames/genesys.js';
2
+ import * as THREE from 'three';
3
+
4
+ import { CAMERA_SETTINGS, PLAYER_MOVEMENT } from './const.js';
5
+
6
+ // ============================================================================
7
+ // PLAYER PAWN
8
+ // ============================================================================
9
+
10
+ // The side-scroller player pawn class using animated character.
11
+ @ENGINE.GameClass()
12
+ export class SideScrollerPlayer extends ENGINE.ThirdPersonCharacterPawn {
13
+ camera: THREE.PerspectiveCamera;
14
+ characterMesh: ENGINE.GLTFMeshComponent | null = null;
15
+ smoothedCameraHeight: number | null = null;
16
+ smoothedLookAtHeight: number | null = null;
17
+
18
+ constructor(options: Omit<ENGINE.ThirdPersonCharacterPawnOptions, 'movementComponent' | 'camera' | 'rootComponent'>) {
19
+ // Create directional movement component for side-scrolling
20
+ const movementComponent = new ENGINE.DirectionalCharacterMovementComponent({
21
+ ...ENGINE.DirectionalCharacterMovementComponent.DEFAULT_OPTIONS,
22
+ direction: ENGINE.CharacterMovementDirection.LeftRight, // Move left and right
23
+ autoMove: false, // Player controls movement manually
24
+ jumpSpeed: PLAYER_MOVEMENT.JUMP_SPEED,
25
+ maxSpeed: PLAYER_MOVEMENT.MAX_SPEED,
26
+ maxMidAirJumps: PLAYER_MOVEMENT.MAX_MID_AIR_JUMPS, // Allow double jump
27
+ // Physics and movement settings for platformer feel
28
+ accelerationLambda: PLAYER_MOVEMENT.ACCELERATION_LAMBDA,
29
+ decelerationLambda: PLAYER_MOVEMENT.DECELERATION_LAMBDA,
30
+ midAirAccelerationLambda: PLAYER_MOVEMENT.MID_AIR_ACCELERATION_LAMBDA,
31
+ midAirDecelerationLambda: PLAYER_MOVEMENT.MID_AIR_DECELERATION_LAMBDA,
32
+ });
33
+
34
+ // Physics options for the player
35
+ const physicsOptions: ENGINE.ComponentPhysicsOptions = {
36
+ enabled: true,
37
+ motionType: ENGINE.PhysicsMotionType.KinematicVelocityBased,
38
+ collisionProfile: ENGINE.DefaultCollisionProfile.Character,
39
+ generateCollisionEvents: true,
40
+ };
41
+
42
+ // Create root component with physics (invisible capsule for collision)
43
+ const rootComponent = new ENGINE.MeshComponent({
44
+ geometry: new THREE.CapsuleGeometry(
45
+ ENGINE.CHARACTER_WIDTH / 2,
46
+ ENGINE.CHARACTER_HEIGHT - ENGINE.CHARACTER_WIDTH
47
+ ),
48
+ material: new THREE.MeshStandardMaterial({
49
+ color: 0xffff00,
50
+ visible: false, // Make invisible since we'll have the animated character mesh
51
+ transparent: true,
52
+ opacity: 0.5
53
+ }),
54
+ physicsOptions,
55
+ });
56
+
57
+ super({
58
+ ...options,
59
+ // Use default character model from engine assets
60
+ modelUrl: '@engine/assets/character/mannequinG.glb',
61
+ configUrl: '@engine/assets/character/config/mannequin-anim.json',
62
+ meshPosition: new THREE.Vector3(0, -ENGINE.CHARACTER_HEIGHT / 2, 0),
63
+ meshRotation: new THREE.Euler(0, Math.PI, 0), // Face right initially
64
+ meshScale: new THREE.Vector3(1, 1, 1),
65
+ movementComponent,
66
+ camera: null, // Do not attach the camera to the player directly
67
+ rootComponent,
68
+ enableDirectionalLightFollowing: true,
69
+ });
70
+
71
+ // Enable shadow casting for the character
72
+ this.rootComponent.castShadow = true;
73
+ this.camera = new THREE.PerspectiveCamera(CAMERA_SETTINGS.FOV, 1, CAMERA_SETTINGS.NEAR, CAMERA_SETTINGS.FAR);
74
+ }
75
+
76
+ public override async doBeginPlay(): Promise<void> {
77
+ await super.doBeginPlay();
78
+ this.getWorld()?.setOverrideCamera(this.camera);
79
+ }
80
+
81
+ public override tickPrePhysics(deltaTime: number): void {
82
+ super.tickPrePhysics(deltaTime);
83
+
84
+ // manually update the camera position
85
+ const desiredCameraPosition = this.rootComponent.localToWorld(new THREE.Vector3(
86
+ CAMERA_SETTINGS.POSITION.x,
87
+ CAMERA_SETTINGS.POSITION.y,
88
+ CAMERA_SETTINGS.POSITION.z
89
+ ));
90
+ const desiredCameraLookAt = this.rootComponent.localToWorld(new THREE.Vector3(
91
+ CAMERA_SETTINGS.LOOK_AT.x,
92
+ CAMERA_SETTINGS.LOOK_AT.y,
93
+ CAMERA_SETTINGS.LOOK_AT.z
94
+ ));
95
+ this.smoothedCameraHeight ??= desiredCameraPosition.y;
96
+ this.smoothedLookAtHeight ??= desiredCameraLookAt.y;
97
+
98
+ this.smoothedCameraHeight = THREE.MathUtils.damp(this.smoothedCameraHeight, desiredCameraPosition.y, CAMERA_SETTINGS.DAMP_FACTOR, deltaTime);
99
+ this.smoothedLookAtHeight = THREE.MathUtils.damp(this.smoothedLookAtHeight, desiredCameraLookAt.y, CAMERA_SETTINGS.DAMP_FACTOR, deltaTime);
100
+
101
+ this.camera.position.x = desiredCameraPosition.x;
102
+ this.camera.position.y = this.smoothedCameraHeight;
103
+ this.camera.position.z = desiredCameraPosition.z;
104
+
105
+ this.camera.lookAt(new THREE.Vector3(
106
+ desiredCameraLookAt.x,
107
+ this.smoothedLookAtHeight,
108
+ desiredCameraLookAt.z
109
+ ));
110
+
111
+ // change the direction of the character mesh based on the movement direction
112
+ this.characterMesh ??= this.getComponent(ENGINE.GLTFMeshComponent);
113
+ if (this.characterMesh && this.movementComponent) {
114
+ const movementComponent = this.movementComponent as ENGINE.DirectionalCharacterMovementComponent;
115
+ const velocity = movementComponent.getVelocities();
116
+ if (velocity.right > 0.1) {
117
+ // Moving right - face right (90 degrees)
118
+ this.characterMesh.rotation.set(0, Math.PI / 2, 0);
119
+ } else if (velocity.right < -0.1) {
120
+ // Moving left - face left (-90 degrees)
121
+ this.characterMesh.rotation.set(0, -Math.PI / 2, 0);
122
+ }
123
+ }
124
+ }
125
+ }
@@ -1,166 +1,166 @@
1
- {
2
- "$version": 0,
3
- "class": "ENGINE.World",
4
- "uuid": "c0ae85792bc3b946",
5
- "ctor": {
6
- "backgroundColor": 3026478,
7
- "navigationOptions": {
8
- "engine": "recast-navigation",
9
- "debug": false,
10
- "generateOnStartUp": false
11
- },
12
- "physicsOptions": {
13
- "gravity": [
14
- 0,
15
- -9.81,
16
- 0,
17
- "v"
18
- ],
19
- "engine": "rapier"
20
- },
21
- "useManifold": true
22
- },
23
- "actors": [
24
- {
25
- "uuid": "9a86d389088b361c",
26
- "class": "ENGINE.Actor",
27
- "properties": {
28
- "editorData": {
29
- "displayName": "Directional Light",
30
- "hidden": false
31
- }
32
- },
33
- "ctor": {
34
- "rootComponent": {
35
- "class": "ENGINE.DirectionalLightComponent",
36
- "uuid": "cfe05433-9edc-4dfe-a535-c71f33e92d78",
37
- "ctor": {
38
- "color": 16777215,
39
- "intensity": 1,
40
- "castShadow": true,
41
- "shadowMapSize": 2048,
42
- "shadowBias": 0,
43
- "shadowNormalBias": 0,
44
- "shadowNear": 0.1,
45
- "shadowFar": 100
46
- },
47
- "properties": {
48
- "position": [
49
- 10,
50
- 50,
51
- -10,
52
- "v"
53
- ],
54
- "castShadow": true
55
- }
56
- }
57
- }
58
- },
59
- {
60
- "uuid": "9d428f2a16e5374a",
61
- "class": "ENGINE.Actor",
62
- "properties": {
63
- "editorData": {
64
- "displayName": "Ground",
65
- "hidden": false
66
- }
67
- },
68
- "ctor": {
69
- "rootComponent": {
70
- "class": "ENGINE.MeshComponent",
71
- "uuid": "71caea24-62d7-4e45-a76e-4c7519de2c3c",
72
- "ctor": {
73
- "geometry": {
74
- "class": "THREE.BoxGeometry",
75
- "ctor": [
76
- 500,
77
- 0.1,
78
- 500
79
- ]
80
- },
81
- "material": {
82
- "@external": "DefaultMaterial"
83
- },
84
- "uvScaleTilesPerUnit": 0.2,
85
- "physicsOptions": {
86
- "enabled": true,
87
- "motionType": "static",
88
- "collisionProfile": "BlockAll"
89
- }
90
- },
91
- "properties": {
92
- "position": [
93
- 0,
94
- -0.9,
95
- 0,
96
- "v"
97
- ],
98
- "receiveShadow": true
99
- }
100
- }
101
- }
102
- },
103
- {
104
- "uuid": "b87cbc5e60a2e54c",
105
- "class": "ENGINE.PlayerStart",
106
- "properties": {
107
- "editorData": {
108
- "displayName": "Player Start",
109
- "hidden": false
110
- }
111
- },
112
- "ctor": {
113
- "rootComponent": {
114
- "class": "ENGINE.SceneComponent",
115
- "uuid": "b4d5f8f7-2512-45e1-9157-c7ff6772402d",
116
- "ctor": {},
117
- "properties": {
118
- "position": [
119
- 0,
120
- 0.9,
121
- 0,
122
- "v"
123
- ]
124
- }
125
- }
126
- }
127
- },
128
- {
129
- "uuid": "0ba1f4677e8370d1",
130
- "class": "ENGINE.Actor",
131
- "properties": {
132
- "editorData": {
133
- "displayName": "Skybox",
134
- "hidden": false
135
- }
136
- },
137
- "ctor": {
138
- "rootComponent": {
139
- "class": "ENGINE.SceneComponent",
140
- "uuid": "195e88df-73ff-4f4b-82ae-7fb58671463d",
141
- "ctor": {},
142
- "properties": {},
143
- "children": [
144
- {
145
- "class": "ENGINE.SkyboxComponent",
146
- "uuid": "a6cea5af-a972-4031-97b4-cd9218198a2f",
147
- "ctor": {
148
- "textureUrl": "@engine/assets/textures/skybox/citrus_orchard_road_puresky_2k.hdr",
149
- "width": 2048,
150
- "height": 1024,
151
- "bottomColor": "#E6F3FF",
152
- "middleColor": "#4A90E2",
153
- "topColor": "#0F1B3C",
154
- "envMapIntensity": 1
155
- },
156
- "properties": {}
157
- }
158
- ]
159
- }
160
- }
161
- }
162
- ],
163
- "properties": {
164
- "editorData": {}
165
- }
1
+ {
2
+ "$version": 0,
3
+ "class": "ENGINE.World",
4
+ "uuid": "c0ae85792bc3b946",
5
+ "ctor": {
6
+ "backgroundColor": 3026478,
7
+ "navigationOptions": {
8
+ "engine": "recast-navigation",
9
+ "debug": false,
10
+ "generateOnStartUp": false
11
+ },
12
+ "physicsOptions": {
13
+ "gravity": [
14
+ 0,
15
+ -9.81,
16
+ 0,
17
+ "v"
18
+ ],
19
+ "engine": "rapier"
20
+ },
21
+ "useManifold": true
22
+ },
23
+ "actors": [
24
+ {
25
+ "uuid": "9a86d389088b361c",
26
+ "class": "ENGINE.Actor",
27
+ "properties": {
28
+ "editorData": {
29
+ "displayName": "Directional Light",
30
+ "hidden": false
31
+ }
32
+ },
33
+ "ctor": {
34
+ "rootComponent": {
35
+ "class": "ENGINE.DirectionalLightComponent",
36
+ "uuid": "cfe05433-9edc-4dfe-a535-c71f33e92d78",
37
+ "ctor": {
38
+ "color": 16777215,
39
+ "intensity": 1,
40
+ "castShadow": true,
41
+ "shadowMapSize": 2048,
42
+ "shadowBias": 0,
43
+ "shadowNormalBias": 0,
44
+ "shadowNear": 0.1,
45
+ "shadowFar": 100
46
+ },
47
+ "properties": {
48
+ "position": [
49
+ 10,
50
+ 50,
51
+ -10,
52
+ "v"
53
+ ],
54
+ "castShadow": true
55
+ }
56
+ }
57
+ }
58
+ },
59
+ {
60
+ "uuid": "9d428f2a16e5374a",
61
+ "class": "ENGINE.Actor",
62
+ "properties": {
63
+ "editorData": {
64
+ "displayName": "Ground",
65
+ "hidden": false
66
+ }
67
+ },
68
+ "ctor": {
69
+ "rootComponent": {
70
+ "class": "ENGINE.MeshComponent",
71
+ "uuid": "71caea24-62d7-4e45-a76e-4c7519de2c3c",
72
+ "ctor": {
73
+ "geometry": {
74
+ "class": "THREE.BoxGeometry",
75
+ "ctor": [
76
+ 500,
77
+ 0.1,
78
+ 500
79
+ ]
80
+ },
81
+ "material": {
82
+ "@external": "DefaultMaterial"
83
+ },
84
+ "uvScaleTilesPerUnit": 0.2,
85
+ "physicsOptions": {
86
+ "enabled": true,
87
+ "motionType": "static",
88
+ "collisionProfile": "BlockAll"
89
+ }
90
+ },
91
+ "properties": {
92
+ "position": [
93
+ 0,
94
+ -0.9,
95
+ 0,
96
+ "v"
97
+ ],
98
+ "receiveShadow": true
99
+ }
100
+ }
101
+ }
102
+ },
103
+ {
104
+ "uuid": "b87cbc5e60a2e54c",
105
+ "class": "ENGINE.PlayerStart",
106
+ "properties": {
107
+ "editorData": {
108
+ "displayName": "Player Start",
109
+ "hidden": false
110
+ }
111
+ },
112
+ "ctor": {
113
+ "rootComponent": {
114
+ "class": "ENGINE.SceneComponent",
115
+ "uuid": "b4d5f8f7-2512-45e1-9157-c7ff6772402d",
116
+ "ctor": {},
117
+ "properties": {
118
+ "position": [
119
+ 0,
120
+ 0.9,
121
+ 0,
122
+ "v"
123
+ ]
124
+ }
125
+ }
126
+ }
127
+ },
128
+ {
129
+ "uuid": "0ba1f4677e8370d1",
130
+ "class": "ENGINE.Actor",
131
+ "properties": {
132
+ "editorData": {
133
+ "displayName": "Skybox",
134
+ "hidden": false
135
+ }
136
+ },
137
+ "ctor": {
138
+ "rootComponent": {
139
+ "class": "ENGINE.SceneComponent",
140
+ "uuid": "195e88df-73ff-4f4b-82ae-7fb58671463d",
141
+ "ctor": {},
142
+ "properties": {},
143
+ "children": [
144
+ {
145
+ "class": "ENGINE.SkyboxComponent",
146
+ "uuid": "a6cea5af-a972-4031-97b4-cd9218198a2f",
147
+ "ctor": {
148
+ "textureUrl": "@engine/assets/textures/skybox/citrus_orchard_road_puresky_2k.hdr",
149
+ "width": 2048,
150
+ "height": 1024,
151
+ "bottomColor": "#E6F3FF",
152
+ "middleColor": "#4A90E2",
153
+ "topColor": "#0F1B3C",
154
+ "envMapIntensity": 1
155
+ },
156
+ "properties": {}
157
+ }
158
+ ]
159
+ }
160
+ }
161
+ }
162
+ ],
163
+ "properties": {
164
+ "editorData": {}
165
+ }
166
166
  }
@@ -1,39 +1,39 @@
1
-
2
- import * as ENGINE from 'genesys.js';
3
- import * as THREE from 'three';
4
-
5
- import { ThirdPersonPlayer } from './player.js';
6
- import './auto-imports.js';
7
-
8
- class ThirdPersonGame extends ENGINE.BaseGameLoop {
9
- private pawn: ThirdPersonPlayer | null = null;
10
- private controller: ENGINE.PlayerController | null = null;
11
-
12
- protected override createLoadingScreen(): ENGINE.ILoadingScreen | null {
13
- // enable the default loading screen
14
- return new ENGINE.DefaultLoadingScreen();
15
- }
16
-
17
- protected override async preStart(): Promise<void> {
18
- // default spawn location
19
- const position = new THREE.Vector3(0, ENGINE.CHARACTER_HEIGHT / 2, 0);
20
-
21
- // create the pawn
22
- this.pawn = new ThirdPersonPlayer({ position });
23
-
24
- // create the controller and possess the pawn
25
- this.controller = new ENGINE.PlayerController();
26
- this.controller.possess(this.pawn);
27
-
28
- // add both to the world
29
- this.world.addActors(this.pawn, this.controller);
30
- }
31
- }
32
-
33
- export function main(container: HTMLElement, gameId: string): ENGINE.IGameLoop {
34
- const game = new ThirdPersonGame(container, {
35
- ...ENGINE.BaseGameLoop.DEFAULT_OPTIONS,
36
- gameId
37
- });
38
- return game;
39
- }
1
+
2
+ import * as ENGINE from '@directivegames/genesys.js';
3
+ import * as THREE from 'three';
4
+
5
+ import { ThirdPersonPlayer } from './player.js';
6
+ import './auto-imports.js';
7
+
8
+ class ThirdPersonGame extends ENGINE.BaseGameLoop {
9
+ private pawn: ThirdPersonPlayer | null = null;
10
+ private controller: ENGINE.PlayerController | null = null;
11
+
12
+ protected override createLoadingScreen(): ENGINE.ILoadingScreen | null {
13
+ // enable the default loading screen
14
+ return new ENGINE.DefaultLoadingScreen();
15
+ }
16
+
17
+ protected override async preStart(): Promise<void> {
18
+ // default spawn location
19
+ const position = new THREE.Vector3(0, ENGINE.CHARACTER_HEIGHT / 2, 0);
20
+
21
+ // create the pawn
22
+ this.pawn = new ThirdPersonPlayer({ position });
23
+
24
+ // create the controller and possess the pawn
25
+ this.controller = new ENGINE.PlayerController();
26
+ this.controller.possess(this.pawn);
27
+
28
+ // add both to the world
29
+ this.world.addActors(this.pawn, this.controller);
30
+ }
31
+ }
32
+
33
+ export function main(container: HTMLElement, gameId: string): ENGINE.IGameLoop {
34
+ const game = new ThirdPersonGame(container, {
35
+ ...ENGINE.BaseGameLoop.DEFAULT_OPTIONS,
36
+ gameId
37
+ });
38
+ return game;
39
+ }