@bendyline/molen-tooling 0.0.8 → 0.0.10
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/dist/capture/harness.js +276 -228
- package/dist/capture/worldgen-preview.js +215 -215
- package/dist/cli.mjs +6 -5
- package/dist/docs-src/guide/3d-art-guidelines.md +15 -11
- package/dist/docs-src/guide/adaptive-performance.md +18 -2
- package/dist/docs-src/guide/aircraft.md +113 -40
- package/dist/docs-src/guide/ambient-life.md +100 -11
- package/dist/docs-src/guide/audio.md +1 -1
- package/dist/docs-src/guide/boats.md +99 -0
- package/dist/docs-src/guide/determinism.md +1 -1
- package/dist/docs-src/guide/dioramas.md +167 -0
- package/dist/docs-src/guide/earth-view.md +265 -10
- package/dist/docs-src/guide/entities.md +32 -1
- package/dist/docs-src/guide/figures.md +7 -1
- package/dist/docs-src/guide/graphics-performance.md +16 -3
- package/dist/docs-src/guide/medium-fi.md +337 -0
- package/dist/docs-src/guide/project.md +8 -0
- package/dist/docs-src/guide/sky.md +4 -1
- package/dist/docs-src/guide/surface-rendering.md +4 -1
- package/dist/docs-src/guide/vehicle-interiors.md +40 -2
- package/dist/docs-src/guide/vehicles.md +121 -19
- package/dist/docs-src/guide/weather.md +45 -3
- package/dist/docs-src/guide/worldgen.md +22 -1
- package/dist/docs-src/llms.txt +7 -4
- package/dist/docs-src/schemas/archstyle.md +114 -0
- package/dist/docs-src/schemas/components.md +1592 -139
- package/dist/docs-src/schemas/scatter.md +9 -0
- package/dist/docs-src/schemas/scene.md +6 -3
- package/dist/docs-src/schemas/transport-network.md +4 -2
- package/dist/index.mjs +1 -1
- package/dist/{mcp-BbHk4ibu.mjs → mcp-BbxqqnD1.mjs} +3 -2
- package/dist/{ops-CErtZh2t.mjs → ops-b4Pag8U-.mjs} +7 -5
- package/dist/templates/city-courier/README.md +18 -0
- package/dist/templates/city-courier/gen/molen-types.ts +218 -16
- package/dist/templates/city-courier/index.html +1 -1
- package/dist/templates/city-courier/scripts/molen-scripts.d.ts +220 -18
- package/dist/templates/city-courier/src/audio.ts +26 -4
- package/dist/templates/city-courier/src/game-shell.css +7 -3
- package/dist/templates/city-courier/src/main.ts +25 -3
- package/dist/templates/city-courier/src/shared/accessibility.css +325 -0
- package/dist/templates/city-courier/src/shared/game-controls.ts +406 -0
- package/dist/templates/city-courier/src/shared/game-descriptions.ts +143 -0
- package/dist/templates/city-courier/src/shared/playback.ts +146 -0
- package/dist/templates/city-courier/src/worker.ts +5 -1
- package/dist/templates/cubes/index.html +6 -1
- package/dist/templates/cubes/src/main.ts +25 -2
- package/dist/templates/cubes/src/shared/accessibility.css +325 -0
- package/dist/templates/cubes/src/shared/playback.ts +146 -0
- package/dist/templates/cubes/src/vite-env.d.ts +1 -0
- package/dist/templates/cubes/src/worker.ts +1 -0
- package/dist/templates/data-viz/README.md +4 -0
- package/dist/templates/data-viz/index.html +6 -1
- package/dist/templates/data-viz/src/main.ts +53 -11
- package/dist/templates/data-viz/src/shared/accessibility.css +325 -0
- package/dist/templates/data-viz/src/shared/playback.ts +146 -0
- package/dist/templates/data-viz/src/vite-env.d.ts +1 -0
- package/dist/templates/data-viz/src/worker.ts +1 -0
- package/dist/templates/figures-gallery/index.html +6 -1
- package/dist/templates/figures-gallery/src/main.ts +21 -2
- package/dist/templates/figures-gallery/src/shared/accessibility.css +325 -0
- package/dist/templates/figures-gallery/src/shared/playback.ts +146 -0
- package/dist/templates/figures-gallery/src/vite-env.d.ts +1 -0
- package/dist/templates/figures-gallery/src/worker.ts +1 -0
- package/dist/templates/index.json +36 -16
- package/dist/templates/skybound/README.md +18 -0
- package/dist/templates/skybound/gen/molen-types.ts +218 -16
- package/dist/templates/skybound/index.html +1 -1
- package/dist/templates/skybound/scripts/molen-scripts.d.ts +220 -18
- package/dist/templates/skybound/src/audio.ts +26 -4
- package/dist/templates/skybound/src/game-shell.css +7 -3
- package/dist/templates/skybound/src/main.ts +25 -3
- package/dist/templates/skybound/src/shared/accessibility.css +325 -0
- package/dist/templates/skybound/src/shared/game-controls.ts +406 -0
- package/dist/templates/skybound/src/shared/game-descriptions.ts +143 -0
- package/dist/templates/skybound/src/shared/playback.ts +146 -0
- package/dist/templates/skybound/src/worker.ts +1 -1
- package/dist/templates/terrain-flyover/README.md +5 -1
- package/dist/templates/terrain-flyover/index.html +4 -1
- package/dist/templates/terrain-flyover/src/main.ts +40 -39
- package/dist/templates/top-down-arena/index.html +6 -1
- package/dist/templates/top-down-arena/scripts/molen-scripts.d.ts +220 -18
- package/dist/templates/top-down-arena/src/audio.ts +26 -4
- package/dist/templates/top-down-arena/src/gen/molen-types.ts +218 -16
- package/dist/templates/top-down-arena/src/main.ts +31 -5
- package/dist/templates/top-down-arena/src/shared/accessibility.css +325 -0
- package/dist/templates/top-down-arena/src/shared/playback.ts +146 -0
- package/dist/templates/top-down-arena/src/worker.ts +1 -1
- package/package.json +12 -12
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
.access-toolbar,
|
|
2
|
+
.demo-playback {
|
|
3
|
+
position: fixed;
|
|
4
|
+
z-index: 6;
|
|
5
|
+
top: calc(var(--game-header-height, 124px) + 8px);
|
|
6
|
+
left: 16px;
|
|
7
|
+
right: 16px;
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-wrap: wrap;
|
|
10
|
+
gap: 8px;
|
|
11
|
+
align-items: center;
|
|
12
|
+
pointer-events: none;
|
|
13
|
+
}
|
|
14
|
+
.demo-playback {
|
|
15
|
+
top: 12px;
|
|
16
|
+
}
|
|
17
|
+
.access-toolbar button,
|
|
18
|
+
.demo-playback button,
|
|
19
|
+
.touch-controls button,
|
|
20
|
+
.text-play-panel button {
|
|
21
|
+
pointer-events: auto;
|
|
22
|
+
min-height: 44px;
|
|
23
|
+
padding: 9px 14px;
|
|
24
|
+
border: 1px solid #b7c9cc;
|
|
25
|
+
border-radius: 8px;
|
|
26
|
+
color: #f5f7fa;
|
|
27
|
+
background: #19343e;
|
|
28
|
+
font: 14px / 1.4 system-ui;
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
}
|
|
31
|
+
.access-toolbar button:focus-visible,
|
|
32
|
+
.demo-playback button:focus-visible,
|
|
33
|
+
.touch-controls button:focus-visible,
|
|
34
|
+
.text-play-panel button:focus-visible {
|
|
35
|
+
outline: 3px solid #ffd68e;
|
|
36
|
+
outline-offset: 2px;
|
|
37
|
+
}
|
|
38
|
+
.touch-controls button[data-held] {
|
|
39
|
+
background: #466979;
|
|
40
|
+
}
|
|
41
|
+
.access-toolbar button:disabled,
|
|
42
|
+
.touch-controls:disabled {
|
|
43
|
+
opacity: 0.65;
|
|
44
|
+
}
|
|
45
|
+
.touch-controls {
|
|
46
|
+
position: fixed;
|
|
47
|
+
z-index: 5;
|
|
48
|
+
bottom: 12px;
|
|
49
|
+
left: 12px;
|
|
50
|
+
right: 12px;
|
|
51
|
+
margin: 0;
|
|
52
|
+
display: flex;
|
|
53
|
+
flex-wrap: wrap;
|
|
54
|
+
justify-content: center;
|
|
55
|
+
gap: 8px;
|
|
56
|
+
padding: 8px;
|
|
57
|
+
border: 0;
|
|
58
|
+
border-radius: 10px;
|
|
59
|
+
background: #122b36ed;
|
|
60
|
+
color: white;
|
|
61
|
+
font: 12px / 1.5 system-ui;
|
|
62
|
+
max-width: 650px;
|
|
63
|
+
margin-inline: auto;
|
|
64
|
+
}
|
|
65
|
+
.touch-controls button {
|
|
66
|
+
touch-action: none;
|
|
67
|
+
user-select: none;
|
|
68
|
+
min-width: 60px;
|
|
69
|
+
}
|
|
70
|
+
.touch-controls legend {
|
|
71
|
+
background: #122b36;
|
|
72
|
+
padding: 3px 8px;
|
|
73
|
+
border-radius: 6px;
|
|
74
|
+
}
|
|
75
|
+
.touch-controls[hidden],
|
|
76
|
+
.text-play-panel[hidden] {
|
|
77
|
+
display: none;
|
|
78
|
+
}
|
|
79
|
+
body:has(.touch-controls:not([hidden])) .bottom {
|
|
80
|
+
bottom: 150px;
|
|
81
|
+
}
|
|
82
|
+
body:has(.touch-controls:not([hidden])) .sound-toggle {
|
|
83
|
+
bottom: 154px;
|
|
84
|
+
}
|
|
85
|
+
.access-sr-only {
|
|
86
|
+
position: absolute;
|
|
87
|
+
width: 1px;
|
|
88
|
+
height: 1px;
|
|
89
|
+
overflow: hidden;
|
|
90
|
+
clip-path: inset(50%);
|
|
91
|
+
white-space: nowrap;
|
|
92
|
+
}
|
|
93
|
+
body.text-play {
|
|
94
|
+
overflow: auto;
|
|
95
|
+
height: auto;
|
|
96
|
+
background: #102530;
|
|
97
|
+
}
|
|
98
|
+
.text-play canvas#view {
|
|
99
|
+
position: fixed;
|
|
100
|
+
visibility: hidden;
|
|
101
|
+
}
|
|
102
|
+
.text-play #interface,
|
|
103
|
+
.text-play .touch-controls {
|
|
104
|
+
display: none;
|
|
105
|
+
}
|
|
106
|
+
.text-play .access-toolbar {
|
|
107
|
+
position: sticky;
|
|
108
|
+
top: 0;
|
|
109
|
+
left: auto;
|
|
110
|
+
padding: 12px;
|
|
111
|
+
background: #102530;
|
|
112
|
+
}
|
|
113
|
+
.text-play-panel {
|
|
114
|
+
max-width: 900px;
|
|
115
|
+
margin: auto;
|
|
116
|
+
padding: 16px 24px 40px;
|
|
117
|
+
color: #f5f7fa;
|
|
118
|
+
background: #102530;
|
|
119
|
+
font: 16px / 1.65 system-ui;
|
|
120
|
+
}
|
|
121
|
+
.text-play-panel h1 {
|
|
122
|
+
font-size: 28px;
|
|
123
|
+
}
|
|
124
|
+
.text-play-panel li {
|
|
125
|
+
margin-bottom: 10px;
|
|
126
|
+
}
|
|
127
|
+
.text-actions {
|
|
128
|
+
display: flex;
|
|
129
|
+
flex-wrap: wrap;
|
|
130
|
+
gap: 10px;
|
|
131
|
+
}
|
|
132
|
+
.text-actions button[aria-disabled] {
|
|
133
|
+
opacity: 0.65;
|
|
134
|
+
}
|
|
135
|
+
@media (max-width: 720px) {
|
|
136
|
+
.access-toolbar {
|
|
137
|
+
left: 10px;
|
|
138
|
+
right: 10px;
|
|
139
|
+
gap: 6px;
|
|
140
|
+
}
|
|
141
|
+
.access-toolbar button {
|
|
142
|
+
padding-inline: 10px;
|
|
143
|
+
font-size: 12px;
|
|
144
|
+
}
|
|
145
|
+
body:has(.touch-controls:not([hidden])) .bottom {
|
|
146
|
+
bottom: 230px;
|
|
147
|
+
}
|
|
148
|
+
body:has(.touch-controls:not([hidden])) .bottom > :not(:first-child) {
|
|
149
|
+
display: none;
|
|
150
|
+
}
|
|
151
|
+
body:has(.touch-controls:not([hidden])) .brief {
|
|
152
|
+
max-width: none;
|
|
153
|
+
padding: 8px 12px;
|
|
154
|
+
}
|
|
155
|
+
body:has(.touch-controls:not([hidden])) .brief .controls {
|
|
156
|
+
display: none;
|
|
157
|
+
}
|
|
158
|
+
body:has(.touch-controls:not([hidden])) .sound-toggle {
|
|
159
|
+
bottom: 200px;
|
|
160
|
+
right: 12px;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
@media (prefers-reduced-motion: reduce) {
|
|
164
|
+
*,
|
|
165
|
+
*::before,
|
|
166
|
+
*::after {
|
|
167
|
+
scroll-behavior: auto;
|
|
168
|
+
transition: none;
|
|
169
|
+
animation: none;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.demo-playback {
|
|
174
|
+
display: flex;
|
|
175
|
+
gap: 8px;
|
|
176
|
+
flex-wrap: wrap;
|
|
177
|
+
position: fixed;
|
|
178
|
+
z-index: 5;
|
|
179
|
+
top: 12px;
|
|
180
|
+
right: 12px;
|
|
181
|
+
left: auto;
|
|
182
|
+
}
|
|
183
|
+
.data-values {
|
|
184
|
+
position: fixed;
|
|
185
|
+
top: 68px;
|
|
186
|
+
right: 12px;
|
|
187
|
+
padding: 10px;
|
|
188
|
+
color: #f5f7fa;
|
|
189
|
+
background: #102530;
|
|
190
|
+
font: 14px / 1.6 system-ui;
|
|
191
|
+
}
|
|
192
|
+
.data-values table {
|
|
193
|
+
border-collapse: collapse;
|
|
194
|
+
}
|
|
195
|
+
.data-values td,
|
|
196
|
+
.data-values th {
|
|
197
|
+
padding: 3px 14px;
|
|
198
|
+
text-align: left;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
html:has(body.text-play),
|
|
202
|
+
body.text-play > main {
|
|
203
|
+
height: auto;
|
|
204
|
+
overflow: visible;
|
|
205
|
+
}
|
|
206
|
+
.text-play-panel h1 {
|
|
207
|
+
line-height: 1.25;
|
|
208
|
+
letter-spacing: -0.5px;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.fine-actions {
|
|
212
|
+
display: flex;
|
|
213
|
+
align-items: center;
|
|
214
|
+
gap: 8px;
|
|
215
|
+
min-height: 44px;
|
|
216
|
+
margin-bottom: 12px;
|
|
217
|
+
}
|
|
218
|
+
.fine-actions input {
|
|
219
|
+
width: 20px;
|
|
220
|
+
height: 20px;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.face-direction {
|
|
224
|
+
display: flex;
|
|
225
|
+
gap: 8px;
|
|
226
|
+
align-items: center;
|
|
227
|
+
flex-wrap: wrap;
|
|
228
|
+
}
|
|
229
|
+
.face-direction select {
|
|
230
|
+
min-height: 44px;
|
|
231
|
+
font: inherit;
|
|
232
|
+
border: 1px solid #b7c9cc;
|
|
233
|
+
border-radius: 6px;
|
|
234
|
+
padding: 6px;
|
|
235
|
+
color: #f5f7fa;
|
|
236
|
+
background: #19343e;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
@media (max-width: 720px) {
|
|
240
|
+
body:has(.access-toolbar) .topbar {
|
|
241
|
+
flex-direction: column;
|
|
242
|
+
gap: 8px;
|
|
243
|
+
padding: 12px 18px;
|
|
244
|
+
}
|
|
245
|
+
body:has(.access-toolbar) .eyebrow {
|
|
246
|
+
letter-spacing: 2px;
|
|
247
|
+
font-size: 9px;
|
|
248
|
+
margin-bottom: 6px;
|
|
249
|
+
}
|
|
250
|
+
body:has(.access-toolbar) .stats {
|
|
251
|
+
width: 100%;
|
|
252
|
+
justify-content: space-between;
|
|
253
|
+
padding: 8px 12px;
|
|
254
|
+
}
|
|
255
|
+
body:has(.access-toolbar) .topbar h1 {
|
|
256
|
+
margin-bottom: 0;
|
|
257
|
+
}
|
|
258
|
+
.access-toolbar button {
|
|
259
|
+
padding-inline: 8px;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
@media (min-width: 600px) and (max-height: 500px) {
|
|
264
|
+
body:has(.access-toolbar) .topbar {
|
|
265
|
+
flex-direction: row;
|
|
266
|
+
align-items: center;
|
|
267
|
+
gap: 12px;
|
|
268
|
+
padding: 8px 16px;
|
|
269
|
+
}
|
|
270
|
+
body:has(.access-toolbar) .topbar h1 {
|
|
271
|
+
font-size: 22px;
|
|
272
|
+
margin: 0;
|
|
273
|
+
}
|
|
274
|
+
body:has(.access-toolbar) .topbar .eyebrow,
|
|
275
|
+
body:has(.access-toolbar) .subtitle {
|
|
276
|
+
display: none;
|
|
277
|
+
}
|
|
278
|
+
body:has(.access-toolbar) .stats {
|
|
279
|
+
width: auto;
|
|
280
|
+
padding: 4px 12px;
|
|
281
|
+
gap: 20px;
|
|
282
|
+
}
|
|
283
|
+
body:has(.access-toolbar) .stat strong {
|
|
284
|
+
font-size: 16px;
|
|
285
|
+
}
|
|
286
|
+
body:has(.touch-controls:not([hidden])) .bottom {
|
|
287
|
+
bottom: 12px;
|
|
288
|
+
left: 12px;
|
|
289
|
+
right: 380px;
|
|
290
|
+
}
|
|
291
|
+
body:has(.touch-controls:not([hidden])) .bottom > :not(:first-child),
|
|
292
|
+
body:has(.touch-controls:not([hidden])) .brief .controls,
|
|
293
|
+
body:has(.touch-controls:not([hidden])) .brief .label {
|
|
294
|
+
display: none;
|
|
295
|
+
}
|
|
296
|
+
body:has(.touch-controls:not([hidden])) .brief {
|
|
297
|
+
padding: 8px 12px;
|
|
298
|
+
max-width: 100%;
|
|
299
|
+
}
|
|
300
|
+
body:has(.touch-controls:not([hidden])) #message {
|
|
301
|
+
margin: 0;
|
|
302
|
+
font-size: 12px;
|
|
303
|
+
}
|
|
304
|
+
body:has(.touch-controls:not([hidden])) .sound-toggle {
|
|
305
|
+
top: 64px;
|
|
306
|
+
bottom: auto;
|
|
307
|
+
right: 12px;
|
|
308
|
+
}
|
|
309
|
+
.touch-controls {
|
|
310
|
+
left: auto;
|
|
311
|
+
right: 8px;
|
|
312
|
+
bottom: 8px;
|
|
313
|
+
width: 360px;
|
|
314
|
+
gap: 4px;
|
|
315
|
+
padding: 6px;
|
|
316
|
+
}
|
|
317
|
+
.touch-controls button {
|
|
318
|
+
min-width: 54px;
|
|
319
|
+
padding: 6px 10px;
|
|
320
|
+
font-size: 12px;
|
|
321
|
+
}
|
|
322
|
+
.touch-controls legend {
|
|
323
|
+
font-size: 11px;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/** Browser presentation helpers shared by the examples and copied into standalone templates. */
|
|
2
|
+
export interface PlaybackClient {
|
|
3
|
+
readonly tick: number | undefined;
|
|
4
|
+
control(
|
|
5
|
+
action: { action: 'pause' | 'resume' | 'request-keyframe' } | { action: 'step'; ticks: number },
|
|
6
|
+
): void;
|
|
7
|
+
renderFrame(now?: number): void;
|
|
8
|
+
}
|
|
9
|
+
export interface PlaybackInput {
|
|
10
|
+
setEnabled(enabled: boolean): void;
|
|
11
|
+
reset(): void;
|
|
12
|
+
setVirtual(source: string, action: string, value: number): void;
|
|
13
|
+
clearVirtual(source?: string): void;
|
|
14
|
+
}
|
|
15
|
+
export interface Playback {
|
|
16
|
+
readonly paused: boolean;
|
|
17
|
+
readonly button: HTMLButtonElement;
|
|
18
|
+
setPaused(paused: boolean): void;
|
|
19
|
+
setVisible(visible: boolean): void;
|
|
20
|
+
draw(): void;
|
|
21
|
+
onChange(listener: () => void): () => void;
|
|
22
|
+
dispose(): void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** The worker must boot paused and the client must use frameLoop: 'manual'. */
|
|
26
|
+
export function createPlayback(options: {
|
|
27
|
+
client: PlaybackClient;
|
|
28
|
+
input?: PlaybackInput | undefined;
|
|
29
|
+
canvas: HTMLCanvasElement;
|
|
30
|
+
container: HTMLElement;
|
|
31
|
+
render?: (elapsedMs: number, now: number) => void;
|
|
32
|
+
}): Playback {
|
|
33
|
+
const { client, input, canvas } = options;
|
|
34
|
+
const motion = matchMedia('(prefers-reduced-motion: reduce)');
|
|
35
|
+
const button = document.createElement('button');
|
|
36
|
+
button.type = 'button';
|
|
37
|
+
button.id = 'pause-playback';
|
|
38
|
+
button.className = 'playback-button';
|
|
39
|
+
options.container.append(button);
|
|
40
|
+
const listeners = new Set<() => void>();
|
|
41
|
+
let paused =
|
|
42
|
+
motion.matches || document.hidden || new URLSearchParams(location.search).get('text') === '1';
|
|
43
|
+
let visible = true;
|
|
44
|
+
let disposed = false;
|
|
45
|
+
let handle = 0;
|
|
46
|
+
let elapsed = 0;
|
|
47
|
+
let previous = performance.now();
|
|
48
|
+
let frames = 0;
|
|
49
|
+
let resizeFrame = 0;
|
|
50
|
+
function render(now: number): void {
|
|
51
|
+
if (!visible || disposed) return;
|
|
52
|
+
if (options.render) options.render(elapsed, now);
|
|
53
|
+
else client.renderFrame(now);
|
|
54
|
+
canvas.dataset.renderFrames = String(++frames);
|
|
55
|
+
}
|
|
56
|
+
function draw(): void {
|
|
57
|
+
// Let the interpolation buffer reach its last simulation sample while frozen.
|
|
58
|
+
render(performance.now() + 100);
|
|
59
|
+
}
|
|
60
|
+
function loop(now: number): void {
|
|
61
|
+
handle = 0;
|
|
62
|
+
if (paused || disposed || !visible) return;
|
|
63
|
+
elapsed += Math.min(100, Math.max(0, now - previous));
|
|
64
|
+
previous = now;
|
|
65
|
+
render(now);
|
|
66
|
+
handle = requestAnimationFrame(loop);
|
|
67
|
+
}
|
|
68
|
+
function sync(): void {
|
|
69
|
+
cancelAnimationFrame(handle);
|
|
70
|
+
handle = 0;
|
|
71
|
+
input?.setEnabled(!paused);
|
|
72
|
+
client.control({ action: paused ? 'pause' : 'resume' });
|
|
73
|
+
button.textContent = paused ? 'Resume animation' : 'Pause animation';
|
|
74
|
+
canvas.dataset.paused = String(paused);
|
|
75
|
+
canvas.dispatchEvent(new Event('playbackchange'));
|
|
76
|
+
if (paused && document.pointerLockElement === canvas) document.exitPointerLock();
|
|
77
|
+
previous = performance.now();
|
|
78
|
+
draw();
|
|
79
|
+
if (!paused && visible) handle = requestAnimationFrame(loop);
|
|
80
|
+
for (const listener of listeners) listener();
|
|
81
|
+
}
|
|
82
|
+
function setPaused(value: boolean): void {
|
|
83
|
+
if (disposed || value === paused) return;
|
|
84
|
+
paused = value;
|
|
85
|
+
sync();
|
|
86
|
+
}
|
|
87
|
+
const toggle = (): void => setPaused(!paused);
|
|
88
|
+
const reduce = (): void => {
|
|
89
|
+
if (motion.matches) setPaused(true);
|
|
90
|
+
};
|
|
91
|
+
const hide = (): void => {
|
|
92
|
+
if (document.hidden) setPaused(true);
|
|
93
|
+
};
|
|
94
|
+
button.addEventListener('click', toggle);
|
|
95
|
+
motion.addEventListener('change', reduce);
|
|
96
|
+
document.addEventListener('visibilitychange', hide);
|
|
97
|
+
// A mount's ResizeObserver resets the drawing buffer after window.resize. Draw on the
|
|
98
|
+
// following frame so a paused canvas is not cleared after its one still image was drawn.
|
|
99
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
100
|
+
cancelAnimationFrame(resizeFrame);
|
|
101
|
+
resizeFrame = requestAnimationFrame(draw);
|
|
102
|
+
});
|
|
103
|
+
resizeObserver.observe(canvas);
|
|
104
|
+
sync();
|
|
105
|
+
return {
|
|
106
|
+
get paused() {
|
|
107
|
+
return paused;
|
|
108
|
+
},
|
|
109
|
+
button,
|
|
110
|
+
setPaused,
|
|
111
|
+
setVisible(value): void {
|
|
112
|
+
visible = value;
|
|
113
|
+
sync();
|
|
114
|
+
},
|
|
115
|
+
draw,
|
|
116
|
+
onChange(listener) {
|
|
117
|
+
listeners.add(listener);
|
|
118
|
+
return () => {
|
|
119
|
+
listeners.delete(listener);
|
|
120
|
+
};
|
|
121
|
+
},
|
|
122
|
+
dispose(): void {
|
|
123
|
+
disposed = true;
|
|
124
|
+
cancelAnimationFrame(handle);
|
|
125
|
+
input?.reset();
|
|
126
|
+
motion.removeEventListener('change', reduce);
|
|
127
|
+
document.removeEventListener('visibilitychange', hide);
|
|
128
|
+
resizeObserver.disconnect();
|
|
129
|
+
cancelAnimationFrame(resizeFrame);
|
|
130
|
+
button.remove();
|
|
131
|
+
listeners.clear();
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** Asset readiness alone can resolve before the first Worker keyframe has arrived. */
|
|
137
|
+
export async function readyToPlay(
|
|
138
|
+
client: PlaybackClient & { ready(): Promise<void> },
|
|
139
|
+
): Promise<void> {
|
|
140
|
+
const deadline = performance.now() + 60000;
|
|
141
|
+
while (client.tick === undefined) {
|
|
142
|
+
if (performance.now() > deadline) throw new Error('The world did not load. Reload to retry.');
|
|
143
|
+
await new Promise((resolve) => setTimeout(resolve, 16));
|
|
144
|
+
}
|
|
145
|
+
await client.ready();
|
|
146
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
@@ -13,5 +13,6 @@ const world = buildWorld(scene.value, undefined, {
|
|
|
13
13
|
capabilities: [(w) => ({ figures: figuresScriptApi(installFigures(w)) })],
|
|
14
14
|
});
|
|
15
15
|
new KernelHost(world, self as unknown as MessageLink, {
|
|
16
|
+
startPaused: true,
|
|
16
17
|
keyframeInterval: scene.value.keyframeInterval,
|
|
17
18
|
});
|
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
"scene.json",
|
|
11
11
|
"src/cubes.ts",
|
|
12
12
|
"src/main.ts",
|
|
13
|
+
"src/shared/accessibility.css",
|
|
14
|
+
"src/shared/playback.ts",
|
|
15
|
+
"src/vite-env.d.ts",
|
|
13
16
|
"src/worker.ts",
|
|
14
17
|
"test/headless.test.ts",
|
|
15
18
|
"tsconfig.json",
|
|
@@ -32,6 +35,9 @@
|
|
|
32
35
|
"package.json",
|
|
33
36
|
"scene.json",
|
|
34
37
|
"src/main.ts",
|
|
38
|
+
"src/shared/accessibility.css",
|
|
39
|
+
"src/shared/playback.ts",
|
|
40
|
+
"src/vite-env.d.ts",
|
|
35
41
|
"src/viz.ts",
|
|
36
42
|
"src/worker.ts",
|
|
37
43
|
"test/headless.test.ts",
|
|
@@ -65,6 +71,8 @@
|
|
|
65
71
|
"src/gen/molen-types.ts",
|
|
66
72
|
"src/main.ts",
|
|
67
73
|
"src/scene.ts",
|
|
74
|
+
"src/shared/accessibility.css",
|
|
75
|
+
"src/shared/playback.ts",
|
|
68
76
|
"src/vite-env.d.ts",
|
|
69
77
|
"src/worker.ts",
|
|
70
78
|
"test/headless.test.ts",
|
|
@@ -108,6 +116,9 @@
|
|
|
108
116
|
"package.json",
|
|
109
117
|
"scene.json",
|
|
110
118
|
"src/main.ts",
|
|
119
|
+
"src/shared/accessibility.css",
|
|
120
|
+
"src/shared/playback.ts",
|
|
121
|
+
"src/vite-env.d.ts",
|
|
111
122
|
"src/worker.ts",
|
|
112
123
|
"test/headless.test.ts",
|
|
113
124
|
"tsconfig.json",
|
|
@@ -139,6 +150,10 @@
|
|
|
139
150
|
"src/game-shell.css",
|
|
140
151
|
"src/main.ts",
|
|
141
152
|
"src/scene.ts",
|
|
153
|
+
"src/shared/accessibility.css",
|
|
154
|
+
"src/shared/game-controls.ts",
|
|
155
|
+
"src/shared/game-descriptions.ts",
|
|
156
|
+
"src/shared/playback.ts",
|
|
142
157
|
"src/vite-env.d.ts",
|
|
143
158
|
"src/worker.ts",
|
|
144
159
|
"test/headless.test.ts",
|
|
@@ -173,6 +188,10 @@
|
|
|
173
188
|
"src/game-shell.css",
|
|
174
189
|
"src/main.ts",
|
|
175
190
|
"src/scene.ts",
|
|
191
|
+
"src/shared/accessibility.css",
|
|
192
|
+
"src/shared/game-controls.ts",
|
|
193
|
+
"src/shared/game-descriptions.ts",
|
|
194
|
+
"src/shared/playback.ts",
|
|
176
195
|
"src/vite-env.d.ts",
|
|
177
196
|
"src/worker.ts",
|
|
178
197
|
"test/headless.test.ts",
|
|
@@ -189,21 +208,22 @@
|
|
|
189
208
|
}
|
|
190
209
|
],
|
|
191
210
|
"versions": {
|
|
192
|
-
"@bendyline/molen-ambient": "0.0.
|
|
193
|
-
"@bendyline/molen-client": "0.0.
|
|
194
|
-
"@bendyline/molen-
|
|
195
|
-
"@bendyline/molen-
|
|
196
|
-
"@bendyline/molen-
|
|
197
|
-
"@bendyline/molen-
|
|
198
|
-
"@bendyline/molen-
|
|
199
|
-
"@bendyline/molen-
|
|
200
|
-
"@bendyline/molen-
|
|
201
|
-
"@bendyline/molen-
|
|
202
|
-
"@bendyline/molen-
|
|
203
|
-
"@bendyline/molen-
|
|
204
|
-
"@bendyline/molen-
|
|
205
|
-
"@bendyline/molen-
|
|
206
|
-
"@bendyline/molen-
|
|
207
|
-
"@bendyline/molen-worldgen
|
|
211
|
+
"@bendyline/molen-ambient": "0.0.10",
|
|
212
|
+
"@bendyline/molen-client": "0.0.9",
|
|
213
|
+
"@bendyline/molen-dioramas": "0.0.2",
|
|
214
|
+
"@bendyline/molen-earth": "0.0.10",
|
|
215
|
+
"@bendyline/molen-entities": "0.0.9",
|
|
216
|
+
"@bendyline/molen-figures": "0.0.9",
|
|
217
|
+
"@bendyline/molen-input-react": "0.0.9",
|
|
218
|
+
"@bendyline/molen-kernel": "0.0.7",
|
|
219
|
+
"@bendyline/molen-materials": "0.0.8",
|
|
220
|
+
"@bendyline/molen-pack": "0.0.8",
|
|
221
|
+
"@bendyline/molen-pathfinding": "0.0.7",
|
|
222
|
+
"@bendyline/molen-physics-rapier": "0.0.7",
|
|
223
|
+
"@bendyline/molen-schema": "0.0.7",
|
|
224
|
+
"@bendyline/molen-terrain": "0.0.10",
|
|
225
|
+
"@bendyline/molen-tooling": "0.0.10",
|
|
226
|
+
"@bendyline/molen-worldgen": "0.0.9",
|
|
227
|
+
"@bendyline/molen-worldgen-earth": "0.0.10"
|
|
208
228
|
}
|
|
209
229
|
}
|
|
@@ -18,6 +18,24 @@ npm run dev
|
|
|
18
18
|
|
|
19
19
|
A/D or Left/Right: run. Space: jump; hold for a full jump, release for a short hop. R: restart.
|
|
20
20
|
|
|
21
|
+
## Accessible play
|
|
22
|
+
|
|
23
|
+
The game offers **Pause animation**, **Touch controls**, and **Text play** beside the HUD.
|
|
24
|
+
Touch buttons support simultaneous holds (move while jumping, steering, or striking); releasing,
|
|
25
|
+
cancelling, hiding the page, or pausing releases every held action. Touch controls appear by default
|
|
26
|
+
on devices with a coarse pointer and can also be enabled manually.
|
|
27
|
+
|
|
28
|
+
Reduced-motion preferences start the game paused. Pausing stops the simulation, camera, rendering,
|
|
29
|
+
and audio; returning from a hidden page requires an explicit resume. The world also waits for its
|
|
30
|
+
initial snapshot and assets before play starts.
|
|
31
|
+
|
|
32
|
+
**Text play** (or `?text=1`) describes the actual world: position, objectives, nearby hazards and
|
|
33
|
+
resources. Named buttons advance short turns, then pause so reading takes no game time. Precise
|
|
34
|
+
actions use two ticks, including the release tick. Keyboard and assistive activation work on the
|
|
35
|
+
same buttons. The dungeon additionally offers compass and target-facing controls. Visual play can
|
|
36
|
+
be resumed from the same state. These controls change input and pacing; the game's collisions,
|
|
37
|
+
combat, collectibles, time limit and win conditions remain in its scene scripts.
|
|
38
|
+
|
|
21
39
|
## Authoring map
|
|
22
40
|
|
|
23
41
|
- `scene.json`: validated prefabs, level entities, component schemas, command payloads, input bindings, camera, physics, and gameplay configuration.
|