@bendyline/molen-tooling 0.0.9 → 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.
Files changed (85) hide show
  1. package/dist/capture/harness.js +239 -236
  2. package/dist/capture/worldgen-preview.js +215 -215
  3. package/dist/cli.mjs +6 -5
  4. package/dist/docs-src/guide/adaptive-performance.md +5 -2
  5. package/dist/docs-src/guide/aircraft.md +113 -40
  6. package/dist/docs-src/guide/ambient-life.md +100 -11
  7. package/dist/docs-src/guide/audio.md +1 -1
  8. package/dist/docs-src/guide/boats.md +99 -0
  9. package/dist/docs-src/guide/determinism.md +1 -1
  10. package/dist/docs-src/guide/dioramas.md +167 -0
  11. package/dist/docs-src/guide/earth-view.md +241 -3
  12. package/dist/docs-src/guide/entities.md +32 -1
  13. package/dist/docs-src/guide/figures.md +7 -1
  14. package/dist/docs-src/guide/graphics-performance.md +16 -3
  15. package/dist/docs-src/guide/medium-fi.md +15 -6
  16. package/dist/docs-src/guide/sky.md +3 -2
  17. package/dist/docs-src/guide/surface-rendering.md +4 -1
  18. package/dist/docs-src/guide/vehicle-interiors.md +40 -2
  19. package/dist/docs-src/guide/vehicles.md +121 -19
  20. package/dist/docs-src/guide/weather.md +45 -3
  21. package/dist/docs-src/guide/worldgen.md +8 -0
  22. package/dist/docs-src/llms.txt +6 -4
  23. package/dist/docs-src/schemas/archstyle.md +114 -0
  24. package/dist/docs-src/schemas/components.md +1589 -137
  25. package/dist/docs-src/schemas/scene.md +6 -3
  26. package/dist/docs-src/schemas/transport-network.md +4 -2
  27. package/dist/index.mjs +1 -1
  28. package/dist/{mcp-BbHk4ibu.mjs → mcp-BbxqqnD1.mjs} +3 -2
  29. package/dist/{ops-CErtZh2t.mjs → ops-b4Pag8U-.mjs} +7 -5
  30. package/dist/templates/city-courier/README.md +18 -0
  31. package/dist/templates/city-courier/gen/molen-types.ts +217 -15
  32. package/dist/templates/city-courier/index.html +1 -1
  33. package/dist/templates/city-courier/scripts/molen-scripts.d.ts +219 -17
  34. package/dist/templates/city-courier/src/audio.ts +26 -4
  35. package/dist/templates/city-courier/src/game-shell.css +7 -3
  36. package/dist/templates/city-courier/src/main.ts +25 -3
  37. package/dist/templates/city-courier/src/shared/accessibility.css +325 -0
  38. package/dist/templates/city-courier/src/shared/game-controls.ts +406 -0
  39. package/dist/templates/city-courier/src/shared/game-descriptions.ts +143 -0
  40. package/dist/templates/city-courier/src/shared/playback.ts +146 -0
  41. package/dist/templates/city-courier/src/worker.ts +5 -1
  42. package/dist/templates/cubes/index.html +6 -1
  43. package/dist/templates/cubes/src/main.ts +25 -2
  44. package/dist/templates/cubes/src/shared/accessibility.css +325 -0
  45. package/dist/templates/cubes/src/shared/playback.ts +146 -0
  46. package/dist/templates/cubes/src/vite-env.d.ts +1 -0
  47. package/dist/templates/cubes/src/worker.ts +1 -0
  48. package/dist/templates/data-viz/README.md +4 -0
  49. package/dist/templates/data-viz/index.html +6 -1
  50. package/dist/templates/data-viz/src/main.ts +53 -11
  51. package/dist/templates/data-viz/src/shared/accessibility.css +325 -0
  52. package/dist/templates/data-viz/src/shared/playback.ts +146 -0
  53. package/dist/templates/data-viz/src/vite-env.d.ts +1 -0
  54. package/dist/templates/data-viz/src/worker.ts +1 -0
  55. package/dist/templates/figures-gallery/index.html +6 -1
  56. package/dist/templates/figures-gallery/src/main.ts +21 -2
  57. package/dist/templates/figures-gallery/src/shared/accessibility.css +325 -0
  58. package/dist/templates/figures-gallery/src/shared/playback.ts +146 -0
  59. package/dist/templates/figures-gallery/src/vite-env.d.ts +1 -0
  60. package/dist/templates/figures-gallery/src/worker.ts +1 -0
  61. package/dist/templates/index.json +36 -16
  62. package/dist/templates/skybound/README.md +18 -0
  63. package/dist/templates/skybound/gen/molen-types.ts +217 -15
  64. package/dist/templates/skybound/index.html +1 -1
  65. package/dist/templates/skybound/scripts/molen-scripts.d.ts +219 -17
  66. package/dist/templates/skybound/src/audio.ts +26 -4
  67. package/dist/templates/skybound/src/game-shell.css +7 -3
  68. package/dist/templates/skybound/src/main.ts +25 -3
  69. package/dist/templates/skybound/src/shared/accessibility.css +325 -0
  70. package/dist/templates/skybound/src/shared/game-controls.ts +406 -0
  71. package/dist/templates/skybound/src/shared/game-descriptions.ts +143 -0
  72. package/dist/templates/skybound/src/shared/playback.ts +146 -0
  73. package/dist/templates/skybound/src/worker.ts +1 -1
  74. package/dist/templates/terrain-flyover/README.md +5 -1
  75. package/dist/templates/terrain-flyover/index.html +4 -1
  76. package/dist/templates/terrain-flyover/src/main.ts +40 -39
  77. package/dist/templates/top-down-arena/index.html +6 -1
  78. package/dist/templates/top-down-arena/scripts/molen-scripts.d.ts +219 -17
  79. package/dist/templates/top-down-arena/src/audio.ts +26 -4
  80. package/dist/templates/top-down-arena/src/gen/molen-types.ts +217 -15
  81. package/dist/templates/top-down-arena/src/main.ts +31 -5
  82. package/dist/templates/top-down-arena/src/shared/accessibility.css +325 -0
  83. package/dist/templates/top-down-arena/src/shared/playback.ts +146 -0
  84. package/dist/templates/top-down-arena/src/worker.ts +1 -1
  85. package/package.json +12 -12
@@ -93,10 +93,12 @@ bind the loaded names explicitly. Two bindings cannot write the same node/proper
93
93
 
94
94
  Aircraft signals are `airspeed` (m/s), `altitude`/`altitudeAGL` (m), `verticalSpeed` (m/s),
95
95
  `heading`/`pitch`/`roll` (radians), `rpm`/`power` (0–1), `pitchInput`/`rollInput`/`yawInput`
96
- (-1–1), and `gear`/`flaps`/`engine` (0 or 1). Calibration belongs to each model.
96
+ and `elevator` (-1–1), `gear`/`flaps` (the positions 0–1 as they travel, 0 up), and
97
+ `engine`/`brake`/`grounded` (0 or 1). Calibration belongs to each model.
97
98
  Cars supply `steering` and `wheelAngle` (radians); their optional third `update` argument accepts
98
99
  additional signals. World explorer passes `speed` (signed m/s), `heading`/`pitch`/`roll` (radians),
99
- `throttle` (-1–1) and `brake` (0 or 1).
100
+ `throttle` (-1–1), `brake` (0 or 1) and the sprung body's `bodyRoll`/`bodyPitch` (radians), which
101
+ the car visual also uses to keep its wheels on the road.
100
102
 
101
103
  An interior can also include `sources`, using the same component/path mappings as `model.signals`.
102
104
  World explorer resolves these for each vehicle and merges them over the convenience signals,
@@ -117,6 +119,42 @@ Legacy explicit `controlStick`, `collective` and `steeringWheelNode` bindings wo
117
119
  convention is removed: assets must list instruments explicitly. `airspeedGaugeMax` remains
118
120
  legacy metadata and no longer drives a gauge.
119
121
 
122
+ ## Exterior animation
123
+
124
+ Landing gear, doors, flaps and control surfaces are bound the same way, in an `animation` block
125
+ beside `interior`: `aircraft.spec.visual.animation` or `vehicle.visual.animation`, with the same
126
+ `sources` and `bindings` and the same signals. The interior and the animation may not bind the
127
+ same node channel.
128
+
129
+ A binding can replace `scale` and `offset` with a keyframed curve: `keys` are `[signal,
130
+ displacement]` pairs with strictly ascending signals, and the displacement holds the first or
131
+ last value outside them. `"ease": "smooth"` eases out of and into every key, the way a hydraulic
132
+ actuator starts and stops; the default is `linear`. Keys let one signal sequence several parts.
133
+ The P-51's gear position runs from 0 (up) to 1 (down); its inner wheel doors open over the first
134
+ and last eighth of that travel and stay open in between, while the legs swing:
135
+
136
+ ```json
137
+ {
138
+ "animation": {
139
+ "bindings": [
140
+ { "node": "wheel-door-1", "source": "gear", "property": "rotation", "axis": "x",
141
+ "keys": [[0, 0], [0.12, 1.5], [0.88, 1.5], [1, 0]], "ease": "smooth" },
142
+ { "node": "gear-1", "source": "gear", "property": "rotation", "axis": "x",
143
+ "keys": [[0.12, 1.5708], [0.88, 0]], "ease": "smooth" },
144
+ { "node": "rudder", "source": "yawInput", "property": "rotation", "axis": "y", "scale": 0.44 }
145
+ ]
146
+ }
147
+ }
148
+ ```
149
+
150
+ Each moving part rotates about one local axis, so the model gives it a parent frame aligned with
151
+ its hinge: a canted trunnion, a door's edge. Author the GLB in the at-rest pose (gear down,
152
+ doors as they stand on the ground); keys are displacements from it. A model whose retracted parts
153
+ would show through the skin can also list them in `visual.gearNodes`, hidden while the gear is
154
+ fully up. Simulated gear and flap positions come from `airplane.gearTransitTime` and
155
+ `flapTransitTime` (see [Aircraft](aircraft.md)); a script can drive any other part by publishing
156
+ a component and naming it in `sources`.
157
+
120
158
  ## Exterior views and detail levels
121
159
 
122
160
  Cockpit and chase views share the GLB. An interior can be a high-detail portion of that model,
@@ -11,8 +11,15 @@ into schema, kernel, or client. The P-51D Mustang and OH-6 share the same mount/
11
11
  and add separate flight controls, physics, assets and cockpit cameras; see [Aircraft](aircraft.md).
12
12
 
13
13
  In **Walk mode**, approach a car and press **E** to enter its driver seat. **W/S** accelerate or
14
- brake then reverse; **A/D** steer; **Space** brakes; **V** switches cockpit/chase views. Mouse look
15
- works while seated. Stop and press **E** to exit. The controller checks both sides and then the rear;
14
+ brake then reverse; **A/D** steer; **Space** brakes; **Shift** pulls the handbrake; **V** switches
15
+ cockpit/chase views. Mouse look works while seated. Stop and press **E** to exit.
16
+
17
+ Cars drive on their tires. Push one past its grip and it slides: a front-drive sedan runs wide, a
18
+ rear-drive pickup on full power swings its tail round, and steering with the handbrake up throws
19
+ the back out for a handbrake turn. Brakes are anti-lock, so you can still steer while stopping.
20
+ Rain and snow from the Weather setting make the road slippery (about 40% and 100% longer stops),
21
+ and gusts push on the body. The body dives under braking, squats under power and leans out of
22
+ turns. Hitting a wall or another car bounces you off it, and a corner hit spins you. The controller checks both sides and then the rear;
16
23
  blocked exits leave the rider seated. Switching to Fly also requires a safe stopped exit.
17
24
 
18
25
  Modified cars stay where they were left throughout the current explorer session, even when their
@@ -58,7 +65,8 @@ Outside a scene, resolve a type's components from the pack's type documents with
58
65
  `@bendyline/molen-kernel/content`, and spawn a copy.
59
66
 
60
67
  Declare commands and input bindings in the scene using the normal input schema. Give `drive`
61
- a payload schema with `throttle` and `steering` numbers in [-1,1] and a boolean `brake`.
68
+ a payload schema with `throttle` and `steering` numbers in [-1,1], a boolean `brake` and an
69
+ optional boolean `handbrake`.
62
70
  Run this setup through `buildWorld`, the Worker, or `molen sim run --setup`.
63
71
 
64
72
  `mountable.seats` is reusable for passenger seats or non-car mounts. Each seat has a unique
@@ -67,21 +75,52 @@ ordered local foot positions; `reach` limits mounting distance. A seat accepts o
67
75
  only the current driver can submit vehicle intent. Mounted actors bypass the kernel character
68
76
  and kinematics solvers. When the mount disappears, the rider is detached.
69
77
 
70
- The fixed-step bicycle solver integrates signed speed, steering slew, wheel rotation, mass-scaled
71
- engine force, rolling/air resistance, braking, reverse limits, lateral grip, gravity and four-wheel
72
- terrain support. All chassis-specific coefficients, mass/center of gravity, wheel geometry, limits,
73
- and terrain tolerances come from `vehicle.spec`. Collision probes run at 120 Hz or finer (through
74
- the host's `canOccupy` adapter).
75
- World explorer uses an oriented chassis against other cars and nearby triangles for walls,
76
- fixtures and buildings. Terrain gaps pause motion; abrupt steps and slopes above 35 degrees stop
78
+ Passenger seats: every stock car carries a `passenger` seat beside the driver, mirrored across
79
+ the centreline, and the OH-6 one on the pilot's left; the P-51D has a rear `passenger` seat behind
80
+ the pilot, like the TF-51D trainer. Only the `driver` seat controls the vehicle.
81
+
82
+ The solver is a dynamic bicycle model substepped at 120 Hz or finer. Each axle's tires turn slip
83
+ angle into side force (`corneringStiffness` per unit load per radian) up to the road's grip, then
84
+ let go to about 85% of it as they slide. Side grip is `grip` (m/s², so `grip / 9.81` is the
85
+ friction coefficient); straight-line grip is 15% higher, and drive and brakes share it with
86
+ cornering, so a car braking or under power at the limit steers less. `drive` picks the front,
87
+ rear or all wheels; drive beyond the grip spins them. Anti-lock brakes split by `brakeBias` and
88
+ stop just short of the limit. `handbrake` locks the rear wheels, which then slide. State carries
89
+ the forward `speed`, the sideways `lateralSpeed`, `yawRate` and a 0–1 `skid` for tire sounds or
90
+ effects.
91
+
92
+ Weight moves between the axles through the suspension: the sprung body pitches by
93
+ `pitchStiffness` and rolls by `rollStiffness` (radians per g) on springs of
94
+ `suspensionFrequency` and `suspensionDamping`, so braking loads the front tires and lifting off
95
+ in a turn can tighten it. `bodyPitch` and `bodyRoll` add to the terrain `pitch` and `roll` in the
96
+ transform, so the cockpit view feels them too. Passed to the car visual as signals, they become
97
+ suspension travel: the wheels move against the lean and stay on the road. Steering lock and steering speed fade with road
98
+ speed (`steeringFadeSpeed`), and full lock never asks for more than half again the cornering the
99
+ tires can give, so a keyboard tap changes lanes instead of spinning the car. At walking pace the
100
+ car simply rolls where its wheels point, so it never turns in place and parks exactly.
101
+
102
+ `installVehicles` reads the world's `weather`: rain takes up to 30% of the grip and snow up to 60%
103
+ (`weatherGrip(weather)`), and the wind field, gusts included, pushes on the body's long side.
104
+ Engine force, top and reverse speeds, rolling and air resistance, mass, wheel geometry and terrain
105
+ tolerances come from `vehicle.spec` as before, and `yawInertia` defaults from the body size.
106
+
107
+ Collision probes run at 120 Hz or finer through the host's `canOccupy` adapter. When it refuses a
108
+ move, the solver finds which way is open by probing around the car, and answers with an impulse at
109
+ the corner that struck: a bounce that grows with impact speed (none below walking pace, so a car
110
+ can rest against a wall), scraping friction along the obstacle, and a spin. `installVehicles` emits
111
+ `vehicle-impact` (5 m/s or more) and `vehicle-bump` (1.5 m/s or more) with the car's `entity` and
112
+ the closing `speed`; the Earth soundscape plays a metal impact for each. World explorer uses an
113
+ oriented chassis against other cars and nearby triangles for walls, fixtures and buildings; the
114
+ car it hits stays put. Terrain gaps pause motion; abrupt steps and slopes above 35 degrees stop
77
115
  the car. Cockpit views use the full chassis quaternion; chase views shorten at obstructions.
78
116
 
79
- This is a grounded driving foundation. It does not implement rigid-body rollovers, crash deformation,
80
- passenger animation, multiplayer ownership, or disk persistence. Background traffic is a separate
81
- package: [ambient life](ambient-life.md) moves NPC cars along lanes without this solver, and they
82
- stop for a car someone is driving. Without collision hooks,
83
- the reusable kernel solver supplies terrain driving only. Do not attach a second physics body to the
84
- same vehicle; the vehicle solver owns its transform.
117
+ This is a grounded driving model. It does not implement airborne rotation, rollovers, crash
118
+ deformation or damage, pushing other cars, per-surface friction (grass and gravel grip like the
119
+ road), passenger animation, multiplayer ownership, or disk persistence. Background traffic is a
120
+ separate package: [ambient life](ambient-life.md) moves NPC cars along lanes without this solver,
121
+ and they stop for a car someone is driving. Without collision hooks, the reusable kernel solver
122
+ supplies terrain driving only. Do not attach a second physics body to the same vehicle; the
123
+ vehicle solver owns its transform.
85
124
 
86
125
  All durable simulation state and mount relationships live in ECS components and survive keyframes
87
126
  and replay. Install the same systems/environment when restoring. Host streaming and render resources
@@ -98,9 +137,63 @@ ground (under open sky, never a roof or deck), `board(id)` without walking to th
98
137
  in. The entity's `vehicle.color`, when set, paints the model's `paintMaterial`; without one the
99
138
  authored paint stays.
100
139
 
140
+ Passengers use the same mount contract. A `mountable` lists seats with a role: `driver` seats
141
+ drive, `passenger` seats ride. `mountEntity(world, actor, vehicle, 'passenger')` seats someone
142
+ beside the driver (stopped vehicle, within `reach` of the seat), the `mounted-seats` system carries
143
+ them along, and `unmountEntity` lets any seat out by the exits once the vehicle has stopped. A
144
+ passenger climbing in or out leaves the driver's controls alone; the driver leaving idles them.
145
+ `driveVehicle` accepts input only from a driver seat, and `self.occupied` engine sounds count only
146
+ non-passenger seats. The entities pack's cars and the OH-6 have a `passenger` seat and the P-51D a
147
+ rear one. In the Earth view, actors board and leave them (`{ kind: 'board', vehicle }` and
148
+ `{ kind: 'alight' }`; see [actors](earth-view.md#actors-companions-and-npcs)), and
149
+ `EarthVehicles.unmount(actor)` steps any mounted entity out by those rules.
150
+
151
+ ## Riding cycles
152
+
153
+ The entities pack includes six rideable types: `molen.entities.cycle.standard_motorcycle`,
154
+ `cruiser_motorcycle`, `motor_scooter`, `city_bicycle`, `road_bicycle` and `cargo_bicycle` (the same
155
+ namespace prefix applies to each). Mount, drive and exit them with the same APIs as cars. In the
156
+ Earth view example, select a cycle beside **Drive**, then press **Drive**. **W** supplies motor or
157
+ pedal power, **S** and **Space** brake, **A/D** steer, **V** changes view, and **E** steps off once
158
+ stopped. These cycles have no powered reverse. The Earth view API accepts the full type ID:
159
+
160
+ ```js
161
+ view.setMode('drive', { vehicle: 'molen.entities.cycle.city_bicycle', force: true });
162
+ ```
163
+
164
+ `vehicle.spec.cycle` opts into two centreline tire contacts and automatic balance: the cycle
165
+ leans into the turn, limited by `maxLean`, and returns upright as it stops. Lean follows lateral
166
+ acceleration through damped springs; `g * tan(maxLean)` also limits steering at speed, so reducing the lean
167
+ limit increases the minimum turning radius. Braking, tire grip, weather, terrain gaps, collision hooks and safe exits use the existing solver. Bicycles have
168
+ lighter mass and lower power and speed limits. `cycle.pedals.ratio` specifies wheel revolutions
169
+ per crank revolution; snapshot-safe `vehicleState.pedalAngle` advances under forward power and
170
+ holds while coasting or braking. Wheel spin continues while coasting.
171
+
172
+ The driver seat is a pelvis anchor. `cycle.riderLean`, `handlebarPivot`, `grips`, `footrests` and
173
+ optional `pedals` describe metric contact points in model space. The figures capability and
174
+ Earth avatar renderer share the same pose evaluator: hands follow the turning handlebars and
175
+ feet follow the pedals or footrests. At low-speed steering lock the rider counterweights at the
176
+ saddle and turns the shoulders to keep both grips within reach. The stock dimensions fit an adult human; unusually small
177
+ or large figures may not reach every contact point. The cockpit uses `spec.driverEye` separately
178
+ from the saddle. `vehicle.visual.animation` binds the moving parts in Earth; `model.signals`
179
+ provides the same steering, wheel and pedal animation in ordinary Molen scenes.
180
+
181
+ Cycles use the existing `molenVehicle(types, id)` helper and are enumerated separately by
182
+ `MOLEN_CYCLE_ENTITY_IDS`; `MOLEN_VEHICLE_ENTITY_IDS` continues to enumerate cars and trucks.
183
+ Cycles are excluded from automatic car parking and ambient traffic. Balance is assisted; this
184
+ is grounded riding, without falls, wheelies, jumps, gears or stunt simulation.
185
+
186
+ For a repeatable mounted-rider review in the engine repository:
187
+
188
+ ```sh
189
+ molen validate content/entities/scenes/cycles.scene.json
190
+ molen sim run content/entities/scenes/cycles.scene.json --setup content/entities/scenes/cycles.setup.mjs --ticks 120 --hash
191
+ molen shot content/entities/scenes/cycles.scene.json --setup content/entities/scenes/cycles.setup.mjs --ticks 60 --out content/entities/shots/cycles.png
192
+ ```
193
+
101
194
  ## Engine sound
102
195
 
103
- Every `molen.entities` vehicle type carries an `audioSource`: the compact, sedan and SUV run
196
+ The original five road vehicle types carry an `audioSource`: the compact, sedan and SUV run
104
197
  `vehicle.engine.car`, the pickup and van `vehicle.engine.diesel`, each with its own pitch. The
105
198
  engine plays only while someone drives (`self.occupied`), rises in pitch with
106
199
  `vehicleState.speed`, and grows louder with `vehicleInput.throttle`. Any host that plays audio from
@@ -112,8 +205,10 @@ hears it with no extra code. Override the component on a type or entity to chang
112
205
 
113
206
  `@bendyline/molen-client/vehicles` exports `createVehicleVisual`, `createParkedVehicleBatch`,
114
207
  and `vehicleCameraPose`. `createVehicleVisual(loadedGlb, vehicleData)` binds wheel, steering, and
115
- paint nodes named by `vehicle.visual`; dynamic visuals expose `update(steer, wheelAngle)` and
116
- `dispose()`. The camera helper accepts a transform, `vehicle.spec`, view, look offsets, and an
208
+ paint nodes named by `vehicle.visual`; dynamic visuals expose `update(steer, wheelAngle, signals)`
209
+ and `dispose()`. `signals` feeds the interior and `vehicle.visual.animation` bindings (see
210
+ [exterior animation](vehicle-interiors.md#exterior-animation)); `bodyRoll` and `bodyPitch` among
211
+ them keep the wheels planted. The camera helper accepts a transform, `vehicle.spec`, view, look offsets, and an
117
212
  optional obstruction-distance callback.
118
213
 
119
214
  Surface objects expose `userData.vehicles: VehiclePlacement[]`; each record has an `id`, external
@@ -134,3 +229,10 @@ working reference for scripting [`molen play`](experience-playback.md) against y
134
229
  pnpm build
135
230
  npx molen play dist --scenario test/visual/vehicles.play.json --out-dir .artifacts/vehicles
136
231
  ```
232
+
233
+ ## Boats
234
+
235
+ [Boats and water](boats.md) use the same mounting, passenger seats and camera controls with a
236
+ separate hull solver. `mountable.entries` optionally locates a gangway away from the seat;
237
+ boat exits are checked against their local deck height. Earth view and World Explorer share
238
+ boat launching, driving and dry dockside exits through `EarthVehicles`.
@@ -53,8 +53,15 @@ external data with `weatherSchema.parse` before using it in typed code.
53
53
  | `clouds.baseAltitude`, `thickness`, `scale` | Absolute base Y, layer separation, and horizontal pattern repeat size in meters. |
54
54
  | `precipitation.kind`, `intensity` | Explicit none/rain/snow and 0–1 visual intensity; not calibrated mm/hour. |
55
55
  | `visibility` | Approximate visual fade distance in meters, independent of clouds and precipitation. |
56
+ | `wind.referenceHeight` | Height above ground in meters where `windVelocity` applies; default 10. |
57
+ | `wind.shear` | Power-law exponent of wind speed with height, to 600 m; default 0 (uniform). About 0.14 over open country, 0.3 over cities. |
58
+ | `wind.turbulence` | 0–1 intensity; default 0. About 0.15 light chop, 0.4 moderate, 0.8 severe. |
59
+ | `wind.gusts` | 0–1 along-wind gust swing as a fraction of the mean wind; default 0. |
60
+ | `wind.terrain` | 0–1 strength of slope flow: lift up windward hillsides, sink and rougher air in the lee; default 0. |
56
61
 
57
62
  Presets are starting points, not classifications that constrain these independent parameters.
63
+ Every preset includes a `wind` block: light chop and gusts for sunny skies, rougher air in rain,
64
+ and nearly still, strongly sheared air in fog.
58
65
 
59
66
  ## Simulation and physics
60
67
 
@@ -76,9 +83,44 @@ temperature lapse rate or fluid simulation.
76
83
 
77
84
  `installAircraft` reads the world's weather each physics tick. Wind changes airspeed, and
78
85
  temperature/pressure change aerodynamic density. Explicit `AircraftEnvironment.weather`
79
- overrides the component; explicit `wind` overrides its wind. `stepAircraft` accepts the same
80
- optional weather value. Without weather, aircraft retain their existing altitude-density
81
- model exactly. Ground friction and character temperature exposure are not implicitly changed.
86
+ overrides the component; explicit `wind` overrides its wind with a uniform velocity. `stepAircraft`
87
+ accepts the same optional weather value and a `time`. Without weather, aircraft retain their
88
+ existing altitude-density model exactly. Ground friction and character temperature exposure are
89
+ not implicitly changed.
90
+
91
+ ## Wind shear, turbulence and gusts
92
+
93
+ The `wind` block shapes the air around the mean `windVelocity`. `windField(weather)` returns its
94
+ deterministic field, and `sampleWind(weather, position, time, groundHeight?)` samples it, both
95
+ from `@bendyline/molen-kernel`:
96
+
97
+ ```ts
98
+ import { sampleWind, weatherOf } from '@bendyline/molen-kernel';
99
+
100
+ world.addSystem((w, ctx) => {
101
+ const weather = weatherOf(w);
102
+ if (!weather) return;
103
+ // Air velocity in m/s at a point, on the world clock, over the world's terrain.
104
+ const air = sampleWind(weather, [0, 120, 0], ctx.tick * ctx.dt, (x, z) => ground(x, z));
105
+ });
106
+ ```
107
+
108
+ - **Shear.** The mean wind's horizontal speed follows `(height / referenceHeight) ^ shear` with
109
+ height above the ground beneath the point, up to 600 m. Below the reference height it is
110
+ lighter.
111
+ - **Turbulence.** Eddies from 20 m to 1.2 km across, with the -5/3 energy spectrum of real air,
112
+ are carried downwind with the mean wind and slowly evolve. Their strength grows with
113
+ `turbulence` and with wind speed, comes in patches a few kilometers across, fades above the
114
+ 1 km boundary layer, and near the ground loses its vertical part.
115
+ - **Gusts.** Along-wind speed swings of up to `gusts` times the mean, in fronts a few hundred
116
+ meters apart that sweep past with the wind.
117
+ - **Terrain.** With a ground-height function, wind blowing up a slope rises and wind blowing
118
+ down one sinks, fading over a few hundred meters of height; the lee side is also rougher.
119
+
120
+ The field is a pure function of the weather, the point and simulation time, so it needs no state
121
+ in snapshots and consumes no simulation random numbers; `seed` varies the pattern. Two aircraft
122
+ crossing the same air feel the same bump, and a replay feels every bump again. The renderer's
123
+ clouds and precipitation still drift with the mean wind; audio's wind level follows the mean too.
82
124
 
83
125
  ## Rendering and clocks
84
126
 
@@ -151,6 +151,14 @@ the sampled palette color multiplies the texture, so pack textures are authored
151
151
  default pack asserts a mean luminance of at least 0.55 for every tinted material). Windows use
152
152
  `tint: 'none'` and `uv: 'cell'`: every window is one texture repeat.
153
153
 
154
+ A material choice may name its own `palette`, which replaces the part's palette when that choice
155
+ is picked. The material and the color are otherwise independent picks, so without it a brick wall
156
+ can draw a concrete grey and a concrete panel can draw brick red. `materials.flatRoof` is an
157
+ optional roof material used only when the style resolves a flat roof (a flat choice or the
158
+ wide-footprint fallback). A pitched style keeps shingles or tile on its slopes and puts light
159
+ membrane or gravel on its flat tops. Tile-edge cuts and dropped roof shapes keep `roof`, so a
160
+ clipped house still matches its neighbors from above.
161
+
154
162
  `facade.windows` places windows per bay and floor: `punched` (one window per bay, seeded
155
163
  `probabilityPerBay`), `ribbon` (one strip per floor), `grid` (glazing filling the bay), or
156
164
  `none`; `groundFloor: 'storefront'` adds ground-floor glazing even when upper windows are
@@ -4,7 +4,7 @@
4
4
  > three.js rendering client, authored through JSON schemas, a small typed API, and a headless
5
5
  > dev loop. This bundle is version-locked to the engine release.
6
6
 
7
- Engine version: 0.0.6. three.js peer range: >=0.184.0 <0.187.0 (developed against 0.184.0). Node ≥ 22.13, ESM only.
7
+ Engine version: 0.0.7. three.js peer range: >=0.184.0 <0.187.0 (developed against 0.184.0). Node ≥ 22.13, ESM only.
8
8
 
9
9
  ## Start here
10
10
 
@@ -52,10 +52,12 @@ downloads them into a project and pins them in project.json.
52
52
  - [Logical source bundles](guide/source-bundles.md): one copyable folder per entity, structure, vehicle, prop, or other authored thing, with all definitions and source files listed in `source.json`.
53
53
  - [Components](schemas/components.md): the component vocabulary `molen validate` checks against.
54
54
  - [Mountable vehicles](guide/vehicles.md): stable parking entities, driver seats, deterministic vehicle physics, safe exits, and cockpit/chase views.
55
+ - [Boats and water](guide/boats.md): powered hulls, helm controls, passengers, boarding points, swells, currents and Earth-view water coverage.
55
56
  - [Aircraft](guide/aircraft.md): P-51D and OH-6 assets, flight physics, cockpit instruments, practice airfield and controls.
56
- - [Vehicle interiors and model signals](guide/vehicle-interiors.md): model-owned cabins, declarative simulation-to-GLB bindings, script-owned telemetry, and nearby detail loading.
57
+ - [Vehicle interiors and model signals](guide/vehicle-interiors.md): model-owned cabins, declarative simulation-to-GLB bindings, keyframed exterior animation (landing gear, doors, control surfaces), script-owned telemetry, and nearby detail loading.
57
58
  - [Figures](guide/figures.md): stylized humans, bipeds and quadrupeds: presets and descriptors, canonical rigs and sockets, deterministic gaits, `figureAttachment` accessories, riders, and `molen figure preview`.
58
- - [Ambient life](guide/ambient-life.md): NPC cars, pedestrians, trains and aircraft that spawn around an observer on a transport network (the scene `ambient` block, `molen/transport-network@1`, `molen.ambient.*`, the Earth view's `ambient` option, `ambientRole` content).
59
+ - [Ambient life](guide/ambient-life.md): NPC cars, pedestrians, trains, aircraft and watercraft that spawn around an observer on a transport network (the scene `ambient` block, `molen/transport-network@1`, `molen.ambient.*`, the Earth view's `ambient` option, `ambientRole` content).
60
+ - [Dioramas](guide/dioramas.md): bounded scripted set pieces loaded near the viewer; local deterministic scenes, schedules, lazy playback, football choreography, and geographic Earth placements.
59
61
  - [Complete game samples](guide/game-samples.md): city driving, first-person dungeon, and platformer; shared follow cameras and XY platform physics.
60
62
  - [Samples gallery](guide/examples.md): every sample with its molen.dev/play link and `--template` id, plus the capability layers (kinematics,
61
63
  character, pathfinding, physics-rapier, terrain) — copy-and-modify starting points.
@@ -90,7 +92,7 @@ with `molen validate <file>`, which prints precise, fixable errors. The shipped
90
92
  Schema + example, generated from the registry) live in [schemas/](schemas/README.md):
91
93
 
92
94
  - [Scene manifest](schemas/scene.md) (`molen/scene@3`: entities, prefabs, `commands`, `components`, camera, input, physics, terrain, ambient)
93
- - [Transport network](schemas/transport-network.md) (`molen/transport-network@1`: roads, railways and paths for ambient traffic)
95
+ - [Transport network](schemas/transport-network.md) (`molen/transport-network@1`: roads, railways, paths and water routes for ambient traffic)
94
96
  - [Command envelope](schemas/command.md) · [Assertions](schemas/assert.md)
95
97
  - [Keyframe](schemas/keyframe.md) · [Delta](schemas/delta.md) · [Replay](schemas/replay.md)
96
98
  - [Components](schemas/components.md) — every component with units and axis conventions
@@ -1547,6 +1547,11 @@ How to turn any outline into a styled building: massing, roof grammar, facade rh
1547
1547
  "minimum": 0,
1548
1548
  "maximum": 1000,
1549
1549
  "description": "Relative weight among sibling entries; 0 disables the entry."
1550
+ },
1551
+ "palette": {
1552
+ "type": "string",
1553
+ "minLength": 1,
1554
+ "description": "Key of `palettes` that tints this choice instead of the part palette, so brick stays brick-colored and concrete stays concrete-colored."
1550
1555
  }
1551
1556
  },
1552
1557
  "required": [
@@ -1630,6 +1635,11 @@ How to turn any outline into a styled building: massing, roof grammar, facade rh
1630
1635
  "minimum": 0,
1631
1636
  "maximum": 1000,
1632
1637
  "description": "Relative weight among sibling entries; 0 disables the entry."
1638
+ },
1639
+ "palette": {
1640
+ "type": "string",
1641
+ "minLength": 1,
1642
+ "description": "Key of `palettes` that tints this choice instead of the part palette, so brick stays brick-colored and concrete stays concrete-colored."
1633
1643
  }
1634
1644
  },
1635
1645
  "required": [
@@ -1694,6 +1704,95 @@ How to turn any outline into a styled building: massing, roof grammar, facade rh
1694
1704
  ],
1695
1705
  "additionalProperties": false
1696
1706
  },
1707
+ "flatRoof": {
1708
+ "type": "object",
1709
+ "properties": {
1710
+ "choices": {
1711
+ "minItems": 1,
1712
+ "type": "array",
1713
+ "items": {
1714
+ "type": "object",
1715
+ "properties": {
1716
+ "ref": {
1717
+ "type": "string",
1718
+ "pattern": "^(palette:#[0-9a-fA-F]{6}|matgraph:\\S+|pixelgrid:\\S+)$",
1719
+ "description": "materialRef: 'palette:#rrggbb', 'matgraph:<pack material id or path>', or 'pixelgrid:<id or path>'."
1720
+ },
1721
+ "weight": {
1722
+ "type": "number",
1723
+ "minimum": 0,
1724
+ "maximum": 1000,
1725
+ "description": "Relative weight among sibling entries; 0 disables the entry."
1726
+ },
1727
+ "palette": {
1728
+ "type": "string",
1729
+ "minLength": 1,
1730
+ "description": "Key of `palettes` that tints this choice instead of the part palette, so brick stays brick-colored and concrete stays concrete-colored."
1731
+ }
1732
+ },
1733
+ "required": [
1734
+ "ref",
1735
+ "weight"
1736
+ ],
1737
+ "additionalProperties": false
1738
+ },
1739
+ "description": "Weighted materials; one is picked per building."
1740
+ },
1741
+ "palette": {
1742
+ "type": "string",
1743
+ "minLength": 1,
1744
+ "description": "Key of `palettes` used to tint this part."
1745
+ },
1746
+ "tint": {
1747
+ "default": "multiply",
1748
+ "type": "string",
1749
+ "enum": [
1750
+ "multiply",
1751
+ "none"
1752
+ ],
1753
+ "description": "'multiply' = vertex color times texture (author textures light); 'none' = texture as is."
1754
+ },
1755
+ "uv": {
1756
+ "default": "meters",
1757
+ "type": "string",
1758
+ "enum": [
1759
+ "meters",
1760
+ "cell"
1761
+ ],
1762
+ "description": "'meters': world-metric UVs; 'cell': one repeat per (bay, floor) facade cell."
1763
+ },
1764
+ "uvScale": {
1765
+ "minItems": 2,
1766
+ "maxItems": 2,
1767
+ "type": "array",
1768
+ "items": {
1769
+ "type": "number",
1770
+ "exclusiveMinimum": 0
1771
+ },
1772
+ "description": "Meters per texture repeat [u, v] when uv is meters."
1773
+ },
1774
+ "uvOffset": {
1775
+ "default": "meters",
1776
+ "type": "string",
1777
+ "enum": [
1778
+ "cell",
1779
+ "meters",
1780
+ "none"
1781
+ ],
1782
+ "description": "Seeded per-building UV shift so neighbours never align."
1783
+ },
1784
+ "uvMirror": {
1785
+ "default": false,
1786
+ "type": "boolean",
1787
+ "description": "Allow a seeded horizontal flip."
1788
+ }
1789
+ },
1790
+ "required": [
1791
+ "choices"
1792
+ ],
1793
+ "additionalProperties": false,
1794
+ "description": "Replaces `roof` when the style resolves a flat roof (a flat choice or the flat fallback), so a pitched style keeps shingles on its slopes but light membrane or gravel on flat tops."
1795
+ },
1697
1796
  "trim": {
1698
1797
  "type": "object",
1699
1798
  "properties": {
@@ -1713,6 +1812,11 @@ How to turn any outline into a styled building: massing, roof grammar, facade rh
1713
1812
  "minimum": 0,
1714
1813
  "maximum": 1000,
1715
1814
  "description": "Relative weight among sibling entries; 0 disables the entry."
1815
+ },
1816
+ "palette": {
1817
+ "type": "string",
1818
+ "minLength": 1,
1819
+ "description": "Key of `palettes` that tints this choice instead of the part palette, so brick stays brick-colored and concrete stays concrete-colored."
1716
1820
  }
1717
1821
  },
1718
1822
  "required": [
@@ -1796,6 +1900,11 @@ How to turn any outline into a styled building: massing, roof grammar, facade rh
1796
1900
  "minimum": 0,
1797
1901
  "maximum": 1000,
1798
1902
  "description": "Relative weight among sibling entries; 0 disables the entry."
1903
+ },
1904
+ "palette": {
1905
+ "type": "string",
1906
+ "minLength": 1,
1907
+ "description": "Key of `palettes` that tints this choice instead of the part palette, so brick stays brick-colored and concrete stays concrete-colored."
1799
1908
  }
1800
1909
  },
1801
1910
  "required": [
@@ -1879,6 +1988,11 @@ How to turn any outline into a styled building: massing, roof grammar, facade rh
1879
1988
  "minimum": 0,
1880
1989
  "maximum": 1000,
1881
1990
  "description": "Relative weight among sibling entries; 0 disables the entry."
1991
+ },
1992
+ "palette": {
1993
+ "type": "string",
1994
+ "minLength": 1,
1995
+ "description": "Key of `palettes` that tints this choice instead of the part palette, so brick stays brick-colored and concrete stays concrete-colored."
1882
1996
  }
1883
1997
  },
1884
1998
  "required": [