hytopia 0.1.30 → 0.1.31
Sign up to get free protection for your applications and to get access to all the features.
package/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# HYTOPIA SDK
|
2
2
|
|
3
3
|
## Quick Links
|
4
|
-
[Quickstart](#quickstart) • [Developer Docs](https://dev.hytopia.com/) • [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)
|
4
|
+
[Quickstart (Start Here)](#quickstart-start-here) • [Developer Docs](https://dev.hytopia.com/) • [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
|
|
@@ -28,32 +28,9 @@ Available as a simple NPM package, this SDK provides everything you need to get
|
|
28
28
|
|
29
29
|
With these resources, you can quickly build and share immersive, voxel-style multiplayer games on HYTOPIA.
|
30
30
|
|
31
|
-
## Quickstart
|
31
|
+
## Quickstart (Start Here)
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
2. Create a new project directory somewhere on your machine and navigate into it.
|
36
|
-
```bash
|
37
|
-
mkdir my-project-directory && cd my-project-directory
|
38
|
-
```
|
39
|
-
|
40
|
-
3. Initialize a hytopia project from boilerplate or an existing example. Sets up package.json and all dependencies, copies assets and an index.ts game script into your project.
|
41
|
-
```bash
|
42
|
-
# Option 1: Initialize a boilerplate project
|
43
|
-
bunx hytopia init
|
44
|
-
|
45
|
-
# Option 2: Initialize a project from any of the examples in the examples directory like so:
|
46
|
-
bunx hytopia init --template payload-game
|
47
|
-
```
|
48
|
-
|
49
|
-
3. Start the server, use --watch for hot reloads as you make changes.
|
50
|
-
```bash
|
51
|
-
bun --watch index.ts
|
52
|
-
```
|
53
|
-
|
54
|
-
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
|
-
|
56
|
-
**Note: If you'd prefer to use JavaScript instead of TypeScript, simply change the file extension of index.ts to index.js - Your editor will highlight the TypeScript syntax errors, simple delete the type annotations and everything should work the same without any TypeScript usage.**
|
33
|
+
**[Follow the Initial Setup guide, here](https://dev.hytopia.com/getting-started/initial-setup).**
|
57
34
|
|
58
35
|
Once you're up and running, here's some other resources to go further:
|
59
36
|
- [Developer Docs](https://dev.hytopia.com/)
|
package/bin/scripts.js
CHANGED
@@ -27,28 +27,34 @@ const path = require('path');
|
|
27
27
|
if (command === 'init') {
|
28
28
|
const destDir = process.cwd();
|
29
29
|
|
30
|
+
// Initialize project with latest HYTOPIA SDK
|
31
|
+
console.log('🔧 Initializing project with latest HYTOPIA SDK...');
|
32
|
+
execSync('bun init --yes');
|
33
|
+
execSync('bun add hytopia@latest');
|
34
|
+
|
30
35
|
if (flags.template) {
|
31
|
-
|
36
|
+
// Init from example template
|
37
|
+
console.log(`🖨️ Initializing project with examples template "${flags.template}"...`);
|
32
38
|
|
33
|
-
const templateDir = path.join(
|
39
|
+
const templateDir = path.join(destDir, 'node_modules', 'hytopia', 'examples', flags.template);
|
34
40
|
|
35
41
|
if (!fs.existsSync(templateDir)) {
|
36
|
-
console.error(`Examples template ${flags.template} does not exist in the examples directory, could not initialize project
|
42
|
+
console.error(`Examples template ${flags.template} does not exist in the examples directory, could not initialize project! Tried directory: ${templateDir}`);
|
37
43
|
return;
|
38
44
|
}
|
39
45
|
|
40
46
|
fs.cpSync(templateDir, destDir, { recursive: true });
|
41
|
-
execSync('bun install');
|
42
47
|
} else {
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
48
|
+
// Init from boilerplate
|
49
|
+
console.log('🧑💻 Initializing project with boilerplate...');
|
50
|
+
|
47
51
|
const srcDir = path.join(__dirname, '..', 'boilerplate');
|
52
|
+
|
48
53
|
fs.cpSync(srcDir, destDir, { recursive: true });
|
49
54
|
}
|
50
55
|
|
51
56
|
// Done, lfg!
|
57
|
+
console.log('--------------------------------');
|
52
58
|
console.log('🚀 Hytopia project initialized successfully!');
|
53
59
|
console.log('💡 Start your development server with `bun --watch index.ts`!');
|
54
60
|
console.log('🎮 After you start your development server, play by opening your browser and visiting: https://play.hytopia.com/?join=localhost:8080')
|
package/package.json
CHANGED