hytopia 0.1.14 → 0.1.16
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +5 -10
- package/bin/scripts.js +12 -23
- package/boilerplate/assets/certs/README.md +11 -6
- package/boilerplate/assets/certs/localhost.crt +20 -0
- package/boilerplate/assets/certs/localhost.key +27 -0
- package/docs/server.hytopia.md +1 -1
- package/docs/server.hytopia.port.md +2 -2
- package/docs/server.hytopia.supported_input_keys.md +1 -1
- package/docs/server.md +1 -1
- package/docs/server.port.md +2 -2
- package/docs/server.supported_input_keys.md +1 -1
- package/examples/character-controller/MyCharacterController.ts +230 -0
- package/examples/character-controller/README.md +15 -0
- package/examples/character-controller/assets/audio/sfx/damage.wav +0 -0
- package/examples/character-controller/assets/audio/sfx/step.wav +0 -0
- package/examples/character-controller/assets/certs/README.md +11 -0
- package/examples/character-controller/assets/certs/localhost.crt +20 -0
- package/examples/character-controller/assets/certs/localhost.key +27 -0
- package/examples/character-controller/assets/cubemaps/skybox/+x.png +0 -0
- package/examples/character-controller/assets/cubemaps/skybox/+y.png +0 -0
- package/examples/character-controller/assets/cubemaps/skybox/+z.png +0 -0
- package/examples/character-controller/assets/cubemaps/skybox/-x.png +0 -0
- package/examples/character-controller/assets/cubemaps/skybox/-y.png +0 -0
- package/examples/character-controller/assets/cubemaps/skybox/-z.png +0 -0
- package/examples/character-controller/assets/map.json +2623 -0
- package/examples/character-controller/assets/models/player.gltf +1 -0
- package/examples/character-controller/assets/textures/bricks.png +0 -0
- package/examples/character-controller/assets/textures/clay.png +0 -0
- package/examples/character-controller/assets/textures/diamond_ore.png +0 -0
- package/examples/character-controller/assets/textures/dirt.png +0 -0
- package/examples/character-controller/assets/textures/dragons_stone.png +0 -0
- package/examples/character-controller/assets/textures/glass.png +0 -0
- package/examples/character-controller/assets/textures/grass/+x.png +0 -0
- package/examples/character-controller/assets/textures/grass/+y.png +0 -0
- package/examples/character-controller/assets/textures/grass/+z.png +0 -0
- package/examples/character-controller/assets/textures/grass/-x.png +0 -0
- package/examples/character-controller/assets/textures/grass/-y.png +0 -0
- package/examples/character-controller/assets/textures/grass/-z.png +0 -0
- package/examples/character-controller/assets/textures/grass.png +0 -0
- package/examples/character-controller/assets/textures/gravel.png +0 -0
- package/examples/character-controller/assets/textures/ice.png +0 -0
- package/examples/character-controller/assets/textures/infected_shadowrock.png +0 -0
- package/examples/character-controller/assets/textures/log_side.png +0 -0
- package/examples/character-controller/assets/textures/log_top.png +0 -0
- package/examples/character-controller/assets/textures/mossy_coblestone.png +0 -0
- package/examples/character-controller/assets/textures/nuit.png +0 -0
- package/examples/character-controller/assets/textures/oak_leaves.png +0 -0
- package/examples/character-controller/assets/textures/oak_planks.png +0 -0
- package/examples/character-controller/assets/textures/sand.png +0 -0
- package/examples/character-controller/assets/textures/shadowrock.png +0 -0
- package/examples/character-controller/assets/textures/stone.png +0 -0
- package/examples/character-controller/assets/textures/stone_bricks.png +0 -0
- package/examples/character-controller/assets/textures/void_sand.png +0 -0
- package/examples/character-controller/assets/textures/water_still.png +0 -0
- package/examples/character-controller/bun.lockb +0 -0
- package/examples/character-controller/index.ts +43 -0
- package/examples/character-controller/package.json +14 -0
- package/examples/character-controller/tsconfig.json +27 -0
- package/examples/entity-spawn/README.md +15 -0
- package/examples/entity-spawn/assets/certs/README.md +11 -0
- package/examples/entity-spawn/assets/certs/localhost.crt +20 -0
- package/examples/entity-spawn/assets/certs/localhost.key +27 -0
- package/examples/entity-spawn/assets/cubemaps/skybox/+x.png +0 -0
- package/examples/entity-spawn/assets/cubemaps/skybox/+y.png +0 -0
- package/examples/entity-spawn/assets/cubemaps/skybox/+z.png +0 -0
- package/examples/entity-spawn/assets/cubemaps/skybox/-x.png +0 -0
- package/examples/entity-spawn/assets/cubemaps/skybox/-y.png +0 -0
- package/examples/entity-spawn/assets/cubemaps/skybox/-z.png +0 -0
- package/examples/entity-spawn/assets/map.json +2623 -0
- package/examples/entity-spawn/assets/models/player.gltf +1 -0
- package/examples/entity-spawn/assets/models/spider.gltf +1 -0
- package/examples/entity-spawn/assets/textures/bricks.png +0 -0
- package/examples/entity-spawn/assets/textures/clay.png +0 -0
- package/examples/entity-spawn/assets/textures/diamond_ore.png +0 -0
- package/examples/entity-spawn/assets/textures/dirt.png +0 -0
- package/examples/entity-spawn/assets/textures/dragons_stone.png +0 -0
- package/examples/entity-spawn/assets/textures/glass.png +0 -0
- package/examples/entity-spawn/assets/textures/grass/+x.png +0 -0
- package/examples/entity-spawn/assets/textures/grass/+y.png +0 -0
- package/examples/entity-spawn/assets/textures/grass/+z.png +0 -0
- package/examples/entity-spawn/assets/textures/grass/-x.png +0 -0
- package/examples/entity-spawn/assets/textures/grass/-y.png +0 -0
- package/examples/entity-spawn/assets/textures/grass/-z.png +0 -0
- package/examples/entity-spawn/assets/textures/grass.png +0 -0
- package/examples/entity-spawn/assets/textures/gravel.png +0 -0
- package/examples/entity-spawn/assets/textures/ice.png +0 -0
- package/examples/entity-spawn/assets/textures/infected_shadowrock.png +0 -0
- package/examples/entity-spawn/assets/textures/log_side.png +0 -0
- package/examples/entity-spawn/assets/textures/log_top.png +0 -0
- package/examples/entity-spawn/assets/textures/mossy_coblestone.png +0 -0
- package/examples/entity-spawn/assets/textures/nuit.png +0 -0
- package/examples/entity-spawn/assets/textures/oak_leaves.png +0 -0
- package/examples/entity-spawn/assets/textures/oak_planks.png +0 -0
- package/examples/entity-spawn/assets/textures/sand.png +0 -0
- package/examples/entity-spawn/assets/textures/shadowrock.png +0 -0
- package/examples/entity-spawn/assets/textures/stone.png +0 -0
- package/examples/entity-spawn/assets/textures/stone_bricks.png +0 -0
- package/examples/entity-spawn/assets/textures/void_sand.png +0 -0
- package/examples/entity-spawn/assets/textures/water_still.png +0 -0
- package/examples/entity-spawn/bun.lockb +0 -0
- package/examples/entity-spawn/index.ts +93 -0
- package/examples/entity-spawn/package.json +14 -0
- package/examples/entity-spawn/tsconfig.json +27 -0
- package/examples/payload-game/README.md +15 -0
- package/examples/payload-game/assets/certs/README.md +11 -0
- package/examples/payload-game/assets/certs/localhost.crt +20 -0
- package/examples/payload-game/assets/certs/localhost.key +27 -0
- package/examples/payload-game/bun.lockb +0 -0
- package/examples/payload-game/index.ts +12 -3
- package/examples/payload-game/package.json +14 -0
- package/examples/payload-game/tsconfig.json +27 -0
- package/package.json +2 -5
- package/server.api.json +6 -6
- package/server.d.ts +10 -3
- package/server.js +1 -1
- package/tsconfig.json +1 -4
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import {
|
2
|
+
startServer,
|
3
|
+
GameServer,
|
4
|
+
PlayerEntity,
|
5
|
+
} from 'hytopia';
|
6
|
+
|
7
|
+
import MyCharacterController from './MyCharacterController';
|
8
|
+
|
9
|
+
import worldMap from './assets/map.json';
|
10
|
+
|
11
|
+
startServer(world => {
|
12
|
+
GameServer.instance.webServer.enableLocalSSL();
|
13
|
+
world.simulation.enableDebugRendering(true);
|
14
|
+
world.loadMap(worldMap);
|
15
|
+
|
16
|
+
world.onPlayerJoin = player => {
|
17
|
+
const playerEntity = new PlayerEntity({
|
18
|
+
player,
|
19
|
+
name: 'Player',
|
20
|
+
modelUri: 'models/player.gltf',
|
21
|
+
modelLoopedAnimations: [ 'idle' ],
|
22
|
+
modelScale: 0.5,
|
23
|
+
});
|
24
|
+
|
25
|
+
// Assign a custom character controller factory to the player entity.
|
26
|
+
// This must be assigned before spawning the entity.
|
27
|
+
// createCustomCharacterController if set will be handled internally when
|
28
|
+
// .spawn() is called.
|
29
|
+
playerEntity.createCustomCharacterController = () => {
|
30
|
+
console.log('Creating custom player entity character controller...');
|
31
|
+
|
32
|
+
return new MyCharacterController(playerEntity);
|
33
|
+
}
|
34
|
+
|
35
|
+
playerEntity.spawn(world, { x: 0, y: 10, z: 0 });
|
36
|
+
console.log('Spawned player entity!');
|
37
|
+
|
38
|
+
};
|
39
|
+
|
40
|
+
world.onPlayerLeave = player => {
|
41
|
+
world.entityManager.getAllPlayerEntities(player).forEach(entity => entity.despawn());
|
42
|
+
};
|
43
|
+
});
|
@@ -0,0 +1,27 @@
|
|
1
|
+
{
|
2
|
+
"compilerOptions": {
|
3
|
+
// Enable latest features
|
4
|
+
"lib": ["ESNext", "DOM"],
|
5
|
+
"target": "ESNext",
|
6
|
+
"module": "ESNext",
|
7
|
+
"moduleDetection": "force",
|
8
|
+
"jsx": "react-jsx",
|
9
|
+
"allowJs": true,
|
10
|
+
|
11
|
+
// Bundler mode
|
12
|
+
"moduleResolution": "bundler",
|
13
|
+
"allowImportingTsExtensions": true,
|
14
|
+
"verbatimModuleSyntax": true,
|
15
|
+
"noEmit": true,
|
16
|
+
|
17
|
+
// Best practices
|
18
|
+
"strict": true,
|
19
|
+
"skipLibCheck": true,
|
20
|
+
"noFallthroughCasesInSwitch": true,
|
21
|
+
|
22
|
+
// Some stricter flags (disabled by default)
|
23
|
+
"noUnusedLocals": false,
|
24
|
+
"noUnusedParameters": false,
|
25
|
+
"noPropertyAccessFromIndexSignature": false
|
26
|
+
}
|
27
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# entity-spawn
|
2
|
+
|
3
|
+
To install dependencies:
|
4
|
+
|
5
|
+
```bash
|
6
|
+
bun install
|
7
|
+
```
|
8
|
+
|
9
|
+
To run:
|
10
|
+
|
11
|
+
```bash
|
12
|
+
bun run index.ts
|
13
|
+
```
|
14
|
+
|
15
|
+
This project was created using `bun init` in bun v1.1.26. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
|
@@ -0,0 +1,11 @@
|
|
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
|
+
MIIDRjCCAi6gAwIBAgIFOTEzNTIwDQYJKoZIhvcNAQELBQAwWDEQMA4GA1UEAxMH
|
3
|
+
SFlUT1BJQTELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNV
|
4
|
+
BAcTB1NlYXR0bGUxEDAOBgNVBAoTB0hZVE9QSUEwHhcNMjQxMTEzMjIyMjEwWhcN
|
5
|
+
MzQxMTExMjIyMjEwWjAUMRIwEAYDVQQDEwlsb2NhbGhvc3QwggEiMA0GCSqGSIb3
|
6
|
+
DQEBAQUAA4IBDwAwggEKAoIBAQCo2i9L13+4KxvR9dxBeE3Xrj5WtoGFBwbUZkeV
|
7
|
+
3B8n+ehJ2LWD13sGvCuHvSDovbSOxLxqbESQzWBRVrmfJMR1qe+o7kd/SMaLHosC
|
8
|
+
2BWASn1oV9rGLktvd2Xs6xRf75cejzrr/OrNoTpICp3j1Z0Kd+73TuYyVFPfCbqH
|
9
|
+
N6mwS+yCmG2/w3sXwbOGymNuYpaPoD8XVcIhO7GPZsCVqqSKP2xsGF+oP5+Isma+
|
10
|
+
y3usNUnFnVW5ckk6SWWdxP9kuOW2xXoFFwj43STaE4OvXbTPCG7jowUpDH1aMvFA
|
11
|
+
ceXUfuaE7H8QfZqoUNu8jCb8LiqTL+uL5kHbl2kQ7sQCN9gjAgMBAAGjWzBZMAwG
|
12
|
+
A1UdEwEB/wQCMAAwDgYDVR0PAQH/BAQDAgWgMB0GA1UdJQQWMBQGCCsGAQUFBwMB
|
13
|
+
BggrBgEFBQcDAjAaBgN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BALEspoxQozwohGQnP7EMF0/0JoKNpdNv0b0qCVvNiMo0+N297lI2mFQp
|
25
|
+
6xYlW/1l9afLokklF/J2IsyBrTCZoY7SaEk/lMMrQSyra+y0z71ogZ8A4ny9fxsj
|
26
|
+
0dDYJZGllL+3E/MQfd7k+KnOM/+A+cPoAnci76+L3vdkUb2P8SJk
|
27
|
+
-----END RSA PRIVATE KEY-----
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|