hytopia 0.1.19 → 0.1.21

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,23 @@
1
+ ---
2
+ name: Bug report
3
+ about: Create a bug report. Use this for unexpected behaviors that we can reproduce so we can fix them in the SDK. If we find your issue is not an SDK bug, we'll provide clarity on a fix for your code.
4
+ title: <Concise title for this bug> [BUG]
5
+ labels: bug
6
+ assignees: iamarkdev
7
+
8
+ ---
9
+
10
+ **What were you trying to do, what did you expect to happen?**
11
+ Let us know what you were trying to do, and what you expected your code to do that it did not.
12
+
13
+ **What actually happened?**
14
+ What did your code actually do? Explain the bug/issue clearly.
15
+
16
+ **To Reproduce**
17
+ For SDK specific bugs, please provide the HYTOPIA SDK version you're using and a complete snippet of your code so we can reproduce this issue locally.
18
+
19
+ **Screenshots**
20
+ If applicable, add screenshots to help explain your problem.
21
+
22
+ **Additional context**
23
+ Add any other context about the problem here.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # HYTOPIA SDK
2
2
 
3
3
  ## Quick Links
4
- [Quickstart](#quickstart) • [API Reference](./docs/server.md) • [Report Bugs or Request Features](https://github.com/hytopiagg/sdk/issues)
4
+ [Quickstart](#quickstart) • [API Reference](./docs/server.md) • [Examples](./examples) • [Join Our Developer Discord](https://discord.gg/hytopia-developers) • [Report Bugs or Request Features](https://github.com/hytopiagg/sdk/issues)
5
5
 
6
6
  ## What is HYTOPIA?
7
7
 
package/bin/scripts.js CHANGED
@@ -43,7 +43,8 @@ const path = require('path');
43
43
  console.log('🔧 Initializing project');
44
44
  execSync('bun init --yes');
45
45
  execSync('bun add hytopia');
46
-
46
+
47
+ const srcDir = path.join(__dirname, '..', 'boilerplate');
47
48
  fs.cpSync(srcDir, destDir, { recursive: true });
48
49
  }
49
50
 
@@ -1,7 +1,6 @@
1
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.
2
+ The server will look for assets/certs/localhost.key and
3
+ assets/certs/localhost.cert and use those for localhost SSL.
5
4
 
6
5
  We use these self-signed certs to allow https://localhost
7
6
  & wss://localhost support. Without this, play.hytopia.com
@@ -42,17 +42,6 @@ import worldMap from './assets/map.json';
42
42
  */
43
43
 
44
44
  startServer(world => {
45
- /**
46
- * Enable SSL for local development. This allows you to
47
- * connect to your local game server from https://play.hytopia.com
48
- * without having to manually set up SSL.
49
- *
50
- * If you are using a reverse proxy like ngrok (IE, `ngrok http 8080`)
51
- * so others can connect to your local game server via the ngrok
52
- * provided URL, make sure to remove this or comment it out.
53
- */
54
- GameServer.instance.webServer.enableLocalSSL();
55
-
56
45
  /**
57
46
  * Enable debug rendering of the physics simulation.
58
47
  * This will overlay lines in-game representing colliders,
@@ -19,36 +19,3 @@ This class is used as a singleton and should be accessed via the GameServer.webS
19
19
 
20
20
  The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `WebServer` class.
21
21
 
22
- ## Methods
23
-
24
- <table><thead><tr><th>
25
-
26
- Method
27
-
28
-
29
- </th><th>
30
-
31
- Modifiers
32
-
33
-
34
- </th><th>
35
-
36
- Description
37
-
38
-
39
- </th></tr></thead>
40
- <tbody><tr><td>
41
-
42
- [enableLocalSSL()](./server.hytopia.webserver.enablelocalssl.md)
43
-
44
-
45
- </td><td>
46
-
47
-
48
- </td><td>
49
-
50
- Enables SSL for local development. The server will be available at https://localhost:8080. This is intended for local development without a reverse proxy. Don't use it when using tunnels like ngrok.com that already handle SSL. Usage of this method will be ignored in production. Must be called in init function of [startServer()](./server.startserver.md)<!-- -->.
51
-
52
-
53
- </td></tr>
54
- </tbody></table>
@@ -19,36 +19,3 @@ This class is used as a singleton and should be accessed via the GameServer.webS
19
19
 
20
20
  The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `WebServer` class.
21
21
 
22
- ## Methods
23
-
24
- <table><thead><tr><th>
25
-
26
- Method
27
-
28
-
29
- </th><th>
30
-
31
- Modifiers
32
-
33
-
34
- </th><th>
35
-
36
- Description
37
-
38
-
39
- </th></tr></thead>
40
- <tbody><tr><td>
41
-
42
- [enableLocalSSL()](./server.webserver.enablelocalssl.md)
43
-
44
-
45
- </td><td>
46
-
47
-
48
- </td><td>
49
-
50
- Enables SSL for local development. The server will be available at https://localhost:8080. This is intended for local development without a reverse proxy. Don't use it when using tunnels like ngrok.com that already handle SSL. Usage of this method will be ignored in production. Must be called in init function of [startServer()](./server.startserver.md)<!-- -->.
51
-
52
-
53
- </td></tr>
54
- </tbody></table>
@@ -0,0 +1,22 @@
1
+ # HYTOPIA SDK Examples
2
+
3
+ HYTOPIA SDK examples are a collection of HYTOPIA SDK projects that demonstrate full games or specific features using the SDK.
4
+
5
+ In each folder, you'll find an index.ts file - this is the main entry point and where you'll find the code for each example.
6
+
7
+ Here's an overview of the examples available:
8
+ - [`payload-game`](./payload-game): A simple game where players must stay near a payload for it to move towards its destination while enemies spawn and swarm the players.
9
+ - [`character-controller`](./character-controller): A simple example of how to implement your own character controller class.
10
+ - [`entity-spawn`](./entity-spawn): A simple example of how to spawn an entity and set some of its properties.
11
+
12
+ ## Use Examples As Templates For Your Projects
13
+
14
+ If you want to init a new HYTOPIA project based on an example in this directory, you can use the `hytopia init` command with the `--template` flag.
15
+
16
+ For example, to create a new project based on the `payload-game` example, you can run:
17
+
18
+ ```bash
19
+ bunx hytopia init --template payload-game
20
+ ```
21
+
22
+ The value passed to the `--template` flag should be the name of the folder in the examples directory.
@@ -1,7 +1,6 @@
1
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.
2
+ The server will look for assets/certs/localhost.key and
3
+ assets/certs/localhost.cert and use those for localhost SSL.
5
4
 
6
5
  We use these self-signed certs to allow https://localhost
7
6
  & wss://localhost support. Without this, play.hytopia.com
@@ -9,7 +9,6 @@ import MyCharacterController from './MyCharacterController';
9
9
  import worldMap from './assets/map.json';
10
10
 
11
11
  startServer(world => {
12
- GameServer.instance.webServer.enableLocalSSL();
13
12
  world.simulation.enableDebugRendering(true);
14
13
  world.loadMap(worldMap);
15
14
 
@@ -1,7 +1,6 @@
1
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.
2
+ The server will look for assets/certs/localhost.key and
3
+ assets/certs/localhost.cert and use those for localhost SSL.
5
4
 
6
5
  We use these self-signed certs to allow https://localhost
7
6
  & wss://localhost support. Without this, play.hytopia.com
@@ -68,8 +68,6 @@ startServer(world => {
68
68
  * Boilerplate setup for our example
69
69
  */
70
70
  function setup(world: World) {
71
- GameServer.instance.webServer.enableLocalSSL();
72
-
73
71
  world.simulation.enableDebugRendering(true);
74
72
  world.loadMap(worldMap);
75
73
 
@@ -1,7 +1,6 @@
1
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.
2
+ The server will look for assets/certs/localhost.key and
3
+ assets/certs/localhost.cert and use those for localhost SSL.
5
4
 
6
5
  We use these self-signed certs to allow https://localhost
7
6
  & wss://localhost support. Without this, play.hytopia.com
@@ -1,5 +1,19 @@
1
1
  /**
2
+ * payload-game is a simple game that encompasses a number of core HYTOPIA SDK systems.
3
+ * This example utilizes entities, spawning, rigid body, colliders and sensors,
4
+ * collision groups, audio, character controller hooks, and more.
2
5
  *
6
+ * This example is a quick and dirty implementation of an overwatch style push the payload
7
+ * in a multiplayer PvE style. Players start the game around the payload and must stay near it
8
+ * for it to move towards the next waypoint. Enemies spawn near the next arget waypoint of
9
+ * the payload and swarm towards the players. Players can left click to shoot spiders with
10
+ * bullets.
11
+ *
12
+ * This example is not meant to be a polished game, but rather a demonstration of how to use
13
+ * the SDK to build your own games.
14
+ *
15
+ * In a polished implementation, we'd be using multiple files and not just index.ts to
16
+ * break out and properly organize game behavior and mechanics.
3
17
  */
4
18
 
5
19
  import {
@@ -75,11 +89,6 @@ let targetWaypointCoordinateIndex = 0; // Current waypoint coordinate index for
75
89
  startServer(world => { // Perform our game setup logic in the startServer init callback here.
76
90
  const chatManager = world.chatManager;
77
91
 
78
- // Enable local ssl, so we can connect to https://localhost:8080 from play.hytopia.com for testing
79
- // If using NGROK or a reverse proxy that handles SSL, you need to comment this out to be able to
80
- // connect to the server from the client using the reverse proxy URL.
81
- GameServer.instance.webServer.enableLocalSSL();
82
-
83
92
  // Load Map
84
93
  world.loadMap(map);
85
94
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hytopia",
3
- "version": "0.1.19",
3
+ "version": "0.1.21",
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": {
package/server.api.json CHANGED
@@ -28702,39 +28702,7 @@
28702
28702
  "isAbstract": false,
28703
28703
  "name": "WebServer",
28704
28704
  "preserveMemberOrder": false,
28705
- "members": [
28706
- {
28707
- "kind": "Method",
28708
- "canonicalReference": "server!HYTOPIA.WebServer#enableLocalSSL:member(1)",
28709
- "docComment": "/**\n * Enables SSL for local development. The server will be available at https://localhost:8080. This is intended for local development without a reverse proxy. Don't use it when using tunnels like ngrok.com that already handle SSL. Usage of this method will be ignored in production. Must be called in init function of {@link startServer}.\n */\n",
28710
- "excerptTokens": [
28711
- {
28712
- "kind": "Content",
28713
- "text": "enableLocalSSL(): "
28714
- },
28715
- {
28716
- "kind": "Content",
28717
- "text": "void"
28718
- },
28719
- {
28720
- "kind": "Content",
28721
- "text": ";"
28722
- }
28723
- ],
28724
- "isStatic": false,
28725
- "returnTypeTokenRange": {
28726
- "startIndex": 1,
28727
- "endIndex": 2
28728
- },
28729
- "releaseTag": "Public",
28730
- "isProtected": false,
28731
- "overloadIndex": 1,
28732
- "parameters": [],
28733
- "isOptional": false,
28734
- "isAbstract": false,
28735
- "name": "enableLocalSSL"
28736
- }
28737
- ],
28705
+ "members": [],
28738
28706
  "implementsTokenRanges": [
28739
28707
  {
28740
28708
  "startIndex": 1,
@@ -35526,39 +35494,7 @@
35526
35494
  "isAbstract": false,
35527
35495
  "name": "WebServer",
35528
35496
  "preserveMemberOrder": false,
35529
- "members": [
35530
- {
35531
- "kind": "Method",
35532
- "canonicalReference": "server!WebServer#enableLocalSSL:member(1)",
35533
- "docComment": "/**\n * Enables SSL for local development. The server will be available at https://localhost:8080. This is intended for local development without a reverse proxy. Don't use it when using tunnels like ngrok.com that already handle SSL. Usage of this method will be ignored in production. Must be called in init function of {@link startServer}.\n */\n",
35534
- "excerptTokens": [
35535
- {
35536
- "kind": "Content",
35537
- "text": "enableLocalSSL(): "
35538
- },
35539
- {
35540
- "kind": "Content",
35541
- "text": "void"
35542
- },
35543
- {
35544
- "kind": "Content",
35545
- "text": ";"
35546
- }
35547
- ],
35548
- "isStatic": false,
35549
- "returnTypeTokenRange": {
35550
- "startIndex": 1,
35551
- "endIndex": 2
35552
- },
35553
- "releaseTag": "Public",
35554
- "isProtected": false,
35555
- "overloadIndex": 1,
35556
- "parameters": [],
35557
- "isOptional": false,
35558
- "isAbstract": false,
35559
- "name": "enableLocalSSL"
35560
- }
35561
- ],
35497
+ "members": [],
35562
35498
  "implementsTokenRanges": [
35563
35499
  {
35564
35500
  "startIndex": 1,
package/server.d.ts CHANGED
@@ -2401,16 +2401,6 @@ export declare class WebServer implements Readyable {
2401
2401
 
2402
2402
 
2403
2403
 
2404
- /**
2405
- * Enables SSL for local development. The server will be
2406
- * available at https://localhost:8080. This is intended
2407
- * for local development without a reverse proxy. Don't
2408
- * use it when using tunnels like ngrok.com that already
2409
- * handle SSL. Usage of this method will be ignored
2410
- * in production. Must be called in init function of
2411
- * {@link startServer}.
2412
- */
2413
- enableLocalSSL(): void;
2414
2404
 
2415
2405
 
2416
2406