hytopia 0.1.14 → 0.1.15

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -31,27 +31,22 @@ With these resources, you can quickly build and share immersive, voxel-style mul
31
31
 
32
32
  1. Install a compatible JavaScript runtime. We recommend you use [Bun](https://bun.sh/), but [Node.js](https://nodejs.org/) and [Deno](https://deno.com/) can work with additional configuration. All examples will be given using Bun.
33
33
 
34
- 2. If you're starting a new project, initialize it.
34
+ 2. Create a new project directory somewhere on your machine and navigate into it.
35
35
  ```bash
36
- bun init
36
+ mkdir my-project-directory && cd my-project-directory
37
37
  ```
38
38
 
39
- 3. Install the SDK in a new or existing project.
40
- ```bash
41
- bun add hytopia
42
- ```
43
-
44
- 4. Initialize boilerplate. Copies assets and an index.ts game script into your project.
39
+ 3. Initialize a hytopia project. Sets up package.json and all dependencies, copies assets and an index.ts game script into your project.
45
40
  ```bash
46
41
  bunx hytopia init
47
42
  ```
48
43
 
49
- 5. Start the server, use --watch for hot reloads as you make changes.
44
+ 3. Start the server, use --watch for hot reloads as you make changes.
50
45
  ```bash
51
46
  bun --watch index.ts
52
47
  ```
53
48
 
54
- 6. Visit https://play.hytopia.com - when prompted, enter `localhost:8080` - this is the hostname of the local server you started in the previous step.
49
+ 4. Visit https://play.hytopia.com - when prompted, enter `localhost:8080` - this is the hostname of the local server you started in the previous step.
55
50
 
56
51
  Once you're up and running, here's some other resources to go further:
57
52
  - [Game Examples](./examples)
package/bin/scripts.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ const { execSync } = require('child_process');
3
4
  const fs = require('fs');
4
5
  const path = require('path');
5
- const mkcert = require('mkcert');
6
6
 
7
7
  (async () => {
8
8
  const command = process.argv[2];
@@ -10,35 +10,23 @@ const mkcert = require('mkcert');
10
10
  /**
11
11
  * Init command
12
12
  *
13
- * Initializes a new HYTOPIA project.
13
+ * Initializes a new HYTOPIA project. Accepting an optional
14
+ * project name as an argument.
15
+ *
16
+ * @example
17
+ * `bunx hytopia init my-project-name`
14
18
  */
15
19
  if (command === 'init') {
16
20
  const srcDir = path.join(__dirname, '..', 'boilerplate');
17
21
  const destDir = process.cwd();
18
-
22
+
23
+ // Initialize project
24
+ execSync('bun init --yes');
25
+ execSync('bun add hytopia');
26
+
19
27
  // Copy boilerplate
20
28
  console.log(`🖨️ Copying boilerplate to ${destDir}`);
21
29
  fs.cpSync(srcDir, destDir, { recursive: true });
22
-
23
- // Generate SSL cert and allow mkcert to auto handle CA/Cert setup
24
- console.log(`🔒 Generating SSL cert for local development`);
25
- const validity = 3650; // 10 years
26
- const ca = await mkcert.createCA({
27
- organization: 'HYTOPIA',
28
- countryCode: 'US',
29
- state: 'Washington',
30
- locality: 'Seattle',
31
- validity,
32
- });
33
-
34
- const cert = await mkcert.createCert({
35
- ca: { key: ca.key, cert: ca.cert },
36
- domains: ['localhost', '127.0.0.1'],
37
- validity,
38
- });
39
-
40
- fs.writeFileSync(path.join(destDir, 'assets', 'certs', 'localhost.crt'), cert.cert);
41
- fs.writeFileSync(path.join(destDir, 'assets', 'certs', 'localhost.key'), cert.key);
42
30
 
43
31
  // Done, lfg!
44
32
  console.log('🚀 Hytopia project initialized successfully!');
@@ -1,6 +1,11 @@
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.
1
+ For local development self-signed certs are stored here.
2
+ The server when GameServer.instance.webServer.enableLocalSSL();
3
+ is used, will look for assets/certs/localhost.key and
4
+ assets/certs/localhost.cert and use those for SSL.
5
+
6
+ We use these self-signed certs to allow https://localhost
7
+ & wss://localhost support. Without this, play.hytopia.com
8
+ requires a bunch of funky browser flag workarounds in
9
+ order to connect to your local server. This is only used
10
+ for local development and will be ignored when your game
11
+ is deployed to HYTOPIA servers.
@@ -0,0 +1,20 @@
1
+ -----BEGIN CERTIFICATE-----
2
+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LwHw7jAVB52DLDCdUnRv5fP3o8K
15
+ xEseMJQaJm95eFVfTETcnjDixWtIzNbXULQbGjF3AY74aFjc1fhc/yUCgYEAv9jj
16
+ Zrc+UzR0oi00Ip8O5C5Uvu2W35M+j2XoV/xPkX+Hcr12U40Gnc/rnzVp2lGTwNZS
17
+ ImQcjLEd31qLOy90F9lcaKvOfgcx0JvGEp5SdzQQaS3RJqn0xWLh1O4NMsiVbLNi
18
+ Zi5qFv7pW/DO174xSa7cMVE8qp8YHAOZdpcqm6cCgYB9FL2ZnetteTQE78E3NsrE
19
+ pIwPATIeQdOQkOaK3k6Qw57vUrQNYE//LODJAl0Ln21buQd+1MCMhZctRzbvTK8z
20
+ 4TtgpVmyH7g1eouSU/Y/4nEcaYyuQr55ZjImSbGSsMPAN7SlxHytHPpnGj3Z6VKy
21
+ rKl3CwrDxLjGRL6j0jLeOQKBgBiu3xMoIGy0Iw16o2qQ7GmPTHgEOZUqbLImem5X
22
+ mCUwM00f80lsq51CUx540NW2CTyWVpr2JnYzk5RZIfDLejRXUvxknny4kEA2ypU6
23
+ qYGMwU/HBVHkLAn5XvT2a9xM0mzZ558d+ahbw8qAgRxg7BZ+2PW/bf7F2WRBUk1f
24
+ xauhAoGBALEspoxQozwohGQnP7EMF0/0JoKNpdNv0b0qCVvNiMo0+N297lI2mFQp
25
+ 6xYlW/1l9afLokklF/J2IsyBrTCZoY7SaEk/lMMrQSyra+y0z71ogZ8A4ny9fxsj
26
+ 0dDYJZGllL+3E/MQfd7k+KnOM/+A+cPoAnci76+L3vdkUb2P8SJk
27
+ -----END RSA PRIVATE KEY-----
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hytopia",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
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,8 +46,5 @@
46
46
  "bugs": {
47
47
  "url": "https://github.com/hytopiagg/sdk/issues"
48
48
  },
49
- "homepage": "https://github.com/hytopiagg/sdk#readme",
50
- "dependencies": {
51
- "mkcert": "^3.2.0"
52
- }
49
+ "homepage": "https://github.com/hytopiagg/sdk#readme"
53
50
  }