@bendyline/molen-tooling 0.0.2 → 0.0.4

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 (86) hide show
  1. package/README.md +4 -4
  2. package/dist/capture/harness.js +222 -222
  3. package/dist/capture/worldgen-preview.js +288 -288
  4. package/dist/cli.mjs +162 -10
  5. package/dist/docs-src/guide/3d-model-assets.md +35 -3
  6. package/dist/docs-src/guide/adaptive-performance.md +4 -0
  7. package/dist/docs-src/guide/agent-loop.md +6 -6
  8. package/dist/docs-src/guide/aircraft.md +28 -7
  9. package/dist/docs-src/guide/ambient-life.md +389 -0
  10. package/dist/docs-src/guide/audio.md +247 -0
  11. package/dist/docs-src/guide/browser-mount.md +8 -1
  12. package/dist/docs-src/guide/building-interiors.md +5 -4
  13. package/dist/docs-src/guide/capability-authoring.md +5 -0
  14. package/dist/docs-src/guide/determinism.md +35 -27
  15. package/dist/docs-src/guide/earth-view.md +492 -0
  16. package/dist/docs-src/guide/entities.md +9 -1
  17. package/dist/docs-src/guide/examples.md +6 -2
  18. package/dist/docs-src/guide/figures.md +3 -0
  19. package/dist/docs-src/guide/game-samples.md +22 -5
  20. package/dist/docs-src/guide/graphics-performance.md +40 -8
  21. package/dist/docs-src/guide/input.md +9 -0
  22. package/dist/docs-src/guide/markers.md +55 -0
  23. package/dist/docs-src/guide/materials.md +10 -3
  24. package/dist/docs-src/guide/navigation.md +150 -0
  25. package/dist/docs-src/guide/project.md +1 -1
  26. package/dist/docs-src/guide/quickstart.md +2 -2
  27. package/dist/docs-src/guide/recognizable-places.md +3 -2
  28. package/dist/docs-src/guide/scripting.md +4 -2
  29. package/dist/docs-src/guide/sky.md +16 -0
  30. package/dist/docs-src/guide/source-bundles.md +0 -1
  31. package/dist/docs-src/guide/structure-library.md +2 -2
  32. package/dist/docs-src/guide/surface-rendering.md +4 -3
  33. package/dist/docs-src/guide/terrain.md +52 -2
  34. package/dist/docs-src/guide/vehicles.md +32 -10
  35. package/dist/docs-src/guide/worldgen.md +3 -3
  36. package/dist/docs-src/llms.txt +14 -5
  37. package/dist/docs-src/schemas/README.md +4 -0
  38. package/dist/docs-src/schemas/archive-set.md +175 -0
  39. package/dist/docs-src/schemas/components.md +1634 -2
  40. package/dist/docs-src/schemas/matgraph.md +6 -0
  41. package/dist/docs-src/schemas/scene.md +105 -0
  42. package/dist/docs-src/schemas/soundbank.md +251 -0
  43. package/dist/docs-src/schemas/structure-placements.md +496 -0
  44. package/dist/docs-src/schemas/terrain-package.md +120 -0
  45. package/dist/docs-src/schemas/transport-network.md +351 -0
  46. package/dist/index.d.mts +49 -2
  47. package/dist/index.mjs +81 -4
  48. package/dist/{mcp-AOfIp89b.mjs → mcp-BtuworIW.mjs} +88 -3
  49. package/dist/{ops-C4BvDgP-.mjs → ops-DMGcWoL2.mjs} +1204 -93
  50. package/dist/templates/city-courier/README.md +14 -1
  51. package/dist/templates/city-courier/delivery-run.replay.json +151 -151
  52. package/dist/templates/city-courier/gen/molen-types.ts +223 -5
  53. package/dist/templates/city-courier/package.json +2 -0
  54. package/dist/templates/city-courier/scene.json +142 -246
  55. package/dist/templates/city-courier/scripts/game.ts +7 -15
  56. package/dist/templates/city-courier/scripts/molen-scripts.d.ts +252 -16
  57. package/dist/templates/city-courier/src/audio.ts +96 -0
  58. package/dist/templates/city-courier/src/game-shell.css +8 -0
  59. package/dist/templates/city-courier/src/main.ts +3 -0
  60. package/dist/templates/city-courier/src/worker.ts +3 -1
  61. package/dist/templates/city-courier/test/headless.test.ts +3 -2
  62. package/dist/templates/data-viz/README.md +1 -1
  63. package/dist/templates/index.json +22 -1
  64. package/dist/templates/skybound/README.md +13 -0
  65. package/dist/templates/skybound/first-leap.replay.json +152 -152
  66. package/dist/templates/skybound/gen/molen-types.ts +223 -5
  67. package/dist/templates/skybound/package.json +1 -0
  68. package/dist/templates/skybound/scene.json +40 -0
  69. package/dist/templates/skybound/scripts/game.ts +8 -5
  70. package/dist/templates/skybound/scripts/molen-scripts.d.ts +248 -5
  71. package/dist/templates/skybound/src/audio.ts +96 -0
  72. package/dist/templates/skybound/src/game-shell.css +8 -0
  73. package/dist/templates/skybound/src/main.ts +3 -0
  74. package/dist/templates/skybound/test/headless.test.ts +1 -1
  75. package/dist/templates/terrain-flyover/README.md +2 -2
  76. package/dist/templates/top-down-arena/README.md +15 -2
  77. package/dist/templates/top-down-arena/arena-skirmish.replay.json +152 -152
  78. package/dist/templates/top-down-arena/package.json +1 -0
  79. package/dist/templates/top-down-arena/scene.json +20 -0
  80. package/dist/templates/top-down-arena/scripts/combat.ts +1 -0
  81. package/dist/templates/top-down-arena/scripts/molen-scripts.d.ts +248 -5
  82. package/dist/templates/top-down-arena/src/audio.ts +96 -0
  83. package/dist/templates/top-down-arena/src/gen/molen-types.ts +223 -5
  84. package/dist/templates/top-down-arena/src/main.ts +3 -0
  85. package/dist/templates/top-down-arena/test/headless.test.ts +1 -1
  86. package/package.json +13 -12
@@ -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,13 @@ 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
+ | `ambientAgent` | ambient | Kernel-owned state of an ambient NPC (car, pedestrian, train car or aircraft): its lane, position along it, speed and routing. Read it; the ambient systems write it. |
41
+ | `ambientObserver` | ambient | Marks the entity ambient NPCs spawn around (usually the player or camera rig), with optional radius and density overrides. |
42
+ | `ambientRole` | ambient | On an entity type: makes it an ambient NPC candidate (car, bus, rail car or aircraft) with dimensions, speeds and spawn weight. |
43
+ | `ambientState` | ambient | Kernel-owned ambient bookkeeping on the `$ambient` entity: observer, spawn sequence and policy overrides. |
44
+ | `audioEnvironment` | audio | Singleton soundscape rules: bus gains, ambience layers gated on weather/sky/listener signals, music playlist, event → sound mappings and listener footsteps. |
45
+ | `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. |
46
+ | `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
47
  | `character` | kernel/character | Kinematic character controller state (speed/jump/gravity + kernel-owned vy/grounded). |
41
48
  | `collider` | kernel/kinematics | 2.5D kinematic collider (circle or XZ AABB) with layer/mask bitmasks. |
42
49
  | `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 +83,1630 @@ with `registerComponent(name, zodSchema, meta)` from `@bendyline/molen-schema`.
76
83
  | `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
84
  | `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
85
 
86
+ ## Owner: ambient
87
+
88
+ ### `ambientAgent`
89
+
90
+ Kernel-owned state of an ambient NPC (car, pedestrian, train car or aircraft): its lane, position along it, speed and routing. Read it; the ambient systems write it.
91
+
92
+ Required: `kind`, `type`, `lane`, `s`, `speed`, `seed`, `length`, `width`, `state`, `since`, `hops`, `spawnedTick`
93
+
94
+ ```json
95
+ {
96
+ "kind": "car",
97
+ "type": "molen.entities.vehicle.sedan",
98
+ "color": "#4d76b8",
99
+ "lane": "15/5245/11443#k3j9x2>f0",
100
+ "s": 42.5,
101
+ "speed": 11.2,
102
+ "seed": 1964432,
103
+ "length": 4.65,
104
+ "width": 1.82,
105
+ "state": "move",
106
+ "since": 1200,
107
+ "hops": 3,
108
+ "spawnedTick": 1180
109
+ }
110
+ ```
111
+
112
+ <details>
113
+ <summary>JSON Schema</summary>
114
+
115
+ ```json
116
+ {
117
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
118
+ "type": "object",
119
+ "properties": {
120
+ "kind": {
121
+ "type": "string",
122
+ "enum": [
123
+ "car",
124
+ "pedestrian",
125
+ "train",
126
+ "aircraft"
127
+ ],
128
+ "description": "Agent class."
129
+ },
130
+ "type": {
131
+ "type": "string",
132
+ "description": "Content type id (e.g. molen.entities.vehicle.sedan), figure preset, or \"proxy\"."
133
+ },
134
+ "color": {
135
+ "type": "string",
136
+ "description": "Body colour (#rrggbb)."
137
+ },
138
+ "lane": {
139
+ "type": "string",
140
+ "description": "Lane id the agent is on (\"\" for aircraft)."
141
+ },
142
+ "s": {
143
+ "type": "number",
144
+ "description": "Metres along the lane; negative while on the connector into it."
145
+ },
146
+ "speed": {
147
+ "type": "number",
148
+ "minimum": 0,
149
+ "description": "Speed along the lane in m/s."
150
+ },
151
+ "prev": {
152
+ "type": "string",
153
+ "description": "Previous lane (its connector leads onto `lane`)."
154
+ },
155
+ "next": {
156
+ "type": "string",
157
+ "description": "Chosen next lane."
158
+ },
159
+ "seed": {
160
+ "type": "integer",
161
+ "minimum": 0,
162
+ "maximum": 9007199254740991,
163
+ "description": "Per-agent seed for every random choice it makes."
164
+ },
165
+ "length": {
166
+ "type": "number",
167
+ "exclusiveMinimum": 0,
168
+ "description": "Body length in metres."
169
+ },
170
+ "width": {
171
+ "type": "number",
172
+ "exclusiveMinimum": 0,
173
+ "description": "Body width in metres."
174
+ },
175
+ "state": {
176
+ "type": "string",
177
+ "enum": [
178
+ "move",
179
+ "wait",
180
+ "dwell",
181
+ "idle"
182
+ ],
183
+ "description": "Moving, waiting (queue, signal, crossing), dwelling at a stop, or idling."
184
+ },
185
+ "since": {
186
+ "type": "integer",
187
+ "minimum": 0,
188
+ "maximum": 9007199254740991,
189
+ "description": "Tick the current state began."
190
+ },
191
+ "hops": {
192
+ "type": "integer",
193
+ "minimum": 0,
194
+ "maximum": 9007199254740991,
195
+ "description": "Lane transitions so far (routing draw stream)."
196
+ },
197
+ "hidden": {
198
+ "type": "boolean",
199
+ "description": "Inside a tunnel: simulated but not drawn."
200
+ },
201
+ "consist": {
202
+ "type": "string",
203
+ "description": "Train cars: the lead agent of the consist."
204
+ },
205
+ "carIndex": {
206
+ "type": "integer",
207
+ "exclusiveMinimum": 0,
208
+ "maximum": 9007199254740991,
209
+ "description": "Train cars: position behind the lead (1 = first)."
210
+ },
211
+ "trail": {
212
+ "type": "array",
213
+ "items": {
214
+ "type": "string"
215
+ },
216
+ "description": "Train leads: the lanes behind the lead, most recent first."
217
+ },
218
+ "served": {
219
+ "type": "string",
220
+ "description": "The last stop served (not stopped at again)."
221
+ },
222
+ "air": {
223
+ "type": "object",
224
+ "properties": {
225
+ "x": {
226
+ "type": "number",
227
+ "description": "Corridor start X."
228
+ },
229
+ "z": {
230
+ "type": "number",
231
+ "description": "Corridor start Z."
232
+ },
233
+ "dx": {
234
+ "type": "number",
235
+ "description": "Unit heading X."
236
+ },
237
+ "dz": {
238
+ "type": "number",
239
+ "description": "Unit heading Z."
240
+ },
241
+ "y0": {
242
+ "type": "number",
243
+ "description": "Altitude at the start."
244
+ },
245
+ "y1": {
246
+ "type": "number",
247
+ "description": "Altitude at the end."
248
+ },
249
+ "length": {
250
+ "type": "number",
251
+ "exclusiveMinimum": 0,
252
+ "description": "Corridor length in metres."
253
+ }
254
+ },
255
+ "required": [
256
+ "x",
257
+ "z",
258
+ "dx",
259
+ "dz",
260
+ "y0",
261
+ "y1",
262
+ "length"
263
+ ],
264
+ "additionalProperties": false,
265
+ "description": "Aircraft: the straight corridor flown (s runs along it)."
266
+ },
267
+ "spawnedTick": {
268
+ "type": "integer",
269
+ "minimum": 0,
270
+ "maximum": 9007199254740991,
271
+ "description": "Tick the agent appeared (clients fade it in)."
272
+ }
273
+ },
274
+ "required": [
275
+ "kind",
276
+ "type",
277
+ "lane",
278
+ "s",
279
+ "speed",
280
+ "seed",
281
+ "length",
282
+ "width",
283
+ "state",
284
+ "since",
285
+ "hops",
286
+ "spawnedTick"
287
+ ],
288
+ "additionalProperties": false
289
+ }
290
+ ```
291
+
292
+ </details>
293
+
294
+ ### `ambientObserver`
295
+
296
+ Marks the entity ambient NPCs spawn around (usually the player or camera rig), with optional radius and density overrides.
297
+
298
+ Required: none
299
+
300
+ ```json
301
+ {}
302
+ ```
303
+
304
+ <details>
305
+ <summary>JSON Schema</summary>
306
+
307
+ ```json
308
+ {
309
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
310
+ "type": "object",
311
+ "properties": {
312
+ "radius": {
313
+ "type": "number",
314
+ "exclusiveMinimum": 0,
315
+ "description": "Override the car spawn radius in metres."
316
+ },
317
+ "despawnRadius": {
318
+ "type": "number",
319
+ "exclusiveMinimum": 0,
320
+ "description": "Override the car despawn radius in metres."
321
+ },
322
+ "density": {
323
+ "type": "number",
324
+ "minimum": 0,
325
+ "description": "Scale every class density (1 = default)."
326
+ }
327
+ },
328
+ "additionalProperties": false
329
+ }
330
+ ```
331
+
332
+ </details>
333
+
334
+ ### `ambientRole`
335
+
336
+ On an entity type: makes it an ambient NPC candidate (car, bus, rail car or aircraft) with dimensions, speeds and spawn weight.
337
+
338
+ Required: `role`
339
+
340
+ ```json
341
+ {
342
+ "role": "car",
343
+ "cruise": 13,
344
+ "max": 25
345
+ }
346
+ ```
347
+
348
+ <details>
349
+ <summary>JSON Schema</summary>
350
+
351
+ ```json
352
+ {
353
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
354
+ "type": "object",
355
+ "properties": {
356
+ "role": {
357
+ "type": "string",
358
+ "enum": [
359
+ "car",
360
+ "bus",
361
+ "rail",
362
+ "aircraft"
363
+ ],
364
+ "description": "Which ambient pool the type joins (buses drive with cars)."
365
+ },
366
+ "length": {
367
+ "type": "number",
368
+ "exclusiveMinimum": 0,
369
+ "description": "Body length in metres (default from vehicle.spec)."
370
+ },
371
+ "width": {
372
+ "type": "number",
373
+ "exclusiveMinimum": 0,
374
+ "description": "Body width in metres (default from vehicle.spec)."
375
+ },
376
+ "height": {
377
+ "type": "number",
378
+ "exclusiveMinimum": 0,
379
+ "description": "Body height in metres (default from vehicle.spec)."
380
+ },
381
+ "cruise": {
382
+ "type": "number",
383
+ "exclusiveMinimum": 0,
384
+ "description": "Preferred cruise speed in m/s."
385
+ },
386
+ "max": {
387
+ "type": "number",
388
+ "exclusiveMinimum": 0,
389
+ "description": "Top speed in m/s."
390
+ },
391
+ "weight": {
392
+ "type": "number",
393
+ "minimum": 0,
394
+ "description": "Relative spawn weight within its pool (default 1)."
395
+ },
396
+ "cars": {
397
+ "type": "integer",
398
+ "exclusiveMinimum": 0,
399
+ "maximum": 9007199254740991,
400
+ "description": "Rail: cars per consist (default 2)."
401
+ },
402
+ "colors": {
403
+ "minItems": 1,
404
+ "type": "array",
405
+ "items": {
406
+ "type": "string"
407
+ },
408
+ "description": "Paint colours spawned agents pick from (#rrggbb)."
409
+ },
410
+ "visual": {
411
+ "type": "object",
412
+ "properties": {
413
+ "wheelNodes": {
414
+ "type": "array",
415
+ "items": {
416
+ "type": "string"
417
+ },
418
+ "description": "Wheel nodes (their first child spins)."
419
+ },
420
+ "frontWheelNodes": {
421
+ "type": "array",
422
+ "items": {
423
+ "type": "string"
424
+ },
425
+ "description": "Wheel nodes that steer."
426
+ },
427
+ "paintMaterial": {
428
+ "type": "string",
429
+ "description": "Material name tinted with the agent colour."
430
+ },
431
+ "wheelRadius": {
432
+ "type": "number",
433
+ "exclusiveMinimum": 0,
434
+ "description": "Wheel radius in metres."
435
+ },
436
+ "wheelbase": {
437
+ "type": "number",
438
+ "exclusiveMinimum": 0,
439
+ "description": "Axle spacing in metres."
440
+ },
441
+ "rotors": {
442
+ "type": "array",
443
+ "items": {
444
+ "type": "string"
445
+ },
446
+ "description": "Aircraft: nodes spun about Z (fans, propellers)."
447
+ },
448
+ "gearNodes": {
449
+ "type": "array",
450
+ "items": {
451
+ "type": "string"
452
+ },
453
+ "description": "Aircraft: landing gear shown on approach."
454
+ }
455
+ },
456
+ "additionalProperties": false,
457
+ "description": "How the model animates when drawn in full near the camera (types without a vehicle component)."
458
+ }
459
+ },
460
+ "required": [
461
+ "role"
462
+ ],
463
+ "additionalProperties": false
464
+ }
465
+ ```
466
+
467
+ </details>
468
+
469
+ ### `ambientState`
470
+
471
+ Kernel-owned ambient bookkeeping on the `$ambient` entity: observer, spawn sequence and policy overrides.
472
+
473
+ Required: `nextSeq`, `spawned`, `despawned`
474
+
475
+ ```json
476
+ {
477
+ "nextSeq": 12,
478
+ "spawned": 12,
479
+ "despawned": 3,
480
+ "observer": {
481
+ "pos": [
482
+ 0,
483
+ 0,
484
+ 0
485
+ ],
486
+ "setAtTick": 0
487
+ }
488
+ }
489
+ ```
490
+
491
+ <details>
492
+ <summary>JSON Schema</summary>
493
+
494
+ ```json
495
+ {
496
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
497
+ "type": "object",
498
+ "properties": {
499
+ "observer": {
500
+ "type": "object",
501
+ "properties": {
502
+ "pos": {
503
+ "minItems": 3,
504
+ "maxItems": 3,
505
+ "type": "array",
506
+ "items": {
507
+ "type": "number"
508
+ },
509
+ "description": "Observer position."
510
+ },
511
+ "forward": {
512
+ "minItems": 2,
513
+ "maxItems": 2,
514
+ "type": "array",
515
+ "items": {
516
+ "type": "number"
517
+ },
518
+ "description": "Unit view direction [x, z]; spawns avoid the view cone near it."
519
+ },
520
+ "entity": {
521
+ "type": "string",
522
+ "description": "Entity whose transform is the observer."
523
+ },
524
+ "setAtTick": {
525
+ "type": "integer",
526
+ "minimum": 0,
527
+ "maximum": 9007199254740991,
528
+ "description": "Tick the observer was last set."
529
+ }
530
+ },
531
+ "required": [
532
+ "setAtTick"
533
+ ],
534
+ "additionalProperties": false,
535
+ "description": "Where agents spawn around."
536
+ },
537
+ "nextSeq": {
538
+ "type": "integer",
539
+ "minimum": 0,
540
+ "maximum": 9007199254740991,
541
+ "description": "Sequence number of the next spawned agent."
542
+ },
543
+ "spawned": {
544
+ "type": "integer",
545
+ "minimum": 0,
546
+ "maximum": 9007199254740991,
547
+ "description": "Agents spawned so far."
548
+ },
549
+ "despawned": {
550
+ "type": "integer",
551
+ "minimum": 0,
552
+ "maximum": 9007199254740991,
553
+ "description": "Agents removed so far."
554
+ },
555
+ "policy": {
556
+ "type": "object",
557
+ "propertyNames": {
558
+ "type": "string"
559
+ },
560
+ "additionalProperties": {
561
+ "$ref": "#/$defs/__schema0"
562
+ },
563
+ "description": "Policy overrides set by the ambient.policy command."
564
+ }
565
+ },
566
+ "required": [
567
+ "nextSeq",
568
+ "spawned",
569
+ "despawned"
570
+ ],
571
+ "additionalProperties": false,
572
+ "$defs": {
573
+ "__schema0": {
574
+ "anyOf": [
575
+ {
576
+ "type": "string"
577
+ },
578
+ {
579
+ "type": "number"
580
+ },
581
+ {
582
+ "type": "boolean"
583
+ },
584
+ {
585
+ "type": "null"
586
+ },
587
+ {
588
+ "type": "array",
589
+ "items": {
590
+ "$ref": "#/$defs/__schema0"
591
+ }
592
+ },
593
+ {
594
+ "type": "object",
595
+ "propertyNames": {
596
+ "type": "string"
597
+ },
598
+ "additionalProperties": {
599
+ "$ref": "#/$defs/__schema0"
600
+ }
601
+ }
602
+ ]
603
+ }
604
+ }
605
+ }
606
+ ```
607
+
608
+ </details>
609
+
610
+ ## Owner: audio
611
+
612
+ ### `audioEnvironment`
613
+
614
+ Singleton soundscape rules: bus gains, ambience layers gated on weather/sky/listener signals, music playlist, event → sound mappings and listener footsteps.
615
+
616
+ Required: none
617
+
618
+ ```json
619
+ {
620
+ "buses": {
621
+ "music": 0.5
622
+ },
623
+ "ambience": [
624
+ {
625
+ "sound": "ambience.rain.medium",
626
+ "when": {
627
+ "weather.precipitation.kind": "rain"
628
+ },
629
+ "gainFrom": {
630
+ "signal": "weather.precipitation.intensity",
631
+ "curve": [
632
+ [
633
+ 0,
634
+ 0
635
+ ],
636
+ [
637
+ 1,
638
+ 1
639
+ ]
640
+ ]
641
+ }
642
+ },
643
+ {
644
+ "sound": "ambience.birds.day",
645
+ "when": {
646
+ "sky.daylight": {
647
+ "min": 0.3
648
+ }
649
+ },
650
+ "fadeS": 4
651
+ }
652
+ ],
653
+ "music": {
654
+ "playlist": [
655
+ "music.ambient.dawn"
656
+ ],
657
+ "mode": "sequence"
658
+ },
659
+ "events": {
660
+ "crash": {
661
+ "sound": "impact.metal.heavy"
662
+ }
663
+ },
664
+ "footsteps": {
665
+ "sound": "footstep.grass",
666
+ "strideM": 0.75
667
+ }
668
+ }
669
+ ```
670
+
671
+ <details>
672
+ <summary>JSON Schema</summary>
673
+
674
+ ```json
675
+ {
676
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
677
+ "type": "object",
678
+ "properties": {
679
+ "buses": {
680
+ "description": "Bus gains (music, ambience, sfx, ui, voice, custom), default 1 each.",
681
+ "type": "object",
682
+ "propertyNames": {
683
+ "type": "string",
684
+ "pattern": "^[a-z][a-z0-9-]*$"
685
+ },
686
+ "additionalProperties": {
687
+ "type": "number",
688
+ "minimum": 0,
689
+ "maximum": 2
690
+ }
691
+ },
692
+ "ambience": {
693
+ "description": "Looping ambience layers, each active while its `when` holds.",
694
+ "type": "array",
695
+ "items": {
696
+ "type": "object",
697
+ "properties": {
698
+ "sound": {
699
+ "type": "string",
700
+ "pattern": "^[a-z0-9][a-z0-9_-]*(\\.[a-z0-9][a-z0-9_-]*)*$",
701
+ "description": "Sound id from a molen/soundbank@1 document, e.g. \"ambience.rain.medium\"."
702
+ },
703
+ "when": {
704
+ "type": "object",
705
+ "propertyNames": {
706
+ "type": "string",
707
+ "minLength": 1
708
+ },
709
+ "additionalProperties": {
710
+ "anyOf": [
711
+ {
712
+ "type": [
713
+ "string",
714
+ "number",
715
+ "boolean"
716
+ ]
717
+ },
718
+ {
719
+ "minItems": 1,
720
+ "type": "array",
721
+ "items": {
722
+ "type": [
723
+ "string",
724
+ "number",
725
+ "boolean"
726
+ ]
727
+ }
728
+ },
729
+ {
730
+ "type": "object",
731
+ "properties": {
732
+ "min": {
733
+ "description": "Inclusive lower bound.",
734
+ "type": "number"
735
+ },
736
+ "max": {
737
+ "description": "Inclusive upper bound.",
738
+ "type": "number"
739
+ }
740
+ },
741
+ "additionalProperties": false
742
+ },
743
+ {
744
+ "type": "object",
745
+ "properties": {
746
+ "exists": {
747
+ "type": "boolean",
748
+ "description": "true = the signal resolves to a value."
749
+ }
750
+ },
751
+ "required": [
752
+ "exists"
753
+ ],
754
+ "additionalProperties": false
755
+ }
756
+ ]
757
+ },
758
+ "description": "Conditions that must ALL hold, keyed by signal: a value (equality), a list (any of), {min,max} (inclusive range), or {exists}."
759
+ },
760
+ "gain": {
761
+ "description": "Gain multiplier; default 1.",
762
+ "type": "number",
763
+ "minimum": 0,
764
+ "maximum": 4
765
+ },
766
+ "gainFrom": {
767
+ "description": "Drive gain from a signal, or from several whose curves multiply.",
768
+ "anyOf": [
769
+ {
770
+ "type": "object",
771
+ "properties": {
772
+ "signal": {
773
+ "type": "string",
774
+ "minLength": 1,
775
+ "description": "Signal path: <component>.<field> on the entity (vehicleState.speed), or self.*, listener.*, weather.*, sky.*, time.*, host.*."
776
+ },
777
+ "curve": {
778
+ "minItems": 1,
779
+ "type": "array",
780
+ "items": {
781
+ "minItems": 2,
782
+ "maxItems": 2,
783
+ "type": "array",
784
+ "items": {
785
+ "type": "number"
786
+ }
787
+ },
788
+ "description": "Piecewise-linear [input, output] points, clamped at the ends."
789
+ },
790
+ "smoothS": {
791
+ "description": "Smoothing time constant in seconds; default 0.15.",
792
+ "type": "number",
793
+ "minimum": 0
794
+ }
795
+ },
796
+ "required": [
797
+ "signal",
798
+ "curve"
799
+ ],
800
+ "additionalProperties": false
801
+ },
802
+ {
803
+ "minItems": 1,
804
+ "type": "array",
805
+ "items": {
806
+ "type": "object",
807
+ "properties": {
808
+ "signal": {
809
+ "type": "string",
810
+ "minLength": 1,
811
+ "description": "Signal path: <component>.<field> on the entity (vehicleState.speed), or self.*, listener.*, weather.*, sky.*, time.*, host.*."
812
+ },
813
+ "curve": {
814
+ "minItems": 1,
815
+ "type": "array",
816
+ "items": {
817
+ "minItems": 2,
818
+ "maxItems": 2,
819
+ "type": "array",
820
+ "items": {
821
+ "type": "number"
822
+ }
823
+ },
824
+ "description": "Piecewise-linear [input, output] points, clamped at the ends."
825
+ },
826
+ "smoothS": {
827
+ "description": "Smoothing time constant in seconds; default 0.15.",
828
+ "type": "number",
829
+ "minimum": 0
830
+ }
831
+ },
832
+ "required": [
833
+ "signal",
834
+ "curve"
835
+ ],
836
+ "additionalProperties": false
837
+ }
838
+ }
839
+ ]
840
+ },
841
+ "pitchFrom": {
842
+ "description": "Drive pitch from a signal, or from several whose curves multiply.",
843
+ "anyOf": [
844
+ {
845
+ "type": "object",
846
+ "properties": {
847
+ "signal": {
848
+ "type": "string",
849
+ "minLength": 1,
850
+ "description": "Signal path: <component>.<field> on the entity (vehicleState.speed), or self.*, listener.*, weather.*, sky.*, time.*, host.*."
851
+ },
852
+ "curve": {
853
+ "minItems": 1,
854
+ "type": "array",
855
+ "items": {
856
+ "minItems": 2,
857
+ "maxItems": 2,
858
+ "type": "array",
859
+ "items": {
860
+ "type": "number"
861
+ }
862
+ },
863
+ "description": "Piecewise-linear [input, output] points, clamped at the ends."
864
+ },
865
+ "smoothS": {
866
+ "description": "Smoothing time constant in seconds; default 0.15.",
867
+ "type": "number",
868
+ "minimum": 0
869
+ }
870
+ },
871
+ "required": [
872
+ "signal",
873
+ "curve"
874
+ ],
875
+ "additionalProperties": false
876
+ },
877
+ {
878
+ "minItems": 1,
879
+ "type": "array",
880
+ "items": {
881
+ "type": "object",
882
+ "properties": {
883
+ "signal": {
884
+ "type": "string",
885
+ "minLength": 1,
886
+ "description": "Signal path: <component>.<field> on the entity (vehicleState.speed), or self.*, listener.*, weather.*, sky.*, time.*, host.*."
887
+ },
888
+ "curve": {
889
+ "minItems": 1,
890
+ "type": "array",
891
+ "items": {
892
+ "minItems": 2,
893
+ "maxItems": 2,
894
+ "type": "array",
895
+ "items": {
896
+ "type": "number"
897
+ }
898
+ },
899
+ "description": "Piecewise-linear [input, output] points, clamped at the ends."
900
+ },
901
+ "smoothS": {
902
+ "description": "Smoothing time constant in seconds; default 0.15.",
903
+ "type": "number",
904
+ "minimum": 0
905
+ }
906
+ },
907
+ "required": [
908
+ "signal",
909
+ "curve"
910
+ ],
911
+ "additionalProperties": false
912
+ }
913
+ }
914
+ ]
915
+ },
916
+ "fadeS": {
917
+ "description": "Fade in/out time in seconds; default 1.5.",
918
+ "type": "number",
919
+ "minimum": 0
920
+ }
921
+ },
922
+ "required": [
923
+ "sound"
924
+ ],
925
+ "additionalProperties": false
926
+ }
927
+ },
928
+ "music": {
929
+ "description": "Background music; scripts switch it with molen.audio.music().",
930
+ "type": "object",
931
+ "properties": {
932
+ "playlist": {
933
+ "minItems": 1,
934
+ "type": "array",
935
+ "items": {
936
+ "type": "string",
937
+ "pattern": "^[a-z0-9][a-z0-9_-]*(\\.[a-z0-9][a-z0-9_-]*)*$",
938
+ "description": "Sound id from a molen/soundbank@1 document, e.g. \"ambience.rain.medium\"."
939
+ },
940
+ "description": "Tracks, played on the music bus."
941
+ },
942
+ "mode": {
943
+ "description": "Default sequence.",
944
+ "type": "string",
945
+ "enum": [
946
+ "sequence",
947
+ "shuffle"
948
+ ]
949
+ },
950
+ "crossfadeS": {
951
+ "description": "Crossfade between tracks; default 4.",
952
+ "type": "number",
953
+ "minimum": 0
954
+ },
955
+ "gain": {
956
+ "description": "Music gain multiplier; default 1.",
957
+ "type": "number",
958
+ "minimum": 0,
959
+ "maximum": 4
960
+ },
961
+ "when": {
962
+ "type": "object",
963
+ "propertyNames": {
964
+ "type": "string",
965
+ "minLength": 1
966
+ },
967
+ "additionalProperties": {
968
+ "anyOf": [
969
+ {
970
+ "type": [
971
+ "string",
972
+ "number",
973
+ "boolean"
974
+ ]
975
+ },
976
+ {
977
+ "minItems": 1,
978
+ "type": "array",
979
+ "items": {
980
+ "type": [
981
+ "string",
982
+ "number",
983
+ "boolean"
984
+ ]
985
+ }
986
+ },
987
+ {
988
+ "type": "object",
989
+ "properties": {
990
+ "min": {
991
+ "description": "Inclusive lower bound.",
992
+ "type": "number"
993
+ },
994
+ "max": {
995
+ "description": "Inclusive upper bound.",
996
+ "type": "number"
997
+ }
998
+ },
999
+ "additionalProperties": false
1000
+ },
1001
+ {
1002
+ "type": "object",
1003
+ "properties": {
1004
+ "exists": {
1005
+ "type": "boolean",
1006
+ "description": "true = the signal resolves to a value."
1007
+ }
1008
+ },
1009
+ "required": [
1010
+ "exists"
1011
+ ],
1012
+ "additionalProperties": false
1013
+ }
1014
+ ]
1015
+ },
1016
+ "description": "Conditions that must ALL hold, keyed by signal: a value (equality), a list (any of), {min,max} (inclusive range), or {exists}."
1017
+ }
1018
+ },
1019
+ "required": [
1020
+ "playlist"
1021
+ ],
1022
+ "additionalProperties": false
1023
+ },
1024
+ "events": {
1025
+ "description": "Engine/script event type → one-shot sound (e.g. \"crash\", \"delivery\").",
1026
+ "type": "object",
1027
+ "propertyNames": {
1028
+ "type": "string",
1029
+ "minLength": 1
1030
+ },
1031
+ "additionalProperties": {
1032
+ "type": "object",
1033
+ "properties": {
1034
+ "sound": {
1035
+ "type": "string",
1036
+ "pattern": "^[a-z0-9][a-z0-9_-]*(\\.[a-z0-9][a-z0-9_-]*)*$",
1037
+ "description": "Sound id from a molen/soundbank@1 document, e.g. \"ambience.rain.medium\"."
1038
+ },
1039
+ "at": {
1040
+ "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.",
1041
+ "type": "string"
1042
+ },
1043
+ "gain": {
1044
+ "type": "number",
1045
+ "minimum": 0,
1046
+ "maximum": 4
1047
+ },
1048
+ "pitch": {
1049
+ "type": "number",
1050
+ "exclusiveMinimum": 0
1051
+ },
1052
+ "bus": {
1053
+ "type": "string",
1054
+ "pattern": "^[a-z][a-z0-9-]*$",
1055
+ "description": "Mixer bus: music, ambience, sfx, ui, voice, or a custom lowercase name."
1056
+ }
1057
+ },
1058
+ "required": [
1059
+ "sound"
1060
+ ],
1061
+ "additionalProperties": false
1062
+ }
1063
+ },
1064
+ "footsteps": {
1065
+ "description": "Listener footsteps from distance travelled (walk modes, first-person games).",
1066
+ "type": "object",
1067
+ "properties": {
1068
+ "sound": {
1069
+ "type": "string",
1070
+ "pattern": "^[a-z0-9][a-z0-9_-]*(\\.[a-z0-9][a-z0-9_-]*)*$",
1071
+ "description": "Default footstep sound."
1072
+ },
1073
+ "surfaces": {
1074
+ "description": "listener.surface value → footstep sound (grass, concrete, wood…).",
1075
+ "type": "object",
1076
+ "propertyNames": {
1077
+ "type": "string"
1078
+ },
1079
+ "additionalProperties": {
1080
+ "type": "string",
1081
+ "pattern": "^[a-z0-9][a-z0-9_-]*(\\.[a-z0-9][a-z0-9_-]*)*$",
1082
+ "description": "Sound id from a molen/soundbank@1 document, e.g. \"ambience.rain.medium\"."
1083
+ }
1084
+ },
1085
+ "strideM": {
1086
+ "description": "Meters per step; default 0.75.",
1087
+ "type": "number",
1088
+ "exclusiveMinimum": 0
1089
+ },
1090
+ "gain": {
1091
+ "description": "Footstep gain multiplier; default 1.",
1092
+ "type": "number",
1093
+ "minimum": 0,
1094
+ "maximum": 4
1095
+ },
1096
+ "when": {
1097
+ "description": "Default { \"listener.grounded\": true }.",
1098
+ "type": "object",
1099
+ "propertyNames": {
1100
+ "type": "string",
1101
+ "minLength": 1
1102
+ },
1103
+ "additionalProperties": {
1104
+ "anyOf": [
1105
+ {
1106
+ "type": [
1107
+ "string",
1108
+ "number",
1109
+ "boolean"
1110
+ ]
1111
+ },
1112
+ {
1113
+ "minItems": 1,
1114
+ "type": "array",
1115
+ "items": {
1116
+ "type": [
1117
+ "string",
1118
+ "number",
1119
+ "boolean"
1120
+ ]
1121
+ }
1122
+ },
1123
+ {
1124
+ "type": "object",
1125
+ "properties": {
1126
+ "min": {
1127
+ "description": "Inclusive lower bound.",
1128
+ "type": "number"
1129
+ },
1130
+ "max": {
1131
+ "description": "Inclusive upper bound.",
1132
+ "type": "number"
1133
+ }
1134
+ },
1135
+ "additionalProperties": false
1136
+ },
1137
+ {
1138
+ "type": "object",
1139
+ "properties": {
1140
+ "exists": {
1141
+ "type": "boolean",
1142
+ "description": "true = the signal resolves to a value."
1143
+ }
1144
+ },
1145
+ "required": [
1146
+ "exists"
1147
+ ],
1148
+ "additionalProperties": false
1149
+ }
1150
+ ]
1151
+ }
1152
+ }
1153
+ },
1154
+ "required": [
1155
+ "sound"
1156
+ ],
1157
+ "additionalProperties": false
1158
+ },
1159
+ "listenerEntity": {
1160
+ "description": "Entity treated as the listener's body; <component>.<field> signals in ambience/music/footsteps resolve on it.",
1161
+ "type": "string"
1162
+ },
1163
+ "maxVoices": {
1164
+ "description": "Voice budget; default 32.",
1165
+ "type": "integer",
1166
+ "minimum": 1,
1167
+ "maximum": 256
1168
+ }
1169
+ },
1170
+ "additionalProperties": false
1171
+ }
1172
+ ```
1173
+
1174
+ </details>
1175
+
1176
+ ### `audioSource`
1177
+
1178
+ 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.
1179
+
1180
+ Required: `sound`
1181
+
1182
+ ```json
1183
+ {
1184
+ "sound": "vehicle.engine.car",
1185
+ "loop": true,
1186
+ "spatial": {
1187
+ "refDistance": 3,
1188
+ "maxDistance": 120
1189
+ },
1190
+ "pitchFrom": {
1191
+ "signal": "vehicleState.speed",
1192
+ "curve": [
1193
+ [
1194
+ 0,
1195
+ 0.8
1196
+ ],
1197
+ [
1198
+ 30,
1199
+ 1.7
1200
+ ]
1201
+ ]
1202
+ },
1203
+ "gainFrom": {
1204
+ "signal": "vehicleInput.throttle",
1205
+ "curve": [
1206
+ [
1207
+ 0,
1208
+ 0.45
1209
+ ],
1210
+ [
1211
+ 1,
1212
+ 1
1213
+ ]
1214
+ ]
1215
+ }
1216
+ }
1217
+ ```
1218
+
1219
+ <details>
1220
+ <summary>JSON Schema</summary>
1221
+
1222
+ ```json
1223
+ {
1224
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
1225
+ "type": "object",
1226
+ "properties": {
1227
+ "sound": {
1228
+ "type": "string",
1229
+ "pattern": "^[a-z0-9][a-z0-9_-]*(\\.[a-z0-9][a-z0-9_-]*)*$",
1230
+ "description": "Sound id from a molen/soundbank@1 document, e.g. \"ambience.rain.medium\"."
1231
+ },
1232
+ "loop": {
1233
+ "description": "Loop while active; default the sound's own loop flag.",
1234
+ "type": "boolean"
1235
+ },
1236
+ "autoplay": {
1237
+ "description": "Play when the entity exists and `when` holds; default true. false = only triggerFrom/startTick fire it.",
1238
+ "type": "boolean"
1239
+ },
1240
+ "gain": {
1241
+ "description": "Gain multiplier; default 1.",
1242
+ "type": "number",
1243
+ "minimum": 0,
1244
+ "maximum": 4
1245
+ },
1246
+ "pitch": {
1247
+ "description": "Playback-rate multiplier; default 1.",
1248
+ "type": "number",
1249
+ "exclusiveMinimum": 0
1250
+ },
1251
+ "bus": {
1252
+ "type": "string",
1253
+ "pattern": "^[a-z][a-z0-9-]*$",
1254
+ "description": "Mixer bus: music, ambience, sfx, ui, voice, or a custom lowercase name."
1255
+ },
1256
+ "spatial": {
1257
+ "description": "Override the sound's spatial settings. Positional sources follow the entity's transform.",
1258
+ "anyOf": [
1259
+ {
1260
+ "type": "boolean",
1261
+ "const": false
1262
+ },
1263
+ {
1264
+ "type": "object",
1265
+ "properties": {
1266
+ "refDistance": {
1267
+ "description": "Distance in meters at which the sound plays at full gain; default 1.",
1268
+ "type": "number",
1269
+ "exclusiveMinimum": 0
1270
+ },
1271
+ "maxDistance": {
1272
+ "description": "Distance in meters beyond which the sound is culled; default 60.",
1273
+ "type": "number",
1274
+ "exclusiveMinimum": 0
1275
+ },
1276
+ "rolloff": {
1277
+ "description": "How fast gain falls off past refDistance; default 1.",
1278
+ "type": "number",
1279
+ "minimum": 0
1280
+ },
1281
+ "model": {
1282
+ "description": "Distance attenuation model (Web Audio PannerNode.distanceModel); default inverse.",
1283
+ "type": "string",
1284
+ "enum": [
1285
+ "linear",
1286
+ "inverse",
1287
+ "exponential"
1288
+ ]
1289
+ }
1290
+ },
1291
+ "additionalProperties": false
1292
+ }
1293
+ ]
1294
+ },
1295
+ "when": {
1296
+ "type": "object",
1297
+ "propertyNames": {
1298
+ "type": "string",
1299
+ "minLength": 1
1300
+ },
1301
+ "additionalProperties": {
1302
+ "anyOf": [
1303
+ {
1304
+ "type": [
1305
+ "string",
1306
+ "number",
1307
+ "boolean"
1308
+ ]
1309
+ },
1310
+ {
1311
+ "minItems": 1,
1312
+ "type": "array",
1313
+ "items": {
1314
+ "type": [
1315
+ "string",
1316
+ "number",
1317
+ "boolean"
1318
+ ]
1319
+ }
1320
+ },
1321
+ {
1322
+ "type": "object",
1323
+ "properties": {
1324
+ "min": {
1325
+ "description": "Inclusive lower bound.",
1326
+ "type": "number"
1327
+ },
1328
+ "max": {
1329
+ "description": "Inclusive upper bound.",
1330
+ "type": "number"
1331
+ }
1332
+ },
1333
+ "additionalProperties": false
1334
+ },
1335
+ {
1336
+ "type": "object",
1337
+ "properties": {
1338
+ "exists": {
1339
+ "type": "boolean",
1340
+ "description": "true = the signal resolves to a value."
1341
+ }
1342
+ },
1343
+ "required": [
1344
+ "exists"
1345
+ ],
1346
+ "additionalProperties": false
1347
+ }
1348
+ ]
1349
+ },
1350
+ "description": "Conditions that must ALL hold, keyed by signal: a value (equality), a list (any of), {min,max} (inclusive range), or {exists}."
1351
+ },
1352
+ "gainFrom": {
1353
+ "description": "Drive gain from a signal, or from several whose curves multiply.",
1354
+ "anyOf": [
1355
+ {
1356
+ "type": "object",
1357
+ "properties": {
1358
+ "signal": {
1359
+ "type": "string",
1360
+ "minLength": 1,
1361
+ "description": "Signal path: <component>.<field> on the entity (vehicleState.speed), or self.*, listener.*, weather.*, sky.*, time.*, host.*."
1362
+ },
1363
+ "curve": {
1364
+ "minItems": 1,
1365
+ "type": "array",
1366
+ "items": {
1367
+ "minItems": 2,
1368
+ "maxItems": 2,
1369
+ "type": "array",
1370
+ "items": {
1371
+ "type": "number"
1372
+ }
1373
+ },
1374
+ "description": "Piecewise-linear [input, output] points, clamped at the ends."
1375
+ },
1376
+ "smoothS": {
1377
+ "description": "Smoothing time constant in seconds; default 0.15.",
1378
+ "type": "number",
1379
+ "minimum": 0
1380
+ }
1381
+ },
1382
+ "required": [
1383
+ "signal",
1384
+ "curve"
1385
+ ],
1386
+ "additionalProperties": false
1387
+ },
1388
+ {
1389
+ "minItems": 1,
1390
+ "type": "array",
1391
+ "items": {
1392
+ "type": "object",
1393
+ "properties": {
1394
+ "signal": {
1395
+ "type": "string",
1396
+ "minLength": 1,
1397
+ "description": "Signal path: <component>.<field> on the entity (vehicleState.speed), or self.*, listener.*, weather.*, sky.*, time.*, host.*."
1398
+ },
1399
+ "curve": {
1400
+ "minItems": 1,
1401
+ "type": "array",
1402
+ "items": {
1403
+ "minItems": 2,
1404
+ "maxItems": 2,
1405
+ "type": "array",
1406
+ "items": {
1407
+ "type": "number"
1408
+ }
1409
+ },
1410
+ "description": "Piecewise-linear [input, output] points, clamped at the ends."
1411
+ },
1412
+ "smoothS": {
1413
+ "description": "Smoothing time constant in seconds; default 0.15.",
1414
+ "type": "number",
1415
+ "minimum": 0
1416
+ }
1417
+ },
1418
+ "required": [
1419
+ "signal",
1420
+ "curve"
1421
+ ],
1422
+ "additionalProperties": false
1423
+ }
1424
+ }
1425
+ ]
1426
+ },
1427
+ "pitchFrom": {
1428
+ "description": "Drive pitch from a signal, or from several whose curves multiply.",
1429
+ "anyOf": [
1430
+ {
1431
+ "type": "object",
1432
+ "properties": {
1433
+ "signal": {
1434
+ "type": "string",
1435
+ "minLength": 1,
1436
+ "description": "Signal path: <component>.<field> on the entity (vehicleState.speed), or self.*, listener.*, weather.*, sky.*, time.*, host.*."
1437
+ },
1438
+ "curve": {
1439
+ "minItems": 1,
1440
+ "type": "array",
1441
+ "items": {
1442
+ "minItems": 2,
1443
+ "maxItems": 2,
1444
+ "type": "array",
1445
+ "items": {
1446
+ "type": "number"
1447
+ }
1448
+ },
1449
+ "description": "Piecewise-linear [input, output] points, clamped at the ends."
1450
+ },
1451
+ "smoothS": {
1452
+ "description": "Smoothing time constant in seconds; default 0.15.",
1453
+ "type": "number",
1454
+ "minimum": 0
1455
+ }
1456
+ },
1457
+ "required": [
1458
+ "signal",
1459
+ "curve"
1460
+ ],
1461
+ "additionalProperties": false
1462
+ },
1463
+ {
1464
+ "minItems": 1,
1465
+ "type": "array",
1466
+ "items": {
1467
+ "type": "object",
1468
+ "properties": {
1469
+ "signal": {
1470
+ "type": "string",
1471
+ "minLength": 1,
1472
+ "description": "Signal path: <component>.<field> on the entity (vehicleState.speed), or self.*, listener.*, weather.*, sky.*, time.*, host.*."
1473
+ },
1474
+ "curve": {
1475
+ "minItems": 1,
1476
+ "type": "array",
1477
+ "items": {
1478
+ "minItems": 2,
1479
+ "maxItems": 2,
1480
+ "type": "array",
1481
+ "items": {
1482
+ "type": "number"
1483
+ }
1484
+ },
1485
+ "description": "Piecewise-linear [input, output] points, clamped at the ends."
1486
+ },
1487
+ "smoothS": {
1488
+ "description": "Smoothing time constant in seconds; default 0.15.",
1489
+ "type": "number",
1490
+ "minimum": 0
1491
+ }
1492
+ },
1493
+ "required": [
1494
+ "signal",
1495
+ "curve"
1496
+ ],
1497
+ "additionalProperties": false
1498
+ }
1499
+ }
1500
+ ]
1501
+ },
1502
+ "triggerFrom": {
1503
+ "description": "Fire one-shots from a signal (footsteps from distance, clicks on change).",
1504
+ "type": "object",
1505
+ "properties": {
1506
+ "signal": {
1507
+ "type": "string",
1508
+ "minLength": 1,
1509
+ "description": "Signal to watch (see signal paths)."
1510
+ },
1511
+ "every": {
1512
+ "description": "Fire each time the signal advances by this much (odometer-style, e.g. meters).",
1513
+ "type": "number",
1514
+ "exclusiveMinimum": 0
1515
+ },
1516
+ "onChange": {
1517
+ "description": "Fire whenever the signal value changes.",
1518
+ "type": "boolean"
1519
+ },
1520
+ "sound": {
1521
+ "description": "Sound to fire; default the source's own sound.",
1522
+ "type": "string",
1523
+ "pattern": "^[a-z0-9][a-z0-9_-]*(\\.[a-z0-9][a-z0-9_-]*)*$"
1524
+ }
1525
+ },
1526
+ "required": [
1527
+ "signal"
1528
+ ],
1529
+ "additionalProperties": false
1530
+ },
1531
+ "startTick": {
1532
+ "description": "Play once at this tick; changing it retriggers (like renderable.animation).",
1533
+ "type": "integer",
1534
+ "minimum": 0,
1535
+ "maximum": 9007199254740991
1536
+ }
1537
+ },
1538
+ "required": [
1539
+ "sound"
1540
+ ],
1541
+ "additionalProperties": false
1542
+ }
1543
+ ```
1544
+
1545
+ </details>
1546
+
1547
+ ### `audioZone`
1548
+
1549
+ 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).
1550
+
1551
+ Required: `sound`, `shape`
1552
+
1553
+ ```json
1554
+ {
1555
+ "sound": "ambience.water.stream",
1556
+ "shape": {
1557
+ "kind": "sphere",
1558
+ "radius": 12
1559
+ },
1560
+ "fade": 8
1561
+ }
1562
+ ```
1563
+
1564
+ <details>
1565
+ <summary>JSON Schema</summary>
1566
+
1567
+ ```json
1568
+ {
1569
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
1570
+ "type": "object",
1571
+ "properties": {
1572
+ "sound": {
1573
+ "type": "string",
1574
+ "pattern": "^[a-z0-9][a-z0-9_-]*(\\.[a-z0-9][a-z0-9_-]*)*$",
1575
+ "description": "Looping ambience played while the listener is inside the zone."
1576
+ },
1577
+ "shape": {
1578
+ "oneOf": [
1579
+ {
1580
+ "type": "object",
1581
+ "properties": {
1582
+ "kind": {
1583
+ "type": "string",
1584
+ "const": "sphere",
1585
+ "description": "Sphere around the entity."
1586
+ },
1587
+ "radius": {
1588
+ "type": "number",
1589
+ "exclusiveMinimum": 0,
1590
+ "description": "Radius in meters."
1591
+ }
1592
+ },
1593
+ "required": [
1594
+ "kind",
1595
+ "radius"
1596
+ ],
1597
+ "additionalProperties": false
1598
+ },
1599
+ {
1600
+ "type": "object",
1601
+ "properties": {
1602
+ "kind": {
1603
+ "type": "string",
1604
+ "const": "box",
1605
+ "description": "Axis-aligned box around the entity."
1606
+ },
1607
+ "halfExtents": {
1608
+ "minItems": 3,
1609
+ "maxItems": 3,
1610
+ "type": "array",
1611
+ "items": {
1612
+ "type": "number"
1613
+ },
1614
+ "description": "Half sizes [x, y, z] in meters, axis-aligned."
1615
+ }
1616
+ },
1617
+ "required": [
1618
+ "kind",
1619
+ "halfExtents"
1620
+ ],
1621
+ "additionalProperties": false
1622
+ }
1623
+ ],
1624
+ "description": "Zone volume, centered on the entity's transform."
1625
+ },
1626
+ "fade": {
1627
+ "description": "Meters outside the shape over which gain fades to zero; default 5.",
1628
+ "type": "number",
1629
+ "minimum": 0
1630
+ },
1631
+ "gain": {
1632
+ "description": "Gain multiplier; default 1.",
1633
+ "type": "number",
1634
+ "minimum": 0,
1635
+ "maximum": 4
1636
+ },
1637
+ "bus": {
1638
+ "description": "Default ambience.",
1639
+ "type": "string",
1640
+ "pattern": "^[a-z][a-z0-9-]*$"
1641
+ },
1642
+ "when": {
1643
+ "type": "object",
1644
+ "propertyNames": {
1645
+ "type": "string",
1646
+ "minLength": 1
1647
+ },
1648
+ "additionalProperties": {
1649
+ "anyOf": [
1650
+ {
1651
+ "type": [
1652
+ "string",
1653
+ "number",
1654
+ "boolean"
1655
+ ]
1656
+ },
1657
+ {
1658
+ "minItems": 1,
1659
+ "type": "array",
1660
+ "items": {
1661
+ "type": [
1662
+ "string",
1663
+ "number",
1664
+ "boolean"
1665
+ ]
1666
+ }
1667
+ },
1668
+ {
1669
+ "type": "object",
1670
+ "properties": {
1671
+ "min": {
1672
+ "description": "Inclusive lower bound.",
1673
+ "type": "number"
1674
+ },
1675
+ "max": {
1676
+ "description": "Inclusive upper bound.",
1677
+ "type": "number"
1678
+ }
1679
+ },
1680
+ "additionalProperties": false
1681
+ },
1682
+ {
1683
+ "type": "object",
1684
+ "properties": {
1685
+ "exists": {
1686
+ "type": "boolean",
1687
+ "description": "true = the signal resolves to a value."
1688
+ }
1689
+ },
1690
+ "required": [
1691
+ "exists"
1692
+ ],
1693
+ "additionalProperties": false
1694
+ }
1695
+ ]
1696
+ },
1697
+ "description": "Conditions that must ALL hold, keyed by signal: a value (equality), a list (any of), {min,max} (inclusive range), or {exists}."
1698
+ }
1699
+ },
1700
+ "required": [
1701
+ "sound",
1702
+ "shape"
1703
+ ],
1704
+ "additionalProperties": false
1705
+ }
1706
+ ```
1707
+
1708
+ </details>
1709
+
79
1710
  ## Owner: client
80
1711
 
81
1712
  ### `environment`
@@ -912,9 +2543,10 @@ Required: `kind`, `ref`
912
2543
  "enum": [
913
2544
  "primitive",
914
2545
  "gltf",
2546
+ "ambient-vehicle",
915
2547
  "figure"
916
2548
  ],
917
- "description": "Render source: 'primitive' (built-in geometry named by ref), 'gltf' (an imported project asset), 'figure' (a procedural skinned figure body from the entity `figure` component)."
2549
+ "description": "Render source: 'primitive' (built-in geometry named by ref), 'gltf' (an imported project asset), 'ambient-vehicle' (an ambient NPC vehicle: an instanced proxy from its `ambientAgent` dimensions, or the content model named by `ref` near the camera), 'figure' (a procedural skinned figure body from the entity `figure` component)."
918
2550
  },
919
2551
  "ref": {
920
2552
  "type": "string",