hytopia 0.1.5 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
package/bin/scripts.js CHANGED
@@ -2,17 +2,45 @@
2
2
 
3
3
  const fs = require('fs');
4
4
  const path = require('path');
5
- const command = process.argv[2];
5
+ const mkcert = require('mkcert');
6
6
 
7
- if (command === 'init') {
8
- const srcDir = path.join(__dirname, '..', 'boilerplate');
9
- const destDir = process.cwd();
7
+ (async () => {
8
+ const command = process.argv[2];
10
9
 
11
- fs.cpSync(srcDir, destDir, { recursive: true });
10
+ if (command === 'init') {
11
+ const srcDir = path.join(__dirname, '..', 'boilerplate');
12
+ const destDir = process.cwd();
13
+
14
+ // Copy boilerplate
15
+ console.log(`Copying boilerplate to ${destDir}`);
16
+ fs.cpSync(srcDir, destDir, { recursive: true });
17
+
18
+ // Generate SSL cert and allow mkcert to auto handle CA/Cert setup
19
+ console.log(`Generating SSL cert for local development...`);
20
+ const validity = 3650; // 10 years
21
+ const ca = await mkcert.createCA({
22
+ organization: 'HYTOPIA',
23
+ countryCode: 'US',
24
+ state: 'Washington',
25
+ locality: 'Seattle',
26
+ validity,
27
+ });
12
28
 
13
- console.log('🚀 Hytopia project initialized successfully!');
14
- console.log('💡 Start your development server with `bun --watch index.ts`!');
15
- return;
16
- }
29
+ const cert = await mkcert.createCert({
30
+ ca: { key: ca.key, cert: ca.cert },
31
+ domains: ['localhost', '127.0.0.1'],
32
+ validity,
33
+ });
34
+
35
+ fs.writeFileSync(path.join(destDir, 'assets', 'certs', 'localhost.crt'), cert.cert);
36
+ fs.writeFileSync(path.join(destDir, 'assets', 'certs', 'localhost.key'), cert.key);
37
+
38
+ // Done, lfg!
39
+ console.log('🚀 Hytopia project initialized successfully!');
40
+ console.log('💡 Start your development server with `bun --watch index.ts`!');
41
+ return;
42
+ }
43
+
44
+ console.log('Unknown command: ' + command);
45
+ })();
17
46
 
18
- console.log('Unknown command: ' + command);
@@ -0,0 +1,6 @@
1
+ For local development, mkcert generated certs will be stored here.
2
+ We do this to allow https://localhost & wss://localhost support.
3
+ Without this, play.hytopia.com requires a bunch of funky browser
4
+ flag workarounds in order to connect to our local server.
5
+ This is only used for local development and will be ignored
6
+ when your game is deployed to HYTOPIA servers.
@@ -42,15 +42,15 @@ import worldMap from './assets/map.json';
42
42
 
43
43
  startServer(world => {
44
44
  /**
45
- * Enable debugging of the physics simulation.
45
+ * Enable debug rendering of the physics simulation.
46
46
  * This will overlay lines in-game representing colliders,
47
47
  * rigid bodies, and raycasts. This is useful for debugging
48
- * physics-related issues and is very frequently used.
48
+ * physics-related issues in a development environment.
49
49
  * For larger worlds, enabling this can cause performance
50
50
  * issues, which will be noticed as dropped frame rates
51
51
  * and higher RTT times.
52
52
  */
53
- world.simulation.enableDebug(true);
53
+ world.simulation.enableDebugRendering(true);
54
54
 
55
55
  /**
56
56
  * Load our map.
@@ -84,7 +84,7 @@ startServer(world => {
84
84
  world.chatManager.sendPlayerMessage(player, 'Use WASD to move around.');
85
85
  world.chatManager.sendPlayerMessage(player, 'Press space to jump.');
86
86
  world.chatManager.sendPlayerMessage(player, 'Hold shift to sprint.');
87
- world.chatManager.sendPlayerMessage(player, 'Type /rocket for a little surprise!');
87
+ world.chatManager.sendPlayerMessage(player, 'Press \\ to enter or exit debug view.');
88
88
  };
89
89
 
90
90
  /**
package/bun.lockb ADDED
Binary file
Binary file
@@ -1,15 +1,15 @@
1
1
  <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
2
 
3
- [Home](./index.md) &gt; [server](./server.md) &gt; [HYTOPIA](./server.hytopia.md) &gt; [Simulation](./server.hytopia.simulation.md) &gt; [enableDebug](./server.hytopia.simulation.enabledebug.md)
3
+ [Home](./index.md) &gt; [server](./server.md) &gt; [HYTOPIA](./server.hytopia.md) &gt; [Simulation](./server.hytopia.simulation.md) &gt; [enableDebugRendering](./server.hytopia.simulation.enabledebugrendering.md)
4
4
 
5
- ## HYTOPIA.Simulation.enableDebug() method
5
+ ## HYTOPIA.Simulation.enableDebugRendering() method
6
6
 
7
- Enables or disables debug rendering for the simulation. When enabled, all colliders and rigid bodies will be rendered in the world. Do not enable this in production. In large worlds this can cause noticable lag and RTT spikes.
7
+ Enables or disables debug rendering for the simulation. When enabled, all colliders, rigid body and raycast outlines will be rendered in the world. Do not enable this in production. In large worlds enabling this can cause noticable lag and RTT spikes.
8
8
 
9
9
  **Signature:**
10
10
 
11
11
  ```typescript
12
- enableDebug(enabled: boolean): void;
12
+ enableDebugRendering(enabled: boolean): void;
13
13
  ```
14
14
 
15
15
  ## Parameters
@@ -1,13 +1,13 @@
1
1
  <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
2
 
3
- [Home](./index.md) &gt; [server](./server.md) &gt; [HYTOPIA](./server.hytopia.md) &gt; [Simulation](./server.hytopia.simulation.md) &gt; [isDebugEnabled](./server.hytopia.simulation.isdebugenabled.md)
3
+ [Home](./index.md) &gt; [server](./server.md) &gt; [HYTOPIA](./server.hytopia.md) &gt; [Simulation](./server.hytopia.simulation.md) &gt; [isDebugRenderingEnabled](./server.hytopia.simulation.isdebugrenderingenabled.md)
4
4
 
5
- ## HYTOPIA.Simulation.isDebugEnabled property
5
+ ## HYTOPIA.Simulation.isDebugRenderingEnabled property
6
6
 
7
7
  Whether the simulation has debug rendering enabled.
8
8
 
9
9
  **Signature:**
10
10
 
11
11
  ```typescript
12
- get isDebugEnabled(): boolean;
12
+ get isDebugRenderingEnabled(): boolean;
13
13
  ```
@@ -64,7 +64,7 @@ The gravity vector for the simulation.
64
64
  </td></tr>
65
65
  <tr><td>
66
66
 
67
- [isDebugEnabled](./server.hytopia.simulation.isdebugenabled.md)
67
+ [isDebugRenderingEnabled](./server.hytopia.simulation.isdebugrenderingenabled.md)
68
68
 
69
69
 
70
70
  </td><td>
@@ -161,7 +161,7 @@ Casts a ray through the simulation.
161
161
  </td></tr>
162
162
  <tr><td>
163
163
 
164
- [enableDebug(enabled)](./server.hytopia.simulation.enabledebug.md)
164
+ [enableDebugRendering(enabled)](./server.hytopia.simulation.enabledebugrendering.md)
165
165
 
166
166
 
167
167
  </td><td>
@@ -169,7 +169,7 @@ Casts a ray through the simulation.
169
169
 
170
170
  </td><td>
171
171
 
172
- Enables or disables debug rendering for the simulation. When enabled, all colliders and rigid bodies will be rendered in the world. Do not enable this in production. In large worlds this can cause noticable lag and RTT spikes.
172
+ Enables or disables debug rendering for the simulation. When enabled, all colliders, rigid body and raycast outlines will be rendered in the world. Do not enable this in production. In large worlds enabling this can cause noticable lag and RTT spikes.
173
173
 
174
174
 
175
175
  </td></tr>
@@ -1,15 +1,15 @@
1
1
  <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
2
 
3
- [Home](./index.md) &gt; [server](./server.md) &gt; [Simulation](./server.simulation.md) &gt; [enableDebug](./server.simulation.enabledebug.md)
3
+ [Home](./index.md) &gt; [server](./server.md) &gt; [Simulation](./server.simulation.md) &gt; [enableDebugRendering](./server.simulation.enabledebugrendering.md)
4
4
 
5
- ## Simulation.enableDebug() method
5
+ ## Simulation.enableDebugRendering() method
6
6
 
7
- Enables or disables debug rendering for the simulation. When enabled, all colliders and rigid bodies will be rendered in the world. Do not enable this in production. In large worlds this can cause noticable lag and RTT spikes.
7
+ Enables or disables debug rendering for the simulation. When enabled, all colliders, rigid body and raycast outlines will be rendered in the world. Do not enable this in production. In large worlds enabling this can cause noticable lag and RTT spikes.
8
8
 
9
9
  **Signature:**
10
10
 
11
11
  ```typescript
12
- enableDebug(enabled: boolean): void;
12
+ enableDebugRendering(enabled: boolean): void;
13
13
  ```
14
14
 
15
15
  ## Parameters
@@ -1,13 +1,13 @@
1
1
  <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
2
 
3
- [Home](./index.md) &gt; [server](./server.md) &gt; [Simulation](./server.simulation.md) &gt; [isDebugEnabled](./server.simulation.isdebugenabled.md)
3
+ [Home](./index.md) &gt; [server](./server.md) &gt; [Simulation](./server.simulation.md) &gt; [isDebugRenderingEnabled](./server.simulation.isdebugrenderingenabled.md)
4
4
 
5
- ## Simulation.isDebugEnabled property
5
+ ## Simulation.isDebugRenderingEnabled property
6
6
 
7
7
  Whether the simulation has debug rendering enabled.
8
8
 
9
9
  **Signature:**
10
10
 
11
11
  ```typescript
12
- get isDebugEnabled(): boolean;
12
+ get isDebugRenderingEnabled(): boolean;
13
13
  ```
@@ -64,7 +64,7 @@ The gravity vector for the simulation.
64
64
  </td></tr>
65
65
  <tr><td>
66
66
 
67
- [isDebugEnabled](./server.simulation.isdebugenabled.md)
67
+ [isDebugRenderingEnabled](./server.simulation.isdebugrenderingenabled.md)
68
68
 
69
69
 
70
70
  </td><td>
@@ -161,7 +161,7 @@ Casts a ray through the simulation.
161
161
  </td></tr>
162
162
  <tr><td>
163
163
 
164
- [enableDebug(enabled)](./server.simulation.enabledebug.md)
164
+ [enableDebugRendering(enabled)](./server.simulation.enabledebugrendering.md)
165
165
 
166
166
 
167
167
  </td><td>
@@ -169,7 +169,7 @@ Casts a ray through the simulation.
169
169
 
170
170
  </td><td>
171
171
 
172
- Enables or disables debug rendering for the simulation. When enabled, all colliders and rigid bodies will be rendered in the world. Do not enable this in production. In large worlds this can cause noticable lag and RTT spikes.
172
+ Enables or disables debug rendering for the simulation. When enabled, all colliders, rigid body and raycast outlines will be rendered in the world. Do not enable this in production. In large worlds enabling this can cause noticable lag and RTT spikes.
173
173
 
174
174
 
175
175
  </td></tr>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hytopia",
3
- "version": "0.1.5",
3
+ "version": "0.1.8",
4
4
  "description": "The HYTOPIA SDK makes it easy for developers to create multiplayer games on the HYTOPIA platform using JavaScript or TypeScript.",
5
5
  "main": "server.js",
6
6
  "bin": {
@@ -46,5 +46,8 @@
46
46
  "bugs": {
47
47
  "url": "https://github.com/hytopiagg/sdk/issues"
48
48
  },
49
- "homepage": "https://github.com/hytopiagg/sdk#readme"
49
+ "homepage": "https://github.com/hytopiagg/sdk#readme",
50
+ "devDependencies": {
51
+ "mkcert": "^3.2.0"
52
+ }
50
53
  }
package/server.api.json CHANGED
@@ -28116,12 +28116,12 @@
28116
28116
  },
28117
28117
  {
28118
28118
  "kind": "Method",
28119
- "canonicalReference": "server!HYTOPIA.Simulation#enableDebug:member(1)",
28120
- "docComment": "/**\n * Enables or disables debug rendering for the simulation. When enabled, all colliders and rigid bodies will be rendered in the world. Do not enable this in production. In large worlds this can cause noticable lag and RTT spikes.\n *\n * @param enabled - Whether to enable debug rendering.\n */\n",
28119
+ "canonicalReference": "server!HYTOPIA.Simulation#enableDebugRendering:member(1)",
28120
+ "docComment": "/**\n * Enables or disables debug rendering for the simulation. When enabled, all colliders, rigid body and raycast outlines will be rendered in the world. Do not enable this in production. In large worlds enabling this can cause noticable lag and RTT spikes.\n *\n * @param enabled - Whether to enable debug rendering.\n */\n",
28121
28121
  "excerptTokens": [
28122
28122
  {
28123
28123
  "kind": "Content",
28124
- "text": "enableDebug(enabled: "
28124
+ "text": "enableDebugRendering(enabled: "
28125
28125
  },
28126
28126
  {
28127
28127
  "kind": "Content",
@@ -28160,7 +28160,7 @@
28160
28160
  ],
28161
28161
  "isOptional": false,
28162
28162
  "isAbstract": false,
28163
- "name": "enableDebug"
28163
+ "name": "enableDebugRendering"
28164
28164
  },
28165
28165
  {
28166
28166
  "kind": "Property",
@@ -28195,12 +28195,12 @@
28195
28195
  },
28196
28196
  {
28197
28197
  "kind": "Property",
28198
- "canonicalReference": "server!HYTOPIA.Simulation#isDebugEnabled:member",
28198
+ "canonicalReference": "server!HYTOPIA.Simulation#isDebugRenderingEnabled:member",
28199
28199
  "docComment": "/**\n * Whether the simulation has debug rendering enabled.\n */\n",
28200
28200
  "excerptTokens": [
28201
28201
  {
28202
28202
  "kind": "Content",
28203
- "text": "get isDebugEnabled(): "
28203
+ "text": "get isDebugRenderingEnabled(): "
28204
28204
  },
28205
28205
  {
28206
28206
  "kind": "Content",
@@ -28214,7 +28214,7 @@
28214
28214
  "isReadonly": true,
28215
28215
  "isOptional": false,
28216
28216
  "releaseTag": "Public",
28217
- "name": "isDebugEnabled",
28217
+ "name": "isDebugRenderingEnabled",
28218
28218
  "propertyTypeTokenRange": {
28219
28219
  "startIndex": 1,
28220
28220
  "endIndex": 2
@@ -34853,12 +34853,12 @@
34853
34853
  },
34854
34854
  {
34855
34855
  "kind": "Method",
34856
- "canonicalReference": "server!Simulation#enableDebug:member(1)",
34857
- "docComment": "/**\n * Enables or disables debug rendering for the simulation. When enabled, all colliders and rigid bodies will be rendered in the world. Do not enable this in production. In large worlds this can cause noticable lag and RTT spikes.\n *\n * @param enabled - Whether to enable debug rendering.\n */\n",
34856
+ "canonicalReference": "server!Simulation#enableDebugRendering:member(1)",
34857
+ "docComment": "/**\n * Enables or disables debug rendering for the simulation. When enabled, all colliders, rigid body and raycast outlines will be rendered in the world. Do not enable this in production. In large worlds enabling this can cause noticable lag and RTT spikes.\n *\n * @param enabled - Whether to enable debug rendering.\n */\n",
34858
34858
  "excerptTokens": [
34859
34859
  {
34860
34860
  "kind": "Content",
34861
- "text": "enableDebug(enabled: "
34861
+ "text": "enableDebugRendering(enabled: "
34862
34862
  },
34863
34863
  {
34864
34864
  "kind": "Content",
@@ -34897,7 +34897,7 @@
34897
34897
  ],
34898
34898
  "isOptional": false,
34899
34899
  "isAbstract": false,
34900
- "name": "enableDebug"
34900
+ "name": "enableDebugRendering"
34901
34901
  },
34902
34902
  {
34903
34903
  "kind": "Property",
@@ -34932,12 +34932,12 @@
34932
34932
  },
34933
34933
  {
34934
34934
  "kind": "Property",
34935
- "canonicalReference": "server!Simulation#isDebugEnabled:member",
34935
+ "canonicalReference": "server!Simulation#isDebugRenderingEnabled:member",
34936
34936
  "docComment": "/**\n * Whether the simulation has debug rendering enabled.\n */\n",
34937
34937
  "excerptTokens": [
34938
34938
  {
34939
34939
  "kind": "Content",
34940
- "text": "get isDebugEnabled(): "
34940
+ "text": "get isDebugRenderingEnabled(): "
34941
34941
  },
34942
34942
  {
34943
34943
  "kind": "Content",
@@ -34951,7 +34951,7 @@
34951
34951
  "isReadonly": true,
34952
34952
  "isOptional": false,
34953
34953
  "releaseTag": "Public",
34954
- "name": "isDebugEnabled",
34954
+ "name": "isDebugRenderingEnabled",
34955
34955
  "propertyTypeTokenRange": {
34956
34956
  "startIndex": 1,
34957
34957
  "endIndex": 2
package/server.d.ts CHANGED
@@ -2299,7 +2299,7 @@ export declare class Simulation {
2299
2299
 
2300
2300
 
2301
2301
  /** Whether the simulation has debug rendering enabled. */
2302
- get isDebugEnabled(): boolean;
2302
+ get isDebugRenderingEnabled(): boolean;
2303
2303
  /** The gravity vector for the simulation. */
2304
2304
  get gravity(): RAPIER.Vector3;
2305
2305
  /** The fixed timestep for the simulation. */
@@ -2319,12 +2319,12 @@ export declare class Simulation {
2319
2319
 
2320
2320
  /**
2321
2321
  * Enables or disables debug rendering for the simulation.
2322
- * When enabled, all colliders and rigid bodies will be rendered
2323
- * in the world. Do not enable this in production. In large
2324
- * worlds this can cause noticable lag and RTT spikes.
2322
+ * When enabled, all colliders, rigid body and raycast outlines
2323
+ * will be rendered in the world. Do not enable this in production.
2324
+ * In large worlds enabling this can cause noticable lag and RTT spikes.
2325
2325
  * @param enabled - Whether to enable debug rendering.
2326
2326
  */
2327
- enableDebug(enabled: boolean): void;
2327
+ enableDebugRendering(enabled: boolean): void;
2328
2328
 
2329
2329
 
2330
2330