@bendyline/molen-tooling 0.0.11 → 0.0.13

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 (70) hide show
  1. package/dist/capture/harness.js +682 -293
  2. package/dist/capture/worldgen-preview.js +396 -298
  3. package/dist/cli.mjs +2 -2
  4. package/dist/docs-src/guide/3d-art-guidelines.md +34 -10
  5. package/dist/docs-src/guide/3d-model-assets.md +27 -2
  6. package/dist/docs-src/guide/adaptive-performance.md +42 -7
  7. package/dist/docs-src/guide/aircraft.md +249 -27
  8. package/dist/docs-src/guide/ambient-life.md +28 -5
  9. package/dist/docs-src/guide/audio.md +19 -5
  10. package/dist/docs-src/guide/boats.md +9 -4
  11. package/dist/docs-src/guide/boost-mode.md +64 -0
  12. package/dist/docs-src/guide/building-interiors.md +7 -2
  13. package/dist/docs-src/guide/determinism.md +1 -1
  14. package/dist/docs-src/guide/dioramas.md +17 -4
  15. package/dist/docs-src/guide/earth-view.md +225 -24
  16. package/dist/docs-src/guide/entities.md +87 -5
  17. package/dist/docs-src/guide/figures.md +31 -7
  18. package/dist/docs-src/guide/graphics-performance.md +203 -24
  19. package/dist/docs-src/guide/input.md +34 -1
  20. package/dist/docs-src/guide/liveries.md +167 -0
  21. package/dist/docs-src/guide/livery-catalog.md +2659 -0
  22. package/dist/docs-src/guide/livery-gallery.md +2684 -0
  23. package/dist/docs-src/guide/medium-fi.md +279 -27
  24. package/dist/docs-src/guide/navigation.md +5 -2
  25. package/dist/docs-src/guide/night-lighting.md +96 -0
  26. package/dist/docs-src/guide/project.md +6 -1
  27. package/dist/docs-src/guide/recognizable-places.md +6 -0
  28. package/dist/docs-src/guide/regional-fleets.md +94 -0
  29. package/dist/docs-src/guide/regional-world.md +19 -6
  30. package/dist/docs-src/guide/rendering-backends.md +6 -2
  31. package/dist/docs-src/guide/sky.md +36 -3
  32. package/dist/docs-src/guide/structure-library.md +4 -1
  33. package/dist/docs-src/guide/surface-rendering.md +276 -2
  34. package/dist/docs-src/guide/terrain.md +43 -0
  35. package/dist/docs-src/guide/typography.md +105 -0
  36. package/dist/docs-src/guide/vehicle-interiors.md +169 -9
  37. package/dist/docs-src/guide/vehicles.md +26 -3
  38. package/dist/docs-src/guide/weather.md +15 -8
  39. package/dist/docs-src/guide/worldgen.md +100 -13
  40. package/dist/docs-src/llms.txt +9 -1
  41. package/dist/docs-src/schemas/README.md +3 -0
  42. package/dist/docs-src/schemas/archstyle.md +65 -0
  43. package/dist/docs-src/schemas/components.md +2009 -213
  44. package/dist/docs-src/schemas/fleet-catalog.md +113 -0
  45. package/dist/docs-src/schemas/landmark.md +10 -0
  46. package/dist/docs-src/schemas/matgraph.md +11 -1
  47. package/dist/docs-src/schemas/pack-source.md +11 -1
  48. package/dist/docs-src/schemas/pack.md +1 -1
  49. package/dist/docs-src/schemas/project.md +1 -1
  50. package/dist/docs-src/schemas/regional-catalog.md +39 -0
  51. package/dist/docs-src/schemas/scatter.md +36 -0
  52. package/dist/docs-src/schemas/structure-placement-data.md +753 -0
  53. package/dist/docs-src/schemas/structure-placement-index.md +87 -0
  54. package/dist/docs-src/schemas/structure-placements.md +274 -0
  55. package/dist/docs-src/schemas/transport-network.md +8 -0
  56. package/dist/docs-src/schemas/types.md +1 -1
  57. package/dist/docs-src/schemas/worldgen-batch.md +145 -0
  58. package/dist/index.d.mts +2 -0
  59. package/dist/index.mjs +1 -1
  60. package/dist/{mcp-BbxqqnD1.mjs → mcp-BXaK46X-.mjs} +1 -1
  61. package/dist/{ops-b4Pag8U-.mjs → ops-Cm7WNvb9.mjs} +55 -22
  62. package/dist/templates/city-courier/gen/molen-types.ts +240 -17
  63. package/dist/templates/city-courier/scripts/molen-scripts.d.ts +240 -17
  64. package/dist/templates/figures-gallery/test/headless.test.ts +2 -1
  65. package/dist/templates/index.json +17 -17
  66. package/dist/templates/skybound/gen/molen-types.ts +240 -17
  67. package/dist/templates/skybound/scripts/molen-scripts.d.ts +240 -17
  68. package/dist/templates/top-down-arena/scripts/molen-scripts.d.ts +240 -17
  69. package/dist/templates/top-down-arena/src/gen/molen-types.ts +240 -17
  70. package/package.json +13 -13
@@ -0,0 +1,105 @@
1
+ # Fonts and world-space lettering
2
+
3
+ Use the shared font engine for shop names, highway signs, equipment labels and generated models.
4
+ `@bendyline/molen-materials/text` lays out text and emits indexed triangles without DOM, canvas,
5
+ three.js, GPU state or a system-font dependency. `@bendyline/molen-client/text` adds a three.js
6
+ geometry adapter and an offline outline compiler. Both consume the same host-supplied font data.
7
+
8
+ ## Loading fonts
9
+
10
+ `loadEarthContent` reads the Earth pack's `provides.fonts` catalog into `content.fonts`. Earth
11
+ view and world explorer pass it to road surfaces and storefront models. The stock catalog has
12
+ Overpass semibold (`highway`), Overpass regular (`sans`), Overpass Mono semibold (`mono`), and
13
+ Molen Sign Serif (`serif`, derived from Libre Baskerville). Overpass is inspired by Highway
14
+ Gothic; it does not reproduce an exact FHWA alphabet. Font assets carry their SIL OFL licenses
15
+ inside the content pack. Libraries ship code, not font files, and never choose a font host.
16
+
17
+ For another pack or local content source:
18
+
19
+ ```ts
20
+ import { loadFontLibrary } from '@bendyline/molen-materials/text';
21
+
22
+ const fonts = await loadFontLibrary(
23
+ await pack.readJson('fonts/catalog.json'),
24
+ (path) => pack.readJson(`fonts/${path}`),
25
+ );
26
+ ```
27
+
28
+ The catalog format is `molen/font-catalog@1`, with `defaultFont`, a `fonts` map from id to
29
+ catalog-relative JSON path, and optional `roles` mapping semantic names to ids. Loading validates
30
+ font ids, metrics and triangle buffers. Treat a loaded library as immutable; replace it with
31
+ a new library when changing faces. Terrain workers receive it once per change, not per tile.
32
+ Old packs without fonts still load; panels and symbols render without lettering until a host
33
+ supplies a library.
34
+
35
+ ## Rendering and fitting
36
+
37
+ ```ts
38
+ import * as THREE from 'three';
39
+ import { createTextGeometry } from '@bendyline/molen-client/text';
40
+
41
+ const geometry = createTextGeometry('Café Étoile', fonts, {
42
+ font: 'serif',
43
+ size: 0.6,
44
+ maxWidth: 3.2,
45
+ maxHeight: 0.5,
46
+ align: 'center',
47
+ verticalAlign: 'center',
48
+ });
49
+ const label = new THREE.Mesh(geometry, new THREE.MeshStandardMaterial({ color: '#eeeadd' }));
50
+ label.position.set(0, 2.8, 0.11);
51
+ scene.add(label);
52
+ ```
53
+
54
+ Text lies in XY with its front facing +Z. Rotate/place it in the sign's local frame and keep it
55
+ slightly ahead of the panel to prevent z-fighting. The caller owns the geometry and material;
56
+ dispose them when no longer used. Merge static labels into material batches or export their
57
+ buffers into a GLB, rather than adding a draw call for every letter.
58
+
59
+ `buildTextMesh(text, fonts, options)` returns `positions`, `indices`, fitted `width` and `height`,
60
+ the rendered `text`, `missingGlyphs`, and `truncated`. It uses proportional advances, pair
61
+ kerning, NFC normalization, Unicode code points and explicit `\n` line breaks. `size` is the
62
+ maximum em size; width/height constraints uniformly shrink the whole label. Glyphs are never
63
+ stretched sideways. `overflow: 'ellipsis'` shortens each line at the requested size before
64
+ fitting; default is `shrink`. `letterSpacing` adds em spacing, `lineHeight` sets baseline spacing,
65
+ and `fallbackFonts` supplies additional face ids/roles. `maxCharacters` bounds work (default 256,
66
+ maximum 4096). The geometry adapter exposes the same diagnostics in `geometry.userData.textLayout`.
67
+
68
+ The stock subset covers available Latin, accented Latin, digits, punctuation and arrows.
69
+ Unknown characters use a visible `?` and appear in `missingGlyphs`; they are never silently
70
+ dropped. This is left-to-right layout with pair kerning, not a complex-script shaper. Arabic,
71
+ Indic shaping, bidirectional paragraphs and automatic word wrapping need a shaping/layout stage
72
+ before adding those scripts. Font family selection alone does not provide that stage.
73
+
74
+ ## Signs and authored assets
75
+
76
+ Pass `{ fonts, signFont: 'highway' }` to `createTerrainSurfaceRenderer` or
77
+ `createTerrainSurfaceObject`. Preserve `fonts` when calling `setOptions`. Sign text keeps the
78
+ source's case and accents; an exit number still comes only from mapped exit metadata.
79
+
80
+ Storefront `SignDesign`/landmark `sign` accepts `font` and `letterSpacing`. Call
81
+ `generateSignModel(design, detail, fonts)`, `generateLandmarkModel(id, definitions, detail, fonts)`,
82
+ or `new ModelLibrary(loader, definitions, disposeLoadedScene, plants, fonts)`. Detail 2 keeps
83
+ the panel and mark and omits name lettering. `molen worldgen preview` also reads the `fonts` catalog provided by its style or configured
84
+ project content packs (including the Earth pack). Fine signs use real text instead of decorative
85
+ stripes. The generators' buffers can be passed to `encodeGlb` like any other model.
86
+
87
+ For Node asset generators, call `createTextGeometry` and merge its triangles into the authored
88
+ mesh; this is the same API used in the browser. Existing baked GLBs must be regenerated to
89
+ change their lettering. Seven-segment electronic displays can retain their physical segments;
90
+ fixed captions around those displays should use font geometry.
91
+
92
+ ## Compiling another face
93
+
94
+ `compileVectorFont(typefaceJson, { id, characters, weight, style, curveSegments, kerning })`
95
+ from `@bendyline/molen-client/text` converts three.js `FontLoader` typeface data to a serializable
96
+ `molen/vector-font@1` document. It preserves counters/holes and uses a configurable outline
97
+ tessellation (default six segments per curve). Store that document, its license and provenance
98
+ in your content pack. Runtime rendering does not parse TTFs or retessellate outlines.
99
+
100
+ TTFLoader output is accepted. It uses historical 100000/72 outline units per em: set its
101
+ `resolution = 100000 / 72` before compiling if you need true em metrics. Supply pair kerning
102
+ in matching em units from your font parser; TTFLoader's JSON does not include kerning tables.
103
+ Variable fonts use their default outlines unless instantiated to a static face beforehand.
104
+ Regular, bold and italic variants are separate faces, not synthetic distortions. Check the
105
+ font's redistribution license and reserved-name terms before shipping a compiled subset.
@@ -32,8 +32,9 @@ Sources use explicit path segments, not JavaScript expressions or dot-split stri
32
32
  on the same entity; numbers are passed through, booleans become 0/1, and missing/nonfinite values
33
33
  are ignored. Declare custom components such as `avionics` in the scene or type registry;
34
34
  deterministic entity scripts can publish calculated RPM, sensor values, or switch positions to
35
- them. Unit conversions and instrument calibration belong in the asset's bindings, or in a
36
- simulation script for nonlinear/computed readings. Render bindings never write back to physics.
35
+ them. Unit conversions and instrument calibration belong in the asset's derived signals and
36
+ bindings; simulated systems belong in deterministic scripts or kernel code. Render bindings
37
+ never write back to physics.
37
38
 
38
39
  Bindings receive the latest values even if the GLB finishes loading later. Replacing/removing
39
40
  bindings restores their authored transforms. Signal-driven models stay out of static mesh
@@ -43,8 +44,9 @@ the same channel to multiple systems. Other clip channels keep animating normall
43
44
  Custom hosts can use `createModelSignalVisual(model, spec)` and `readModelSignals(sources,
44
45
  readComponent)` from `@bendyline/molen-client`. `update(signals)` accepts arbitrary named numeric
45
46
  telemetry, `reset()` restores the authored pose, and `missingNodes` diagnoses unresolved names.
46
- This is a transform-binding foundation for analog gauges, tapes, levers and moving parts;
47
- text readouts, emissive annunciators and render-to-texture avionics screens are not implemented.
47
+ This supports analog gauges, tapes, levers, moving parts, visibility flags and model-owned
48
+ seven-segment readouts. General text layout, changing emissive intensity and render-to-texture
49
+ avionics screens are separate capabilities.
48
50
 
49
51
  ## Source ownership
50
52
 
@@ -54,9 +56,38 @@ and horizon placement) and `models/interior.mjs` (their local cockpit builder).
54
56
  `models/generate.mjs` includes that cockpit in the main GLB. Each aircraft can change its
55
57
  layout and builder independently. All of these files are inventoried by `source.json`.
56
58
 
57
- The five road vehicles have editable GLB interiors. Their current basic dashboard/chassis
58
- geometry is merged into `body`, with a separate steering wheel. Edit these meshes in a DCC
59
- to add cabin detail. There is no universal dashboard fabricated by the runtime.
59
+ The controllable fleet has model-owned interiors for road vehicles, RVs, cycles, boats, transit
60
+ and aircraft. Road dashboard profiles live in `content/entities/source/interiors.json`; the
61
+ authoring helpers in `packages/entities/scripts/vehicle-interiors.mjs` build them into the main
62
+ GLB. Profiles specify the dashboard generation, instrument arrangement, vents, selector,
63
+ steering wheel and trim. MINI's central speedometer, Audi TT's driver-only display, Tesla's
64
+ single center screen and commercial-vehicle controls are separate layouts. The five original
65
+ editable road masters stay intact; `detailed.glb` removes their solid cabin infill and adds
66
+ new seats, enclosed footwells and the authored dashboard while preserving the exterior skin.
67
+ There is no dashboard fabricated by the runtime and no reference-photo download in the client.
68
+
69
+ Photo citations, authors, exact licenses, generation/trim caveats and unfilled reference gaps
70
+ are recorded in `content/entities/source/interior-references.json` and its adjacent
71
+ `INTERIORS.md`. Prefer a correctly matched CC0/public-domain photo; CC BY and CC BY-SA are
72
+ acceptable research references with recorded attribution. Never infer a photo's license from
73
+ the Commons site's metadata license, and never treat open source as a blanket license grant.
74
+ These models use original polygon geometry rather than photo textures. Embedding a photo or
75
+ an adaptation later requires handling that image's attribution and, where applicable,
76
+ ShareAlike terms separately from the software license.
77
+
78
+ Check both the exact seated camera and a wider, downward-looking cabin view. The former proves
79
+ sightlines; the latter exposes center-stack, console, door-card and control placement. Leave
80
+ daylight through real glazing, preserve animated pivots, and keep abstract display graphics
81
+ distinct from live telemetry. A named model is a generation-informed approximation, not a
82
+ certified trim-level reproduction; steering side remains the existing fleet convention.
83
+
84
+ Apply the [vehicle reference overlay goal](medium-fi.md#vehicle-reference-overlays) to the
85
+ interior independently of the exterior. Overlay panel drawings and cabin sections with matching
86
+ orthographic renders where available; match camera pose and field of view for cockpit photos.
87
+ Verify the panel outline, tilt and depth, windshield pillars, console, seats and control reach
88
+ before adding labels and small switches. Record calibration and differences, including unknown
89
+ depths or variant mismatches. If suitable interior references cannot be found, document the
90
+ search and mark the affected geometry as approximate; do not infer approval from exterior QA.
60
91
 
61
92
  Aircraft generators accept `--out /path/to/candidate.glb` for reviewing changes without
62
93
  overwriting the master or baseline. Import an approved master with `molen asset import`, update
@@ -86,15 +117,30 @@ the source manifest hash, and run the entity package's `generate` command for ag
86
117
 
87
118
  Bindings add `clamp(signal * scale + offset, min, max)` to a node's authored local transform.
88
119
  `rotation` uses radians; `position` uses meters (useful for tapes and levers). Limits are optional.
89
- Repeated updates do not accumulate movement. Missing/nonfinite signals leave channels unchanged.
120
+ Repeated updates do not accumulate movement. Missing/nonfinite signals hold the last reading by
121
+ default; `missing: "rest"` restores the authored pose. A `visible` binding omits `axis`, displays
122
+ its node when the calibrated value is positive, and can use `missing: "hide"` to blank it.
90
123
  Duplicate names animate together, but GLTFLoader can suffix duplicate GLB names with `_1`;
91
124
  bind the loaded names explicitly. Two bindings cannot write the same node/property/axis.
92
125
  `nodes` identifies cabin geometry and never changes its visibility.
93
126
 
94
- Aircraft signals are `airspeed` (m/s), `altitude`/`altitudeAGL` (m), `verticalSpeed` (m/s),
127
+ Aircraft signals are `airspeed`/`trueAirspeed` (true air-relative speed, m/s),
128
+ `altitude`/`altitudeAGL` (m), `verticalSpeed` (m/s),
95
129
  `heading`/`pitch`/`roll` (radians), `rpm`/`power` (0–1), `pitchInput`/`rollInput`/`yawInput`
96
130
  and `elevator` (-1–1), `gear`/`flaps` (the positions 0–1 as they travel, 0 up), and
97
131
  `engine`/`brake`/`grounded` (0 or 1). Calibration belongs to each model.
132
+ Additional signals are `groundSpeed` (horizontal m/s), `angleOfAttack`/`sideslip` (radians),
133
+ `pitchRate`/`rollRate`/`yawRate` (rad/s), `loadFactor` (g), and `stalled`/`crashed` (0 or 1).
134
+ Unavailable optional simulation fields stay unavailable. `rpmNormalized` aliases `rpm`.
135
+ A single-engine spec also supplies `rotorRpm` in revolutions per minute, calculated from its
136
+ configured shaft/rotor angular speed. Engine banks supply `engines.<id>.rpmNormalized`,
137
+ `engines.<id>.rotorRpm`, `engines.<id>.failed` and `engines.<id>.thrustN` separately; a missing
138
+ engine reading never falls back to another engine.
139
+
140
+ The Earth host additionally provides `trueHeading` (clockwise from north, radians), `airDensity`
141
+ (kg/m³, from the atmosphere used by flight physics) and `staticPressure` (Pa, when weather is
142
+ available). The legacy `heading` signal is raw simulation yaw, not a magnetic compass reading.
143
+
98
144
  Cars supply `steering` and `wheelAngle` (radians); their optional third `update` argument accepts
99
145
  additional signals. World explorer passes `speed` (signed m/s), `heading`/`pitch`/`roll` (radians),
100
146
  `throttle` (-1–1), `brake` (0 or 1) and the sprung body's `bodyRoll`/`bodyPitch` (radians), which
@@ -106,6 +152,8 @@ so an asset can bind a gauge to script-owned state or to an individual engine. O
106
152
  hosts pass resolved readings as the aircraft visual's optional fourth `update` argument or the
107
153
  car visual's third argument. Choose the interior adapter or the automatic `model.signals`
108
154
  component for a given model; do not let two adapters own the same transform channel.
155
+ An explicitly declared source that is unavailable overrides a host convenience reading with
156
+ missing data. It never silently substitutes the host reading for a missing sensor.
109
157
 
110
158
  The `createVehicleInteriorVisual(model, spec)` wrapper around model signals is exported from
111
159
  `@bendyline/molen-client/vehicles`. Its `update(signals)` also accepts custom telemetry names,
@@ -119,6 +167,106 @@ Legacy explicit `controlStick`, `collective` and `steeringWheelNode` bindings wo
119
167
  convention is removed: assets must list instruments explicitly. `airspeedGaugeMax` remains
120
168
  legacy metadata and no longer drives a gauge.
121
169
 
170
+ ## Named variables and expressions
171
+
172
+ Every `interior`, `animation`, or `model.signals` block can declare `derived` variables. Numeric
173
+ operands are constants; string operands are signal names. Give intermediate results names to
174
+ build a dependency graph. Declaration order does not matter. Formulas are data, with no JavaScript,
175
+ property traversal, assignment, clocks, random numbers or simulation side effects:
176
+
177
+ ```json
178
+ {
179
+ "derived": {
180
+ "airspeedKnots": { "op": "multiply", "args": ["trueAirspeed", 1.9438444924406048] },
181
+ "altitudeFeet": { "op": "divide", "args": ["altitude", 0.3048] },
182
+ "climbFeetPerMinute": { "op": "multiply", "args": ["verticalSpeed", 196.8503937007874] },
183
+ "gearUnlocked": { "op": "less", "args": ["gear", 0.99] },
184
+ "lowHeight": { "op": "less", "args": ["altitudeAGL", 100] },
185
+ "gearWarning": { "op": "and", "args": ["gearUnlocked", "lowHeight"] }
186
+ },
187
+ "bindings": [
188
+ {
189
+ "node": "speed-pointer", "source": "airspeedKnots",
190
+ "property": "rotation", "axis": "z",
191
+ "keys": [[0, -2.2], [40, -1.5], [80, 0], [160, 2.2]],
192
+ "responseSeconds": 0.2, "missing": "rest"
193
+ },
194
+ {
195
+ "node": "gear-warning-lamp", "source": "gearWarning",
196
+ "property": "visible", "scale": 1, "missing": "hide"
197
+ }
198
+ ]
199
+ }
200
+ ```
201
+
202
+ This is illustrative calibration and a simple warning rule, not an aircraft-specific operating
203
+ limit. Measure the real face's angles and scale markings before supplying its calibration.
204
+ The automatic `model.signals` component also requires `sources` mappings for every external
205
+ variable; aircraft/vehicle adapters can obtain them from host telemetry instead.
206
+
207
+ | Operators | Operands and result |
208
+ | --- | --- |
209
+ | `add`, `multiply`, `min`, `max` | 2–16 numbers |
210
+ | `subtract`, `divide` | Exactly 2, in order |
211
+ | `clamp` | Value, minimum, maximum |
212
+ | `abs`, `sqrt`, `floor` | Exactly 1 |
213
+ | `modulo` | Value, positive period; result in [0, period) even for negative values |
214
+ | `sin`, `cos`, `atan2` | Angles in radians; `atan2` takes y, x |
215
+ | `less`, `greater`, `equal` | Compare 2 values; result 0 or 1 |
216
+ | `and`, `or`, `not` | Nonzero means true; `and`/`or` take 2–16 operands, `not` takes 1 |
217
+ | `if` | Condition, true value, false value; only the selected value must be available |
218
+ | `coalesce` | First available value among 2–16 operands; explicit fallback |
219
+
220
+ Up to 256 derived variables are allowed per block. Validation rejects cycles, wrong operand
221
+ counts, duplicate source/derived names, and undeclared references in the automatic ECS bridge.
222
+ Direct adapters report unresolved binding inputs in `visual.missingSignals`; unknown model
223
+ nodes are separate in `visual.missingNodes`. Divide by zero, negative square roots, invalid
224
+ clamp ranges and nonfinite results produce missing data. Formulas do not silently replace them
225
+ with zero. Derived names are local to their block and take precedence over same-named host values;
226
+ use distinct names to keep the raw reading available.
227
+
228
+ `responseSeconds` is the time constant of a first-order response: after one time constant a
229
+ step has moved about 63% of the way to its target. Pass **absolute simulation seconds** as the
230
+ second argument to `createModelSignalVisual(...).update`, the fifth argument to an aircraft
231
+ visual, or the fourth argument to a vehicle visual. The built-in ECS and Earth hosts do this.
232
+ First readings, rewinds and recovery from missing data snap to the current reading; a paused
233
+ timestamp does not advance a response. Omitting time applies readings immediately. This is
234
+ visual response, not instrument failure/lag state stored in the simulation or replay history.
235
+
236
+ For continuously rotating needles/cards, `period: 6.283185307179586` wraps angular displacement
237
+ and filters across the shortest arc. It is only available on rotation channels without min/max
238
+ limits. All axes remain in the node's local parent frame: rotate or tilt the gauge assembly in
239
+ the model without changing its calibration.
240
+
241
+ ## Reusable instrument wiring
242
+
243
+ `@bendyline/molen-client/instruments` exports data helpers for model-owned geometry:
244
+
245
+ - `dialInstrument`: measured, potentially nonlinear reading-to-angle calibration.
246
+ - `altimeterInstrument`: separate needles making one turn per 1,000, 10,000 and optionally
247
+ 100,000 feet, with continuous wraparound.
248
+ - `attitudeInstrument`: a rotating bank frame containing a translating pitch card, behind an
249
+ authored mask and fixed aircraft symbol. Axis, sign, travel and response are configurable.
250
+ - `annunciatorInstrument`: a positive reading shows a lamp/flag; missing data hides it.
251
+ - `numericInstrument`: a fixed-width unsigned integer on authored seven-segment digit nodes.
252
+ Values are floored; leading zeros are shown. Missing, negative and overflowing values blank
253
+ the display. Each display needs a unique variable prefix when combining its bindings.
254
+
255
+ These helpers return bindings/spec data; they do not fabricate a dashboard, create textures,
256
+ or choose the instrument arrangement. Export their data with the model. Use
257
+ `modelSignalDisplacement(binding, reading)` when authoring face markings so tick positions and
258
+ needle calibration share the same curve. The module also exports `compileModelSignalExpressions`
259
+ for inspecting derived readings without a renderer.
260
+
261
+ Gauge motion is only as accurate as its measurement. True airspeed is not indicated airspeed;
262
+ world Y is not a pressure altimeter with a pilot-set reference; normalized engine RPM is not
263
+ turbine N1/N2; sideslip is not a slip/skid ball's lateral specific force. Use correctly modeled
264
+ system readings where available, and identify approximations. Never drive fuel, oil pressure,
265
+ navigation receivers or clocks from unrelated values just to make a needle move. A future
266
+ system can publish those readings through the same component sources without changing the
267
+ gauge renderer. See the FAA's [Flight Instruments chapter](https://www.faa.gov/regulationspolicies/handbooksmanuals/aviation/phak/chapter-8-flight-instruments)
268
+ for instrument principles and distinctions.
269
+
122
270
  ## Exterior animation
123
271
 
124
272
  Landing gear, doors, flaps and control surfaces are bound the same way, in an `animation` block
@@ -126,6 +274,18 @@ beside `interior`: `aircraft.spec.visual.animation` or `vehicle.visual.animation
126
274
  `sources` and `bindings` and the same signals. The interior and the animation may not bind the
127
275
  same node channel.
128
276
 
277
+ Verify motion in physical space, not just a numeric angle. Molen aircraft use +Z forward,
278
+ +Y up and +X toward the pilot's left. Positive pitch input means nose up, positive roll
279
+ means right wing down, and positive yaw input means right rudder. A pulled yoke moves aft
280
+ (negative Z); a vertical stick tilts aft for nose up and toward negative X for right bank.
281
+ Right rudder pushes the right pedal forward. For a trailing edge extending along negative Z,
282
+ negative X rotation lowers a flap, while positive X rotation raises an elevator. Right bank
283
+ lowers the left aileron and raises the right one. These signs assume unrotated model parents;
284
+ transform a representative grip or trailing-edge point through the actual hierarchy to verify
285
+ both positive and negative commands. Use the referenced full-travel angle, not a generic radian.
286
+ Inspect deployed surfaces and moved cockpit controls in current renders as well as checking
287
+ their transforms. A neutral-pose overlay cannot validate an animation direction.
288
+
129
289
  A binding can replace `scale` and `offset` with a keyframed curve: `keys` are `[signal,
130
290
  displacement]` pairs with strictly ascending signals, and the displacement holds the first or
131
291
  last value outside them. `"ease": "smooth"` eases out of and into every key, the way a hydraulic
@@ -1,7 +1,21 @@
1
1
  # Mountable vehicles and driving
2
2
 
3
- World explorer's parking cars are external entity types with stable IDs, metric dimensions, and five
4
- models: compact, sedan, SUV, pickup and van. You can walk up to one, get in and drive it.
3
+ Generic vehicles use the Bendy house brand, with stable asset/type IDs. The Bendy Bus and
4
+ Bendy Light Rail are also mountable through the vehicle API. World Explorer has buttons for
5
+ both at the practice area: W/S applies traction or reverse, Space brakes, V switches view,
6
+ and E exits after stopping. The bus steers with A/D; light rail has locked steering on its
7
+ straight practice track. Player controls do not yet follow curved rail-network routes.
8
+ See the [close-view vehicle standard](medium-fi.md#controllable-vehicles-close-view-fidelity)
9
+ for the extra model detail expected around the operator.
10
+
11
+ Compare car colors and RV graphics in the [livery gallery](livery-gallery.md). The
12
+ [complete livery catalog](livery-catalog.md) lists selection ids and reference evidence.
13
+
14
+ World Explorer's parking cars are external entity types with stable IDs and metric dimensions.
15
+ The entity pack includes eleven Bendy road models and eighty U.S. market reference vehicles:
16
+ forty recent models plus forty varied models from 2005–2024. These range from the F-150,
17
+ Prius and Model 3 to the Smart fortwo, MX-5 and Sprinter. You can walk up to one, get in and drive it.
18
+ See the [entity catalog](entities.md#road-cycle-and-water-fleets) for IDs and authoring details.
5
19
 
6
20
  Each type owns its GLB reference, complete physics configuration, seats, named visual bindings,
7
21
  and optional deterministic scripts. Dormant cars use generic dimension-driven instance proxies;
@@ -137,6 +151,12 @@ ground (under open sky, never a roof or deck), `board(id)` without walking to th
137
151
  in. The entity's `vehicle.color`, when set, paints the model's `paintMaterial`; without one the
138
152
  authored paint stays.
139
153
 
154
+ Parked cars become simulation entities only within 300 m of the observer passed to `sync`, to
155
+ approach, board and collide with; farther ones that nobody moved are reclaimed and stay part of
156
+ their tile's merged mesh. Under an aircraft a town's parked cars were otherwise thousands of
157
+ dormant entities, spawned as each tile streamed in and visited every tick. The `vehicles` system
158
+ also passes over a dormant car after one lookup until a write replaces its state.
159
+
140
160
  Passengers use the same mount contract. A `mountable` lists seats with a role: `driver` seats
141
161
  drive, `passenger` seats ride. `mountEntity(world, actor, vehicle, 'passenger')` seats someone
142
162
  beside the driver (stopped vehicle, within `reach` of the seat), the `mounted-seats` system carries
@@ -215,7 +235,10 @@ Surface objects expose `userData.vehicles: VehiclePlacement[]`; each record has
215
235
  type `kind`, `color`, resolved `spec`, absolute metric `position`, and `yaw`, with optional
216
236
  terrain-alignment `pitch` and `roll`. IDs derive from world-space bay positions rather
217
237
  than tile IDs. Instance meshes retain `userData.vehicleIds` for promotion and duplicate suppression.
218
- The worker transports the same placement records as synchronous generation.
238
+ The worker transports the same placement records as synchronous generation. Surface objects with
239
+ parked cars are tagged `'parked-vehicles'` and water surfaces `'water'` (`tagTerrainObject`), and
240
+ Earth view's vehicles visit `taggedTerrainObjects(tag)` shown under their root instead of walking
241
+ the whole scene five times a second; a host building its own such objects tags them the same way.
219
242
 
220
243
  For repeatable visual review open
221
244
  [World Explorer with `?synthetic=1&parking=1`](https://molen.dev/play/world-explorer/?synthetic=1&parking=1).
@@ -43,6 +43,8 @@ external data with `weatherSchema.parse` before using it in typed code.
43
43
 
44
44
  | Parameter | Meaning |
45
45
  | --- | --- |
46
+ | `atmosphere.model` | `standard` (default): layered Earth atmosphere; `isothermal`: uniform temperature, including alternate-world use. |
47
+ | `atmosphere.moistAir` | Apply humidity's ideal-gas density correction; default false for dry reference air. |
46
48
  | `atmosphere.temperatureK` | Kelvin at the reference altitude; default 288.15 K (15 °C). |
47
49
  | `atmosphere.pressurePa` | Absolute pressure at the reference altitude; default 101325 Pa. Zero allows vacuum. |
48
50
  | `atmosphere.relativeHumidity` | 0–1; stored for consumers, independent of precipitation. |
@@ -76,16 +78,19 @@ if (current) molen.patch('conditions', 'weather', {
76
78
 
77
79
  Typed systems use `Weather`, `weatherOf(world)` and `sampleAtmosphere(data, altitude, gravity?)`
78
80
  from `@bendyline/molen-kernel`. The sample contains `temperatureK`, `pressurePa`, `densityKgM3`,
79
- `relativeHumidity` and `windVelocity`. It uses deterministic math, ideal-gas density
80
- `pressure / (gasConstant * temperature)` and an isothermal hydrostatic pressure profile.
81
- Gravity defaults to 9.80665 m/s². Humidity is informational: there is no moist-air correction,
82
- temperature lapse rate or fluid simulation.
81
+ `relativeHumidity`, `windVelocity` and `speedOfSound`. It uses deterministic math and the
82
+ US Standard Atmosphere 1976 lower-atmosphere lapse layers, with geometric-to-geopotential
83
+ altitude conversion, anchored to authored reference temperature/pressure. The supported range
84
+ is -2 to 100 km; values beyond it sample the nearest endpoint. Gravity defaults to 9.80665 m/s².
85
+ `model: 'isothermal'` retains the former uniform-temperature hydrostatic profile.
86
+ Dry ideal-gas density is the default; `moistAir: true` adds a water-vapor correction using
87
+ relative humidity and saturation vapor pressure. This does not select rain/snow or simulate fluid flow.
83
88
 
84
89
  `installAircraft` reads the world's weather each physics tick. Wind changes airspeed, and
85
90
  temperature/pressure change aerodynamic density. Explicit `AircraftEnvironment.weather`
86
91
  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
92
+ accepts the same optional weather value and a `time`. Without weather, aircraft use the dry
93
+ standard atmosphere. Ground friction and character temperature exposure are
89
94
  not implicitly changed.
90
95
 
91
96
  ## Wind shear, turbulence and gusts
@@ -153,8 +158,10 @@ collision, splash, accumulation or wet-material response.
153
158
 
154
159
  ## World explorer
155
160
 
156
- The Weather dropdown includes Sunny / clear, Partly cloudy, Overcast, Rain, Snow and Fog.
157
- Weather details mixes cloud coverage/density/altitude, precipitation, intensity, visibility,
161
+ The Weather dropdown includes Fair, Sunny / clear, Partly cloudy, Overcast, Rain, Snow and Fog.
162
+ The explorer opens on Fair, its own preset: Sunny with scattered fair-weather cumulus (30%
163
+ 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,
158
165
  temperature, pressure and wind, marking the profile Custom. Temperature and pressure controls
159
166
  refer to sea level, displayed in °C and hPa and stored in kelvin and pascals. The same component
160
167
  is installed in the explorer's vehicle/aircraft simulation.
@@ -174,7 +174,10 @@ geometry budget. Shared linear-filtered worldgen textures use mipmaps and anisot
174
174
 
175
175
  `props` attach pack or builtin models: `roof-ridge` walks the ridge of the dominant wing
176
176
  (chimneys), `roof-flat` fills a flat roof with `margin` from every edge (rooftop units),
177
- `roof-edge` lines the outer edges at the parapet (canales). Prop models are pack assets
177
+ `roof-edge` lines the outer edges at the parapet (canales), and `ground-any` sets models on the
178
+ ground just out from the outer walls, `spacing` apart and `margin` from the corners, spread
179
+ evenly round the building and clear of its entrance (foundation shrubs on regional houses).
180
+ Prop models are pack assets
178
181
  (`assets` map, a `molen/asset@1` sidecar next to `model.glb`); the default pack generates its
179
182
  materials and prop models from `scripts/generate-pack.mjs` and the build checks they are current.
180
183
  Placements come out of the batch as `props:<model>` placement sets, instanced like scatter.
@@ -233,11 +236,15 @@ species: no texture downloads, alpha cards, or per-tree scene objects. Conifers
233
236
  scalloped crown that conceals the upper trunk; broadleaf crowns use overlapping foliage clumps.
234
237
  Tiles below the finest level use cached coarse crowns (132 triangles per conifer, 124 per
235
238
  broadleaf tree; 60 per shrub and 20 per rock), sharing the same material and instance transforms.
236
- The Earth renderer further partitions vegetation into 512-meter cells and switches from near to
237
- medium to distant geometry as the camera moves. Thresholds are 180 and 650 meters beyond each
238
- cell’s bounding sphere, with 15% hysteresis to avoid flicker. Distant crowns use 12 triangles for
239
- conifers and 20 for broadleaf trees. Cells share geometry, materials, and instance buffers across
240
- levels and can be frustum-culled independently; no per-frame placement uploads are needed.
239
+ The Earth renderer batches vegetation per terrain tile, split into quarters on the finest tiles
240
+ (a batch picks one detail level for all its plants, so a camera inside a whole-tile batch drew
241
+ every tree in it at near detail), and switches each batch from near to medium to distant
242
+ geometry by its projected error, with 15% hysteresis to avoid flicker. A batch chooses again
243
+ only when the camera, the batch's placement, the lens or the error policy changes, so a still view
244
+ costs no per-batch matrix work. Distant crowns are
245
+ opaque: a cone for conifers and one lumpy volume for broadleaf trees. Cells share geometry,
246
+ materials, and instance buffers across levels and can be frustum-culled independently; no
247
+ per-frame placement uploads are needed.
241
248
  `propLod: false` disables this camera LOD, and the explorer exposes `?propLod=0` for comparison.
242
249
  The explorer's `AssetCache` still resolves authored GLBs for custom packs and building props.
243
250
 
@@ -250,7 +257,9 @@ levels are empty, so the clumps fade out about 400 meters away instead of shimme
250
257
  adapter labels land that no map polygon covers `open_ground` (the `OPEN_GROUND_LABEL` export), as a
251
258
  tile-wide polygon that every mapped polygon paints over, so verges and unmapped meadows can carry
252
259
  ground cover too. The default packs place it in meadows, parks, yards, forest floors and open
253
- ground, on the finest tile level only, and not at Economy quality.
260
+ ground, on the finest tile level only, and not at Economy quality. In temperate and wet habitats
261
+ the regional catalog's `open_trees` rule also plants a few clustered groves of park trees on open
262
+ ground (14 per hectare before clustering), so unmapped institutional lawns and verges are not bare.
254
263
 
255
264
  A population's optional `widthScale: { min: 0.8, max: 1.25 }` multiplies X/Z independently of
256
265
  its uniform `scale`, allowing tall narrow trees, broad bushy trees, and spreading shrubs in the
@@ -314,12 +323,74 @@ styles prefer pitched roofs through three floors and flat roofs from four upward
314
323
  style also allows flat roofs on low buildings. Wide, clipped, or unsuitable footprints can still
315
324
  require a flat roof for geometric reasons.
316
325
 
326
+ ### Inferred buildings where outlines are missing
327
+
328
+ Earth views enable neighborhood building infill by default. `mountEarthView` and
329
+ `createEarthWorldgen` accept `buildingInfill: false` to disable it, or
330
+ `buildingInfill: { seed: 42, density: 0.7 }` to choose a world seed and keep fraction.
331
+ The lower-level renderer and tile generator opt in with the same option. The explorer exposes
332
+ `?buildingInfill=0` and `?infillSeed=42` for comparisons.
333
+
334
+ Infill makes one row of lots on each side of residential, minor and collector streets. Frontage
335
+ anchors repeat every 16 projected meters, with small gaps and varied widths. Every lot reserves an
336
+ unobstructed approach from its street to its entrance or garage; homes never form landlocked rows
337
+ inside a block. Visible ground-following paths and driveways connect the entrances to the roadside.
338
+ Separately mapped sidewalks move the building setback behind the sidewalk while retaining access.
339
+ Inferred homes without an attached garage also receive a simple driveway to the front of the
340
+ house when the corridor is clear. Garage approaches and paths connect to the roadside. Weighted
341
+ `lotFences` (`none`, `timber`, `masonry`, `rail`) select low decorative yard boundaries, including
342
+ some fully open yards. Front fences leave gaps around every path and driveway and stay behind
343
+ mapped sidewalks. Fences follow the terrain, exclude vegetation, use a cheaper shape with simplified
344
+ nearby buildings, and disappear on distant tiles. They do not add physical collision barriers. Yard choices use an
345
+ independent identity salt, so decorating a lot does not move or re-roll its house.
346
+ Mapped footprints, occupied landmark extents, other streets, water and incompatible land uses
347
+ such as parks, farmland, schools and parking exclude the entire parcel, including its approach.
348
+ Slopes above 0.3 or more than three meters of height variation also exclude it.
349
+
350
+ Mapped residential, commercial and retail land-use polygons provide district evidence. Commercial
351
+ and retail areas select commercial styles and shopfront plans; residential areas select homes.
352
+ Without a land-use label, at least three nearby classified buildings with a 70% commercial majority
353
+ can select commercial use. Otherwise a dense network of at least three separate street corridors
354
+ establishes residential demand. Density considers streets within 240 meters and accounts for tile
355
+ edges: 650 meters of road in the full window, or 300 meters with explicit suitable land use.
356
+ Highways, paths, service roads, bridges and tunnels do not establish demand. Mapped buildings keep
357
+ priority in the shared rendering budgets.
358
+
359
+ The regional style's optional `lotPlans` weights select reusable, resizable plans: `cottage`
360
+ (recessed porch), `ranch` (L-shaped), `front-garage`, `side-garage`, `courtyard`, `compact`, and
361
+ `shopfront`. `createLotBuildingPlan(shape, width, depth)` is exported by worldgen's kernel for
362
+ other procedural authors. Plans use local +Z inward from the frontage and return entrance anchors
363
+ and an optional attached garage. Garages have their own single-storey mass and broad door.
364
+ These plans only supply missing outlines; existing mapped outlines remain authoritative.
365
+ The Southwest pool favors stucco, ceramic tile, ranches, courtyards and garages; the North American
366
+ pool used in Washington favors siding and asphalt shingles. Other regional pools use their own
367
+ materials and plan weights, with conservative cottage/ranch/compact forms when no style defines a pool.
368
+
369
+ A versioned seed and geographic frontage anchor determine each home's identity, footprint and floor
370
+ count; that identity seeds its architectural appearance. Unloading and revisiting unchanged map
371
+ data reproduces the same buildings, including through the worker path. Feature order and road
372
+ direction do not reshuffle them. Reducing density retains an unchanged subset; generation settings
373
+ and exclusion geometry participate in cache keys. Records carry the `inferred` label and an
374
+ `infill:v3` identity; they are visual estimates, not recovered footprints or verified addresses.
375
+ Changes to source data, styles, seed or algorithm version can change the result. The frontage-based
376
+ v3 algorithm regenerates older layouts once; subsequent visits reproduce the new layout.
377
+
378
+ Infill uses detailed footprints at the finest two terrain levels, skips generalized
379
+ building data, and caps inferred lots at 3,072 per tile before shared rendering budgets.
380
+ Entire parcels stay inside their owner tile, leaving a small margin at tile edges. A neighboring
381
+ halo participates in corner-lot conflict resolution. Coverage depends on the roads and exclusions
382
+ available in that tile. These are synthetic lots, not surveyed parcels or zoning; missing land-use
383
+ data can still allow buildings on genuinely vacant land. Industrial land remains excluded.
384
+ The same inferred footprints and approaches exclude vegetation in scatter-only requests when the
385
+ source supplies matching semantic layers.
386
+
317
387
  ### Inferred trees around homes
318
388
 
319
389
  Atlas region bindings and the worldwide default accept `treeFillFactor` from 0 to 1. The
320
- shipped atlas uses 0.9 in the Pacific Northwest, 0.3 in Japan, and 0 in the Southwest and
321
- unclassified regions. These are configurable visual priors, not measured canopy percentages
322
- or a global climate dataset. Fill is resolved at each home's location, including region edges.
390
+ shipped atlas uses 0.35 in North America, overridden by 0.9 in the Pacific Northwest and 0 in
391
+ the Southwest; Japan uses 0.3 and unclassified regions use 0. These are configurable visual priors,
392
+ not measured canopy percentages or a global climate dataset. Fill is resolved at each home's
393
+ location, including region edges.
323
394
 
324
395
  For complete low-rise footprints of 45–700 m², the Earth adapter adds an irregular yard patch
325
396
  roughly 18–26 meters beyond the home. Explicit house classifications qualify; small untyped
@@ -338,7 +409,10 @@ Mapped woodland, parks, parking, playing fields, farmland, barren ground, and ot
338
409
  land cover are cut out before planting. Road, building, water, and mapped-tree exclusions still
339
410
  apply, as do slope/altitude limits and instance budgets. Neighboring buffered footprints
340
411
  participate even when their building mesh belongs to another tile; trees emit only inside the
341
- current tile. Coverage still depends on the footprints supplied in the source tile buffer.
412
+ current tile. Coverage still depends on the footprints supplied in the source tile buffer. When
413
+ a terrain package declares `features.buildingDetail`, classification and building rendering share its
414
+ detailed footprints and mapped trees. The same depth limit and missing-coverage fallback apply
415
+ to both; water rendering does not wait for building detail.
342
416
 
343
417
  The dedicated `home_canopy` scatter rule controls species, spacing, setbacks, and detail tiers;
344
418
  custom packs opt in by supplying this rule label. Species use the tile's regional scatter set,
@@ -447,7 +521,19 @@ also uses a dedicated surface worker in the explorer. Archive decoding, scene as
447
521
  uploads still happen on the main thread.
448
522
 
449
523
  A shared `lodPolicy: ScreenSpaceLodPolicy` enables projected-screen-size LOD for vegetation and
450
- buildings. Buildings retain their structural faces while distant materials and facade details
524
+ buildings. Instanced vegetation measures the camera's distance to each batch's bounds, not to its
525
+ bounding sphere: a tile-wide batch's sphere reaches hundreds of meters above the canopy, so an
526
+ aerial camera would otherwise draw every plant in the tiles below at near detail. A level with no
527
+ leaf cards (a tree's distant level, rocks and props) draws with an opaque twin of the alpha-tested
528
+ scatter material: a shader that can discard switches off hidden-surface removal on tile-based
529
+ GPUs, so a distant forest drawn with the card material shaded every layer of crowns behind the
530
+ first. For the same reason a level drawn with cards hands over to the next at a quarter of the
531
+ projected error its geometry alone would allow (a crown's cards overlap several deep), and the
532
+ distant level neither casts nor receives sun shadows. With `vanishPixels` a batch stops drawing
533
+ once its largest instance spans fewer pixels than that from the batch's nearest point (15%
534
+ hysteresis): the semantic renderers pass 1.5 for street props and signs, which from a few
535
+ kilometers were a draw each for a pixel or less, but not for plants, as a distant forest is the
536
+ sum of its trees. Buildings retain their structural faces while distant materials and facade details
451
537
  simplify; geometry attributes are shared across spatial cells and levels. `setQuality(preset)`
452
538
  changes future generation and queues resident architecture for replacement, one building batch
453
539
  at a time. The previous buildings stay visible until their replacements are ready; roads remain
@@ -476,7 +562,8 @@ changes and disposing when the entity goes away.
476
562
  one archive (the Sammamish package does).
477
563
  - Roofs of clipped tile-edge pieces are flat; secondary wings share the main eave height.
478
564
  - Windows are surface quads, not openings; dormers and setbacks are declared in the format but not
479
- built yet; `wall-any` and `ground-any` prop anchors place nothing yet.
565
+ built yet; the `wall-any` prop anchor places nothing yet. `ground-any` props do not know where
566
+ driveways and paths run, so on a lot that is paved to the wall one can stand on the paving.
480
567
  - Builtin vegetation uses spatially batched distance or screen-space LOD. Custom GLBs retain their authored
481
568
  geometry; they need authored LOD assets or simplification before the same reduction is possible.
482
569
  - Baked assets hold the building mesh only; props and scatter stay instanced placements.