@bendyline/molen-tooling 0.0.9 → 0.0.11

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 (95) hide show
  1. package/dist/capture/harness.js +261 -240
  2. package/dist/capture/worldgen-preview.js +309 -309
  3. package/dist/cli.mjs +6 -5
  4. package/dist/docs-src/guide/3d-model-assets.md +13 -0
  5. package/dist/docs-src/guide/adaptive-performance.md +5 -2
  6. package/dist/docs-src/guide/aircraft.md +113 -40
  7. package/dist/docs-src/guide/ambient-life.md +100 -11
  8. package/dist/docs-src/guide/audio.md +1 -1
  9. package/dist/docs-src/guide/boats.md +99 -0
  10. package/dist/docs-src/guide/determinism.md +1 -1
  11. package/dist/docs-src/guide/dioramas.md +167 -0
  12. package/dist/docs-src/guide/earth-view.md +241 -3
  13. package/dist/docs-src/guide/entities.md +32 -1
  14. package/dist/docs-src/guide/figures.md +7 -1
  15. package/dist/docs-src/guide/graphics-performance.md +16 -3
  16. package/dist/docs-src/guide/medium-fi.md +15 -6
  17. package/dist/docs-src/guide/regional-world.md +387 -0
  18. package/dist/docs-src/guide/sky.md +3 -2
  19. package/dist/docs-src/guide/surface-rendering.md +4 -1
  20. package/dist/docs-src/guide/vehicle-interiors.md +40 -2
  21. package/dist/docs-src/guide/vehicles.md +121 -19
  22. package/dist/docs-src/guide/weather.md +45 -3
  23. package/dist/docs-src/guide/worldgen.md +15 -1
  24. package/dist/docs-src/llms.txt +7 -4
  25. package/dist/docs-src/schemas/README.md +3 -0
  26. package/dist/docs-src/schemas/archstyle.md +144 -0
  27. package/dist/docs-src/schemas/components.md +1589 -137
  28. package/dist/docs-src/schemas/ecology-atlas.md +236 -0
  29. package/dist/docs-src/schemas/region-atlas.md +6 -0
  30. package/dist/docs-src/schemas/regional-catalog.md +1436 -0
  31. package/dist/docs-src/schemas/scatter.md +110 -4
  32. package/dist/docs-src/schemas/scene.md +6 -3
  33. package/dist/docs-src/schemas/terrain-package.md +41 -0
  34. package/dist/docs-src/schemas/transport-network.md +4 -2
  35. package/dist/docs-src/schemas/wildlife-ranges.md +251 -0
  36. package/dist/docs-src/schemas/worldgen-batch.md +21 -0
  37. package/dist/index.mjs +1 -1
  38. package/dist/{mcp-BbHk4ibu.mjs → mcp-BbxqqnD1.mjs} +3 -2
  39. package/dist/{ops-CErtZh2t.mjs → ops-b4Pag8U-.mjs} +7 -5
  40. package/dist/templates/city-courier/README.md +18 -0
  41. package/dist/templates/city-courier/gen/molen-types.ts +217 -15
  42. package/dist/templates/city-courier/index.html +1 -1
  43. package/dist/templates/city-courier/scripts/molen-scripts.d.ts +219 -17
  44. package/dist/templates/city-courier/src/audio.ts +26 -4
  45. package/dist/templates/city-courier/src/game-shell.css +7 -3
  46. package/dist/templates/city-courier/src/main.ts +25 -3
  47. package/dist/templates/city-courier/src/shared/accessibility.css +325 -0
  48. package/dist/templates/city-courier/src/shared/game-controls.ts +406 -0
  49. package/dist/templates/city-courier/src/shared/game-descriptions.ts +143 -0
  50. package/dist/templates/city-courier/src/shared/playback.ts +146 -0
  51. package/dist/templates/city-courier/src/worker.ts +5 -1
  52. package/dist/templates/cubes/index.html +6 -1
  53. package/dist/templates/cubes/src/main.ts +25 -2
  54. package/dist/templates/cubes/src/shared/accessibility.css +325 -0
  55. package/dist/templates/cubes/src/shared/playback.ts +146 -0
  56. package/dist/templates/cubes/src/vite-env.d.ts +1 -0
  57. package/dist/templates/cubes/src/worker.ts +1 -0
  58. package/dist/templates/data-viz/README.md +4 -0
  59. package/dist/templates/data-viz/index.html +6 -1
  60. package/dist/templates/data-viz/src/main.ts +53 -11
  61. package/dist/templates/data-viz/src/shared/accessibility.css +325 -0
  62. package/dist/templates/data-viz/src/shared/playback.ts +146 -0
  63. package/dist/templates/data-viz/src/vite-env.d.ts +1 -0
  64. package/dist/templates/data-viz/src/worker.ts +1 -0
  65. package/dist/templates/figures-gallery/index.html +6 -1
  66. package/dist/templates/figures-gallery/src/main.ts +21 -2
  67. package/dist/templates/figures-gallery/src/shared/accessibility.css +325 -0
  68. package/dist/templates/figures-gallery/src/shared/playback.ts +146 -0
  69. package/dist/templates/figures-gallery/src/vite-env.d.ts +1 -0
  70. package/dist/templates/figures-gallery/src/worker.ts +1 -0
  71. package/dist/templates/index.json +36 -16
  72. package/dist/templates/skybound/README.md +18 -0
  73. package/dist/templates/skybound/gen/molen-types.ts +217 -15
  74. package/dist/templates/skybound/index.html +1 -1
  75. package/dist/templates/skybound/scripts/molen-scripts.d.ts +219 -17
  76. package/dist/templates/skybound/src/audio.ts +26 -4
  77. package/dist/templates/skybound/src/game-shell.css +7 -3
  78. package/dist/templates/skybound/src/main.ts +25 -3
  79. package/dist/templates/skybound/src/shared/accessibility.css +325 -0
  80. package/dist/templates/skybound/src/shared/game-controls.ts +406 -0
  81. package/dist/templates/skybound/src/shared/game-descriptions.ts +143 -0
  82. package/dist/templates/skybound/src/shared/playback.ts +146 -0
  83. package/dist/templates/skybound/src/worker.ts +1 -1
  84. package/dist/templates/terrain-flyover/README.md +5 -1
  85. package/dist/templates/terrain-flyover/index.html +4 -1
  86. package/dist/templates/terrain-flyover/src/main.ts +40 -39
  87. package/dist/templates/top-down-arena/index.html +6 -1
  88. package/dist/templates/top-down-arena/scripts/molen-scripts.d.ts +219 -17
  89. package/dist/templates/top-down-arena/src/audio.ts +26 -4
  90. package/dist/templates/top-down-arena/src/gen/molen-types.ts +217 -15
  91. package/dist/templates/top-down-arena/src/main.ts +31 -5
  92. package/dist/templates/top-down-arena/src/shared/accessibility.css +325 -0
  93. package/dist/templates/top-down-arena/src/shared/playback.ts +146 -0
  94. package/dist/templates/top-down-arena/src/worker.ts +1 -1
  95. package/package.json +12 -12
@@ -11,8 +11,15 @@ into schema, kernel, or client. The P-51D Mustang and OH-6 share the same mount/
11
11
  and add separate flight controls, physics, assets and cockpit cameras; see [Aircraft](aircraft.md).
12
12
 
13
13
  In **Walk mode**, approach a car and press **E** to enter its driver seat. **W/S** accelerate or
14
- brake then reverse; **A/D** steer; **Space** brakes; **V** switches cockpit/chase views. Mouse look
15
- works while seated. Stop and press **E** to exit. The controller checks both sides and then the rear;
14
+ brake then reverse; **A/D** steer; **Space** brakes; **Shift** pulls the handbrake; **V** switches
15
+ cockpit/chase views. Mouse look works while seated. Stop and press **E** to exit.
16
+
17
+ Cars drive on their tires. Push one past its grip and it slides: a front-drive sedan runs wide, a
18
+ rear-drive pickup on full power swings its tail round, and steering with the handbrake up throws
19
+ the back out for a handbrake turn. Brakes are anti-lock, so you can still steer while stopping.
20
+ Rain and snow from the Weather setting make the road slippery (about 40% and 100% longer stops),
21
+ and gusts push on the body. The body dives under braking, squats under power and leans out of
22
+ turns. Hitting a wall or another car bounces you off it, and a corner hit spins you. The controller checks both sides and then the rear;
16
23
  blocked exits leave the rider seated. Switching to Fly also requires a safe stopped exit.
17
24
 
18
25
  Modified cars stay where they were left throughout the current explorer session, even when their
@@ -58,7 +65,8 @@ Outside a scene, resolve a type's components from the pack's type documents with
58
65
  `@bendyline/molen-kernel/content`, and spawn a copy.
59
66
 
60
67
  Declare commands and input bindings in the scene using the normal input schema. Give `drive`
61
- a payload schema with `throttle` and `steering` numbers in [-1,1] and a boolean `brake`.
68
+ a payload schema with `throttle` and `steering` numbers in [-1,1], a boolean `brake` and an
69
+ optional boolean `handbrake`.
62
70
  Run this setup through `buildWorld`, the Worker, or `molen sim run --setup`.
63
71
 
64
72
  `mountable.seats` is reusable for passenger seats or non-car mounts. Each seat has a unique
@@ -67,21 +75,52 @@ ordered local foot positions; `reach` limits mounting distance. A seat accepts o
67
75
  only the current driver can submit vehicle intent. Mounted actors bypass the kernel character
68
76
  and kinematics solvers. When the mount disappears, the rider is detached.
69
77
 
70
- The fixed-step bicycle solver integrates signed speed, steering slew, wheel rotation, mass-scaled
71
- engine force, rolling/air resistance, braking, reverse limits, lateral grip, gravity and four-wheel
72
- terrain support. All chassis-specific coefficients, mass/center of gravity, wheel geometry, limits,
73
- and terrain tolerances come from `vehicle.spec`. Collision probes run at 120 Hz or finer (through
74
- the host's `canOccupy` adapter).
75
- World explorer uses an oriented chassis against other cars and nearby triangles for walls,
76
- fixtures and buildings. Terrain gaps pause motion; abrupt steps and slopes above 35 degrees stop
78
+ Passenger seats: every stock car carries a `passenger` seat beside the driver, mirrored across
79
+ the centreline, and the OH-6 one on the pilot's left; the P-51D has a rear `passenger` seat behind
80
+ the pilot, like the TF-51D trainer. Only the `driver` seat controls the vehicle.
81
+
82
+ The solver is a dynamic bicycle model substepped at 120 Hz or finer. Each axle's tires turn slip
83
+ angle into side force (`corneringStiffness` per unit load per radian) up to the road's grip, then
84
+ let go to about 85% of it as they slide. Side grip is `grip` (m/s², so `grip / 9.81` is the
85
+ friction coefficient); straight-line grip is 15% higher, and drive and brakes share it with
86
+ cornering, so a car braking or under power at the limit steers less. `drive` picks the front,
87
+ rear or all wheels; drive beyond the grip spins them. Anti-lock brakes split by `brakeBias` and
88
+ stop just short of the limit. `handbrake` locks the rear wheels, which then slide. State carries
89
+ the forward `speed`, the sideways `lateralSpeed`, `yawRate` and a 0–1 `skid` for tire sounds or
90
+ effects.
91
+
92
+ Weight moves between the axles through the suspension: the sprung body pitches by
93
+ `pitchStiffness` and rolls by `rollStiffness` (radians per g) on springs of
94
+ `suspensionFrequency` and `suspensionDamping`, so braking loads the front tires and lifting off
95
+ in a turn can tighten it. `bodyPitch` and `bodyRoll` add to the terrain `pitch` and `roll` in the
96
+ transform, so the cockpit view feels them too. Passed to the car visual as signals, they become
97
+ suspension travel: the wheels move against the lean and stay on the road. Steering lock and steering speed fade with road
98
+ speed (`steeringFadeSpeed`), and full lock never asks for more than half again the cornering the
99
+ tires can give, so a keyboard tap changes lanes instead of spinning the car. At walking pace the
100
+ car simply rolls where its wheels point, so it never turns in place and parks exactly.
101
+
102
+ `installVehicles` reads the world's `weather`: rain takes up to 30% of the grip and snow up to 60%
103
+ (`weatherGrip(weather)`), and the wind field, gusts included, pushes on the body's long side.
104
+ Engine force, top and reverse speeds, rolling and air resistance, mass, wheel geometry and terrain
105
+ tolerances come from `vehicle.spec` as before, and `yawInertia` defaults from the body size.
106
+
107
+ Collision probes run at 120 Hz or finer through the host's `canOccupy` adapter. When it refuses a
108
+ move, the solver finds which way is open by probing around the car, and answers with an impulse at
109
+ the corner that struck: a bounce that grows with impact speed (none below walking pace, so a car
110
+ can rest against a wall), scraping friction along the obstacle, and a spin. `installVehicles` emits
111
+ `vehicle-impact` (5 m/s or more) and `vehicle-bump` (1.5 m/s or more) with the car's `entity` and
112
+ the closing `speed`; the Earth soundscape plays a metal impact for each. World explorer uses an
113
+ oriented chassis against other cars and nearby triangles for walls, fixtures and buildings; the
114
+ car it hits stays put. Terrain gaps pause motion; abrupt steps and slopes above 35 degrees stop
77
115
  the car. Cockpit views use the full chassis quaternion; chase views shorten at obstructions.
78
116
 
79
- This is a grounded driving foundation. It does not implement rigid-body rollovers, crash deformation,
80
- passenger animation, multiplayer ownership, or disk persistence. Background traffic is a separate
81
- package: [ambient life](ambient-life.md) moves NPC cars along lanes without this solver, and they
82
- stop for a car someone is driving. Without collision hooks,
83
- the reusable kernel solver supplies terrain driving only. Do not attach a second physics body to the
84
- same vehicle; the vehicle solver owns its transform.
117
+ This is a grounded driving model. It does not implement airborne rotation, rollovers, crash
118
+ deformation or damage, pushing other cars, per-surface friction (grass and gravel grip like the
119
+ road), passenger animation, multiplayer ownership, or disk persistence. Background traffic is a
120
+ separate package: [ambient life](ambient-life.md) moves NPC cars along lanes without this solver,
121
+ and they stop for a car someone is driving. Without collision hooks, the reusable kernel solver
122
+ supplies terrain driving only. Do not attach a second physics body to the same vehicle; the
123
+ vehicle solver owns its transform.
85
124
 
86
125
  All durable simulation state and mount relationships live in ECS components and survive keyframes
87
126
  and replay. Install the same systems/environment when restoring. Host streaming and render resources
@@ -98,9 +137,63 @@ ground (under open sky, never a roof or deck), `board(id)` without walking to th
98
137
  in. The entity's `vehicle.color`, when set, paints the model's `paintMaterial`; without one the
99
138
  authored paint stays.
100
139
 
140
+ Passengers use the same mount contract. A `mountable` lists seats with a role: `driver` seats
141
+ drive, `passenger` seats ride. `mountEntity(world, actor, vehicle, 'passenger')` seats someone
142
+ beside the driver (stopped vehicle, within `reach` of the seat), the `mounted-seats` system carries
143
+ them along, and `unmountEntity` lets any seat out by the exits once the vehicle has stopped. A
144
+ passenger climbing in or out leaves the driver's controls alone; the driver leaving idles them.
145
+ `driveVehicle` accepts input only from a driver seat, and `self.occupied` engine sounds count only
146
+ non-passenger seats. The entities pack's cars and the OH-6 have a `passenger` seat and the P-51D a
147
+ rear one. In the Earth view, actors board and leave them (`{ kind: 'board', vehicle }` and
148
+ `{ kind: 'alight' }`; see [actors](earth-view.md#actors-companions-and-npcs)), and
149
+ `EarthVehicles.unmount(actor)` steps any mounted entity out by those rules.
150
+
151
+ ## Riding cycles
152
+
153
+ The entities pack includes six rideable types: `molen.entities.cycle.standard_motorcycle`,
154
+ `cruiser_motorcycle`, `motor_scooter`, `city_bicycle`, `road_bicycle` and `cargo_bicycle` (the same
155
+ namespace prefix applies to each). Mount, drive and exit them with the same APIs as cars. In the
156
+ Earth view example, select a cycle beside **Drive**, then press **Drive**. **W** supplies motor or
157
+ pedal power, **S** and **Space** brake, **A/D** steer, **V** changes view, and **E** steps off once
158
+ stopped. These cycles have no powered reverse. The Earth view API accepts the full type ID:
159
+
160
+ ```js
161
+ view.setMode('drive', { vehicle: 'molen.entities.cycle.city_bicycle', force: true });
162
+ ```
163
+
164
+ `vehicle.spec.cycle` opts into two centreline tire contacts and automatic balance: the cycle
165
+ leans into the turn, limited by `maxLean`, and returns upright as it stops. Lean follows lateral
166
+ acceleration through damped springs; `g * tan(maxLean)` also limits steering at speed, so reducing the lean
167
+ limit increases the minimum turning radius. Braking, tire grip, weather, terrain gaps, collision hooks and safe exits use the existing solver. Bicycles have
168
+ lighter mass and lower power and speed limits. `cycle.pedals.ratio` specifies wheel revolutions
169
+ per crank revolution; snapshot-safe `vehicleState.pedalAngle` advances under forward power and
170
+ holds while coasting or braking. Wheel spin continues while coasting.
171
+
172
+ The driver seat is a pelvis anchor. `cycle.riderLean`, `handlebarPivot`, `grips`, `footrests` and
173
+ optional `pedals` describe metric contact points in model space. The figures capability and
174
+ Earth avatar renderer share the same pose evaluator: hands follow the turning handlebars and
175
+ feet follow the pedals or footrests. At low-speed steering lock the rider counterweights at the
176
+ saddle and turns the shoulders to keep both grips within reach. The stock dimensions fit an adult human; unusually small
177
+ or large figures may not reach every contact point. The cockpit uses `spec.driverEye` separately
178
+ from the saddle. `vehicle.visual.animation` binds the moving parts in Earth; `model.signals`
179
+ provides the same steering, wheel and pedal animation in ordinary Molen scenes.
180
+
181
+ Cycles use the existing `molenVehicle(types, id)` helper and are enumerated separately by
182
+ `MOLEN_CYCLE_ENTITY_IDS`; `MOLEN_VEHICLE_ENTITY_IDS` continues to enumerate cars and trucks.
183
+ Cycles are excluded from automatic car parking and ambient traffic. Balance is assisted; this
184
+ is grounded riding, without falls, wheelies, jumps, gears or stunt simulation.
185
+
186
+ For a repeatable mounted-rider review in the engine repository:
187
+
188
+ ```sh
189
+ molen validate content/entities/scenes/cycles.scene.json
190
+ molen sim run content/entities/scenes/cycles.scene.json --setup content/entities/scenes/cycles.setup.mjs --ticks 120 --hash
191
+ molen shot content/entities/scenes/cycles.scene.json --setup content/entities/scenes/cycles.setup.mjs --ticks 60 --out content/entities/shots/cycles.png
192
+ ```
193
+
101
194
  ## Engine sound
102
195
 
103
- Every `molen.entities` vehicle type carries an `audioSource`: the compact, sedan and SUV run
196
+ The original five road vehicle types carry an `audioSource`: the compact, sedan and SUV run
104
197
  `vehicle.engine.car`, the pickup and van `vehicle.engine.diesel`, each with its own pitch. The
105
198
  engine plays only while someone drives (`self.occupied`), rises in pitch with
106
199
  `vehicleState.speed`, and grows louder with `vehicleInput.throttle`. Any host that plays audio from
@@ -112,8 +205,10 @@ hears it with no extra code. Override the component on a type or entity to chang
112
205
 
113
206
  `@bendyline/molen-client/vehicles` exports `createVehicleVisual`, `createParkedVehicleBatch`,
114
207
  and `vehicleCameraPose`. `createVehicleVisual(loadedGlb, vehicleData)` binds wheel, steering, and
115
- paint nodes named by `vehicle.visual`; dynamic visuals expose `update(steer, wheelAngle)` and
116
- `dispose()`. The camera helper accepts a transform, `vehicle.spec`, view, look offsets, and an
208
+ paint nodes named by `vehicle.visual`; dynamic visuals expose `update(steer, wheelAngle, signals)`
209
+ and `dispose()`. `signals` feeds the interior and `vehicle.visual.animation` bindings (see
210
+ [exterior animation](vehicle-interiors.md#exterior-animation)); `bodyRoll` and `bodyPitch` among
211
+ them keep the wheels planted. The camera helper accepts a transform, `vehicle.spec`, view, look offsets, and an
117
212
  optional obstruction-distance callback.
118
213
 
119
214
  Surface objects expose `userData.vehicles: VehiclePlacement[]`; each record has an `id`, external
@@ -134,3 +229,10 @@ working reference for scripting [`molen play`](experience-playback.md) against y
134
229
  pnpm build
135
230
  npx molen play dist --scenario test/visual/vehicles.play.json --out-dir .artifacts/vehicles
136
231
  ```
232
+
233
+ ## Boats
234
+
235
+ [Boats and water](boats.md) use the same mounting, passenger seats and camera controls with a
236
+ separate hull solver. `mountable.entries` optionally locates a gangway away from the seat;
237
+ boat exits are checked against their local deck height. Earth view and World Explorer share
238
+ boat launching, driving and dry dockside exits through `EarthVehicles`.
@@ -53,8 +53,15 @@ external data with `weatherSchema.parse` before using it in typed code.
53
53
  | `clouds.baseAltitude`, `thickness`, `scale` | Absolute base Y, layer separation, and horizontal pattern repeat size in meters. |
54
54
  | `precipitation.kind`, `intensity` | Explicit none/rain/snow and 0–1 visual intensity; not calibrated mm/hour. |
55
55
  | `visibility` | Approximate visual fade distance in meters, independent of clouds and precipitation. |
56
+ | `wind.referenceHeight` | Height above ground in meters where `windVelocity` applies; default 10. |
57
+ | `wind.shear` | Power-law exponent of wind speed with height, to 600 m; default 0 (uniform). About 0.14 over open country, 0.3 over cities. |
58
+ | `wind.turbulence` | 0–1 intensity; default 0. About 0.15 light chop, 0.4 moderate, 0.8 severe. |
59
+ | `wind.gusts` | 0–1 along-wind gust swing as a fraction of the mean wind; default 0. |
60
+ | `wind.terrain` | 0–1 strength of slope flow: lift up windward hillsides, sink and rougher air in the lee; default 0. |
56
61
 
57
62
  Presets are starting points, not classifications that constrain these independent parameters.
63
+ Every preset includes a `wind` block: light chop and gusts for sunny skies, rougher air in rain,
64
+ and nearly still, strongly sheared air in fog.
58
65
 
59
66
  ## Simulation and physics
60
67
 
@@ -76,9 +83,44 @@ temperature lapse rate or fluid simulation.
76
83
 
77
84
  `installAircraft` reads the world's weather each physics tick. Wind changes airspeed, and
78
85
  temperature/pressure change aerodynamic density. Explicit `AircraftEnvironment.weather`
79
- overrides the component; explicit `wind` overrides its wind. `stepAircraft` accepts the same
80
- optional weather value. Without weather, aircraft retain their existing altitude-density
81
- model exactly. Ground friction and character temperature exposure are not implicitly changed.
86
+ overrides the component; explicit `wind` overrides its wind with a uniform velocity. `stepAircraft`
87
+ accepts the same optional weather value and a `time`. Without weather, aircraft retain their
88
+ existing altitude-density model exactly. Ground friction and character temperature exposure are
89
+ not implicitly changed.
90
+
91
+ ## Wind shear, turbulence and gusts
92
+
93
+ The `wind` block shapes the air around the mean `windVelocity`. `windField(weather)` returns its
94
+ deterministic field, and `sampleWind(weather, position, time, groundHeight?)` samples it, both
95
+ from `@bendyline/molen-kernel`:
96
+
97
+ ```ts
98
+ import { sampleWind, weatherOf } from '@bendyline/molen-kernel';
99
+
100
+ world.addSystem((w, ctx) => {
101
+ const weather = weatherOf(w);
102
+ if (!weather) return;
103
+ // Air velocity in m/s at a point, on the world clock, over the world's terrain.
104
+ const air = sampleWind(weather, [0, 120, 0], ctx.tick * ctx.dt, (x, z) => ground(x, z));
105
+ });
106
+ ```
107
+
108
+ - **Shear.** The mean wind's horizontal speed follows `(height / referenceHeight) ^ shear` with
109
+ height above the ground beneath the point, up to 600 m. Below the reference height it is
110
+ lighter.
111
+ - **Turbulence.** Eddies from 20 m to 1.2 km across, with the -5/3 energy spectrum of real air,
112
+ are carried downwind with the mean wind and slowly evolve. Their strength grows with
113
+ `turbulence` and with wind speed, comes in patches a few kilometers across, fades above the
114
+ 1 km boundary layer, and near the ground loses its vertical part.
115
+ - **Gusts.** Along-wind speed swings of up to `gusts` times the mean, in fronts a few hundred
116
+ meters apart that sweep past with the wind.
117
+ - **Terrain.** With a ground-height function, wind blowing up a slope rises and wind blowing
118
+ down one sinks, fading over a few hundred meters of height; the lee side is also rougher.
119
+
120
+ The field is a pure function of the weather, the point and simulation time, so it needs no state
121
+ in snapshots and consumes no simulation random numbers; `seed` varies the pattern. Two aircraft
122
+ crossing the same air feel the same bump, and a replay feels every bump again. The renderer's
123
+ clouds and precipitation still drift with the mean wind; audio's wind level follows the mean too.
82
124
 
83
125
  ## Rendering and clocks
84
126
 
@@ -15,6 +15,8 @@ taxonomies and 45 shared materials. The world explorer's `/structures.html` mode
15
15
  every entry and provides dimension, texture and detail controls.
16
16
 
17
17
  For enterable buildings and lazy ground-floor furnishings, see [Building interiors](building-interiors.md).
18
+ For compact global ecological data, regional plant families, and ordinary building profiles, see
19
+ [Regional world content](regional-world.md).
18
20
 
19
21
  ```text
20
22
  @bendyline/molen-worldgen world-agnostic core
@@ -151,6 +153,14 @@ the sampled palette color multiplies the texture, so pack textures are authored
151
153
  default pack asserts a mean luminance of at least 0.55 for every tinted material). Windows use
152
154
  `tint: 'none'` and `uv: 'cell'`: every window is one texture repeat.
153
155
 
156
+ A material choice may name its own `palette`, which replaces the part's palette when that choice
157
+ is picked. The material and the color are otherwise independent picks, so without it a brick wall
158
+ can draw a concrete grey and a concrete panel can draw brick red. `materials.flatRoof` is an
159
+ optional roof material used only when the style resolves a flat roof (a flat choice or the
160
+ wide-footprint fallback). A pitched style keeps shingles or tile on its slopes and puts light
161
+ membrane or gravel on its flat tops. Tile-edge cuts and dropped roof shapes keep `roof`, so a
162
+ clipped house still matches its neighbors from above.
163
+
154
164
  `facade.windows` places windows per bay and floor: `punched` (one window per bay, seeded
155
165
  `probabilityPerBay`), `ribbon` (one strip per floor), `grid` (glazing filling the bay), or
156
166
  `none`; `groundFloor: 'storefront'` adds ground-floor glazing even when upper windows are
@@ -216,7 +226,7 @@ On the client, `ModelLibrary.prepare(ref)` turns a glTF scene into one merged ve
216
226
  geometry (material colors baked in, so an authored tree with two materials is one draw), keeps
217
227
  builtin primitives (`builtin:tree.conifer`, `builtin:shrub`, `builtin:rock`, ...) for packs
218
228
  without assets, and `createInstancedPlacements(set, geometry, material)` uploads a placement set
219
- as one `InstancedMesh`. The default regional scatter packs use procedural fir, pine, oak, and
229
+ as one `InstancedMesh`. The legacy regional scatter packs use procedural fir, pine, oak, and
220
230
  birch (`builtin:tree.conifer.fir|pine`, `builtin:tree.deciduous.oak|birch`), clustered shrubs, and
221
231
  irregular rocks. Their opaque crowns, bark, and vertex colors share one geometry and material per
222
232
  species: no texture downloads, alpha cards, or per-tree scene objects. Conifers have a closed,
@@ -279,6 +289,10 @@ resolved once per tile at its centre; when a tile straddles regions every buildi
279
289
  own centroid. Atlas geometry is projected once into the package's world meters, so lookups are
280
290
  comparisons.
281
291
 
292
+ When a composable regional environment is supplied, its architectural channel precedes this
293
+ legacy chain and every building resolves at its own centroid. Its separate ecological channel
294
+ selects each vegetation candidate by habitat geography. See [Regional world content](regional-world.md).
295
+
282
296
  The adapter also decides tile-edge ownership: a footprint that appears complete in two tiles is
283
297
  rendered by the tile holding more of it, and a footprint cut by both buffers is rendered piecewise
284
298
  with seam walls and a flat roof. Both tiles reach the same verdict from their own copy.
@@ -4,7 +4,7 @@
4
4
  > three.js rendering client, authored through JSON schemas, a small typed API, and a headless
5
5
  > dev loop. This bundle is version-locked to the engine release.
6
6
 
7
- Engine version: 0.0.6. three.js peer range: >=0.184.0 <0.187.0 (developed against 0.184.0). Node ≥ 22.13, ESM only.
7
+ Engine version: 0.0.7. three.js peer range: >=0.184.0 <0.187.0 (developed against 0.184.0). Node ≥ 22.13, ESM only.
8
8
 
9
9
  ## Start here
10
10
 
@@ -42,6 +42,7 @@ downloads them into a project and pins them in project.json.
42
42
  - [Worldgen: styled buildings and scatter](guide/worldgen.md): any outline → a styled building; `worldgenBuilding` component, `molen.worldgen.*` script queries, worker + cache for map tiles
43
43
  (footprint analysis, roofs, walls), labeled polygons → deterministic props, style packs, and the
44
44
  Earth binding (region atlas, terrain-semantics adapter, tile renderers).
45
+ - [Regional world content](guide/regional-world.md): compact ecology and native-range geography, composable packs, procedural plants and wildlife, ordinary buildings, mapped crops, seasons, and habitat sound.
45
46
  - [Default structure library](guide/structure-library.md): 120 resizable buildings in 13 taxonomies, 51 shared construction materials, regional placement and the interactive model sheet.
46
47
  - [Recognizable places](guide/recognizable-places.md): store identity matching, reusable signs, tenant facades and mapped outdoor props.
47
48
  - [Building interiors](guide/building-interiors.md): deterministic layouts by use, real entrances and frontage windows, lazy rendering and walk collision.
@@ -52,10 +53,12 @@ downloads them into a project and pins them in project.json.
52
53
  - [Logical source bundles](guide/source-bundles.md): one copyable folder per entity, structure, vehicle, prop, or other authored thing, with all definitions and source files listed in `source.json`.
53
54
  - [Components](schemas/components.md): the component vocabulary `molen validate` checks against.
54
55
  - [Mountable vehicles](guide/vehicles.md): stable parking entities, driver seats, deterministic vehicle physics, safe exits, and cockpit/chase views.
56
+ - [Boats and water](guide/boats.md): powered hulls, helm controls, passengers, boarding points, swells, currents and Earth-view water coverage.
55
57
  - [Aircraft](guide/aircraft.md): P-51D and OH-6 assets, flight physics, cockpit instruments, practice airfield and controls.
56
- - [Vehicle interiors and model signals](guide/vehicle-interiors.md): model-owned cabins, declarative simulation-to-GLB bindings, script-owned telemetry, and nearby detail loading.
58
+ - [Vehicle interiors and model signals](guide/vehicle-interiors.md): model-owned cabins, declarative simulation-to-GLB bindings, keyframed exterior animation (landing gear, doors, control surfaces), script-owned telemetry, and nearby detail loading.
57
59
  - [Figures](guide/figures.md): stylized humans, bipeds and quadrupeds: presets and descriptors, canonical rigs and sockets, deterministic gaits, `figureAttachment` accessories, riders, and `molen figure preview`.
58
- - [Ambient life](guide/ambient-life.md): NPC cars, pedestrians, trains and aircraft that spawn around an observer on a transport network (the scene `ambient` block, `molen/transport-network@1`, `molen.ambient.*`, the Earth view's `ambient` option, `ambientRole` content).
60
+ - [Ambient life](guide/ambient-life.md): NPC cars, pedestrians, trains, aircraft and watercraft that spawn around an observer on a transport network (the scene `ambient` block, `molen/transport-network@1`, `molen.ambient.*`, the Earth view's `ambient` option, `ambientRole` content).
61
+ - [Dioramas](guide/dioramas.md): bounded scripted set pieces loaded near the viewer; local deterministic scenes, schedules, lazy playback, football choreography, and geographic Earth placements.
59
62
  - [Complete game samples](guide/game-samples.md): city driving, first-person dungeon, and platformer; shared follow cameras and XY platform physics.
60
63
  - [Samples gallery](guide/examples.md): every sample with its molen.dev/play link and `--template` id, plus the capability layers (kinematics,
61
64
  character, pathfinding, physics-rapier, terrain) — copy-and-modify starting points.
@@ -90,7 +93,7 @@ with `molen validate <file>`, which prints precise, fixable errors. The shipped
90
93
  Schema + example, generated from the registry) live in [schemas/](schemas/README.md):
91
94
 
92
95
  - [Scene manifest](schemas/scene.md) (`molen/scene@3`: entities, prefabs, `commands`, `components`, camera, input, physics, terrain, ambient)
93
- - [Transport network](schemas/transport-network.md) (`molen/transport-network@1`: roads, railways and paths for ambient traffic)
96
+ - [Transport network](schemas/transport-network.md) (`molen/transport-network@1`: roads, railways, paths and water routes for ambient traffic)
94
97
  - [Command envelope](schemas/command.md) · [Assertions](schemas/assert.md)
95
98
  - [Keyframe](schemas/keyframe.md) · [Delta](schemas/delta.md) · [Replay](schemas/replay.md)
96
99
  - [Components](schemas/components.md) — every component with units and axis conventions
@@ -11,6 +11,7 @@ Autogenerated from the schema registry `molen validate` checks against; `molen s
11
11
  - [Camera track](cameratrack.md) — `molen/cameratrack@1`
12
12
  - [Command envelope](command.md) — `molen/command@1`
13
13
  - [Per-tick delta](delta.md) — `molen/delta@1`
14
+ - [Ecological geography atlas](ecology-atlas.md) — `molen/ecology-atlas@1`
14
15
  - [Experience play scenario](experience-play.md) — `molen/experience-play@1`
15
16
  - [Figure descriptor](figure.md) — `molen/figure@1`
16
17
  - [Interior catalog](interior-catalog.md) — `molen/interior-catalog@1`
@@ -25,6 +26,7 @@ Autogenerated from the schema registry `molen validate` checks against; `molen s
25
26
  - [Prefab](prefab.md) — `molen/prefab@1`
26
27
  - [Project manifest](project.md) — `molen/project@1`
27
28
  - [Region style atlas](region-atlas.md) — `molen/region-atlas@1`
29
+ - [Regional content catalog](regional-catalog.md) — `molen/regional-catalog@1`
28
30
  - [Replay fixture](replay.md) — `molen/replay@1`
29
31
  - [Scatter rules](scatter.md) — `molen/scatter@1`
30
32
  - [Scene manifest](scene.md) — `molen/scene@3`
@@ -37,4 +39,5 @@ Autogenerated from the schema registry `molen validate` checks against; `molen s
37
39
  - [Transport network](transport-network.md) — `molen/transport-network@1`
38
40
  - [Entity type registry](types.md) — `molen/types@1`
39
41
  - [UV paint sidecar](uvpaint.md) — `molen/uvpaint@1`
42
+ - [Wildlife country range limits](wildlife-ranges.md) — `molen/wildlife-ranges@1`
40
43
  - [Worldgen batch](worldgen-batch.md) — `molen/worldgen-batch@1`
@@ -1249,6 +1249,36 @@ How to turn any outline into a styled building: massing, roof grammar, facade rh
1249
1249
  "details": {
1250
1250
  "type": "object",
1251
1251
  "properties": {
1252
+ "entrance": {
1253
+ "type": "object",
1254
+ "properties": {
1255
+ "width": {
1256
+ "type": "number",
1257
+ "minimum": 0.7,
1258
+ "maximum": 8
1259
+ },
1260
+ "height": {
1261
+ "type": "number",
1262
+ "minimum": 1.8,
1263
+ "maximum": 6
1264
+ },
1265
+ "style": {
1266
+ "type": "string",
1267
+ "enum": [
1268
+ "single",
1269
+ "double",
1270
+ "service"
1271
+ ]
1272
+ }
1273
+ },
1274
+ "required": [
1275
+ "width",
1276
+ "height",
1277
+ "style"
1278
+ ],
1279
+ "additionalProperties": false,
1280
+ "description": "A fitted visual entrance on the longest eligible exterior edge; omitted when structural ground openings exist."
1281
+ },
1252
1282
  "shutters": {
1253
1283
  "type": "boolean",
1254
1284
  "description": "Paired louvered shutters beside punched windows."
@@ -1547,6 +1577,11 @@ How to turn any outline into a styled building: massing, roof grammar, facade rh
1547
1577
  "minimum": 0,
1548
1578
  "maximum": 1000,
1549
1579
  "description": "Relative weight among sibling entries; 0 disables the entry."
1580
+ },
1581
+ "palette": {
1582
+ "type": "string",
1583
+ "minLength": 1,
1584
+ "description": "Key of `palettes` that tints this choice instead of the part palette, so brick stays brick-colored and concrete stays concrete-colored."
1550
1585
  }
1551
1586
  },
1552
1587
  "required": [
@@ -1630,6 +1665,11 @@ How to turn any outline into a styled building: massing, roof grammar, facade rh
1630
1665
  "minimum": 0,
1631
1666
  "maximum": 1000,
1632
1667
  "description": "Relative weight among sibling entries; 0 disables the entry."
1668
+ },
1669
+ "palette": {
1670
+ "type": "string",
1671
+ "minLength": 1,
1672
+ "description": "Key of `palettes` that tints this choice instead of the part palette, so brick stays brick-colored and concrete stays concrete-colored."
1633
1673
  }
1634
1674
  },
1635
1675
  "required": [
@@ -1694,6 +1734,95 @@ How to turn any outline into a styled building: massing, roof grammar, facade rh
1694
1734
  ],
1695
1735
  "additionalProperties": false
1696
1736
  },
1737
+ "flatRoof": {
1738
+ "type": "object",
1739
+ "properties": {
1740
+ "choices": {
1741
+ "minItems": 1,
1742
+ "type": "array",
1743
+ "items": {
1744
+ "type": "object",
1745
+ "properties": {
1746
+ "ref": {
1747
+ "type": "string",
1748
+ "pattern": "^(palette:#[0-9a-fA-F]{6}|matgraph:\\S+|pixelgrid:\\S+)$",
1749
+ "description": "materialRef: 'palette:#rrggbb', 'matgraph:<pack material id or path>', or 'pixelgrid:<id or path>'."
1750
+ },
1751
+ "weight": {
1752
+ "type": "number",
1753
+ "minimum": 0,
1754
+ "maximum": 1000,
1755
+ "description": "Relative weight among sibling entries; 0 disables the entry."
1756
+ },
1757
+ "palette": {
1758
+ "type": "string",
1759
+ "minLength": 1,
1760
+ "description": "Key of `palettes` that tints this choice instead of the part palette, so brick stays brick-colored and concrete stays concrete-colored."
1761
+ }
1762
+ },
1763
+ "required": [
1764
+ "ref",
1765
+ "weight"
1766
+ ],
1767
+ "additionalProperties": false
1768
+ },
1769
+ "description": "Weighted materials; one is picked per building."
1770
+ },
1771
+ "palette": {
1772
+ "type": "string",
1773
+ "minLength": 1,
1774
+ "description": "Key of `palettes` used to tint this part."
1775
+ },
1776
+ "tint": {
1777
+ "default": "multiply",
1778
+ "type": "string",
1779
+ "enum": [
1780
+ "multiply",
1781
+ "none"
1782
+ ],
1783
+ "description": "'multiply' = vertex color times texture (author textures light); 'none' = texture as is."
1784
+ },
1785
+ "uv": {
1786
+ "default": "meters",
1787
+ "type": "string",
1788
+ "enum": [
1789
+ "meters",
1790
+ "cell"
1791
+ ],
1792
+ "description": "'meters': world-metric UVs; 'cell': one repeat per (bay, floor) facade cell."
1793
+ },
1794
+ "uvScale": {
1795
+ "minItems": 2,
1796
+ "maxItems": 2,
1797
+ "type": "array",
1798
+ "items": {
1799
+ "type": "number",
1800
+ "exclusiveMinimum": 0
1801
+ },
1802
+ "description": "Meters per texture repeat [u, v] when uv is meters."
1803
+ },
1804
+ "uvOffset": {
1805
+ "default": "meters",
1806
+ "type": "string",
1807
+ "enum": [
1808
+ "cell",
1809
+ "meters",
1810
+ "none"
1811
+ ],
1812
+ "description": "Seeded per-building UV shift so neighbours never align."
1813
+ },
1814
+ "uvMirror": {
1815
+ "default": false,
1816
+ "type": "boolean",
1817
+ "description": "Allow a seeded horizontal flip."
1818
+ }
1819
+ },
1820
+ "required": [
1821
+ "choices"
1822
+ ],
1823
+ "additionalProperties": false,
1824
+ "description": "Replaces `roof` when the style resolves a flat roof (a flat choice or the flat fallback), so a pitched style keeps shingles on its slopes but light membrane or gravel on flat tops."
1825
+ },
1697
1826
  "trim": {
1698
1827
  "type": "object",
1699
1828
  "properties": {
@@ -1713,6 +1842,11 @@ How to turn any outline into a styled building: massing, roof grammar, facade rh
1713
1842
  "minimum": 0,
1714
1843
  "maximum": 1000,
1715
1844
  "description": "Relative weight among sibling entries; 0 disables the entry."
1845
+ },
1846
+ "palette": {
1847
+ "type": "string",
1848
+ "minLength": 1,
1849
+ "description": "Key of `palettes` that tints this choice instead of the part palette, so brick stays brick-colored and concrete stays concrete-colored."
1716
1850
  }
1717
1851
  },
1718
1852
  "required": [
@@ -1796,6 +1930,11 @@ How to turn any outline into a styled building: massing, roof grammar, facade rh
1796
1930
  "minimum": 0,
1797
1931
  "maximum": 1000,
1798
1932
  "description": "Relative weight among sibling entries; 0 disables the entry."
1933
+ },
1934
+ "palette": {
1935
+ "type": "string",
1936
+ "minLength": 1,
1937
+ "description": "Key of `palettes` that tints this choice instead of the part palette, so brick stays brick-colored and concrete stays concrete-colored."
1799
1938
  }
1800
1939
  },
1801
1940
  "required": [
@@ -1879,6 +2018,11 @@ How to turn any outline into a styled building: massing, roof grammar, facade rh
1879
2018
  "minimum": 0,
1880
2019
  "maximum": 1000,
1881
2020
  "description": "Relative weight among sibling entries; 0 disables the entry."
2021
+ },
2022
+ "palette": {
2023
+ "type": "string",
2024
+ "minLength": 1,
2025
+ "description": "Key of `palettes` that tints this choice instead of the part palette, so brick stays brick-colored and concrete stays concrete-colored."
1882
2026
  }
1883
2027
  },
1884
2028
  "required": [