@bendyline/molen-tooling 0.0.1 → 0.0.3

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.
Files changed (158) hide show
  1. package/README.md +22 -4
  2. package/dist/capture/harness.js +216 -216
  3. package/dist/capture/worldgen-preview.js +288 -288
  4. package/dist/cli.mjs +134 -12
  5. package/dist/docs-src/guide/3d-art-guidelines.md +2 -2
  6. package/dist/docs-src/guide/3d-model-assets.md +49 -13
  7. package/dist/docs-src/guide/adaptive-performance.md +4 -0
  8. package/dist/docs-src/guide/agent-loop.md +6 -6
  9. package/dist/docs-src/guide/aircraft.md +25 -17
  10. package/dist/docs-src/guide/audio.md +247 -0
  11. package/dist/docs-src/guide/browser-mount.md +17 -1
  12. package/dist/docs-src/guide/building-interiors.md +7 -5
  13. package/dist/docs-src/guide/determinism.md +27 -22
  14. package/dist/docs-src/guide/earth-view.md +444 -0
  15. package/dist/docs-src/guide/entities.md +17 -6
  16. package/dist/docs-src/guide/examples.md +39 -23
  17. package/dist/docs-src/guide/experience-playback.md +2 -3
  18. package/dist/docs-src/guide/game-samples.md +50 -21
  19. package/dist/docs-src/guide/graphics-performance.md +40 -8
  20. package/dist/docs-src/guide/input.md +9 -0
  21. package/dist/docs-src/guide/markers.md +52 -0
  22. package/dist/docs-src/guide/materials.md +10 -3
  23. package/dist/docs-src/guide/navigation.md +144 -0
  24. package/dist/docs-src/guide/project.md +23 -3
  25. package/dist/docs-src/guide/quickstart.md +39 -30
  26. package/dist/docs-src/guide/recognizable-places.md +24 -17
  27. package/dist/docs-src/guide/rendering-backends.md +5 -4
  28. package/dist/docs-src/guide/scripting.md +8 -4
  29. package/dist/docs-src/guide/sky.md +26 -9
  30. package/dist/docs-src/guide/source-bundles.md +0 -1
  31. package/dist/docs-src/guide/structure-library.md +20 -10
  32. package/dist/docs-src/guide/terrain.md +51 -6
  33. package/dist/docs-src/guide/vehicles.md +27 -14
  34. package/dist/docs-src/guide/worldgen.md +34 -24
  35. package/dist/docs-src/llms.txt +35 -18
  36. package/dist/docs-src/schemas/README.md +4 -1
  37. package/dist/docs-src/schemas/archive-set.md +175 -0
  38. package/dist/docs-src/schemas/components.md +1104 -1
  39. package/dist/docs-src/schemas/matgraph.md +6 -0
  40. package/dist/docs-src/schemas/soundbank.md +251 -0
  41. package/dist/docs-src/schemas/structure-placements.md +496 -0
  42. package/dist/docs-src/schemas/terrain-package.md +120 -0
  43. package/dist/index.d.mts +31 -3
  44. package/dist/index.mjs +2 -2
  45. package/dist/{mcp-BFnCWrg0.mjs → mcp-BTVwVKFb.mjs} +78 -4
  46. package/dist/{ops-BGxhSP6w.mjs → ops-BPdHodFR.mjs} +1181 -61
  47. package/dist/templates/city-courier/README.md +66 -0
  48. package/dist/templates/city-courier/checks.json +20 -0
  49. package/dist/templates/city-courier/commands.json +32 -0
  50. package/dist/templates/city-courier/delivery-run.replay.json +214 -0
  51. package/dist/templates/city-courier/gen/molen-types.ts +1016 -0
  52. package/dist/templates/city-courier/index.html +2 -0
  53. package/dist/templates/city-courier/package.json +26 -0
  54. package/dist/templates/city-courier/project.json +8 -0
  55. package/dist/templates/city-courier/scene.json +3474 -0
  56. package/dist/templates/city-courier/scripts/game.ts +131 -0
  57. package/dist/templates/city-courier/scripts/molen-scripts.d.ts +1288 -0
  58. package/dist/templates/city-courier/scripts/tsconfig.json +16 -0
  59. package/dist/templates/city-courier/src/audio.ts +96 -0
  60. package/dist/templates/city-courier/src/game-shell.css +317 -0
  61. package/dist/templates/city-courier/src/main.ts +84 -0
  62. package/dist/templates/city-courier/src/scene.ts +17 -0
  63. package/dist/templates/city-courier/src/vite-env.d.ts +1 -0
  64. package/dist/templates/city-courier/src/worker.ts +5 -0
  65. package/dist/templates/city-courier/test/headless.test.ts +95 -0
  66. package/dist/templates/city-courier/test/playthrough.test.js +52 -0
  67. package/dist/templates/city-courier/test/replay.test.ts +22 -0
  68. package/dist/templates/city-courier/tsconfig.json +17 -0
  69. package/dist/templates/city-courier/vite.config.ts +19 -0
  70. package/dist/templates/cubes/README.md +51 -0
  71. package/dist/templates/cubes/index.html +16 -0
  72. package/dist/templates/cubes/package.json +24 -0
  73. package/dist/templates/cubes/scene.json +15 -0
  74. package/dist/templates/cubes/src/cubes.ts +100 -0
  75. package/dist/templates/cubes/src/main.ts +21 -0
  76. package/dist/templates/cubes/src/worker.ts +15 -0
  77. package/dist/templates/cubes/test/headless.test.ts +98 -0
  78. package/dist/templates/cubes/tsconfig.json +17 -0
  79. package/dist/templates/cubes/vite.config.ts +17 -0
  80. package/dist/templates/data-viz/README.md +47 -0
  81. package/dist/templates/data-viz/camera-track.json +12 -0
  82. package/dist/templates/data-viz/data.json +9 -0
  83. package/dist/templates/data-viz/index.html +16 -0
  84. package/dist/templates/data-viz/package.json +25 -0
  85. package/dist/templates/data-viz/scene.json +7 -0
  86. package/dist/templates/data-viz/src/main.ts +39 -0
  87. package/dist/templates/data-viz/src/viz.ts +91 -0
  88. package/dist/templates/data-viz/src/worker.ts +12 -0
  89. package/dist/templates/data-viz/test/headless.test.ts +75 -0
  90. package/dist/templates/data-viz/tsconfig.json +17 -0
  91. package/dist/templates/data-viz/vite.config.ts +16 -0
  92. package/dist/templates/figures-gallery/README.md +46 -0
  93. package/dist/templates/figures-gallery/index.html +16 -0
  94. package/dist/templates/figures-gallery/package.json +25 -0
  95. package/dist/templates/figures-gallery/scene.json +276 -0
  96. package/dist/templates/figures-gallery/src/main.ts +44 -0
  97. package/dist/templates/figures-gallery/src/worker.ts +17 -0
  98. package/dist/templates/figures-gallery/test/headless.test.ts +90 -0
  99. package/dist/templates/figures-gallery/tsconfig.json +17 -0
  100. package/dist/templates/figures-gallery/vite.config.ts +17 -0
  101. package/dist/templates/index.json +191 -0
  102. package/dist/templates/skybound/README.md +66 -0
  103. package/dist/templates/skybound/checks.json +24 -0
  104. package/dist/templates/skybound/commands.json +32 -0
  105. package/dist/templates/skybound/first-leap.replay.json +224 -0
  106. package/dist/templates/skybound/gen/molen-types.ts +1016 -0
  107. package/dist/templates/skybound/index.html +2 -0
  108. package/dist/templates/skybound/package.json +26 -0
  109. package/dist/templates/skybound/project.json +8 -0
  110. package/dist/templates/skybound/scene.json +1777 -0
  111. package/dist/templates/skybound/scripts/game.ts +122 -0
  112. package/dist/templates/skybound/scripts/molen-scripts.d.ts +1288 -0
  113. package/dist/templates/skybound/scripts/tsconfig.json +16 -0
  114. package/dist/templates/skybound/src/audio.ts +96 -0
  115. package/dist/templates/skybound/src/game-shell.css +317 -0
  116. package/dist/templates/skybound/src/main.ts +63 -0
  117. package/dist/templates/skybound/src/scene.ts +17 -0
  118. package/dist/templates/skybound/src/vite-env.d.ts +1 -0
  119. package/dist/templates/skybound/src/worker.ts +5 -0
  120. package/dist/templates/skybound/test/headless.test.ts +124 -0
  121. package/dist/templates/skybound/test/playthrough.test.js +38 -0
  122. package/dist/templates/skybound/test/replay.test.ts +22 -0
  123. package/dist/templates/skybound/tsconfig.json +17 -0
  124. package/dist/templates/skybound/vite.config.ts +19 -0
  125. package/dist/templates/terrain-flyover/README.md +46 -0
  126. package/dist/templates/terrain-flyover/index.html +16 -0
  127. package/dist/templates/terrain-flyover/package.json +26 -0
  128. package/dist/templates/terrain-flyover/src/flyover.ts +23 -0
  129. package/dist/templates/terrain-flyover/src/main.ts +93 -0
  130. package/dist/templates/terrain-flyover/terrain.json +15 -0
  131. package/dist/templates/terrain-flyover/test/headless.test.ts +72 -0
  132. package/dist/templates/terrain-flyover/tsconfig.json +17 -0
  133. package/dist/templates/terrain-flyover/vite.config.ts +15 -0
  134. package/dist/templates/top-down-arena/README.md +65 -0
  135. package/dist/templates/top-down-arena/arena-skirmish.replay.json +204 -0
  136. package/dist/templates/top-down-arena/index.html +16 -0
  137. package/dist/templates/top-down-arena/package.json +26 -0
  138. package/dist/templates/top-down-arena/project.json +10 -0
  139. package/dist/templates/top-down-arena/scene.json +182 -0
  140. package/dist/templates/top-down-arena/scripts/chase.ts +17 -0
  141. package/dist/templates/top-down-arena/scripts/combat.ts +13 -0
  142. package/dist/templates/top-down-arena/scripts/control.ts +8 -0
  143. package/dist/templates/top-down-arena/scripts/molen-scripts.d.ts +1258 -0
  144. package/dist/templates/top-down-arena/scripts/spawner.ts +11 -0
  145. package/dist/templates/top-down-arena/scripts/tsconfig.json +16 -0
  146. package/dist/templates/top-down-arena/src/arena.ts +8 -0
  147. package/dist/templates/top-down-arena/src/audio.ts +96 -0
  148. package/dist/templates/top-down-arena/src/gen/molen-types.ts +1020 -0
  149. package/dist/templates/top-down-arena/src/main.ts +34 -0
  150. package/dist/templates/top-down-arena/src/scene.ts +24 -0
  151. package/dist/templates/top-down-arena/src/vite-env.d.ts +1 -0
  152. package/dist/templates/top-down-arena/src/worker.ts +7 -0
  153. package/dist/templates/top-down-arena/test/headless.test.ts +87 -0
  154. package/dist/templates/top-down-arena/test/replay.test.ts +22 -0
  155. package/dist/templates/top-down-arena/tsconfig.json +17 -0
  156. package/dist/templates/top-down-arena/types/arena.types.json +54 -0
  157. package/dist/templates/top-down-arena/vite.config.ts +21 -0
  158. package/package.json +14 -14
@@ -1,6 +1,6 @@
1
1
  # Components
2
2
 
3
- Components are pure-JSON data attached to entities. molen ships a known component vocabulary;
3
+ Components are pure-JSON data attached to entities. Molen ships a known component vocabulary;
4
4
  `molen validate` checks component data against it, so a typo'd name (`helth` → `health`) or a
5
5
  wrong field (`transform.position` → `pos`) is caught in the cheap pre-sim loop. **Inventing your
6
6
  own components is fine** — a name that doesn't resemble a known one is accepted as-is (declare it
@@ -37,6 +37,9 @@ with `registerComponent(name, zodSchema, meta)` from `@bendyline/molen-schema`.
37
37
  | `aircraft` | kernel/aircraft | External airplane/helicopter instance. Y up, Z forward; landing-contact origin. |
38
38
  | `aircraftInput` | kernel/aircraft | Pilot flight controls. Power is retained when input keys are released. |
39
39
  | `aircraftState` | kernel/aircraft | Deterministic flight state, including rotor phase and engine spool, preserved by keyframes. |
40
+ | `audioEnvironment` | audio | Singleton soundscape rules: bus gains, ambience layers gated on weather/sky/listener signals, music playlist, event → sound mappings and listener footsteps. |
41
+ | `audioSource` | audio | Sound emitter on an entity: a sound-bank id, loop/autoplay, gain and pitch driven by signals (vehicleState.speed, listener.distance…), and one-shot triggers. Positional when the entity has a transform. Render-side only; see guide/audio.md. |
42
+ | `audioZone` | audio | Area ambience: a looping sound that fades in as the listener enters a sphere or box around the entity (a waterfall, a machine room, a market). |
40
43
  | `character` | kernel/character | Kinematic character controller state (speed/jump/gravity + kernel-owned vy/grounded). |
41
44
  | `collider` | kernel/kinematics | 2.5D kinematic collider (circle or XZ AABB) with layer/mask bitmasks. |
42
45
  | `collider3d` | physics-rapier | 3D collider (ball/cuboid/capsule/hull/trimesh/asset/heightfield) with layer/mask, sensor, and material params. Static without a rigidbody. |
@@ -76,6 +79,1106 @@ with `registerComponent(name, zodSchema, meta)` from `@bendyline/molen-schema`.
76
79
  | `weather` | | Singleton physical atmosphere and visual weather: temperature, pressure, humidity, wind, independent cloud cover, precipitation and visibility. Readable by scripts and physics; see guide/weather.md. |
77
80
  | `worldgenBuilding` | worldgen | A building generated at runtime from an outline in the entity frame, styled by a molen/archstyle@1 in the loaded pack; rendered by the worldgen client entity layer. |
78
81
 
82
+ ## Owner: audio
83
+
84
+ ### `audioEnvironment`
85
+
86
+ Singleton soundscape rules: bus gains, ambience layers gated on weather/sky/listener signals, music playlist, event → sound mappings and listener footsteps.
87
+
88
+ Required: none
89
+
90
+ ```json
91
+ {
92
+ "buses": {
93
+ "music": 0.5
94
+ },
95
+ "ambience": [
96
+ {
97
+ "sound": "ambience.rain.medium",
98
+ "when": {
99
+ "weather.precipitation.kind": "rain"
100
+ },
101
+ "gainFrom": {
102
+ "signal": "weather.precipitation.intensity",
103
+ "curve": [
104
+ [
105
+ 0,
106
+ 0
107
+ ],
108
+ [
109
+ 1,
110
+ 1
111
+ ]
112
+ ]
113
+ }
114
+ },
115
+ {
116
+ "sound": "ambience.birds.day",
117
+ "when": {
118
+ "sky.daylight": {
119
+ "min": 0.3
120
+ }
121
+ },
122
+ "fadeS": 4
123
+ }
124
+ ],
125
+ "music": {
126
+ "playlist": [
127
+ "music.ambient.dawn"
128
+ ],
129
+ "mode": "sequence"
130
+ },
131
+ "events": {
132
+ "crash": {
133
+ "sound": "impact.metal.heavy"
134
+ }
135
+ },
136
+ "footsteps": {
137
+ "sound": "footstep.grass",
138
+ "strideM": 0.75
139
+ }
140
+ }
141
+ ```
142
+
143
+ <details>
144
+ <summary>JSON Schema</summary>
145
+
146
+ ```json
147
+ {
148
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
149
+ "type": "object",
150
+ "properties": {
151
+ "buses": {
152
+ "description": "Bus gains (music, ambience, sfx, ui, voice, custom), default 1 each.",
153
+ "type": "object",
154
+ "propertyNames": {
155
+ "type": "string",
156
+ "pattern": "^[a-z][a-z0-9-]*$"
157
+ },
158
+ "additionalProperties": {
159
+ "type": "number",
160
+ "minimum": 0,
161
+ "maximum": 2
162
+ }
163
+ },
164
+ "ambience": {
165
+ "description": "Looping ambience layers, each active while its `when` holds.",
166
+ "type": "array",
167
+ "items": {
168
+ "type": "object",
169
+ "properties": {
170
+ "sound": {
171
+ "type": "string",
172
+ "pattern": "^[a-z0-9][a-z0-9_-]*(\\.[a-z0-9][a-z0-9_-]*)*$",
173
+ "description": "Sound id from a molen/soundbank@1 document, e.g. \"ambience.rain.medium\"."
174
+ },
175
+ "when": {
176
+ "type": "object",
177
+ "propertyNames": {
178
+ "type": "string",
179
+ "minLength": 1
180
+ },
181
+ "additionalProperties": {
182
+ "anyOf": [
183
+ {
184
+ "type": [
185
+ "string",
186
+ "number",
187
+ "boolean"
188
+ ]
189
+ },
190
+ {
191
+ "minItems": 1,
192
+ "type": "array",
193
+ "items": {
194
+ "type": [
195
+ "string",
196
+ "number",
197
+ "boolean"
198
+ ]
199
+ }
200
+ },
201
+ {
202
+ "type": "object",
203
+ "properties": {
204
+ "min": {
205
+ "description": "Inclusive lower bound.",
206
+ "type": "number"
207
+ },
208
+ "max": {
209
+ "description": "Inclusive upper bound.",
210
+ "type": "number"
211
+ }
212
+ },
213
+ "additionalProperties": false
214
+ },
215
+ {
216
+ "type": "object",
217
+ "properties": {
218
+ "exists": {
219
+ "type": "boolean",
220
+ "description": "true = the signal resolves to a value."
221
+ }
222
+ },
223
+ "required": [
224
+ "exists"
225
+ ],
226
+ "additionalProperties": false
227
+ }
228
+ ]
229
+ },
230
+ "description": "Conditions that must ALL hold, keyed by signal: a value (equality), a list (any of), {min,max} (inclusive range), or {exists}."
231
+ },
232
+ "gain": {
233
+ "description": "Gain multiplier; default 1.",
234
+ "type": "number",
235
+ "minimum": 0,
236
+ "maximum": 4
237
+ },
238
+ "gainFrom": {
239
+ "description": "Drive gain from a signal, or from several whose curves multiply.",
240
+ "anyOf": [
241
+ {
242
+ "type": "object",
243
+ "properties": {
244
+ "signal": {
245
+ "type": "string",
246
+ "minLength": 1,
247
+ "description": "Signal path: <component>.<field> on the entity (vehicleState.speed), or self.*, listener.*, weather.*, sky.*, time.*, host.*."
248
+ },
249
+ "curve": {
250
+ "minItems": 1,
251
+ "type": "array",
252
+ "items": {
253
+ "minItems": 2,
254
+ "maxItems": 2,
255
+ "type": "array",
256
+ "items": {
257
+ "type": "number"
258
+ }
259
+ },
260
+ "description": "Piecewise-linear [input, output] points, clamped at the ends."
261
+ },
262
+ "smoothS": {
263
+ "description": "Smoothing time constant in seconds; default 0.15.",
264
+ "type": "number",
265
+ "minimum": 0
266
+ }
267
+ },
268
+ "required": [
269
+ "signal",
270
+ "curve"
271
+ ],
272
+ "additionalProperties": false
273
+ },
274
+ {
275
+ "minItems": 1,
276
+ "type": "array",
277
+ "items": {
278
+ "type": "object",
279
+ "properties": {
280
+ "signal": {
281
+ "type": "string",
282
+ "minLength": 1,
283
+ "description": "Signal path: <component>.<field> on the entity (vehicleState.speed), or self.*, listener.*, weather.*, sky.*, time.*, host.*."
284
+ },
285
+ "curve": {
286
+ "minItems": 1,
287
+ "type": "array",
288
+ "items": {
289
+ "minItems": 2,
290
+ "maxItems": 2,
291
+ "type": "array",
292
+ "items": {
293
+ "type": "number"
294
+ }
295
+ },
296
+ "description": "Piecewise-linear [input, output] points, clamped at the ends."
297
+ },
298
+ "smoothS": {
299
+ "description": "Smoothing time constant in seconds; default 0.15.",
300
+ "type": "number",
301
+ "minimum": 0
302
+ }
303
+ },
304
+ "required": [
305
+ "signal",
306
+ "curve"
307
+ ],
308
+ "additionalProperties": false
309
+ }
310
+ }
311
+ ]
312
+ },
313
+ "pitchFrom": {
314
+ "description": "Drive pitch from a signal, or from several whose curves multiply.",
315
+ "anyOf": [
316
+ {
317
+ "type": "object",
318
+ "properties": {
319
+ "signal": {
320
+ "type": "string",
321
+ "minLength": 1,
322
+ "description": "Signal path: <component>.<field> on the entity (vehicleState.speed), or self.*, listener.*, weather.*, sky.*, time.*, host.*."
323
+ },
324
+ "curve": {
325
+ "minItems": 1,
326
+ "type": "array",
327
+ "items": {
328
+ "minItems": 2,
329
+ "maxItems": 2,
330
+ "type": "array",
331
+ "items": {
332
+ "type": "number"
333
+ }
334
+ },
335
+ "description": "Piecewise-linear [input, output] points, clamped at the ends."
336
+ },
337
+ "smoothS": {
338
+ "description": "Smoothing time constant in seconds; default 0.15.",
339
+ "type": "number",
340
+ "minimum": 0
341
+ }
342
+ },
343
+ "required": [
344
+ "signal",
345
+ "curve"
346
+ ],
347
+ "additionalProperties": false
348
+ },
349
+ {
350
+ "minItems": 1,
351
+ "type": "array",
352
+ "items": {
353
+ "type": "object",
354
+ "properties": {
355
+ "signal": {
356
+ "type": "string",
357
+ "minLength": 1,
358
+ "description": "Signal path: <component>.<field> on the entity (vehicleState.speed), or self.*, listener.*, weather.*, sky.*, time.*, host.*."
359
+ },
360
+ "curve": {
361
+ "minItems": 1,
362
+ "type": "array",
363
+ "items": {
364
+ "minItems": 2,
365
+ "maxItems": 2,
366
+ "type": "array",
367
+ "items": {
368
+ "type": "number"
369
+ }
370
+ },
371
+ "description": "Piecewise-linear [input, output] points, clamped at the ends."
372
+ },
373
+ "smoothS": {
374
+ "description": "Smoothing time constant in seconds; default 0.15.",
375
+ "type": "number",
376
+ "minimum": 0
377
+ }
378
+ },
379
+ "required": [
380
+ "signal",
381
+ "curve"
382
+ ],
383
+ "additionalProperties": false
384
+ }
385
+ }
386
+ ]
387
+ },
388
+ "fadeS": {
389
+ "description": "Fade in/out time in seconds; default 1.5.",
390
+ "type": "number",
391
+ "minimum": 0
392
+ }
393
+ },
394
+ "required": [
395
+ "sound"
396
+ ],
397
+ "additionalProperties": false
398
+ }
399
+ },
400
+ "music": {
401
+ "description": "Background music; scripts switch it with molen.audio.music().",
402
+ "type": "object",
403
+ "properties": {
404
+ "playlist": {
405
+ "minItems": 1,
406
+ "type": "array",
407
+ "items": {
408
+ "type": "string",
409
+ "pattern": "^[a-z0-9][a-z0-9_-]*(\\.[a-z0-9][a-z0-9_-]*)*$",
410
+ "description": "Sound id from a molen/soundbank@1 document, e.g. \"ambience.rain.medium\"."
411
+ },
412
+ "description": "Tracks, played on the music bus."
413
+ },
414
+ "mode": {
415
+ "description": "Default sequence.",
416
+ "type": "string",
417
+ "enum": [
418
+ "sequence",
419
+ "shuffle"
420
+ ]
421
+ },
422
+ "crossfadeS": {
423
+ "description": "Crossfade between tracks; default 4.",
424
+ "type": "number",
425
+ "minimum": 0
426
+ },
427
+ "gain": {
428
+ "description": "Music gain multiplier; default 1.",
429
+ "type": "number",
430
+ "minimum": 0,
431
+ "maximum": 4
432
+ },
433
+ "when": {
434
+ "type": "object",
435
+ "propertyNames": {
436
+ "type": "string",
437
+ "minLength": 1
438
+ },
439
+ "additionalProperties": {
440
+ "anyOf": [
441
+ {
442
+ "type": [
443
+ "string",
444
+ "number",
445
+ "boolean"
446
+ ]
447
+ },
448
+ {
449
+ "minItems": 1,
450
+ "type": "array",
451
+ "items": {
452
+ "type": [
453
+ "string",
454
+ "number",
455
+ "boolean"
456
+ ]
457
+ }
458
+ },
459
+ {
460
+ "type": "object",
461
+ "properties": {
462
+ "min": {
463
+ "description": "Inclusive lower bound.",
464
+ "type": "number"
465
+ },
466
+ "max": {
467
+ "description": "Inclusive upper bound.",
468
+ "type": "number"
469
+ }
470
+ },
471
+ "additionalProperties": false
472
+ },
473
+ {
474
+ "type": "object",
475
+ "properties": {
476
+ "exists": {
477
+ "type": "boolean",
478
+ "description": "true = the signal resolves to a value."
479
+ }
480
+ },
481
+ "required": [
482
+ "exists"
483
+ ],
484
+ "additionalProperties": false
485
+ }
486
+ ]
487
+ },
488
+ "description": "Conditions that must ALL hold, keyed by signal: a value (equality), a list (any of), {min,max} (inclusive range), or {exists}."
489
+ }
490
+ },
491
+ "required": [
492
+ "playlist"
493
+ ],
494
+ "additionalProperties": false
495
+ },
496
+ "events": {
497
+ "description": "Engine/script event type → one-shot sound (e.g. \"crash\", \"delivery\").",
498
+ "type": "object",
499
+ "propertyNames": {
500
+ "type": "string",
501
+ "minLength": 1
502
+ },
503
+ "additionalProperties": {
504
+ "type": "object",
505
+ "properties": {
506
+ "sound": {
507
+ "type": "string",
508
+ "pattern": "^[a-z0-9][a-z0-9_-]*(\\.[a-z0-9][a-z0-9_-]*)*$",
509
+ "description": "Sound id from a molen/soundbank@1 document, e.g. \"ambience.rain.medium\"."
510
+ },
511
+ "at": {
512
+ "description": "Where it plays: \"listener\" (2D) or \"payload.<field>\" naming an entity id or [x,y,z]. Default: payload.entity, payload.position, payload.a, else listener.",
513
+ "type": "string"
514
+ },
515
+ "gain": {
516
+ "type": "number",
517
+ "minimum": 0,
518
+ "maximum": 4
519
+ },
520
+ "pitch": {
521
+ "type": "number",
522
+ "exclusiveMinimum": 0
523
+ },
524
+ "bus": {
525
+ "type": "string",
526
+ "pattern": "^[a-z][a-z0-9-]*$",
527
+ "description": "Mixer bus: music, ambience, sfx, ui, voice, or a custom lowercase name."
528
+ }
529
+ },
530
+ "required": [
531
+ "sound"
532
+ ],
533
+ "additionalProperties": false
534
+ }
535
+ },
536
+ "footsteps": {
537
+ "description": "Listener footsteps from distance travelled (walk modes, first-person games).",
538
+ "type": "object",
539
+ "properties": {
540
+ "sound": {
541
+ "type": "string",
542
+ "pattern": "^[a-z0-9][a-z0-9_-]*(\\.[a-z0-9][a-z0-9_-]*)*$",
543
+ "description": "Default footstep sound."
544
+ },
545
+ "surfaces": {
546
+ "description": "listener.surface value → footstep sound (grass, concrete, wood…).",
547
+ "type": "object",
548
+ "propertyNames": {
549
+ "type": "string"
550
+ },
551
+ "additionalProperties": {
552
+ "type": "string",
553
+ "pattern": "^[a-z0-9][a-z0-9_-]*(\\.[a-z0-9][a-z0-9_-]*)*$",
554
+ "description": "Sound id from a molen/soundbank@1 document, e.g. \"ambience.rain.medium\"."
555
+ }
556
+ },
557
+ "strideM": {
558
+ "description": "Meters per step; default 0.75.",
559
+ "type": "number",
560
+ "exclusiveMinimum": 0
561
+ },
562
+ "gain": {
563
+ "description": "Footstep gain multiplier; default 1.",
564
+ "type": "number",
565
+ "minimum": 0,
566
+ "maximum": 4
567
+ },
568
+ "when": {
569
+ "description": "Default { \"listener.grounded\": true }.",
570
+ "type": "object",
571
+ "propertyNames": {
572
+ "type": "string",
573
+ "minLength": 1
574
+ },
575
+ "additionalProperties": {
576
+ "anyOf": [
577
+ {
578
+ "type": [
579
+ "string",
580
+ "number",
581
+ "boolean"
582
+ ]
583
+ },
584
+ {
585
+ "minItems": 1,
586
+ "type": "array",
587
+ "items": {
588
+ "type": [
589
+ "string",
590
+ "number",
591
+ "boolean"
592
+ ]
593
+ }
594
+ },
595
+ {
596
+ "type": "object",
597
+ "properties": {
598
+ "min": {
599
+ "description": "Inclusive lower bound.",
600
+ "type": "number"
601
+ },
602
+ "max": {
603
+ "description": "Inclusive upper bound.",
604
+ "type": "number"
605
+ }
606
+ },
607
+ "additionalProperties": false
608
+ },
609
+ {
610
+ "type": "object",
611
+ "properties": {
612
+ "exists": {
613
+ "type": "boolean",
614
+ "description": "true = the signal resolves to a value."
615
+ }
616
+ },
617
+ "required": [
618
+ "exists"
619
+ ],
620
+ "additionalProperties": false
621
+ }
622
+ ]
623
+ }
624
+ }
625
+ },
626
+ "required": [
627
+ "sound"
628
+ ],
629
+ "additionalProperties": false
630
+ },
631
+ "listenerEntity": {
632
+ "description": "Entity treated as the listener's body; <component>.<field> signals in ambience/music/footsteps resolve on it.",
633
+ "type": "string"
634
+ },
635
+ "maxVoices": {
636
+ "description": "Voice budget; default 32.",
637
+ "type": "integer",
638
+ "minimum": 1,
639
+ "maximum": 256
640
+ }
641
+ },
642
+ "additionalProperties": false
643
+ }
644
+ ```
645
+
646
+ </details>
647
+
648
+ ### `audioSource`
649
+
650
+ Sound emitter on an entity: a sound-bank id, loop/autoplay, gain and pitch driven by signals (vehicleState.speed, listener.distance…), and one-shot triggers. Positional when the entity has a transform. Render-side only; see guide/audio.md.
651
+
652
+ Required: `sound`
653
+
654
+ ```json
655
+ {
656
+ "sound": "vehicle.engine.car",
657
+ "loop": true,
658
+ "spatial": {
659
+ "refDistance": 3,
660
+ "maxDistance": 120
661
+ },
662
+ "pitchFrom": {
663
+ "signal": "vehicleState.speed",
664
+ "curve": [
665
+ [
666
+ 0,
667
+ 0.8
668
+ ],
669
+ [
670
+ 30,
671
+ 1.7
672
+ ]
673
+ ]
674
+ },
675
+ "gainFrom": {
676
+ "signal": "vehicleInput.throttle",
677
+ "curve": [
678
+ [
679
+ 0,
680
+ 0.45
681
+ ],
682
+ [
683
+ 1,
684
+ 1
685
+ ]
686
+ ]
687
+ }
688
+ }
689
+ ```
690
+
691
+ <details>
692
+ <summary>JSON Schema</summary>
693
+
694
+ ```json
695
+ {
696
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
697
+ "type": "object",
698
+ "properties": {
699
+ "sound": {
700
+ "type": "string",
701
+ "pattern": "^[a-z0-9][a-z0-9_-]*(\\.[a-z0-9][a-z0-9_-]*)*$",
702
+ "description": "Sound id from a molen/soundbank@1 document, e.g. \"ambience.rain.medium\"."
703
+ },
704
+ "loop": {
705
+ "description": "Loop while active; default the sound's own loop flag.",
706
+ "type": "boolean"
707
+ },
708
+ "autoplay": {
709
+ "description": "Play when the entity exists and `when` holds; default true. false = only triggerFrom/startTick fire it.",
710
+ "type": "boolean"
711
+ },
712
+ "gain": {
713
+ "description": "Gain multiplier; default 1.",
714
+ "type": "number",
715
+ "minimum": 0,
716
+ "maximum": 4
717
+ },
718
+ "pitch": {
719
+ "description": "Playback-rate multiplier; default 1.",
720
+ "type": "number",
721
+ "exclusiveMinimum": 0
722
+ },
723
+ "bus": {
724
+ "type": "string",
725
+ "pattern": "^[a-z][a-z0-9-]*$",
726
+ "description": "Mixer bus: music, ambience, sfx, ui, voice, or a custom lowercase name."
727
+ },
728
+ "spatial": {
729
+ "description": "Override the sound's spatial settings. Positional sources follow the entity's transform.",
730
+ "anyOf": [
731
+ {
732
+ "type": "boolean",
733
+ "const": false
734
+ },
735
+ {
736
+ "type": "object",
737
+ "properties": {
738
+ "refDistance": {
739
+ "description": "Distance in meters at which the sound plays at full gain; default 1.",
740
+ "type": "number",
741
+ "exclusiveMinimum": 0
742
+ },
743
+ "maxDistance": {
744
+ "description": "Distance in meters beyond which the sound is culled; default 60.",
745
+ "type": "number",
746
+ "exclusiveMinimum": 0
747
+ },
748
+ "rolloff": {
749
+ "description": "How fast gain falls off past refDistance; default 1.",
750
+ "type": "number",
751
+ "minimum": 0
752
+ },
753
+ "model": {
754
+ "description": "Distance attenuation model (Web Audio PannerNode.distanceModel); default inverse.",
755
+ "type": "string",
756
+ "enum": [
757
+ "linear",
758
+ "inverse",
759
+ "exponential"
760
+ ]
761
+ }
762
+ },
763
+ "additionalProperties": false
764
+ }
765
+ ]
766
+ },
767
+ "when": {
768
+ "type": "object",
769
+ "propertyNames": {
770
+ "type": "string",
771
+ "minLength": 1
772
+ },
773
+ "additionalProperties": {
774
+ "anyOf": [
775
+ {
776
+ "type": [
777
+ "string",
778
+ "number",
779
+ "boolean"
780
+ ]
781
+ },
782
+ {
783
+ "minItems": 1,
784
+ "type": "array",
785
+ "items": {
786
+ "type": [
787
+ "string",
788
+ "number",
789
+ "boolean"
790
+ ]
791
+ }
792
+ },
793
+ {
794
+ "type": "object",
795
+ "properties": {
796
+ "min": {
797
+ "description": "Inclusive lower bound.",
798
+ "type": "number"
799
+ },
800
+ "max": {
801
+ "description": "Inclusive upper bound.",
802
+ "type": "number"
803
+ }
804
+ },
805
+ "additionalProperties": false
806
+ },
807
+ {
808
+ "type": "object",
809
+ "properties": {
810
+ "exists": {
811
+ "type": "boolean",
812
+ "description": "true = the signal resolves to a value."
813
+ }
814
+ },
815
+ "required": [
816
+ "exists"
817
+ ],
818
+ "additionalProperties": false
819
+ }
820
+ ]
821
+ },
822
+ "description": "Conditions that must ALL hold, keyed by signal: a value (equality), a list (any of), {min,max} (inclusive range), or {exists}."
823
+ },
824
+ "gainFrom": {
825
+ "description": "Drive gain from a signal, or from several whose curves multiply.",
826
+ "anyOf": [
827
+ {
828
+ "type": "object",
829
+ "properties": {
830
+ "signal": {
831
+ "type": "string",
832
+ "minLength": 1,
833
+ "description": "Signal path: <component>.<field> on the entity (vehicleState.speed), or self.*, listener.*, weather.*, sky.*, time.*, host.*."
834
+ },
835
+ "curve": {
836
+ "minItems": 1,
837
+ "type": "array",
838
+ "items": {
839
+ "minItems": 2,
840
+ "maxItems": 2,
841
+ "type": "array",
842
+ "items": {
843
+ "type": "number"
844
+ }
845
+ },
846
+ "description": "Piecewise-linear [input, output] points, clamped at the ends."
847
+ },
848
+ "smoothS": {
849
+ "description": "Smoothing time constant in seconds; default 0.15.",
850
+ "type": "number",
851
+ "minimum": 0
852
+ }
853
+ },
854
+ "required": [
855
+ "signal",
856
+ "curve"
857
+ ],
858
+ "additionalProperties": false
859
+ },
860
+ {
861
+ "minItems": 1,
862
+ "type": "array",
863
+ "items": {
864
+ "type": "object",
865
+ "properties": {
866
+ "signal": {
867
+ "type": "string",
868
+ "minLength": 1,
869
+ "description": "Signal path: <component>.<field> on the entity (vehicleState.speed), or self.*, listener.*, weather.*, sky.*, time.*, host.*."
870
+ },
871
+ "curve": {
872
+ "minItems": 1,
873
+ "type": "array",
874
+ "items": {
875
+ "minItems": 2,
876
+ "maxItems": 2,
877
+ "type": "array",
878
+ "items": {
879
+ "type": "number"
880
+ }
881
+ },
882
+ "description": "Piecewise-linear [input, output] points, clamped at the ends."
883
+ },
884
+ "smoothS": {
885
+ "description": "Smoothing time constant in seconds; default 0.15.",
886
+ "type": "number",
887
+ "minimum": 0
888
+ }
889
+ },
890
+ "required": [
891
+ "signal",
892
+ "curve"
893
+ ],
894
+ "additionalProperties": false
895
+ }
896
+ }
897
+ ]
898
+ },
899
+ "pitchFrom": {
900
+ "description": "Drive pitch from a signal, or from several whose curves multiply.",
901
+ "anyOf": [
902
+ {
903
+ "type": "object",
904
+ "properties": {
905
+ "signal": {
906
+ "type": "string",
907
+ "minLength": 1,
908
+ "description": "Signal path: <component>.<field> on the entity (vehicleState.speed), or self.*, listener.*, weather.*, sky.*, time.*, host.*."
909
+ },
910
+ "curve": {
911
+ "minItems": 1,
912
+ "type": "array",
913
+ "items": {
914
+ "minItems": 2,
915
+ "maxItems": 2,
916
+ "type": "array",
917
+ "items": {
918
+ "type": "number"
919
+ }
920
+ },
921
+ "description": "Piecewise-linear [input, output] points, clamped at the ends."
922
+ },
923
+ "smoothS": {
924
+ "description": "Smoothing time constant in seconds; default 0.15.",
925
+ "type": "number",
926
+ "minimum": 0
927
+ }
928
+ },
929
+ "required": [
930
+ "signal",
931
+ "curve"
932
+ ],
933
+ "additionalProperties": false
934
+ },
935
+ {
936
+ "minItems": 1,
937
+ "type": "array",
938
+ "items": {
939
+ "type": "object",
940
+ "properties": {
941
+ "signal": {
942
+ "type": "string",
943
+ "minLength": 1,
944
+ "description": "Signal path: <component>.<field> on the entity (vehicleState.speed), or self.*, listener.*, weather.*, sky.*, time.*, host.*."
945
+ },
946
+ "curve": {
947
+ "minItems": 1,
948
+ "type": "array",
949
+ "items": {
950
+ "minItems": 2,
951
+ "maxItems": 2,
952
+ "type": "array",
953
+ "items": {
954
+ "type": "number"
955
+ }
956
+ },
957
+ "description": "Piecewise-linear [input, output] points, clamped at the ends."
958
+ },
959
+ "smoothS": {
960
+ "description": "Smoothing time constant in seconds; default 0.15.",
961
+ "type": "number",
962
+ "minimum": 0
963
+ }
964
+ },
965
+ "required": [
966
+ "signal",
967
+ "curve"
968
+ ],
969
+ "additionalProperties": false
970
+ }
971
+ }
972
+ ]
973
+ },
974
+ "triggerFrom": {
975
+ "description": "Fire one-shots from a signal (footsteps from distance, clicks on change).",
976
+ "type": "object",
977
+ "properties": {
978
+ "signal": {
979
+ "type": "string",
980
+ "minLength": 1,
981
+ "description": "Signal to watch (see signal paths)."
982
+ },
983
+ "every": {
984
+ "description": "Fire each time the signal advances by this much (odometer-style, e.g. meters).",
985
+ "type": "number",
986
+ "exclusiveMinimum": 0
987
+ },
988
+ "onChange": {
989
+ "description": "Fire whenever the signal value changes.",
990
+ "type": "boolean"
991
+ },
992
+ "sound": {
993
+ "description": "Sound to fire; default the source's own sound.",
994
+ "type": "string",
995
+ "pattern": "^[a-z0-9][a-z0-9_-]*(\\.[a-z0-9][a-z0-9_-]*)*$"
996
+ }
997
+ },
998
+ "required": [
999
+ "signal"
1000
+ ],
1001
+ "additionalProperties": false
1002
+ },
1003
+ "startTick": {
1004
+ "description": "Play once at this tick; changing it retriggers (like renderable.animation).",
1005
+ "type": "integer",
1006
+ "minimum": 0,
1007
+ "maximum": 9007199254740991
1008
+ }
1009
+ },
1010
+ "required": [
1011
+ "sound"
1012
+ ],
1013
+ "additionalProperties": false
1014
+ }
1015
+ ```
1016
+
1017
+ </details>
1018
+
1019
+ ### `audioZone`
1020
+
1021
+ Area ambience: a looping sound that fades in as the listener enters a sphere or box around the entity (a waterfall, a machine room, a market).
1022
+
1023
+ Required: `sound`, `shape`
1024
+
1025
+ ```json
1026
+ {
1027
+ "sound": "ambience.water.stream",
1028
+ "shape": {
1029
+ "kind": "sphere",
1030
+ "radius": 12
1031
+ },
1032
+ "fade": 8
1033
+ }
1034
+ ```
1035
+
1036
+ <details>
1037
+ <summary>JSON Schema</summary>
1038
+
1039
+ ```json
1040
+ {
1041
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
1042
+ "type": "object",
1043
+ "properties": {
1044
+ "sound": {
1045
+ "type": "string",
1046
+ "pattern": "^[a-z0-9][a-z0-9_-]*(\\.[a-z0-9][a-z0-9_-]*)*$",
1047
+ "description": "Looping ambience played while the listener is inside the zone."
1048
+ },
1049
+ "shape": {
1050
+ "oneOf": [
1051
+ {
1052
+ "type": "object",
1053
+ "properties": {
1054
+ "kind": {
1055
+ "type": "string",
1056
+ "const": "sphere",
1057
+ "description": "Sphere around the entity."
1058
+ },
1059
+ "radius": {
1060
+ "type": "number",
1061
+ "exclusiveMinimum": 0,
1062
+ "description": "Radius in meters."
1063
+ }
1064
+ },
1065
+ "required": [
1066
+ "kind",
1067
+ "radius"
1068
+ ],
1069
+ "additionalProperties": false
1070
+ },
1071
+ {
1072
+ "type": "object",
1073
+ "properties": {
1074
+ "kind": {
1075
+ "type": "string",
1076
+ "const": "box",
1077
+ "description": "Axis-aligned box around the entity."
1078
+ },
1079
+ "halfExtents": {
1080
+ "minItems": 3,
1081
+ "maxItems": 3,
1082
+ "type": "array",
1083
+ "items": {
1084
+ "type": "number"
1085
+ },
1086
+ "description": "Half sizes [x, y, z] in meters, axis-aligned."
1087
+ }
1088
+ },
1089
+ "required": [
1090
+ "kind",
1091
+ "halfExtents"
1092
+ ],
1093
+ "additionalProperties": false
1094
+ }
1095
+ ],
1096
+ "description": "Zone volume, centered on the entity's transform."
1097
+ },
1098
+ "fade": {
1099
+ "description": "Meters outside the shape over which gain fades to zero; default 5.",
1100
+ "type": "number",
1101
+ "minimum": 0
1102
+ },
1103
+ "gain": {
1104
+ "description": "Gain multiplier; default 1.",
1105
+ "type": "number",
1106
+ "minimum": 0,
1107
+ "maximum": 4
1108
+ },
1109
+ "bus": {
1110
+ "description": "Default ambience.",
1111
+ "type": "string",
1112
+ "pattern": "^[a-z][a-z0-9-]*$"
1113
+ },
1114
+ "when": {
1115
+ "type": "object",
1116
+ "propertyNames": {
1117
+ "type": "string",
1118
+ "minLength": 1
1119
+ },
1120
+ "additionalProperties": {
1121
+ "anyOf": [
1122
+ {
1123
+ "type": [
1124
+ "string",
1125
+ "number",
1126
+ "boolean"
1127
+ ]
1128
+ },
1129
+ {
1130
+ "minItems": 1,
1131
+ "type": "array",
1132
+ "items": {
1133
+ "type": [
1134
+ "string",
1135
+ "number",
1136
+ "boolean"
1137
+ ]
1138
+ }
1139
+ },
1140
+ {
1141
+ "type": "object",
1142
+ "properties": {
1143
+ "min": {
1144
+ "description": "Inclusive lower bound.",
1145
+ "type": "number"
1146
+ },
1147
+ "max": {
1148
+ "description": "Inclusive upper bound.",
1149
+ "type": "number"
1150
+ }
1151
+ },
1152
+ "additionalProperties": false
1153
+ },
1154
+ {
1155
+ "type": "object",
1156
+ "properties": {
1157
+ "exists": {
1158
+ "type": "boolean",
1159
+ "description": "true = the signal resolves to a value."
1160
+ }
1161
+ },
1162
+ "required": [
1163
+ "exists"
1164
+ ],
1165
+ "additionalProperties": false
1166
+ }
1167
+ ]
1168
+ },
1169
+ "description": "Conditions that must ALL hold, keyed by signal: a value (equality), a list (any of), {min,max} (inclusive range), or {exists}."
1170
+ }
1171
+ },
1172
+ "required": [
1173
+ "sound",
1174
+ "shape"
1175
+ ],
1176
+ "additionalProperties": false
1177
+ }
1178
+ ```
1179
+
1180
+ </details>
1181
+
79
1182
  ## Owner: client
80
1183
 
81
1184
  ### `environment`