@bendyline/molen-tooling 0.0.13 → 0.0.14

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 (37) hide show
  1. package/dist/capture/harness.js +551 -335
  2. package/dist/capture/worldgen-preview.js +539 -325
  3. package/dist/docs-src/guide/adaptive-performance.md +23 -17
  4. package/dist/docs-src/guide/aircraft.md +54 -16
  5. package/dist/docs-src/guide/ambient-life.md +15 -2
  6. package/dist/docs-src/guide/audio.md +38 -1
  7. package/dist/docs-src/guide/browser-mount.md +11 -0
  8. package/dist/docs-src/guide/determinism.md +2 -1
  9. package/dist/docs-src/guide/earth-view.md +45 -8
  10. package/dist/docs-src/guide/glass.md +134 -0
  11. package/dist/docs-src/guide/graphics-performance.md +24 -6
  12. package/dist/docs-src/guide/navigation.md +23 -5
  13. package/dist/docs-src/guide/night-lighting.md +2 -1
  14. package/dist/docs-src/guide/regional-fleets.md +9 -4
  15. package/dist/docs-src/guide/regional-world.md +6 -2
  16. package/dist/docs-src/guide/sky.md +2 -2
  17. package/dist/docs-src/guide/surface-rendering.md +9 -3
  18. package/dist/docs-src/guide/terrain.md +32 -5
  19. package/dist/docs-src/guide/vehicle-interiors.md +34 -3
  20. package/dist/docs-src/guide/vehicles.md +47 -1
  21. package/dist/docs-src/guide/weather.md +60 -21
  22. package/dist/docs-src/llms.txt +3 -2
  23. package/dist/docs-src/schemas/components.md +979 -140
  24. package/dist/templates/city-courier/gen/molen-types.ts +103 -2
  25. package/dist/templates/city-courier/scripts/molen-scripts.d.ts +102 -1
  26. package/dist/templates/city-courier/src/shared/playback.ts +21 -10
  27. package/dist/templates/cubes/src/shared/playback.ts +21 -10
  28. package/dist/templates/data-viz/src/shared/playback.ts +21 -10
  29. package/dist/templates/figures-gallery/src/shared/playback.ts +21 -10
  30. package/dist/templates/index.json +17 -17
  31. package/dist/templates/skybound/gen/molen-types.ts +103 -2
  32. package/dist/templates/skybound/scripts/molen-scripts.d.ts +102 -1
  33. package/dist/templates/skybound/src/shared/playback.ts +21 -10
  34. package/dist/templates/top-down-arena/scripts/molen-scripts.d.ts +102 -1
  35. package/dist/templates/top-down-arena/src/gen/molen-types.ts +103 -2
  36. package/dist/templates/top-down-arena/src/shared/playback.ts +21 -10
  37. package/package.json +12 -12
@@ -80,6 +80,16 @@ marked `'background'` prepares only in budget normal jobs leave: World Explorer'
80
80
  aircraft load with the world that way, as in the normal lane their ~200 jobs held terrain and
81
81
  buildings back by most of a minute on a software renderer.
82
82
 
83
+ Continuous urgent traffic shares service with normal work: after two urgent jobs, a normal job
84
+ waiting at least 50 ms gets a turn, including when each urgent job consumes a whole frame.
85
+ Normal jobs may provide `order: () => number` (lower first), read at dispatch so a moving camera
86
+ can reprioritize queued work. After three ordered jobs, the FIFO head gets a turn; shared decodes
87
+ and unrelated scene work continue to progress. These rules stay within the same frame budgets.
88
+ Terrain layer contexts scope this live order through generation and assembly; their GPU preparation
89
+ uses `userData.admissionOrder`, and publication keeps the same order. Only immediate replacement
90
+ siblings inherit a parent's priority; a distant ancestor must not give a whole city's leaves the
91
+ same priority.
92
+
83
93
  Main-thread work that runs as a tile's sources resolve is admitted too, because several tiles
84
94
  arriving together stacked it into one late frame: decoding vector tiles (the package semantic
85
95
  layers' `admission` option), a worldgen request's own preparation, prop batches, surface results
@@ -114,8 +124,11 @@ signal lenses, markings and parked cars past their draw distance (`updateDetail`
114
124
  [surface rendering](surface-rendering.md)) and street props below 1.5 px (`vanishPixels`, see
115
125
  [worldgen](worldgen.md)); at High over a town that cut a fifth of the draws. A visibility pass makes
116
126
  its first ground cut whatever it costs, but only 4 ms more (`TerrainGroundCutoutController.update`'s
117
- budget); the rest keep their current cut until the next stream update, so tiles arriving together
118
- no longer hold one frame for every cut they need.
127
+ budget); the rest keep their current cut until the next frame, so tiles arriving together
128
+ no longer hold one frame for every cut they need. `stream.updateTransitions(nowMs)` carries those
129
+ cuts on every frame, sharing one 4 ms budget a frame with `stream.update`: hosts update the stream
130
+ ten times a second while the camera is still, and at one budget an update, ground that a descent
131
+ had just shown stood uncut over its own harbor for most of a second.
119
132
 
120
133
  Earth hosts admit more while frames have time to spare: `createEarthAdmissionGovernor(backend)`
121
134
  smooths each frame's main-thread work and, through `earthAdmission`, switches the queue to 8 MiB
@@ -220,9 +233,14 @@ and meshing still run for every tile the stream loads. Long-horizon byte prefetc
220
233
  The Earth view also prepares nearby future tiles through the normal construction and GPU queues,
221
234
  so aircraft can arrive over already prepared terrain and layers even without persistent caching.
222
235
 
223
- A generation worker runs one tile at a time, in the order requested (the stream asks for what the
224
- view needs most first); interleaved, every tile in flight finished late, the nearest with the
225
- rest. It yields to its event loop every 8 ms of work, through a message channel, so a
236
+ A generation worker runs one tile at a time; interleaved, every tile in flight finished late, the
237
+ nearest with the rest. Which tile runs next is decided when a worker frees, not when the tile was
238
+ requested: the worldgen pool keeps waiting tiles on the main thread (two posted per worker), and
239
+ the land cover and road surface queues pick their next job the same way, by each layer context's
240
+ `priority()` (meters from the camera, ground in view first). Posted in request order, a jet's
241
+ nearest ground waited a second or more behind ground it had already passed. Layer adapters that
242
+ pass work to their own workers can read `context.priority` the same way.
243
+ It yields to its event loop every 8 ms of work, through a message channel, so a
226
244
  `cancel` message gets through. It used to yield after every step with a zero `setTimeout`, which a
227
245
  browser holds for at least 4 ms once timers nest: a dense tile took a second of wall time for a
228
246
  fifth of a second of work. Streaming generators also pass `hashOutput: false`: the SHA-256 over
@@ -339,7 +357,7 @@ cut. An aircraft's center can pass behind its cockpit camera at a tile boundary;
339
357
  indefinitely for already cached ground to become visible before moving again.
340
358
 
341
359
  `morphMilliseconds` enables refinement height morphs for bare surfaces; call
342
- `stream.updateTransitions(nowMs)` in the frame loop. Vertices start on the actual parent
360
+ `stream.updateTransitions(nowMs)` in the frame loop (it also carries on unfinished ground cuts). Vertices start on the actual parent
343
361
  triangles and finish at their exact target positions with fixed horizontal coordinates. Grounded
344
362
  semantic layers use coverage-preserving atomic replacement and hysteresis instead. Enabling
345
363
  one finishes any surface morph before layer publication. Coarsening does not height-morph.
@@ -92,10 +92,28 @@ tree entirely. Queries reach at most `radius - rebuildDistance` from the subject
92
92
  `verticalRadius` unset for a walker, whose placement ray scans the whole column.
93
93
 
94
94
  Meshes opt out with `userData.walkIgnore = true`; world-generation ground cover does, so walkers
95
- pass through ferns and moss. Water materials and landcover overlays are never solid. An aircraft can
96
- pass `instanceBounds: true`, which collides with each instance of an instanced mesh as its bounding
97
- box rather than its triangles. A missing terrain tile pauses movement until it arrives, rather than
98
- dropping the walker.
95
+ pass through ferns and moss. Meshes with all render layers disabled are skipped unless marked
96
+ `userData.walkCollisionOnly = true`, as with the smooth ramps beneath visible stair steps.
97
+ Water materials are never solid. Visible landcover provides walking support, including when it
98
+ replaces the bare terrain.
99
+
100
+ Set `walker.sampleWaterHeight = (x, z) => ...` to enable automatic surface swimming. Return the
101
+ water height in world meters, `null` on dry land, or `undefined` while water coverage is loading.
102
+ The walker wades on shallow ground, floats with its eyes 45 cm above deep water, and resumes
103
+ walking when its capsule meets the shore. `walker.swimming` reports this state; the walk input
104
+ profile stays active, with Shift swimming faster and jumping available again on land. Solid
105
+ walls and bridges still collide normally. Water also supports initial placement without a
106
+ rendered lake bed. Earth view and world explorer supply this callback from their boat water
107
+ coverage automatically, excluding tunnels beneath water.
108
+
109
+ An aircraft can pass `instanceBounds: true`, which collides with each instance of an instanced mesh
110
+ as its bounding box rather than its triangles. A missing terrain tile pauses movement until it
111
+ arrives, rather than dropping the walker.
112
+
113
+ For tunnels, the `sampleHeight` callback passed to `walker.update` must return the bore floor
114
+ when the walker's feet are inside it, and the terrain height otherwise. Earth view does this
115
+ automatically. Returning the hill above a tunnel triggers streamed-ground recovery and lifts
116
+ the walker out of the bore. Initial placement still uses the surface height to land above ground.
99
117
 
100
118
  ## Follow
101
119
 
@@ -120,7 +138,7 @@ Default profiles come from `navigationInputProfiles()`:
120
138
  |---|---|---|
121
139
  | `orbit`, `fly` | WASD/arrows move, Q/E down/up, Shift sprint | left stick move, right stick look, bumpers up/down |
122
140
  | `walk`, `drive` | WASD/arrows move, Space jump/brake, E or F interact, V view, Shift sprint | left stick move, right stick look, A jump, X interact, Y view |
123
- | `pilot` | W/S or ↑/↓ nose down/up, A/D or ←/→ bank, Q/Z rudder, Shift/Ctrl (or +/−, Page Up/Down) power, I engine, G gear, F flaps, R recover, Space brake, V view, E exit | left stick pitch/bank, right stick look, triggers power, bumpers rudder, A brake, B engine, X exit, Y view |
141
+ | `pilot` | W/S or ↑/↓ nose down/up, A/D or ←/→ bank, Z/C rudder, =/− (or numpad +/−, Page Up/Down) power, I engine, G gear, F flaps, R recover, Space brake, V view, E exit | left stick pitch/bank, right stick look, triggers power, bumpers rudder, A brake, B engine, X exit, Y view |
124
142
 
125
143
  In the `pilot` profile each `NavigationInput` also carries `pilot`: the held `throttle` and `yaw`
126
144
  axes (-1..1) and edge-triggered `engine`, `gear`, `flaps` and `recover` presses. Pitch is
@@ -64,7 +64,8 @@ metadata; arbitrary tagged model lamps currently emit without creating a point l
64
64
  Active traffic and the driven car get white headlights and red tail lights, including when
65
65
  stopped at a signal. Lenses follow vehicle dimensions and the full chassis rotation, through
66
66
  proxy/model changes and floating-origin shifts. Braking brightens the rear lenses. Four nearby
67
- cars also receive forward, downward-aimed spotlights, with the driven car taking priority.
67
+ cars also receive a pair of forward, downward-aimed spotlights, with the driven car taking priority.
68
+ Each beam starts at its headlight lens and softly lights the road immediately ahead of the car.
68
69
  Their beams illuminate pavement, walls and vehicles ahead. Parked, unoccupied cars keep their
69
70
  lamps off and receive light from their surroundings. Hidden/despawned traffic loses its lights.
70
71
 
@@ -55,8 +55,10 @@ content retain their original behavior.
55
55
  World Explorer builds an entity archive for distribution and a versioned directory manifest for
56
56
  browser use. The index points to `molen-pack.json`, so even a static server without HTTP Range
57
57
  downloads only requested GLBs. Opening the catalog fetches no GLBs; distant traffic and parking
58
- use instanced proxies. Explicit player selection may load any vehicle. Node pack hosting also
59
- accepts a hosted directory index. Content hashes identify shared files in the Earth byte cache.
58
+ use lightweight proxies with shaped hoods, sloped windows, painted roofs and visible wheels.
59
+ The shared car silhouette uses 148 triangles and one material, with no model download.
60
+ Explicit player selection may load any vehicle. Node pack hosting also accepts a hosted directory
61
+ index. Content hashes identify shared files in the Earth byte cache.
60
62
 
61
63
  Directory reads share transfers. Cancelling one reader preserves another reader's request; when
62
64
  the last reader cancels, queued or active work is aborted. Failed/aborted reads can retry. The
@@ -73,8 +75,11 @@ residency budget rather than a process-wide memory ceiling.
73
75
 
74
76
  Configure `idleVehicleModels`, `vehicleModelBytes`, and `vehicleLoads` on `EarthAmbientSettings`
75
77
  or `AmbientRenderBudget`. Zero idle retention is supported. Parking independently loads at most
76
- eight nearby detailed cars with two background requests. Driven cars retain simulation state but
77
- release their model outside the near set. The mounted car and explicitly host-owned cars are
78
+ eight nearby detailed cars with two background requests. Both parking and traffic request full
79
+ car models within 45 metres and retain selected models out to 65 metres, subject to their count
80
+ and residency budgets. This hysteresis prevents repeated swaps at the approach threshold.
81
+ Driven cars retain simulation state but release their model outside the near set. The mounted car
82
+ and explicitly host-owned cars are
78
83
  exceptions, owned until removal. Aircraft keep their existing budget.
79
84
 
80
85
  ## Coverage and authoring
@@ -106,7 +106,7 @@ mangrove, deadwood, shrub, thicket, forb, vine, mat, and fallen-wood silhouettes
106
106
  parks, orchards, and wetlands. Regional refinements keep American cacti out of Old World wild
107
107
  desert profiles and avoid applying Australian eucalyptus profiles to New Zealand.
108
108
 
109
- Each of the 78 plant forms has a base, spreading, and slender preset, available in
109
+ Each of the 88 plant forms has a base, spreading, and slender preset, available in
110
110
  every applicable habitat and crop rule. Optional `shapeSeed` varies branch/frond arrangements,
111
111
  crown contours and stem profiles independently of the placement seed. Dimensions, crown height,
112
112
  trunk lean and restrained foliage tones also vary; these are visual forms, not additional taxa.
@@ -149,7 +149,11 @@ is their interchangeable fallback and its `weight` still controls species propor
149
149
  selection uses an independent random stream, keeping positions, density, crop rows and ordinary
150
150
  quality thinning intact. A tile reserves a base form for each retained species before admitting
151
151
  extra variants into spare model slots. Unretained forms use that base instead of disappearing;
152
- Economy and distant views therefore show fewer forms without increasing draw limits. Variant
152
+ Economy and distant views therefore show fewer forms without increasing draw limits. A species
153
+ past the tile's model budget likewise takes its rule's most common retained species, so a tight
154
+ budget simplifies a mixed stand rather than thinning it; a rule with no retained species, such
155
+ as a lone crop row, still drops out. Weights therefore also decide what a tight budget shows:
156
+ it keeps a tile's most numerous species, and minor ones appear only where it has room. Variant
153
157
  recipes must be suitable for the same habitat and placement-scale bounds as their parent.
154
158
 
155
159
  Mapped trees preserve source `species`, `genus`, `leafType`, `height`, and `crownDiameter` when
@@ -233,8 +233,8 @@ quantized to about 0.005° and magnitudes to 0.04. The engine repository regener
233
233
  No atmospheric refraction, horizon dip, terrain horizon calculation, eclipses, planetary bodies,
234
234
  Milky Way texture, lunar libration or photographic lunar map are modeled. The procedural lunar
235
235
  surface is illustrative. Sunrise and sunset are geometric approximations; this is an experience
236
- renderer, not a navigation or observational ephemeris. Layered clouds, precipitation, visibility
237
- and physical atmospheric state live in the separate [weather component](weather.md).
236
+ renderer, not a navigation or observational ephemeris. Volumetric clouds, precipitation,
237
+ visibility and physical atmospheric state live in the separate [weather component](weather.md).
238
238
  Volumetric atmospheric scattering remains future work.
239
239
 
240
240
  ## Try it
@@ -252,9 +252,15 @@ await surfaces.setOptions({
252
252
  The decoder preserves road `subclass`, `service`, `link` (including Protomaps `is_link`), `surface`, `lanes`, `oneway`, `layer`, `bridge`, `tunnel`
253
253
  and explicit `width`. Properties absent from the source use class-based defaults. Tunnel roads are
254
254
  excluded from the ground painter; Earth views add separate underground bores as described below.
255
- Bridges and differing layers do not form surface junctions. Bridge ribbons retain the
256
- existing approximate terrain-relative elevation; this renderer does not build engineered bridge
257
- decks. Crossing paint, inferred sidewalks, signal placement and parking occupancy are decorative,
255
+ Bridges and differing layers do not form surface junctions. Tagged bridges receive inferred
256
+ decks, slabs, barriers and supports. Motorway spans retain clearance through their ends;
257
+ connected approaches ease back to terrain over the surrounding road fragments, with retaining
258
+ sides below raised pavement. Curved profiles follow distance along the mapped road. Barriers
259
+ sit outside paved shoulders and open at merges where the adjoining carriageway is at the same
260
+ height; edge paint also clears these openings. Traffic uses the same grading samples.
261
+ Surveyed deck heights and authored bridge connections take precedence. Inferred grades depend
262
+ on the available tile geometry and terrain, so they are not surveyed engineering profiles.
263
+ Crossing paint, inferred sidewalks, signal placement and parking occupancy are decorative,
258
264
  not surveyed traffic-control or navigation data. [Ambient life](ambient-life.md) builds its own lane graph
259
265
  from the same features for NPC traffic. Earth view and world explorer match signal heads to
260
266
  that graph, displaying the same phase that controls approaching cars. Without a matching
@@ -351,10 +351,19 @@ For moving cameras, `stream.update(view, futureViews)` accepts optional predicte
351
351
  in time first. It prepares a bounded set of future leaves, semantic layers and GPU resources in
352
352
  the hidden resident cache without changing the current selection. Omit the second argument to
353
353
  stop prediction. Both the Earth view and World Explorer use `createEarthTilePreloader` from
354
- `@bendyline/molen-earth/client` to predict 4, 8 and 12 seconds of fast travel, capped at 4 km.
354
+ `@bendyline/molen-earth/client` to predict 2, 4, 8 and 12 seconds of fast travel, capped at 4 km.
355
355
  Its `views(nowMs, view, steady)` takes positions already in the Earth adapter's metric world frame;
356
356
  pass `steady: false` during scripted camera animations and call `reset()` when changing frames.
357
357
 
358
+ Semantic preparation shares its request window across enabled layers, retaining capacity for
359
+ the next arriving tile's other layers even when one source stalls. Earth applies the same
360
+ 12-height / 24-layer preparation window to manual and automatic quality; bounded worker pools
361
+ and frame admission govern the work itself. Visual quality and selection budgets remain separate.
362
+ Layer priority follows the camera and predicted flight path through worker, assembly, GPU
363
+ preparation and publication queues, ahead of surrounding detail.
364
+ Repeated physics height probes cache the covering fields per finest-level cell; arriving tiles,
365
+ visibility changes and eviction invalidate that lookup without caching or quantizing heights.
366
+
358
367
  The selector measures projected source-sample spacing, adapts its error/range to the selected-tile
359
368
  budget, requests ancestors before descendants, and retains a displayed parent until all selected
360
369
  descendant coverage is resident. A selected tile that is not resident yet shows through its
@@ -367,9 +376,10 @@ screen-space error, displayed-level range, and leaf fallback count. Quality pres
367
376
  error, view-distance, concurrency, selection, and residency budgets. Include `direction` and
368
377
  `aspect` in each view update to reject tiles safely outside a guarded horizontal camera cone while
369
378
  retaining direction-independent coarse coverage to the configured distance. `peripheralDegrees`
370
- widens that cone for ground only: tiles up to that many degrees past it stay selected at reduced
371
- detail (`peripheralDetail`, default 0.4, weighs their error) as bare terrain, without layers, so
372
- turning the camera reveals ground that is already there; layers build once the tile is in view. In-flight surface
379
+ widens that cone: tiles up to that many degrees past it stay selected at reduced
380
+ detail (`peripheralDetail`, default 0.4, weighs their error), with hydrology prepared too, so
381
+ turning the camera reveals ground and mapped water that are already there. Buildings and vegetation
382
+ build once the tile is in view. In-flight surface
373
383
  requests finish into a bounded warm cache instead of being restarted on every small camera turn;
374
384
  hidden cached tiles are evicted only when capacity is needed. Sparse descendants also share a
375
385
  bounded decoded-ancestor cache, avoiding repeated PNG decode/resample work while panning.
@@ -383,6 +393,9 @@ water and road surfaces are marked) and water with `userData.shadowReceiver = fa
383
393
  adaptive tiles. Its optional inclusive `minLevel`/`maxLevel` bounds keep expensive decoration off
384
394
  coarse fallback and horizon tiles. Layer objects become visible only with their selected surface,
385
395
  remain cached briefly across LOD transitions, and are disposed with their resident height tile.
396
+ Hydrology is queued ahead of other visible layer work and appears as soon as it is prepared,
397
+ without waiting for buildings or vegetation. Refinement still retains parent water until its
398
+ replacement family is ready, avoiding gaps or overlapping parent/child shorelines.
386
399
  A layer object that drapes its whole tile with opaque ground (landcover over a full-tile
387
400
  background, as the regional worldgen classification layer builds) can set
388
401
  `userData[TERRAIN_COVERS_GROUND] = true`. While it is displayed, the stream stops drawing that
@@ -429,7 +442,8 @@ stay on the heap meanwhile.
429
442
 
430
443
  Mapped lake polygons also clear coarse elevation and landcover beneath their water surface,
431
444
  preserving polygon holes as islands. Small bank faces close the difference between the rendered
432
- ground triangles and the water level; clipped tile edges do not become artificial banks. These
445
+ ground triangles and the water level over the tile's own ground: clipped tile edges, and the
446
+ buffer that decoded and overzoomed areas carry past them, do not become artificial banks. These
433
447
  openings follow hydrology tile residency, independently of landmark loading, and restore the
434
448
  original ground on hide/unload. Roads and bridge surfaces retain their geometry. Source height
435
449
  samples remain available for anchoring and physics. Ground clipping keeps shared grid vertices
@@ -503,6 +517,19 @@ nearest declared ancestor when an exact tile is absent, then crops and resamples
503
517
  the requested tile bounds. This supports broad coarse coverage plus a small regional detail window
504
518
  without a hard distance cutoff. Set `parentFallback: false` when exact-level coverage is required.
505
519
 
520
+ Geospatial package loaders automatically reject isolated extreme elevation samples before
521
+ resampling or meshing, including in the elevation worker. A sample must sit above or below its
522
+ entire surrounding ring by more than 100 m, twice the native sample spacing, and twice the ring's
523
+ height range. Only those outliers are replaced with the ring median; ordinary slopes, ridges and
524
+ cliffs retain their samples. This conservative check removes narrow DEM spikes and pits without
525
+ blurring the whole terrain. It is not a general repair for broad corrupt regions or missing data.
526
+ Suspicious border samples read neighbouring archive tiles so shared edges receive the same result;
527
+ incomplete surrounding coverage is left unchanged. Meshes, ground queries and ancestor fallback
528
+ all use the corrected samples. Local authored packages keep their original heights by default.
529
+ Pass `filterElevation: false` to the package opening, stream or height-source options to inspect
530
+ the original DEM, or `true` to enable the same filter for a local package. Archive files are never
531
+ rewritten.
532
+
506
533
  Adaptive quality budgets include `maxSurfaceTileResolution` (33 economy, 65 balanced, 129 high).
507
534
  This limits render geometry without reducing the decoded heightfield used for sampling, feature
508
535
  draping, or collision.
@@ -309,12 +309,43 @@ and last eighth of that travel and stay open in between, while the legs swing:
309
309
 
310
310
  Each moving part rotates about one local axis, so the model gives it a parent frame aligned with
311
311
  its hinge: a canted trunnion, a door's edge. Author the GLB in the at-rest pose (gear down,
312
- doors as they stand on the ground); keys are displacements from it. A model whose retracted parts
313
- would show through the skin can also list them in `visual.gearNodes`, hidden while the gear is
314
- fully up. Simulated gear and flap positions come from `airplane.gearTransitTime` and
312
+ doors as they stand on the ground); keys are displacements from it. Rigged gear stays visible
313
+ inside its well, including exposed stowed wheels. Use an explicit `visible` binding if a part
314
+ must disappear at full retraction. The legacy `visual.gearNodes` hide/show fallback applies
315
+ only to nodes without position or rotation bindings. Simulated gear and flap positions come from `airplane.gearTransitTime` and
315
316
  `flapTransitTime` (see [Aircraft](aircraft.md)); a script can drive any other part by publishing
316
317
  a component and naming it in `sources`.
317
318
 
319
+ ## Graduated mechanisms
320
+
321
+ Vehicle and aircraft specs can declare `actuators`, keyed by a mechanism name. An ordinary
322
+ actuator takes `{ "seconds": 3 }` for a three-second full stroke. The corresponding input's
323
+ `actuators` map selects a number from 0 to 1 (or a boolean); the state component's map records
324
+ the actual position. Selecting the opposite target reverses from the current position. These
325
+ values are part of deterministic simulation and keyframes, including while parked.
326
+
327
+ For example, a car can declare `spec.actuators.hood = { seconds: 2 }`, receive
328
+ `vehicleInput.actuators.hood = 0.5`, and bind its `hood-hinge` rotation to a source
329
+ `{ "component": "vehicleState", "path": ["actuators", "hood"] }`. Bindings displace the
330
+ authored rest pose, so hinge origins belong in the model.
331
+
332
+ `mode: "cycle"` makes `seconds` the complete cycle duration: use a 0 → 1 → 0 binding curve
333
+ for a wiper and set its input true to run. Switching off completes the current cycle and parks.
334
+ `seconds: 0` switches a state immediately, such as headlight emission. `mode: "latch"` starts
335
+ an irreversible stroke once selected, suitable for emergency release. Ordinary positional
336
+ actuators are reversible. `initial` supplies the default target and initial position.
337
+
338
+ Aircraft use the same mechanism map for `canopy`, `tailHook` and `speedBrake`; gear and flaps
339
+ retain `gearPosition` and `flapPosition`. Set `airplane.speedBrakeDrag` to the drag coefficient
340
+ added at full speed-brake deployment. Helicopters default to fixed gear; a wheeled retractable
341
+ model sets `helicopter.fixedGear: false` and `gearTransitTime`.
342
+
343
+ The navigation drive/pilot profiles emit actuator press counts: B speed brakes, H hook,
344
+ O canopy, K wipers, L lights, 1–4 doors, 5 hood, 6 rear access. Earth vehicle/aircraft hosts
345
+ apply supported controls only. Use `EarthVehicles.toggleActuators` before `update` when
346
+ consuming navigation input directly. Aircraft cockpit panels expose fractional targets.
347
+ Unsupported equipment should be omitted from the spec instead of drawing fictional parts.
348
+
318
349
  ## Exterior views and detail levels
319
350
 
320
351
  Cockpit and chase views share the GLB. An interior can be a high-detail portion of that model,
@@ -1,5 +1,9 @@
1
1
  # Mountable vehicles and driving
2
2
 
3
+ Vehicles can carry authored [glass surfaces](glass.md). Collision impulses load each pane by
4
+ its mass and orientation: laminated windshields crack while retained, tempered panes fragment,
5
+ and frame/interlayer failure is independent of fracture.
6
+
3
7
  Generic vehicles use the Bendy house brand, with stable asset/type IDs. The Bendy Bus and
4
8
  Bendy Light Rail are also mountable through the vehicle API. World Explorer has buttons for
5
9
  both at the practice area: W/S applies traction or reverse, Space brakes, V switches view,
@@ -129,13 +133,40 @@ car it hits stays put. Terrain gaps pause motion; abrupt steps and slopes above
129
133
  the car. Cockpit views use the full chassis quaternion; chase views shorten at obstructions.
130
134
 
131
135
  This is a grounded driving model. It does not implement airborne rotation, rollovers, crash
132
- deformation or damage, pushing other cars, per-surface friction (grass and gravel grip like the
136
+ deformation, pushing other cars, per-surface friction (grass and gravel grip like the
133
137
  road), passenger animation, multiplayer ownership, or disk persistence. Background traffic is a
134
138
  separate package: [ambient life](ambient-life.md) moves NPC cars along lanes without this solver,
135
139
  and they stop for a car someone is driving. Without collision hooks, the reusable kernel solver
136
140
  supplies terrain driving only. Do not attach a second physics body to the same vehicle; the
137
141
  vehicle solver owns its transform.
138
142
 
143
+ ### Breakable parts
144
+
145
+ The ground-vehicle catalog (cars, buses, cycles and rail vehicles) binds independent wheels and
146
+ exterior panels to `spec.collisionParts`.
147
+ Hard contact reduces the struck part's joint integrity; a broken joint releases its named GLB
148
+ geometry as debris with its own velocity, spin, gravity and collisions. Other parts stay attached.
149
+ Lost wheels reduce grip and drive force on their axle; front-wheel loss also reduces steering.
150
+ Hard landings can break wheel joints. This remains a grounded chassis approximation: the body
151
+ does not roll over or simulate individual suspension collapse after losing a wheel.
152
+
153
+ Each part declares `id`, `role` (`frontWheel`, `rearWheel`, `panel` or `engine`), model-space
154
+ `center`, sphere `probes` and `radius`, `massFraction`, `breakSpeed` in m/s, and exact GLB `nodes`.
155
+ An optional `hinge` has a `pivot`, unit `axis`, full-travel `angle` and `actuator` name; it moves
156
+ door, hood and trunk probes with the panel. Joint strengths are gameplay tuning. Hosts supply
157
+ `VehicleEnvironment.contacts(probes, entity)` for detailed obstacles alongside `canOccupy` for
158
+ the chassis. Chassis impacts also load nearby joints using the inferred contact point, even
159
+ with only `canOccupy`. `vehicleObstacleContacts` from `client/vehicles` adapts resident triangle geometry
160
+ and nearby vehicles. Detailed contacts additionally detect parts extending beyond the chassis.
161
+
162
+ `vehicleState.damage` and `debris` survive keyframes. Debris expires after 20 simulation seconds;
163
+ the part stays missing. Pass the state as the sixth argument to `VehicleVisual.update` to apply
164
+ damage after animation; Earth view and World Explorer do this automatically. Press **R** once
165
+ stopped to repair parts in place. Hosts can call `EarthVehicles.recover()`, `EarthView.recover()`
166
+ in drive mode, or `repairVehicle(world, id)` from `kernel/vehicles`. Glass has its own fracture
167
+ state and is not repaired by this operation. Other vehicles remain static collision targets;
168
+ debris-to-debris collisions and damage transfer into the struck vehicle are not simulated.
169
+
139
170
  All durable simulation state and mount relationships live in ECS components and survive keyframes
140
171
  and replay. Install the same systems/environment when restoring. Host streaming and render resources
141
172
  are separate from those checkpoints.
@@ -151,6 +182,21 @@ ground (under open sky, never a roof or deck), `board(id)` without walking to th
151
182
  in. The entity's `vehicle.color`, when set, paints the model's `paintMaterial`; without one the
152
183
  authored paint stays.
153
184
 
185
+ A host can make boarding two presses, as the world explorer does: `openDoor(eye)` opens the shut
186
+ front door (`doorFrontLeft` or `doorFrontRight`) on the walker's side of the nearest car in reach
187
+ and returns false when there is none, so the next press falls through to `enter(eye)`.
188
+ `closedDoor(id, eye)` names that door for a prompt. The door shuts behind the driver, or once
189
+ nobody is within reach; calling `openDoor(eye, id)` after `exit()` swings it open as the driver
190
+ steps out.
191
+
192
+ A stopped [ambient traffic](ambient-life.md#taking-a-stopped-car) car (slower than 0.5 m/s) is a
193
+ car in reach too, in `mountEarthView` and for these methods: `openDoor` or `enter` takes it out
194
+ of traffic, and a drivable car of its type and paint stands at its pose, after which the doors,
195
+ seats and exits work as for any parked car. `trafficSolids()` lists circles around the cars a
196
+ driver has left standing, for `EarthAmbient.sync`, so traffic queued behind one keeps its gap
197
+ until it drives off. A taken car nobody drove away rejoins traffic once its model unloads 65 m
198
+ away; one driven elsewhere stays parked. Moving traffic is never boardable.
199
+
154
200
  Parked cars become simulation entities only within 300 m of the observer passed to `sync`, to
155
201
  approach, board and collide with; farther ones that nobody moved are reclaimed and stay part of
156
202
  their tile's merged mesh. Under an aircraft a town's parked cars were otherwise thousands of
@@ -20,7 +20,7 @@ Add this entity to a `molen/scene@3` manifest:
20
20
  "referenceAltitude": 0,
21
21
  "gasConstant": 287.05
22
22
  },
23
- "clouds": { "coverage": 0.98, "density": 0.95, "baseAltitude": 1600, "thickness": 1200, "scale": 16000 },
23
+ "clouds": { "type": "stratus", "coverage": 0.98, "density": 0.95, "baseAltitude": 1600, "thickness": 1200, "scale": 16000 },
24
24
  "precipitation": { "kind": "rain", "intensity": 0.7 },
25
25
  "visibility": 4500,
26
26
  "seed": 1
@@ -37,8 +37,8 @@ Weather participates in state hashes, checkpoints and replays.
37
37
 
38
38
  `WeatherData`, `weatherSchema`, `resolveWeather`, `WeatherProfile` and `weatherProfile` are
39
39
  exported by `@bendyline/molen-schema`. The client re-exports the types, resolver and presets.
40
- `weatherProfile('sunny' | 'partly-cloudy' | 'overcast' | 'rain' | 'snow' | 'fog')` returns fresh
41
- editable data. `resolveWeather(data)` supplies defaults and copies nested values. Validate
40
+ `weatherProfile('sunny' | 'partly-cloudy' | 'overcast' | 'rain' | 'storm' | 'snow' | 'fog')`
41
+ returns fresh editable data. `resolveWeather(data)` supplies defaults and copies nested values. Validate
42
42
  external data with `weatherSchema.parse` before using it in typed code.
43
43
 
44
44
  | Parameter | Meaning |
@@ -51,8 +51,10 @@ external data with `weatherSchema.parse` before using it in typed code.
51
51
  | `atmosphere.windVelocity` | World XYZ velocity in m/s; +X east and -Z north in Earth worlds. A velocity toward a direction, not a meteorological "from" bearing. |
52
52
  | `atmosphere.referenceAltitude` | Absolute world Y where temperature/pressure apply, default 0 m. |
53
53
  | `atmosphere.gasConstant` | Specific gas constant, default 287.05 J/(kg·K) for dry air; configurable for other worlds. |
54
- | `clouds.coverage`, `density` | Independent 0–1 coverage and optical density controls. |
55
- | `clouds.baseAltitude`, `thickness`, `scale` | Absolute base Y, layer separation, and horizontal pattern repeat size in meters. |
54
+ | `clouds.type` | `cumulus` (default): separate fair-weather heaps; `stratocumulus`: a lumpy, closed layer; `stratus`: a flat grey sheet; `cumulonimbus`: towering storm cells with anvil tops (give them a deep layer). |
55
+ | `clouds.coverage`, `density` | Independent 0–1 controls: the share of the sky the layer covers (1 closes it) and its optical density. |
56
+ | `clouds.baseAltitude`, `thickness`, `scale` | Absolute base Y and depth of the layer, and the horizontal pattern repeat size, in meters. |
57
+ | `clouds.cirrus`, `cirrusAltitude` | Coverage 0–1 of a thin, wispy high cirrus layer (default 0) and its absolute Y (default 9000 m). Independent of the main layer. |
56
58
  | `precipitation.kind`, `intensity` | Explicit none/rain/snow and 0–1 visual intensity; not calibrated mm/hour. |
57
59
  | `visibility` | Approximate visual fade distance in meters, independent of clouds and precipitation. |
58
60
  | `wind.referenceHeight` | Height above ground in meters where `windVelocity` applies; default 10. |
@@ -62,6 +64,8 @@ external data with `weatherSchema.parse` before using it in typed code.
62
64
  | `wind.terrain` | 0–1 strength of slope flow: lift up windward hillsides, sink and rougher air in the lee; default 0. |
63
65
 
64
66
  Presets are starting points, not classifications that constrain these independent parameters.
67
+ Partly cloudy is cumulus under some cirrus, overcast a closed stratocumulus deck, rain and snow
68
+ stratus, and storm scattered cumulonimbus 7 km deep with heavy rain.
65
69
  Every preset includes a `wind` block: light chop and gusts for sunny skies, rougher air in rain,
66
70
  and nearly still, strongly sheared air in fog.
67
71
 
@@ -139,30 +143,65 @@ viewer.renderer.setWeatherTimeOverride(undefined); // resume simulation time
139
143
  viewer.renderer.setWeather(undefined); // remove weather effects
140
144
  ```
141
145
 
142
- Clouds use two wind-advected procedural layers at absolute world altitudes. They occlude
143
- celestial bodies, tint through dusk/night, and reduce direct lighting. Rain and snow share a
144
- bounded camera-local particle batch with wind drift. Seed/time sampling is deterministic;
145
- floating-origin changes preserve world alignment. No simulation random numbers are consumed.
146
+ The cloud layer is a volume, ray-marched between `baseAltitude` and the top of the layer on
147
+ both backends: a weather map decides where clouds stand, a 3D billow noise carves them, and each
148
+ sample is lit by marching toward the sun (or moon), so cumulus have flat grey bases and bright,
149
+ rounded tops, a closed deck is lumpy underneath, and a low sun lights cloud bases from below.
150
+ You can fly over, under and into it; inside a cloud the view whites out. Cirrus are a flat sheet
151
+ of wind-combed streaks at `cirrusAltitude`. Clouds drift with the mean wind, cumulus slowly boil,
152
+ cirrus ride faster, and all of them occlude celestial bodies, tint through dusk and night, take
153
+ the scene's haze (less of it looking up, since haze lies near the ground) and reduce direct
154
+ lighting. Rain and snow share a bounded camera-local particle batch with wind drift. Seed/time
155
+ sampling is deterministic; floating-origin changes preserve world alignment. No simulation
156
+ random numbers are consumed.
157
+
158
+ `viewer.renderer.setCloudQuality('low' | 'medium' | 'high' | 'ultra')` (default `'medium'`) sets
159
+ the work per pixel: ray-march steps and light samples, edge erosion from `'high'`, and from
160
+ `'high'` cloud shadows. Cloud shadows project the cloud field along the sun onto every lit
161
+ surface, terrain, buildings and vehicles alike, and replace the even dimming of direct light that
162
+ cloud cover applies at lower qualities. The quality is uniform-driven, so changing it, even every
163
+ frame, rebuilds no shader. `mountEarthView` sets it from its performance tier: low at the two
164
+ lowest levels, medium up to Balanced, high and ultra above (with cloud shadows). Measured on a
165
+ 1280x720 partly cloudy view, clouds cost about 0.5-0.7 ms of GPU time at low and 1.0-1.7 ms at
166
+ medium to ultra on an integrated laptop GPU, and 0.15-0.65 ms on a discrete one; looking out
167
+ from inside a cloud costs about twice that.
168
+
169
+ The deck is one draw (a camera-centred plane where view rays enter the layer, or nested shells
170
+ around a camera inside it, so nearer geometry hides it through the ordinary depth test), cirrus
171
+ one more and precipitation one. The noise is generated once per page, a few milliseconds per
172
+ frame, and the clouds appear when it is ready (about a second); sunny startup generates no cloud
173
+ noise and allocates no particle batch. Animation follows simulation time independently of a
174
+ sky-time preview override, so pauses and captures remain repeatable.
175
+
176
+ On WebGL, cloud shadows reach a lit material through three's lighting chunks. A material that
177
+ installs its own `onBeforeCompile` keeps them by calling the prototype's first:
146
178
 
147
- Standard materials work on WebGL and WebGPU, with up to two cloud draws and one precipitation
148
- draw. Textures generate locally when needed; sunny startup generates no cloud noise and
149
- allocates no particle batch. Animation follows simulation time independently of a sky-time
150
- preview override, so pauses and captures remain repeatable.
179
+ ```ts
180
+ material.onBeforeCompile = (shader, renderer) => {
181
+ THREE.Material.prototype.onBeforeCompile.call(material, shader, renderer);
182
+ // ...the material's own changes
183
+ };
184
+ ```
185
+
186
+ On WebGPU every node material receives them through the directional lights.
151
187
 
152
188
  Weather visibility temporarily limits scene fog; a nearer authored terrain fog limit and its
153
- clear foreground are preserved when weather visibility reaches beyond that limit. Removing
154
- weather restores the authored fog and lighting. Clouds are layered
155
- surfaces, not ray-marched 3D volumes: flying through a layer does not simulate condensation.
156
- Precipitation is a local visual field, including above cloud layers, without roof/terrain
157
- collision, splash, accumulation or wet-material response.
189
+ clear foreground are preserved when weather visibility reaches beyond that limit. Under a closed
190
+ deck the fog turns grey. Removing weather restores the authored fog and lighting. Clouds are a
191
+ visual volume: flying through one does not simulate icing, turbulence or condensation (wind
192
+ turbulence is the `wind` block's). Precipitation is a local visual field, including above cloud
193
+ layers, without roof/terrain collision, splash, accumulation or wet-material response.
158
194
 
159
195
  ## World explorer
160
196
 
161
- The Weather dropdown includes Fair, Sunny / clear, Partly cloudy, Overcast, Rain, Snow and Fog.
197
+ The Weather dropdown includes Fair, Sunny / clear, Partly cloudy, Overcast, Rain, Thunderstorms,
198
+ Snow and Fog.
162
199
  The explorer opens on Fair, its own preset: Sunny with scattered fair-weather cumulus (30%
163
200
  coverage at 45% density, in 24 km cells rather than the default 16 km), so a street-level sky is
164
- not a bare gradient and the deck breaks into separate clouds instead of streaks at the horizon. Weather details mixes cloud coverage/density/altitude, precipitation, intensity, visibility,
165
- temperature, pressure and wind, marking the profile Custom. Temperature and pressure controls
201
+ not a bare gradient and the layer breaks into separate clouds toward the horizon. Weather
202
+ details mixes cloud type, coverage, density, base, depth and cirrus, precipitation, intensity,
203
+ visibility, temperature, pressure and wind, marking the profile Custom. Cloud quality follows the
204
+ graphics quality; High casts cloud shadows. Temperature and pressure controls
166
205
  refer to sea level, displayed in °C and hPa and stored in kelvin and pascals. The same component
167
206
  is installed in the explorer's vehicle/aircraft simulation.
168
207
 
@@ -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.9. 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.10. 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
 
@@ -38,7 +38,7 @@ downloads them into a project and pins them in project.json.
38
38
  - [WebGPU and WebGL](guide/rendering-backends.md): the `backend` option ('auto' | 'webgl' | 'webgpu') on the asynchronous client factories, legacy WebGL fallback, compatible materials, and world-explorer comparisons.
39
39
  - [Earth and authored skies](guide/sky.md): day/night cycles, geographic Sun/Moon positions and lunar phases, catalog stars, simulation clocks, custom-world palettes, and the sky observatory.
40
40
  - [Night lighting](guide/night-lighting.md): deterministic occupied windows, streetlamp emission and pavement pools, dusk activation, and light metadata for authored models.
41
- - [Weather and physical atmosphere](guide/weather.md): independent clouds, precipitation and visibility; profiles, temperature/pressure/wind for simulation and aircraft physics; cloud/rain/snow rendering.
41
+ - [Weather and physical atmosphere](guide/weather.md): independent clouds (cumulus, stratocumulus, stratus, cumulonimbus, cirrus), precipitation and visibility; profiles, temperature/pressure/wind for simulation and aircraft physics; volumetric cloud, cloud-shadow, rain and snow rendering and cloud quality.
42
42
  - [Sound and music](guide/audio.md): sound banks, `audioEnvironment`/`audioSource`/`audioZone` rules driven by weather, sky, listener and entity signals, `molen.audio.*` in scripts, `molen audio plan` to hear a scene headlessly, and the CC0 `molen.sounds` pack.
43
43
  - [Graphics performance](guide/graphics-performance.md): sparse transforms, static instancing, worker preparation, staged uploads, animation/light policy and terrain transitions.
44
44
  - [Terrain and world explorer](guide/terrain.md): fixed-grid and screen-space pyramid streaming,
@@ -60,6 +60,7 @@ downloads them into a project and pins them in project.json.
60
60
  - [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`.
61
61
  - [Components](schemas/components.md): the component vocabulary `molen validate` checks against.
62
62
  - [Mountable vehicles](guide/vehicles.md): stable parking entities, driver seats, deterministic vehicle physics, safe exits, and cockpit/chase views.
63
+ - [Glass surfaces](guide/glass.md): physics-driven fracture, laminated windshield retention, tempered granules, independent frame failure, persistent state and render bindings.
63
64
  - [Boost mode](guide/boost-mode.md): optional 4× travel for people, vehicles and ambient life; Earth T toggle, host API and snapshot-safe kernel setting.
64
65
  - [Boats and water](guide/boats.md): powered hulls, helm controls, passengers, boarding points, swells, currents and Earth-view water coverage.
65
66
  - [Aircraft](guide/aircraft.md): P-51D and OH-6 assets, flight physics, cockpit instruments, practice airfield and controls.