hytopia 0.3.33 → 0.4.0
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/examples/child-entity/assets/models/.optimized/sword/baseColor.png +0 -0
- package/examples/child-entity/assets/models/.optimized/sword/sword-named-nodes.bin +0 -0
- package/examples/child-entity/assets/models/.optimized/sword/sword-named-nodes.gltf +356 -0
- package/examples/child-entity/assets/models/.optimized/sword/sword.bin +0 -0
- package/examples/child-entity/assets/models/.optimized/sword/sword.gltf +136 -0
- package/examples/child-entity/assets/models/.optimized/sword/sword.gltf.md5 +1 -0
- package/examples/hole-in-wall-game/assets/ui/index.html +68 -0
- package/examples/hole-in-wall-game/package-lock.json +3132 -0
- package/examples/wall-dodge-game/assets/ui/index.html +69 -0
- package/examples/wall-dodge-game/bun.lock +17 -0
- package/package.json +1 -1
- package/server.d.ts +2 -0
- package/server.js +130 -124
Binary file
|
@@ -0,0 +1,356 @@
|
|
1
|
+
{
|
2
|
+
"asset": {
|
3
|
+
"generator": "glTF-Transform v4.1.3",
|
4
|
+
"version": "2.0"
|
5
|
+
},
|
6
|
+
"accessors": [
|
7
|
+
{
|
8
|
+
"type": "SCALAR",
|
9
|
+
"componentType": 5123,
|
10
|
+
"count": 36,
|
11
|
+
"bufferView": 0,
|
12
|
+
"byteOffset": 0
|
13
|
+
},
|
14
|
+
{
|
15
|
+
"type": "VEC3",
|
16
|
+
"componentType": 5126,
|
17
|
+
"count": 24,
|
18
|
+
"max": [
|
19
|
+
0.140625,
|
20
|
+
1.7109375,
|
21
|
+
0.03125
|
22
|
+
],
|
23
|
+
"min": [
|
24
|
+
-0.171875,
|
25
|
+
0.5234375,
|
26
|
+
-0.09375
|
27
|
+
],
|
28
|
+
"bufferView": 1,
|
29
|
+
"byteOffset": 0
|
30
|
+
},
|
31
|
+
{
|
32
|
+
"type": "VEC3",
|
33
|
+
"componentType": 5126,
|
34
|
+
"count": 24,
|
35
|
+
"bufferView": 1,
|
36
|
+
"byteOffset": 12
|
37
|
+
},
|
38
|
+
{
|
39
|
+
"type": "VEC2",
|
40
|
+
"componentType": 5126,
|
41
|
+
"count": 24,
|
42
|
+
"bufferView": 1,
|
43
|
+
"byteOffset": 24
|
44
|
+
},
|
45
|
+
{
|
46
|
+
"type": "VEC3",
|
47
|
+
"componentType": 5126,
|
48
|
+
"count": 24,
|
49
|
+
"max": [
|
50
|
+
0.0625,
|
51
|
+
1.0625,
|
52
|
+
0.0625
|
53
|
+
],
|
54
|
+
"min": [
|
55
|
+
-0.0625,
|
56
|
+
0.625,
|
57
|
+
-0.0625
|
58
|
+
],
|
59
|
+
"bufferView": 2,
|
60
|
+
"byteOffset": 0
|
61
|
+
},
|
62
|
+
{
|
63
|
+
"type": "VEC2",
|
64
|
+
"componentType": 5126,
|
65
|
+
"count": 24,
|
66
|
+
"bufferView": 2,
|
67
|
+
"byteOffset": 12
|
68
|
+
},
|
69
|
+
{
|
70
|
+
"type": "VEC3",
|
71
|
+
"componentType": 5126,
|
72
|
+
"count": 24,
|
73
|
+
"max": [
|
74
|
+
0.09375,
|
75
|
+
0.15625,
|
76
|
+
0.09375
|
77
|
+
],
|
78
|
+
"min": [
|
79
|
+
-0.15625,
|
80
|
+
-0.09375,
|
81
|
+
-0.09375
|
82
|
+
],
|
83
|
+
"bufferView": 3,
|
84
|
+
"byteOffset": 0
|
85
|
+
},
|
86
|
+
{
|
87
|
+
"type": "VEC2",
|
88
|
+
"componentType": 5126,
|
89
|
+
"count": 24,
|
90
|
+
"bufferView": 3,
|
91
|
+
"byteOffset": 12
|
92
|
+
},
|
93
|
+
{
|
94
|
+
"type": "VEC3",
|
95
|
+
"componentType": 5126,
|
96
|
+
"count": 24,
|
97
|
+
"max": [
|
98
|
+
0.15625,
|
99
|
+
0.09375,
|
100
|
+
0.0000625000029685907
|
101
|
+
],
|
102
|
+
"min": [
|
103
|
+
-0.15625,
|
104
|
+
-0.09375,
|
105
|
+
3.469446951953614e-18
|
106
|
+
],
|
107
|
+
"bufferView": 4,
|
108
|
+
"byteOffset": 0
|
109
|
+
},
|
110
|
+
{
|
111
|
+
"type": "VEC2",
|
112
|
+
"componentType": 5126,
|
113
|
+
"count": 24,
|
114
|
+
"bufferView": 4,
|
115
|
+
"byteOffset": 12
|
116
|
+
},
|
117
|
+
{
|
118
|
+
"type": "VEC3",
|
119
|
+
"componentType": 5126,
|
120
|
+
"count": 24,
|
121
|
+
"max": [
|
122
|
+
0.515625,
|
123
|
+
-0.01718750037252903,
|
124
|
+
0.046875
|
125
|
+
],
|
126
|
+
"min": [
|
127
|
+
-0.171875,
|
128
|
+
-0.20468750596046448,
|
129
|
+
-0.140625
|
130
|
+
],
|
131
|
+
"bufferView": 5,
|
132
|
+
"byteOffset": 0
|
133
|
+
},
|
134
|
+
{
|
135
|
+
"type": "VEC2",
|
136
|
+
"componentType": 5126,
|
137
|
+
"count": 24,
|
138
|
+
"bufferView": 5,
|
139
|
+
"byteOffset": 12
|
140
|
+
}
|
141
|
+
],
|
142
|
+
"bufferViews": [
|
143
|
+
{
|
144
|
+
"buffer": 0,
|
145
|
+
"byteOffset": 0,
|
146
|
+
"byteLength": 72,
|
147
|
+
"target": 34963
|
148
|
+
},
|
149
|
+
{
|
150
|
+
"buffer": 0,
|
151
|
+
"byteOffset": 72,
|
152
|
+
"byteLength": 768,
|
153
|
+
"byteStride": 32,
|
154
|
+
"target": 34962
|
155
|
+
},
|
156
|
+
{
|
157
|
+
"buffer": 0,
|
158
|
+
"byteOffset": 840,
|
159
|
+
"byteLength": 480,
|
160
|
+
"byteStride": 20,
|
161
|
+
"target": 34962
|
162
|
+
},
|
163
|
+
{
|
164
|
+
"buffer": 0,
|
165
|
+
"byteOffset": 1320,
|
166
|
+
"byteLength": 480,
|
167
|
+
"byteStride": 20,
|
168
|
+
"target": 34962
|
169
|
+
},
|
170
|
+
{
|
171
|
+
"buffer": 0,
|
172
|
+
"byteOffset": 1800,
|
173
|
+
"byteLength": 480,
|
174
|
+
"byteStride": 20,
|
175
|
+
"target": 34962
|
176
|
+
},
|
177
|
+
{
|
178
|
+
"buffer": 0,
|
179
|
+
"byteOffset": 2280,
|
180
|
+
"byteLength": 480,
|
181
|
+
"byteStride": 20,
|
182
|
+
"target": 34962
|
183
|
+
}
|
184
|
+
],
|
185
|
+
"samplers": [
|
186
|
+
{
|
187
|
+
"magFilter": 9728,
|
188
|
+
"minFilter": 9728,
|
189
|
+
"wrapS": 33071,
|
190
|
+
"wrapT": 33071
|
191
|
+
}
|
192
|
+
],
|
193
|
+
"textures": [
|
194
|
+
{
|
195
|
+
"source": 0,
|
196
|
+
"sampler": 0
|
197
|
+
}
|
198
|
+
],
|
199
|
+
"images": [
|
200
|
+
{
|
201
|
+
"mimeType": "image/png",
|
202
|
+
"uri": "baseColor.png"
|
203
|
+
}
|
204
|
+
],
|
205
|
+
"buffers": [
|
206
|
+
{
|
207
|
+
"uri": "sword-named-nodes.bin",
|
208
|
+
"byteLength": 2760
|
209
|
+
}
|
210
|
+
],
|
211
|
+
"materials": [
|
212
|
+
{
|
213
|
+
"alphaMode": "MASK",
|
214
|
+
"alphaCutoff": 0.05,
|
215
|
+
"doubleSided": true,
|
216
|
+
"pbrMetallicRoughness": {
|
217
|
+
"metallicFactor": 0,
|
218
|
+
"baseColorTexture": {
|
219
|
+
"index": 0
|
220
|
+
}
|
221
|
+
}
|
222
|
+
}
|
223
|
+
],
|
224
|
+
"meshes": [
|
225
|
+
{
|
226
|
+
"primitives": [
|
227
|
+
{
|
228
|
+
"attributes": {
|
229
|
+
"POSITION": 1,
|
230
|
+
"NORMAL": 2,
|
231
|
+
"TEXCOORD_0": 3
|
232
|
+
},
|
233
|
+
"mode": 4,
|
234
|
+
"material": 0,
|
235
|
+
"indices": 0
|
236
|
+
}
|
237
|
+
]
|
238
|
+
},
|
239
|
+
{
|
240
|
+
"primitives": [
|
241
|
+
{
|
242
|
+
"attributes": {
|
243
|
+
"POSITION": 4,
|
244
|
+
"TEXCOORD_0": 5,
|
245
|
+
"NORMAL": 2
|
246
|
+
},
|
247
|
+
"mode": 4,
|
248
|
+
"material": 0,
|
249
|
+
"indices": 0
|
250
|
+
}
|
251
|
+
]
|
252
|
+
},
|
253
|
+
{
|
254
|
+
"primitives": [
|
255
|
+
{
|
256
|
+
"attributes": {
|
257
|
+
"POSITION": 6,
|
258
|
+
"TEXCOORD_0": 7,
|
259
|
+
"NORMAL": 2
|
260
|
+
},
|
261
|
+
"mode": 4,
|
262
|
+
"material": 0,
|
263
|
+
"indices": 0
|
264
|
+
}
|
265
|
+
]
|
266
|
+
},
|
267
|
+
{
|
268
|
+
"primitives": [
|
269
|
+
{
|
270
|
+
"attributes": {
|
271
|
+
"POSITION": 8,
|
272
|
+
"TEXCOORD_0": 9,
|
273
|
+
"NORMAL": 2
|
274
|
+
},
|
275
|
+
"mode": 4,
|
276
|
+
"material": 0,
|
277
|
+
"indices": 0
|
278
|
+
}
|
279
|
+
]
|
280
|
+
},
|
281
|
+
{
|
282
|
+
"primitives": [
|
283
|
+
{
|
284
|
+
"attributes": {
|
285
|
+
"POSITION": 10,
|
286
|
+
"TEXCOORD_0": 11,
|
287
|
+
"NORMAL": 2
|
288
|
+
},
|
289
|
+
"mode": 4,
|
290
|
+
"material": 0,
|
291
|
+
"indices": 0
|
292
|
+
}
|
293
|
+
]
|
294
|
+
}
|
295
|
+
],
|
296
|
+
"nodes": [
|
297
|
+
{
|
298
|
+
"name": "cube",
|
299
|
+
"translation": [
|
300
|
+
0.01562500004975372,
|
301
|
+
0.3515625,
|
302
|
+
0.031249999975123153
|
303
|
+
],
|
304
|
+
"mesh": 0
|
305
|
+
},
|
306
|
+
{
|
307
|
+
"name": "cube",
|
308
|
+
"translation": [
|
309
|
+
0,
|
310
|
+
-0.375,
|
311
|
+
4.419015442517403e-26
|
312
|
+
],
|
313
|
+
"mesh": 1
|
314
|
+
},
|
315
|
+
{
|
316
|
+
"name": "cube",
|
317
|
+
"translation": [
|
318
|
+
0.03125,
|
319
|
+
0.09531250000000013,
|
320
|
+
-4.9753690750664564e-11
|
321
|
+
],
|
322
|
+
"mesh": 2
|
323
|
+
},
|
324
|
+
{
|
325
|
+
"name": "cube",
|
326
|
+
"translation": [
|
327
|
+
0,
|
328
|
+
2.15625,
|
329
|
+
-3.469446951953614e-18
|
330
|
+
],
|
331
|
+
"mesh": 3
|
332
|
+
},
|
333
|
+
{
|
334
|
+
"name": "cube",
|
335
|
+
"translation": [
|
336
|
+
-0.17187499993780792,
|
337
|
+
0.8921875000000001,
|
338
|
+
0.0468750002736453
|
339
|
+
],
|
340
|
+
"mesh": 4
|
341
|
+
}
|
342
|
+
],
|
343
|
+
"scenes": [
|
344
|
+
{
|
345
|
+
"name": "blockbench_export",
|
346
|
+
"nodes": [
|
347
|
+
0,
|
348
|
+
1,
|
349
|
+
2,
|
350
|
+
3,
|
351
|
+
4
|
352
|
+
]
|
353
|
+
}
|
354
|
+
],
|
355
|
+
"scene": 0
|
356
|
+
}
|
Binary file
|
@@ -0,0 +1,136 @@
|
|
1
|
+
{
|
2
|
+
"asset": {
|
3
|
+
"generator": "glTF-Transform v4.1.3",
|
4
|
+
"version": "2.0"
|
5
|
+
},
|
6
|
+
"accessors": [
|
7
|
+
{
|
8
|
+
"type": "SCALAR",
|
9
|
+
"componentType": 5123,
|
10
|
+
"count": 180,
|
11
|
+
"bufferView": 0,
|
12
|
+
"byteOffset": 0
|
13
|
+
},
|
14
|
+
{
|
15
|
+
"type": "VEC3",
|
16
|
+
"componentType": 5126,
|
17
|
+
"count": 120,
|
18
|
+
"max": [
|
19
|
+
0.328125,
|
20
|
+
1.8984375,
|
21
|
+
0.0625
|
22
|
+
],
|
23
|
+
"min": [
|
24
|
+
-0.359375,
|
25
|
+
-0.3499999940395355,
|
26
|
+
-0.125
|
27
|
+
],
|
28
|
+
"bufferView": 1,
|
29
|
+
"byteOffset": 0
|
30
|
+
},
|
31
|
+
{
|
32
|
+
"type": "VEC3",
|
33
|
+
"componentType": 5126,
|
34
|
+
"count": 120,
|
35
|
+
"bufferView": 1,
|
36
|
+
"byteOffset": 12
|
37
|
+
},
|
38
|
+
{
|
39
|
+
"type": "VEC2",
|
40
|
+
"componentType": 5126,
|
41
|
+
"count": 120,
|
42
|
+
"bufferView": 1,
|
43
|
+
"byteOffset": 24
|
44
|
+
}
|
45
|
+
],
|
46
|
+
"bufferViews": [
|
47
|
+
{
|
48
|
+
"buffer": 0,
|
49
|
+
"byteOffset": 0,
|
50
|
+
"byteLength": 360,
|
51
|
+
"target": 34963
|
52
|
+
},
|
53
|
+
{
|
54
|
+
"buffer": 0,
|
55
|
+
"byteOffset": 360,
|
56
|
+
"byteLength": 3840,
|
57
|
+
"byteStride": 32,
|
58
|
+
"target": 34962
|
59
|
+
}
|
60
|
+
],
|
61
|
+
"samplers": [
|
62
|
+
{
|
63
|
+
"magFilter": 9728,
|
64
|
+
"minFilter": 9728,
|
65
|
+
"wrapS": 33071,
|
66
|
+
"wrapT": 33071
|
67
|
+
}
|
68
|
+
],
|
69
|
+
"textures": [
|
70
|
+
{
|
71
|
+
"source": 0,
|
72
|
+
"sampler": 0
|
73
|
+
}
|
74
|
+
],
|
75
|
+
"images": [
|
76
|
+
{
|
77
|
+
"mimeType": "image/png",
|
78
|
+
"uri": "baseColor.png"
|
79
|
+
}
|
80
|
+
],
|
81
|
+
"buffers": [
|
82
|
+
{
|
83
|
+
"uri": "sword.bin",
|
84
|
+
"byteLength": 4200
|
85
|
+
}
|
86
|
+
],
|
87
|
+
"materials": [
|
88
|
+
{
|
89
|
+
"alphaMode": "MASK",
|
90
|
+
"alphaCutoff": 0.05,
|
91
|
+
"doubleSided": true,
|
92
|
+
"pbrMetallicRoughness": {
|
93
|
+
"metallicFactor": 0,
|
94
|
+
"baseColorTexture": {
|
95
|
+
"index": 0
|
96
|
+
}
|
97
|
+
}
|
98
|
+
}
|
99
|
+
],
|
100
|
+
"meshes": [
|
101
|
+
{
|
102
|
+
"primitives": [
|
103
|
+
{
|
104
|
+
"attributes": {
|
105
|
+
"POSITION": 1,
|
106
|
+
"NORMAL": 2,
|
107
|
+
"TEXCOORD_0": 3
|
108
|
+
},
|
109
|
+
"mode": 4,
|
110
|
+
"material": 0,
|
111
|
+
"indices": 0
|
112
|
+
}
|
113
|
+
]
|
114
|
+
}
|
115
|
+
],
|
116
|
+
"nodes": [
|
117
|
+
{
|
118
|
+
"name": "cube",
|
119
|
+
"translation": [
|
120
|
+
0.01562500004975372,
|
121
|
+
0.3515625,
|
122
|
+
0.031249999975123153
|
123
|
+
],
|
124
|
+
"mesh": 0
|
125
|
+
}
|
126
|
+
],
|
127
|
+
"scenes": [
|
128
|
+
{
|
129
|
+
"name": "blockbench_export",
|
130
|
+
"nodes": [
|
131
|
+
0
|
132
|
+
]
|
133
|
+
}
|
134
|
+
],
|
135
|
+
"scene": 0
|
136
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
845e0791e9357f0cb72bdcbc8575bb3dff0970bfa9b5a0d3e4483939f8ad3175
|
@@ -117,6 +117,21 @@
|
|
117
117
|
hytopia.registerSceneUITemplate('player-queued', () => {
|
118
118
|
return document.getElementById('player-queued').content.cloneNode(true);
|
119
119
|
});
|
120
|
+
|
121
|
+
// MOBILE CONTROLS
|
122
|
+
// Handle jump button touch / untouch
|
123
|
+
const mobileJumpButton = document.getElementById('mobile-jump-button');
|
124
|
+
mobileJumpButton.addEventListener('touchstart', e => {
|
125
|
+
e.preventDefault();
|
126
|
+
mobileJumpButton.classList.add('active');
|
127
|
+
hytopia.pressInput(' ', true);
|
128
|
+
});
|
129
|
+
|
130
|
+
mobileJumpButton.addEventListener('touchend', e => {
|
131
|
+
e.preventDefault();
|
132
|
+
mobileJumpButton.classList.remove('active');
|
133
|
+
hytopia.pressInput(' ', false);
|
134
|
+
});
|
120
135
|
</script>
|
121
136
|
|
122
137
|
<!-- Game UI -->
|
@@ -153,6 +168,12 @@
|
|
153
168
|
</div>
|
154
169
|
</div>
|
155
170
|
|
171
|
+
<div class="mobile-controls">
|
172
|
+
<a id="mobile-jump-button" class="mobile-button">
|
173
|
+
<img src="{{CDN_ASSETS_URL}}/icons/jump.png" />
|
174
|
+
</a>
|
175
|
+
</div>
|
176
|
+
|
156
177
|
<!-- Styles -->
|
157
178
|
<style>
|
158
179
|
/* Global styles */
|
@@ -267,4 +288,51 @@
|
|
267
288
|
left: 50%;
|
268
289
|
transform: translateX(-50%);
|
269
290
|
}
|
291
|
+
|
292
|
+
/* By default, we hide the mobile controls */
|
293
|
+
.mobile-controls {
|
294
|
+
display: none;
|
295
|
+
}
|
296
|
+
|
297
|
+
/*
|
298
|
+
We can use the body.mobile class to detect if we're on a mobile device.
|
299
|
+
The HYTOPIA game client will always add this class to the body element when running on a mobile device.
|
300
|
+
*/
|
301
|
+
body.mobile .mobile-controls { /* If this css selector matches because we're on mobile, show the mobile controls */
|
302
|
+
display: flex;
|
303
|
+
gap: 14px;
|
304
|
+
position: fixed;
|
305
|
+
bottom: 40px;
|
306
|
+
right: 40px;
|
307
|
+
}
|
308
|
+
|
309
|
+
/* You can configure and style your buttons however you'd like. This is a minimalistic starting point. */
|
310
|
+
.mobile-button {
|
311
|
+
background-color: rgba(0, 0, 0, 0.5);
|
312
|
+
border-radius: 50%;
|
313
|
+
align-items: center;
|
314
|
+
justify-content: center;
|
315
|
+
display: flex;
|
316
|
+
width: 50px;
|
317
|
+
height: 50px;
|
318
|
+
transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
|
319
|
+
will-change: transform, background-color;
|
320
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
|
321
|
+
font-family: 'Inter', sans-serif;
|
322
|
+
font-size: 14px;
|
323
|
+
font-weight: bold;
|
324
|
+
color: rgba(255, 255, 255, 0.8);
|
325
|
+
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
|
326
|
+
}
|
327
|
+
|
328
|
+
.mobile-button img {
|
329
|
+
width: 22px;
|
330
|
+
height: 22px;
|
331
|
+
}
|
332
|
+
|
333
|
+
.mobile-button.active {
|
334
|
+
transform: scale(0.92);
|
335
|
+
background-color: rgba(0, 0, 0, 0.75);
|
336
|
+
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
|
337
|
+
}
|
270
338
|
</style>
|