@hytopia.com/examples 1.0.25 → 1.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/frontiers-rpg-game/assets/maps/hearthwilds.json +156973 -38437
- package/frontiers-rpg-game/src/GameManager.ts +6 -5
- package/frontiers-rpg-game/src/entities/BaseEntity.ts +0 -1
- package/frontiers-rpg-game/src/regions/hearthwilds/HearthwildsRegion.ts +3 -0
- package/package.json +1 -1
- package/particles/README.md +3 -0
- package/particles/assets/map.json +2623 -0
- package/particles/assets/particles/circle-blur.png +0 -0
- package/particles/assets/particles/circle.png +0 -0
- package/particles/assets/particles/dirt.png +0 -0
- package/particles/assets/particles/flame.png +0 -0
- package/particles/assets/particles/smoke.png +0 -0
- package/particles/assets/particles/star-2.png +0 -0
- package/particles/assets/particles/star.png +0 -0
- package/particles/index.ts +129 -0
- package/particles/package.json +20 -0
- package/frontiers-rpg-game/dev/persistence/player-421.json +0 -42
- package/frontiers-rpg-game/dev/persistence/player-player-1.json +0 -33
- package/frontiers-rpg-game/dev/persistence/player-player-2.json +0 -31
- package/frontiers-rpg-game/dev/persistence/player-player-4.json +0 -31
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import {
|
|
2
|
+
startServer,
|
|
3
|
+
Entity,
|
|
4
|
+
DefaultPlayerEntity,
|
|
5
|
+
ParticleEmitter,
|
|
6
|
+
PlayerEvent,
|
|
7
|
+
Quaternion,
|
|
8
|
+
} from 'hytopia';
|
|
9
|
+
|
|
10
|
+
import worldMap from './assets/map.json';
|
|
11
|
+
|
|
12
|
+
startServer(world => {
|
|
13
|
+
world.loadMap(worldMap);
|
|
14
|
+
|
|
15
|
+
// Spawn a player entity when a player joins the game.
|
|
16
|
+
world.on(PlayerEvent.JOINED_WORLD, ({ player }) => {
|
|
17
|
+
const playerEntity = new DefaultPlayerEntity({
|
|
18
|
+
player,
|
|
19
|
+
name: 'Player',
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
playerEntity.spawn(world, { x: 0, y: 10, z: 0 });
|
|
23
|
+
|
|
24
|
+
attachPlayerParticles(playerEntity);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
world.on(PlayerEvent.LEFT_WORLD, ({ player }) => {
|
|
28
|
+
world.entityManager.getPlayerEntitiesByPlayer(player).forEach(entity => entity.despawn());
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// Setup particle emitters around the map
|
|
32
|
+
|
|
33
|
+
// Dirt spewing particle emitter
|
|
34
|
+
const dirtParticleEmitter = new ParticleEmitter({
|
|
35
|
+
textureUri: 'particles/dirt.png',
|
|
36
|
+
colorStart: { r: 194, g: 164, b: 132 },
|
|
37
|
+
size: 1,
|
|
38
|
+
sizeVariance: 1, // Variates the base size +/- this value
|
|
39
|
+
lifetime: 5, // How long the particles live for in seconds
|
|
40
|
+
lifetimeVariance: 3, // Variates the base lifetime +/- this value
|
|
41
|
+
position: { x: 0, y: 1, z: 0 }, // Position of the emitter
|
|
42
|
+
rate: 20, // How many particles to emit per second
|
|
43
|
+
|
|
44
|
+
velocity: { x: 0, y: 5, z: 0}, // Velocity of the particles
|
|
45
|
+
velocityVariance: { x: 4, y: 2, z: 4 }, // Variates the base velocity +/- this value
|
|
46
|
+
});
|
|
47
|
+
dirtParticleEmitter.spawn(world);
|
|
48
|
+
|
|
49
|
+
// Start/stop the emitter every 3 seconds
|
|
50
|
+
setInterval(() => {
|
|
51
|
+
if (dirtParticleEmitter.isStopped) {
|
|
52
|
+
dirtParticleEmitter.restart();
|
|
53
|
+
} else {
|
|
54
|
+
dirtParticleEmitter.stop();
|
|
55
|
+
}
|
|
56
|
+
}, 5000);
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
// Falling sparkles emitter
|
|
60
|
+
const fallingSparklesEmitter = new ParticleEmitter({
|
|
61
|
+
textureUri: 'particles/star-2.png',
|
|
62
|
+
colorStart: { r: 255, g: 255, b: 255 }, // White base color
|
|
63
|
+
colorStartVariance: { r: 255, g: 255, b: 255 }, // rgb varies +/- 255
|
|
64
|
+
colorEnd: { r: 255, g: 255, b: 255 }, // White base color
|
|
65
|
+
colorEndVariance: { r: 255, g: 255, b: 255 }, // rgb varies +/- 255
|
|
66
|
+
gravity: { x: 0, y: -3, z: 0 }, // Gravity of the particles, pull them down at a rate of 3 blocks per second
|
|
67
|
+
size: 1, // Base size of the particles
|
|
68
|
+
sizeVariance: 2, // Variates the base size +/- this value
|
|
69
|
+
lifetime: 5, // How long the particles live for in seconds
|
|
70
|
+
lifetimeVariance: 3, // Variates the base lifetime +/- this value
|
|
71
|
+
rate: 50, // How many particles to emit per second
|
|
72
|
+
|
|
73
|
+
position: { x: 17, y: 10, z: 0 }, // Position of the emitter
|
|
74
|
+
velocityVariance: { x: 3, y: 3, z: 3 }, // Variates the base velocity +/- this value
|
|
75
|
+
});
|
|
76
|
+
fallingSparklesEmitter.spawn(world);
|
|
77
|
+
|
|
78
|
+
// Swap the texture every 3 seconds
|
|
79
|
+
setInterval(() => {
|
|
80
|
+
if (fallingSparklesEmitter.textureUri === 'particles/star-2.png') {
|
|
81
|
+
fallingSparklesEmitter.setTextureUri('particles/star.png');
|
|
82
|
+
} else {
|
|
83
|
+
fallingSparklesEmitter.setTextureUri('particles/star-2.png');
|
|
84
|
+
}
|
|
85
|
+
}, 2000);
|
|
86
|
+
|
|
87
|
+
// Smoke emitter
|
|
88
|
+
const smokeEmitter = new ParticleEmitter({
|
|
89
|
+
textureUri: 'particles/smoke.png',
|
|
90
|
+
colorStart: { r: 220, g: 220, b: 220 }, // White-ish color
|
|
91
|
+
opacityStart: 0.7, // Starting opacity of the particles
|
|
92
|
+
opacityStartVariance: 0.5, // Variates the base opacity +/- this value
|
|
93
|
+
opacityEnd: 0, // Ending opacity of the particles
|
|
94
|
+
size: 3, // Base size of the particles
|
|
95
|
+
sizeVariance: 1.5, // Variates the base size +/- this value
|
|
96
|
+
lifetime: 10, // How long the particles live for in seconds
|
|
97
|
+
lifetimeVariance: 5, // Variates the base lifetime +/- this value
|
|
98
|
+
rate: 40, // How many particles to emit per second
|
|
99
|
+
position: { x: -13, y: 1, z: 12 }, // World position of the emitter
|
|
100
|
+
velocity: { x: 0, y: 2, z: 0 }, // Velocity of the particles
|
|
101
|
+
velocityVariance: { x: 0.5, y: 1, z: 0.5 }, // Variates the base velocity +/- this value
|
|
102
|
+
});
|
|
103
|
+
smokeEmitter.spawn(world);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
function attachPlayerParticles(playerEntity: DefaultPlayerEntity) {
|
|
107
|
+
if (!playerEntity.world) {
|
|
108
|
+
return console.log('Player entity must be spawned to attach particles.');
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// Bubble emitter effect from players
|
|
112
|
+
const particleEmitter = new ParticleEmitter({
|
|
113
|
+
attachedToEntity: playerEntity, // Attached to an entity instead of a position, in this case the player entity
|
|
114
|
+
attachedToEntityNodeName: 'hand-right-anchor', // Optional, Emit from the right hand named model node of the player entity, this is an explicit name of a gltf node in the model.
|
|
115
|
+
textureUri: 'particles/circle-blur.png',
|
|
116
|
+
colorStart: { r: 128, g: 128, b: 255 }, // Blue base color
|
|
117
|
+
gravity: { x: 0, y: -1, z: 0 }, // Gravity of the particles, pull them down at a rate of 1 block per second
|
|
118
|
+
opacityStartVariance: 0.5, // Variates the base opacity +/- this value
|
|
119
|
+
velocity: { x: 0, y: 1, z: 0 }, // Velocity of the particles
|
|
120
|
+
velocityVariance: { x: 1, y: 0.5, z: 1 }, // Variates the base velocity +/- this value
|
|
121
|
+
size: 0.1, // Base size of the particles
|
|
122
|
+
sizeVariance: 0.25, // Variates the base size +/- this value
|
|
123
|
+
lifetime: 4, // How long the particles live for in seconds
|
|
124
|
+
rate: 10, // How many particles to emit per second
|
|
125
|
+
maxParticles: 30, // Maximum number of visible particles at any given time
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
particleEmitter.spawn(playerEntity.world);
|
|
129
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "particles",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [],
|
|
10
|
+
"author": "",
|
|
11
|
+
"license": "ISC",
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@hytopia.com/assets": "^0.3.2",
|
|
14
|
+
"hytopia": "^0.6.33"
|
|
15
|
+
},
|
|
16
|
+
"trustedDependencies": [
|
|
17
|
+
"mediasoup",
|
|
18
|
+
"sharp"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"health": 100,
|
|
3
|
-
"currentRegionId": "stalkhaven",
|
|
4
|
-
"currentRegionSpawnFacingAngle": 0,
|
|
5
|
-
"currentRegionSpawnPoint": {
|
|
6
|
-
"x": 1,
|
|
7
|
-
"y": 2,
|
|
8
|
-
"z": 40
|
|
9
|
-
},
|
|
10
|
-
"skillExperience": [],
|
|
11
|
-
"backpack": {
|
|
12
|
-
"items": []
|
|
13
|
-
},
|
|
14
|
-
"hotbar": {
|
|
15
|
-
"items": [
|
|
16
|
-
{
|
|
17
|
-
"position": 0,
|
|
18
|
-
"itemId": "toy_sword"
|
|
19
|
-
}
|
|
20
|
-
]
|
|
21
|
-
},
|
|
22
|
-
"questLog": {
|
|
23
|
-
"quests": [
|
|
24
|
-
{
|
|
25
|
-
"questId": "exploring-stalkhaven",
|
|
26
|
-
"state": "active",
|
|
27
|
-
"objectiveProgress": {
|
|
28
|
-
"talk-to-mycelis": 0,
|
|
29
|
-
"talk-to-finn": 0,
|
|
30
|
-
"talk-to-sporn": 0,
|
|
31
|
-
"talk-to-mark": 0
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
]
|
|
35
|
-
},
|
|
36
|
-
"storage": {
|
|
37
|
-
"items": []
|
|
38
|
-
},
|
|
39
|
-
"wearables": {
|
|
40
|
-
"items": []
|
|
41
|
-
}
|
|
42
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"health": 100,
|
|
3
|
-
"currentRegionId": "stalkhaven-port",
|
|
4
|
-
"skillExperience": [],
|
|
5
|
-
"backpack": {
|
|
6
|
-
"items": []
|
|
7
|
-
},
|
|
8
|
-
"hotbar": {
|
|
9
|
-
"items": [
|
|
10
|
-
{
|
|
11
|
-
"position": 0,
|
|
12
|
-
"itemId": "toy_sword"
|
|
13
|
-
}
|
|
14
|
-
]
|
|
15
|
-
},
|
|
16
|
-
"questLog": {
|
|
17
|
-
"quests": [
|
|
18
|
-
{
|
|
19
|
-
"questId": "welcome-to-stalkhaven",
|
|
20
|
-
"state": "active",
|
|
21
|
-
"objectiveProgress": {
|
|
22
|
-
"talk-to-mark": 0
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
]
|
|
26
|
-
},
|
|
27
|
-
"storage": {
|
|
28
|
-
"items": []
|
|
29
|
-
},
|
|
30
|
-
"wearables": {
|
|
31
|
-
"items": []
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"health": 100,
|
|
3
|
-
"currentRegionId": "stalkhaven",
|
|
4
|
-
"currentRegionSpawnFacingAngle": 90,
|
|
5
|
-
"currentRegionSpawnPoint": {
|
|
6
|
-
"x": 32,
|
|
7
|
-
"y": 2,
|
|
8
|
-
"z": 1
|
|
9
|
-
},
|
|
10
|
-
"skillExperience": [],
|
|
11
|
-
"backpack": {
|
|
12
|
-
"items": []
|
|
13
|
-
},
|
|
14
|
-
"hotbar": {
|
|
15
|
-
"items": [
|
|
16
|
-
{
|
|
17
|
-
"position": 0,
|
|
18
|
-
"itemId": "toy_sword"
|
|
19
|
-
}
|
|
20
|
-
]
|
|
21
|
-
},
|
|
22
|
-
"questLog": {
|
|
23
|
-
"quests": []
|
|
24
|
-
},
|
|
25
|
-
"storage": {
|
|
26
|
-
"items": []
|
|
27
|
-
},
|
|
28
|
-
"wearables": {
|
|
29
|
-
"items": []
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"health": 100,
|
|
3
|
-
"currentRegionId": "stalkhaven",
|
|
4
|
-
"currentRegionSpawnFacingAngle": 0,
|
|
5
|
-
"currentRegionSpawnPoint": {
|
|
6
|
-
"x": 1,
|
|
7
|
-
"y": 2,
|
|
8
|
-
"z": 40
|
|
9
|
-
},
|
|
10
|
-
"skillExperience": [],
|
|
11
|
-
"backpack": {
|
|
12
|
-
"items": []
|
|
13
|
-
},
|
|
14
|
-
"hotbar": {
|
|
15
|
-
"items": [
|
|
16
|
-
{
|
|
17
|
-
"position": 0,
|
|
18
|
-
"itemId": "toy_sword"
|
|
19
|
-
}
|
|
20
|
-
]
|
|
21
|
-
},
|
|
22
|
-
"questLog": {
|
|
23
|
-
"quests": []
|
|
24
|
-
},
|
|
25
|
-
"storage": {
|
|
26
|
-
"items": []
|
|
27
|
-
},
|
|
28
|
-
"wearables": {
|
|
29
|
-
"items": []
|
|
30
|
-
}
|
|
31
|
-
}
|