@bendyline/molen-tooling 0.0.13 → 0.0.15
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.
- package/dist/capture/harness.js +551 -335
- package/dist/capture/worldgen-preview.js +539 -325
- package/dist/docs-src/guide/adaptive-performance.md +23 -17
- package/dist/docs-src/guide/aircraft.md +66 -18
- package/dist/docs-src/guide/ambient-life.md +15 -2
- package/dist/docs-src/guide/audio.md +38 -1
- package/dist/docs-src/guide/browser-mount.md +11 -0
- package/dist/docs-src/guide/determinism.md +2 -1
- package/dist/docs-src/guide/dioramas.md +7 -0
- package/dist/docs-src/guide/earth-view.md +45 -8
- package/dist/docs-src/guide/glass.md +134 -0
- package/dist/docs-src/guide/graphics-performance.md +42 -13
- package/dist/docs-src/guide/navigation.md +23 -5
- package/dist/docs-src/guide/night-lighting.md +2 -1
- package/dist/docs-src/guide/regional-fleets.md +9 -4
- package/dist/docs-src/guide/regional-world.md +6 -2
- package/dist/docs-src/guide/sky.md +2 -2
- package/dist/docs-src/guide/surface-rendering.md +9 -3
- package/dist/docs-src/guide/terrain.md +42 -9
- package/dist/docs-src/guide/vehicle-interiors.md +34 -3
- package/dist/docs-src/guide/vehicles.md +47 -1
- package/dist/docs-src/guide/weather.md +60 -21
- package/dist/docs-src/llms.txt +3 -2
- package/dist/docs-src/schemas/components.md +979 -140
- package/dist/templates/city-courier/gen/molen-types.ts +103 -2
- package/dist/templates/city-courier/scripts/molen-scripts.d.ts +102 -1
- package/dist/templates/city-courier/src/shared/playback.ts +21 -10
- package/dist/templates/cubes/src/shared/playback.ts +21 -10
- package/dist/templates/data-viz/src/shared/playback.ts +21 -10
- package/dist/templates/figures-gallery/src/shared/playback.ts +21 -10
- package/dist/templates/index.json +17 -17
- package/dist/templates/skybound/gen/molen-types.ts +103 -2
- package/dist/templates/skybound/scripts/molen-scripts.d.ts +102 -1
- package/dist/templates/skybound/src/shared/playback.ts +21 -10
- package/dist/templates/top-down-arena/scripts/molen-scripts.d.ts +102 -1
- package/dist/templates/top-down-arena/src/gen/molen-types.ts +103 -2
- package/dist/templates/top-down-arena/src/shared/playback.ts +21 -10
- package/package.json +12 -12
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
# Adaptive rendering performance
|
|
2
2
|
|
|
3
3
|
The world explorer defaults to **Auto (device)** quality. It measures frame cadence, CPU frame
|
|
4
|
-
work, and asynchronous GPU time when
|
|
5
|
-
target 60 FPS without changing simulation state. Manual Economy, Balanced,
|
|
6
|
-
available and can be selected without reloading or moving the camera.
|
|
4
|
+
work, and asynchronous GPU time when WebGL timer queries or WebGPU timestamps are available.
|
|
5
|
+
Six rendering tiers target 60 FPS without changing simulation state. Manual Economy, Balanced,
|
|
6
|
+
and High remain available and can be selected without reloading or moving the camera.
|
|
7
7
|
|
|
8
8
|
## Feedback and budgets
|
|
9
9
|
|
|
10
10
|
`AdaptiveQualityController` from `@bendyline/molen-client` returns a new integer tier when the
|
|
11
11
|
host should change its budgets. It evaluates one-second windows, uses trimmed frame averages
|
|
12
12
|
and slow-frame/p90 statistics, and waits for warmup and sustained overload before lowering detail.
|
|
13
|
-
Memory pressure can also lower detail. Recovery requires stable headroom
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
Memory pressure can also lower detail. Recovery requires stable headroom and memory margin in
|
|
14
|
+
displayed content. During continuous streaming, both CPU and GPU timings must show spare capacity;
|
|
15
|
+
without GPU timing, recovery waits for streaming to settle. Failed upward probes increase the
|
|
16
|
+
recovery delay. Hidden intervals and isolated long pauses reset or bypass measurements instead
|
|
17
|
+
of being mistaken for normal rendering.
|
|
16
18
|
While content streams, slow frames lower detail only when the measured CPU/GPU frame work is itself
|
|
17
19
|
heavy: streaming work runs outside the frame, and a lower tier would restart it. After a memory
|
|
18
20
|
step, the controller lets that step's lower-detail replacements load (up to the recovery delay)
|
|
@@ -20,17 +22,21 @@ before stepping again, since retained content keeps displayed bytes high until t
|
|
|
20
22
|
The explorer starts sampling once its first view has finished loading, or after 20 seconds: the
|
|
21
23
|
first frames carry one-time work (ground refining under the camera, collision trees rebuilt for
|
|
22
24
|
each refinement, models and materials arriving), and measured as overload it stepped a fast
|
|
23
|
-
desktop to the lowest tier before the visitor had moved.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
desktop to the lowest tier before the visitor had moved.
|
|
26
|
+
|
|
27
|
+
The explorer starts at Balanced and can climb through High to Ultra, using measured performance
|
|
28
|
+
rather than the GPU's name. It uses `EARTH_STICKY_QUALITY` timings from the start: down after
|
|
29
|
+
2.5 s of sustained overload, up one tier after 20 s of headroom, and frame-time changes at least
|
|
30
|
+
6 s apart. Measurements use one-second windows, so these are approximate delays. A failed upward
|
|
31
|
+
probe doubles the recovery delay, up to 120 s; that history stays with the controller throughout
|
|
32
|
+
the session. Selecting a manual preset resets it. Hidden time and startup loading do not earn an
|
|
33
|
+
upgrade. Manual presets remain fixed.
|
|
34
|
+
|
|
35
|
+
High switches buildings to a more detailed preset, so promotions need sustained headroom and the
|
|
36
|
+
explorer applies the resolution, terrain, building, surface and shadow changes over separate
|
|
37
|
+
frames. Brief takeoff/streaming stalls do not immediately undo an upgrade. The embeddable Earth
|
|
38
|
+
view retains its separate default ceiling of Balanced (`maxQualityLevel: 3`) and its initial
|
|
39
|
+
12 s calibration policy; hosts can explicitly raise that ceiling.
|
|
34
40
|
|
|
35
41
|
The explorer applies each tier to drawing-buffer resolution, terrain screen-space error and
|
|
36
42
|
range, selected/resident tile limits, terrain and semantic request concurrency, worldgen cache
|
|
@@ -34,10 +34,10 @@ streaming and floating-origin changes. Reloading starts a fresh session.
|
|
|
34
34
|
| --- | --- |
|
|
35
35
|
| E | Board, or exit after landing, stopping and engine shutdown |
|
|
36
36
|
| I | Start/stop engine; allow the propeller or rotor to spool |
|
|
37
|
-
|
|
|
37
|
+
| = / − | Increase/decrease throttle or helicopter collective; fighter afterburners engage above 85% throttle |
|
|
38
38
|
| W / S | Nose down / nose up |
|
|
39
39
|
| A / D | Bank left / right; helicopter cyclic |
|
|
40
|
-
|
|
|
40
|
+
| Z / C | Left / right rudder or anti-torque pedals; ground steering in the Mustang |
|
|
41
41
|
| Space | Wheel brakes |
|
|
42
42
|
| G | Retract/extend airplane gear while airborne |
|
|
43
43
|
| F | Toggle airplane flaps |
|
|
@@ -48,7 +48,7 @@ streaming and floating-origin changes. Reloading starts a fresh session.
|
|
|
48
48
|
|
|
49
49
|
Mustang: start the engine, set flaps, hold the brake while raising throttle, then release the brake.
|
|
50
50
|
The propeller swings the nose left as the tail gets light, and a crosswind turns it into the wind:
|
|
51
|
-
hold a little right rudder (
|
|
51
|
+
hold a little right rudder (C), or rudder away from the wind, to keep the runway centerline.
|
|
52
52
|
Rotate around 85–100 knots and release the pitch key once the nose is about 10 degrees up; the
|
|
53
53
|
airplane keeps the attitude it lifted off at. At climb power the propeller's torque rolls it
|
|
54
54
|
slowly left, so tap right bank (D) as needed. Retract gear and flaps after climbing. Reduce
|
|
@@ -79,7 +79,7 @@ markings are decorative, while live flight readings come from the HUD. Board at
|
|
|
79
79
|
entry point. Its larger footprint needs substantially more runway and clearance.
|
|
80
80
|
|
|
81
81
|
Osprey and Harrier: use J to select vertical thrust (the parked Osprey starts there), allow the nacelles/nozzles to
|
|
82
|
-
reach 90°, start the engine and increase power smoothly. W/S, A/D and
|
|
82
|
+
reach 90°, start the engine and increase power smoothly. W/S, A/D and Z/C provide powered pitch,
|
|
83
83
|
roll and yaw control in a hover. Transition toward forward thrust gradually while gaining airspeed;
|
|
84
84
|
the nacelles take 12 seconds for full travel and Harrier nozzles take 3. These are simplified
|
|
85
85
|
powered-lift dynamics, with finite travel, vertical thrust, engine-dependent hover authority and
|
|
@@ -105,25 +105,47 @@ and a small rebound. A wingtip strike can turn the aircraft while it keeps movin
|
|
|
105
105
|
continues to fall, tumble and slide. Terrain is tested at the airframe probes as well as at the
|
|
106
106
|
landing origin, so a banked wing can hit the runway before the wheels or fuselage.
|
|
107
107
|
|
|
108
|
-
The Mustang has detachable wings, tail surfaces and propeller; the OH-6 has
|
|
109
|
-
and tail; the small airliner has detachable wings (with their engines) and
|
|
108
|
+
The Mustang has detachable wings, tail surfaces and propeller; the OH-6 has separate main rotor,
|
|
109
|
+
tail rotor and tail sections; the small airliner has detachable wings (with their engines) and
|
|
110
|
+
tail. Every animated rotor, propeller and fan in the aircraft catalog has its own collision disc
|
|
111
|
+
and breakable joint. Strong impacts
|
|
110
112
|
or repeated loaded scrapes consume joint integrity. Separation removes the section's collision
|
|
111
113
|
probes, reduces lift/control authority and can disable its attached engines. An asymmetric wing
|
|
112
114
|
loss produces a rolling moment. Detached geometry retains its own velocity and spin, then falls,
|
|
113
115
|
bounces and slows against terrain and resident obstacles. Debris expires after 20 simulation
|
|
114
116
|
seconds; the missing section stays missing. **R** repairs the aircraft and clears debris.
|
|
115
|
-
|
|
116
|
-
|
|
117
|
+
Losing both wings switches the fuselage to ballistic wreck motion, disabling thrust and flight
|
|
118
|
+
controls. Ground and obstacle contact dissipates wreck spin as well as sliding motion, so the
|
|
119
|
+
fuselage settles after impact; airborne wrecks continue to fall and tumble.
|
|
120
|
+
Other aircraft retain their existing airframe probes alongside their independent rotor parts;
|
|
121
|
+
additional wing, tail and gear separation requires authored section bindings.
|
|
122
|
+
|
|
123
|
+
Rotors collide across their complete swept disc, including its interior and the spaces between
|
|
124
|
+
the old tip probes. The obstacle adapter clips triangles to the disc's thickness and tests the
|
|
125
|
+
radial boundary: geometry above or below a horizontal rotor clears it. Both rotors on tandem
|
|
126
|
+
helicopters and both Osprey proprotors are independent; the latter follow the actual nacelle
|
|
127
|
+
conversion position. Blade speed contributes to joint damage, so hovering beside a post can
|
|
128
|
+
break a spinning rotor even when the hub is stationary. Propeller loss disables its engine;
|
|
129
|
+
tail-rotor loss removes anti-torque authority and produces yaw. These conservative swept
|
|
130
|
+
volumes remain active when stopped, regardless of visible blade phase.
|
|
117
131
|
|
|
118
132
|
For custom models, `spec.collisionParts` replaces `collisionProbes`. Every section declares a
|
|
119
|
-
unique `id`, a `role` (`body`, `leftWing`, `rightWing`, `tail`, `rotor`, `gear` or `engine`), local
|
|
133
|
+
unique `id`, a `role` (`body`, `leftWing`, `rightWing`, `tail`, `rotor`, `tailRotor`, `gear` or `engine`), local
|
|
120
134
|
probe centers and sphere `radius`, a section `center`, `massFraction`, and GLB `nodes`. Add
|
|
121
135
|
`breakSpeed` in m/s for a breakable joint and `engines` for engines carried by that section.
|
|
122
136
|
Keep a non-detachable `body` and at least 20% of the mass. Optional `fragments` selects triangles
|
|
123
137
|
from shared static detail meshes using a model-space bounding box, so markings follow a wing.
|
|
138
|
+
`disc` replaces a section's sphere probes with a model-space `center`, unit `normal`, `radius`,
|
|
139
|
+
`halfThickness` and `rotor` node from `visual.rotors`. Its optional `tilt` hinge (`pivot`, unit
|
|
140
|
+
`axis`, `angle`) follows `thrustVectorPosition`. A `parent` part id makes a rotor separate when
|
|
141
|
+
its supporting wing or tail breaks, with no duplicate geometry or debris. Detached rotors
|
|
142
|
+
inherit their shaft spin. Terrain uses deterministic samples of the disc interior, rim and
|
|
143
|
+
lowest point; arbitrary height fields are not exact triangle meshes.
|
|
144
|
+
|
|
124
145
|
These are gameplay approximations with authored joint strengths, not a structural engineering
|
|
125
|
-
or accident-reconstruction model.
|
|
126
|
-
debris-to-debris contacts and impulse transfer into other vehicles are not simulated.
|
|
146
|
+
or accident-reconstruction model. Detached pieces use sphere collision proxies; mesh deformation, fire,
|
|
147
|
+
debris-to-debris contacts and impulse transfer into other vehicles are not simulated. The obstacle
|
|
148
|
+
adapter uses oriented boxes for other cars and body-center spheres for other aircraft.
|
|
127
149
|
|
|
128
150
|
Hosts provide `AircraftEnvironment.contacts(probes, entity)` with world-space contact points,
|
|
129
151
|
outward normals and penetration depths. `aircraftObstacleContacts` from `client/aircraft`
|
|
@@ -175,6 +197,16 @@ ownership of a loaded GLB and animates the nodes named by `spec.visual` from air
|
|
|
175
197
|
exterior moving parts as [model-signal bindings](vehicle-interiors.md#exterior-animation), with
|
|
176
198
|
keyframed curves so one gear position can sequence doors and legs.
|
|
177
199
|
|
|
200
|
+
Exposed airplane propellers fade from individual blades into a translucent, soft-edged disk
|
|
201
|
+
between 20 and 60 rad/s (about 190–570 RPM). The disk follows actual shaft speed, including
|
|
202
|
+
independent engines and spool-down, so blades cannot appear frozen at normal operating RPM.
|
|
203
|
+
Its size and radial colors come from the blade geometry and materials; separate central hubs stay solid.
|
|
204
|
+
This render-only effect needs no model changes and works with WebGL and WebGPU. Fading blades use
|
|
205
|
+
transparent copies of their materials, listed in `userData.materialVariants`: a preparing renderer
|
|
206
|
+
builds them on request, and the blades stay solid until they are built rather than stalling the
|
|
207
|
+
frame the engine starts. Helicopter
|
|
208
|
+
rotors and enclosed jet fans retain their existing animation.
|
|
209
|
+
|
|
178
210
|
For powered lift, declare `spec.poweredLift` with positive `transitTime`, `controlFadeSpeed`,
|
|
179
211
|
`pitchAuthority`, `rollAuthority`, `yawAuthority` and `damping`, and mark the participating
|
|
180
212
|
forward-facing engine installations `vectored: true`. `aircraftInput.thrustVector` is 0–1;
|
|
@@ -258,8 +290,8 @@ Published cruise, maximum and operating speeds are different quantities. Where a
|
|
|
258
290
|
not specify weight, altitude or throttle, the test condition is explicitly estimated. Some
|
|
259
291
|
aircraft still have engineering-estimate anchors. Passing a fitted anchor establishes internal
|
|
260
292
|
consistency, not independent real-world validation. All polar, lapse and high-alpha coefficients
|
|
261
|
-
remain approximations. Fuel burn, stores,
|
|
262
|
-
structural failures and certified flight-control laws are not modeled.
|
|
293
|
+
remain approximations. Fuel burn, stores, continuous CG changes, detailed engine maps, icing,
|
|
294
|
+
fatigue, load-induced structural failures and certified flight-control laws are not modeled.
|
|
263
295
|
|
|
264
296
|
Flight assistance is limited to the pitch axis, so a keyboard can fly it. The stick moves an
|
|
265
297
|
elevator (deflecting at `pitchResponse` per second and springing back four times faster) that
|
|
@@ -420,10 +452,11 @@ wind and forward motion give consistent results. Collision sampling is at least
|
|
|
420
452
|
of translation per substep. Unknown terrain pauses at the last known position and resumes when
|
|
421
453
|
support is available.
|
|
422
454
|
|
|
423
|
-
Hosts can supply `groundHeight`, `wind` and `
|
|
455
|
+
Hosts can supply `groundHeight`, `wind` and `contacts(probes, entity)` (or the legacy
|
|
456
|
+
`canOccupy(transform, spec, entity)`). The world view
|
|
424
457
|
checks nearby resident geometry, the airfield, cars and other aircraft. Cars and exits also check
|
|
425
458
|
conservative aircraft bounds. Imported collision hulls are
|
|
426
|
-
available for hosts that need a different collision solver. Without
|
|
459
|
+
available for hosts that need a different collision solver. Without either obstacle callback, the kernel only
|
|
427
460
|
collides with terrain. Do not add a second physics body that also writes the aircraft transform.
|
|
428
461
|
|
|
429
462
|
This is a game flight model with recognizable polygonal aircraft, not a full aircraft systems
|
|
@@ -446,7 +479,7 @@ master switches, individual engine switches and throttles for airplanes with nam
|
|
|
446
479
|
parking brakes, and applicable gear, flap and nozzle controls. Supplemental labeled modules fill
|
|
447
480
|
gaps in the original models; their layout approximates the aircraft rather than reproducing every
|
|
448
481
|
real switch. The Cessna 172's existing master rocker and flap selector are directly operable.
|
|
449
|
-
Moving common power (including
|
|
482
|
+
Moving common power (including =/− or the modeled **PWR ALL** handle)
|
|
450
483
|
synchronizes all throttle levers while preserving individual engine cutoffs, mixtures and propeller settings. A throttle indicates
|
|
451
484
|
commanded power; shaft RPM follows the simulation's spool response. Retractable airplane gear is
|
|
452
485
|
locked on the ground. Helicopters retain the existing shared engine/gearbox model and collective.
|
|
@@ -490,8 +523,15 @@ Hosts pass the camera to `visual.updateView(camera)` each frame (in the coordina
|
|
|
490
523
|
`visual.object.position`). The cabin, the interior's `nodes`, is drawn only within three times
|
|
491
524
|
the aircraft's length or span of it (at least 60 m): cockpits held most of an aircraft's draw calls
|
|
492
525
|
and as many again in the shadow pass, yet from farther away they are a few pixels behind the canopy.
|
|
493
|
-
Boarded and chase views are always near enough
|
|
494
|
-
|
|
526
|
+
Boarded and chase views are always near enough, but within the cabin a part too small to see from
|
|
527
|
+
the camera (an angular radius under 0.002 rad, a few pixels at 1080p) leaves the frame: from a chase
|
|
528
|
+
camera a P-51's 415 cockpit meshes were a quarter of a takeoff's draws. That culling uses the
|
|
529
|
+
part's render layers, so the `visible` that bindings and damage set is never overridden. A
|
|
530
|
+
`flight-controls` group (the generated cockpit controls) counts as cabin too. Earth views and the
|
|
531
|
+
world explorer also prepare an aircraft's shaders before its model joins the scene.
|
|
532
|
+
|
|
533
|
+
Double-sided transparent materials (canopies, windscreens, instrument covers) draw in one pass:
|
|
534
|
+
three otherwise draws each such pane twice and builds a program before each face, every frame.
|
|
495
535
|
|
|
496
536
|
`createAircraftVisual` exposes `cockpit`, a mesh picker and control inventory derived from the
|
|
497
537
|
interior's authored primary-input bindings and glTF node `extras.aircraftControl` metadata.
|
|
@@ -538,3 +578,11 @@ hold is a harness feature, not a player control or a certified performance chart
|
|
|
538
578
|
`packages/kernel/test/aircraft-engines.test.ts` covers symmetric two/four-engine layouts,
|
|
539
579
|
mirrored engine failures, counter-rudder, thrust moment arms, independent switches/spool,
|
|
540
580
|
explicit repair, terrain rollback, exit safety, keyframe restoration and 30/60/120 Hz consistency.
|
|
581
|
+
|
|
582
|
+
Exterior mechanisms use the snapshot-owned [graduated actuator system](vehicle-interiors.md#graduated-mechanisms).
|
|
583
|
+
Canopies, hooks and speed brakes accept fractional targets through `aircraftInput.actuators`;
|
|
584
|
+
`aircraftState.actuators` holds actual travel. Ordinary mechanisms reverse immediately from
|
|
585
|
+
their current position. Speed-brake drag follows deployment. Retractable helicopter gear
|
|
586
|
+
uses `helicopter.fixedGear: false` and `gearTransitTime`; skids remain fixed by default.
|
|
587
|
+
The supplied aircraft expose only fitted equipment. Helicopter blade release is a gameplay
|
|
588
|
+
escape effect, triggered by the latched `eject` actuator, and removes rotor lift after release.
|
|
@@ -341,7 +341,8 @@ The quality tier caps the numbers:
|
|
|
341
341
|
| Ultra | 320 | 120 | 2 | 4 | 16 | 1000 m |
|
|
342
342
|
|
|
343
343
|
Ambient cars share the view's vehicle world, so the car you drive stops against them and traffic
|
|
344
|
-
waits for you,
|
|
344
|
+
waits for you, for the view's [actors](earth-view.md#actors-companions-and-npcs) on foot and for
|
|
345
|
+
cars a driver left standing. They
|
|
345
346
|
follow the rendered ground and bridge decks, and they rebuild when the view re-anchors after a long
|
|
346
347
|
trip.
|
|
347
348
|
|
|
@@ -367,6 +368,16 @@ no longer counts or removes it, and the actors draw it from then on, looking at
|
|
|
367
368
|
interactable unless the spec says otherwise. `adopt` returns undefined when the pedestrian has
|
|
368
369
|
already gone. It is one-way; an actor never returns to the pool.
|
|
369
370
|
|
|
371
|
+
### Taking a stopped car
|
|
372
|
+
|
|
373
|
+
A walker can take over a traffic car that has stopped (slower than 0.5 m/s), such as one waiting
|
|
374
|
+
for them at the kerb. `EarthVehicles` counts it as a car in reach: `openDoor` and `enter` take it
|
|
375
|
+
out of traffic and stand a drivable car of the same type and paint at its pose, and the agent
|
|
376
|
+
leaves in the frame that car's model shows. Pass `vehicles.trafficSolids()` to `ambient.sync`
|
|
377
|
+
with your other solids, so the cars queued behind it keep their gap until it drives off. A taken
|
|
378
|
+
car nobody drove away rejoins traffic where it stopped once its model unloads (65 m away); one
|
|
379
|
+
driven elsewhere stays parked there. Moving traffic is never boardable.
|
|
380
|
+
|
|
370
381
|
## NPC content and `ambientRole`
|
|
371
382
|
|
|
372
383
|
An entity type joins the ambient pools with an `ambientRole`:
|
|
@@ -489,7 +500,9 @@ most one tile every 200 ms. In the engine repository,
|
|
|
489
500
|
counts follow the width when OSM does not give them.
|
|
490
501
|
- Aircraft fly straight lines. They do not taxi, circle or land beyond the approach.
|
|
491
502
|
- Pedestrians keep to their lane and follow the walker ahead. They do not step around each other.
|
|
492
|
-
- Agents do not open doors, board, or park. A
|
|
503
|
+
- Agents do not open doors, board, or park. A walker can take a stopped car out of traffic (see
|
|
504
|
+
[Taking a stopped car](#taking-a-stopped-car)); a parked car in the Earth view is a separate
|
|
505
|
+
entity.
|
|
493
506
|
- A promoted pedestrian keeps its body but nothing of its walk: it stands until its actor
|
|
494
507
|
behaviour moves it, and it never rejoins ambient life.
|
|
495
508
|
|
|
@@ -17,7 +17,7 @@ play without opening a browser.
|
|
|
17
17
|
| `molen.audio.*` | scene scripts | `play`, `stop` and `music`, emitted as `audio.*` events |
|
|
18
18
|
| `@bendyline/molen-client/audio` | the page | `createAudioLayer` loads banks and plays what the rules ask for |
|
|
19
19
|
|
|
20
|
-
The `molen.sounds` content pack carries
|
|
20
|
+
The `molen.sounds` content pack carries 170 CC0 sounds (ambience, vehicles, footsteps, impacts,
|
|
21
21
|
foley, UI, stings and six music tracks). Fetch it into a project with:
|
|
22
22
|
|
|
23
23
|
```sh
|
|
@@ -212,6 +212,43 @@ boats and exterior cameras retain outside ambience. Only one bed per category pl
|
|
|
212
212
|
staggered rotation and five-second crossfades. See [Earth view](earth-view.md) for host inputs.
|
|
213
213
|
Pass `audio: false` to turn it off, and use `view.audio` for volume.
|
|
214
214
|
|
|
215
|
+
Vehicle details use the same simulation snapshots as the visuals:
|
|
216
|
+
|
|
217
|
+
- Pedestrian-signal recordings belong to the `earth:category:crossing` pool. They require a
|
|
218
|
+
nearby mapped or rendered traffic signal, fade to silence 55 m from the junction edge and
|
|
219
|
+
25 m above ground, and stay silent when the map context is unknown. Ordinary traffic keeps
|
|
220
|
+
its separate road-distance mix. The recording contains its own signal cycle; it is not a
|
|
221
|
+
promise that a simulated crossing is safe to use.
|
|
222
|
+
- Paved airplane touchdowns play a short tire spin-up chirp, scaled by ground speed and descent
|
|
223
|
+
rate. Retracted gear, crashes, grass/unknown surfaces, parked spawns and rapid landing bounces
|
|
224
|
+
stay quiet. Composing hosts supply `EarthAudioFrame.surfaceAt(x, z)` so contact uses the
|
|
225
|
+
aircraft's position; the standard Earth view and World Explorer do this automatically.
|
|
226
|
+
- Door, hood and trunk actuator movement triggers opening/sliding foley; a closing latch sounds
|
|
227
|
+
only when travel reaches the shut position. Van rear doors slide. Wipers sound at each
|
|
228
|
+
half-cycle of their actual actuator phase, including the return stroke when switched off.
|
|
229
|
+
Legacy vehicles retain boarding cues. Passenger boarding never starts or stops an engine.
|
|
230
|
+
- Flap and retractable landing-gear motor loops track changes in `flapPosition` and
|
|
231
|
+
`gearPosition`. They run during extension/retraction, preserve one voice through reversals,
|
|
232
|
+
and fade out when the mechanism stops, including partial flap settings. Fixed or instant
|
|
233
|
+
gear stays silent; retractable helicopter gear is supported. Pauses, teleports, removed
|
|
234
|
+
aircraft and world switches clean up the loops. The two generic servo recordings are CC0:
|
|
235
|
+
[vacuumfan7072](https://freesound.org/people/vacuumfan7072/sounds/264592/) and
|
|
236
|
+
[Burningmonkey](https://freesound.org/people/Burningmonkey/sounds/322021/).
|
|
237
|
+
- Helicopter engine loops tagged `rotor` use estimated collective and cyclic feathering angles,
|
|
238
|
+
bank/rate, descending inflow and listener direction to change gain, low-pass cutoff and a
|
|
239
|
+
once-per-revolution loading envelope. Web Audio generates that envelope at audio rate;
|
|
240
|
+
the recorded blade-passage chop remains intact. RPM still controls playback speed. This is
|
|
241
|
+
an authored acoustic approximation, not a calibrated aerodynamic noise solver, and it does
|
|
242
|
+
not change flight physics or replay hashes. The dependency choices are informed by NASA's
|
|
243
|
+
[maneuvering flight noise study](https://ntrs.nasa.gov/citations/20160005979).
|
|
244
|
+
|
|
245
|
+
Interactive emitters take priority over background beds when the voice budget is full. Missing
|
|
246
|
+
new foley in older/custom packs is silent. The added recordings are CC0, with source pages,
|
|
247
|
+
authors, verified license dates and source hashes in the sound pack's `sources.json` and credits
|
|
248
|
+
in `NOTICE.md`: [tire foley](https://freesound.org/people/johnnydekk/sounds/614627/),
|
|
249
|
+
[wipers](https://bigsoundbank.com/windshield-wipers-slow-2-s3111.html) and
|
|
250
|
+
[sliding door foley](https://freesound.org/people/SwagMuffinPlus/sounds/176146/).
|
|
251
|
+
|
|
215
252
|
Sound packs can also provide a `birdsong` document (`molen/earth-birdsong@1`). The default pack
|
|
216
253
|
contains eight CC0 regional recordings, selected by geography, observed habitat, calendar month
|
|
217
254
|
and local sunlight. Dawn choruses peak near sunrise, breeding songs quieten outside their authored
|
|
@@ -166,6 +166,17 @@ renderer, and on a software rasterizer it will lose.
|
|
|
166
166
|
|
|
167
167
|
## Manual frame loop
|
|
168
168
|
|
|
169
|
+
Automatic clients pause the kernel and stop rendering when the browser window loses focus or
|
|
170
|
+
the tab becomes hidden. Queued GPU preparation waits too. Focus resumes playback without
|
|
171
|
+
catching up the time spent away; an explicit pause or a `startPaused` loading screen stays paused.
|
|
172
|
+
GPU resources remain allocated for a quick return — this frees rendering capacity, not VRAM.
|
|
173
|
+
Pass `pauseWhenInactive: false` to keep a live client running in the background.
|
|
174
|
+
|
|
175
|
+
Manual frame loops and snapshot captures remain host-controlled by default. A manual live client
|
|
176
|
+
can opt into worker suspension with `pauseWhenInactive: true`; its host still owns render calls.
|
|
177
|
+
Custom loops can use `observePageActivity(callback)` to observe initial activity and subsequent
|
|
178
|
+
window focus/blur and page visibility changes; its return value removes the listeners.
|
|
179
|
+
|
|
169
180
|
Pass `frameLoop: 'manual'` to drive rendering yourself (machinima camera tracks, custom timing):
|
|
170
181
|
|
|
171
182
|
```ts
|
|
@@ -46,6 +46,7 @@ subsystem's contribution to the state hash reproduces.
|
|
|
46
46
|
| Scene scripts | Cross-platform **until** the script calls a transcendental; then same JS engine | the Compartment's `Math` is IEEE-exact natives plus `dmath` for everything else (`kernel/src/scripting.ts`); `Math.random` is absent and `Date`/`Intl`/`Promise` are shadowed to `undefined` |
|
|
47
47
|
| Quaternion helpers that use angles — `quatSlerp`, `lookRotation`, `quatFromYaw`, `quatFromEuler`, `yawOf` | Same JS engine | `kernel/src/math3d.ts` routes these through `dmath.sin/cos/acos/atan2`, and `dmath` is currently a thin re-export of native `Math` |
|
|
48
48
|
| Vehicles and aircraft | Same JS engine | `kernel/src/vehicles.ts` and `aircraft.ts` use `dmath.sin/cos/tan/atan2/exp` |
|
|
49
|
+
| Glass fracture and retention | Same JS engine | Authored panes and resolved contact loads produce persistent `glassState`; vehicle-driven loads inherit the chassis solver's guarantee. Debris is cosmetic and uses simulation time |
|
|
49
50
|
| Figures (`@bendyline/molen-figures/kernel`) | Same JS engine | its locomotion system writes `figureState` and `transform.rot` into the world and registers a `figures` snapshot provider, so it **is** hashed; it reaches `dmath.atan2` and `quatFromYaw`, and `gait.ts` reaches `dmath.pow`/`sin`/`cos` |
|
|
50
51
|
| Ambient life (`@bendyline/molen-ambient/kernel`) | Same JS engine | agent state (`ambientAgent`, the `$ambient` bookkeeping entity) and transforms are written into the world, so it **is** hashed; occupancy, junction grants and signal phases are rebuilt from components every tick, so a keyframe restores exactly into a world whose transport network was built from the same inputs. It reaches `dmath.acos/sin/cos` and `lookRotation`. The network itself is a `WeakMap` side channel like worldgen's |
|
|
51
52
|
| `physics.engine: "rapier"` (3D rigid bodies) | Same build + platform | `@dimforge/rapier3d-compat` WASM; the plugin hashes an opaque `takeSnapshot()` blob plus its id→handle maps |
|
|
@@ -135,7 +136,7 @@ Two constants live in `packages/kernel/src/version.ts` and they do different job
|
|
|
135
136
|
|
|
136
137
|
| Constant | Today | Role |
|
|
137
138
|
|---|---|---|
|
|
138
|
-
| `ENGINE_VERSION` | `0.0.
|
|
139
|
+
| `ENGINE_VERSION` | `0.0.10` | metadata. Written into a keyframe's `engine` field so a save says which build wrote it. **Never compared on load, never hashed.** |
|
|
139
140
|
| `STATE_FORMAT` | `1` | the gate. Written into a keyframe under the reserved `plugins.$format` key, compared by `applyKeyframeTo`, and folded into `stateHash` as `stateFormat`. |
|
|
140
141
|
|
|
141
142
|
So a release — even one that moves every package — keeps your keyframes
|
|
@@ -56,6 +56,8 @@ const director = new DioramaDirector({
|
|
|
56
56
|
// assets: a host-owned AssetCache, when the scene uses glTF refs
|
|
57
57
|
// A large streamed world keeps the diorama's own lights out (see below).
|
|
58
58
|
localLights: false,
|
|
59
|
+
// Build its shaders before it is shown.
|
|
60
|
+
prepare: (object, parent) => viewer.renderer.prepareObject(object, undefined, parent),
|
|
59
61
|
}),
|
|
60
62
|
onError: (error, id) => console.error(id, error),
|
|
61
63
|
});
|
|
@@ -82,6 +84,11 @@ A diorama's point and spot lights light the host scene by default. In a large st
|
|
|
82
84
|
`localLights: false` (Earth hosts do): three compiles the scene's lights into every lit shader, so a
|
|
83
85
|
light that arrives and leaves with a diorama rebuilds every object in view in one frame.
|
|
84
86
|
|
|
87
|
+
`prepare` builds a diorama's shaders before it joins `root`: its figures, models and static
|
|
88
|
+
batches otherwise build theirs in the first frame that draws them, and a flight school beside a
|
|
89
|
+
runway stalled a takeoff for a quarter of a second. `EarthDioramaOptions.prepareObject` is the same
|
|
90
|
+
hook for the Earth director; `mountEarthView` passes its renderer's.
|
|
91
|
+
|
|
85
92
|
The loader is a host callback: use an allowlisted dynamic import, HTTP URL or your pack reader.
|
|
86
93
|
The runtime never chooses content hosts. `loadDioramaScene` fetches the scene and relative `.js`
|
|
87
94
|
scripts with the supplied AbortSignal. For `.ts`, use `molenScripts()` with a lazy `?raw` import
|
|
@@ -59,6 +59,10 @@ worker you omit does its work on the main thread instead.
|
|
|
59
59
|
Buildings appear with vertex colors while shared material textures bake in the background.
|
|
60
60
|
Completed textures update the existing materials without regenerating buildings. Terrain detail
|
|
61
61
|
refines in small groups, retaining visible detail during camera turns while replacements load.
|
|
62
|
+
With worldgen content, distant tiles retain broad landcover colors and bounded building silhouettes;
|
|
63
|
+
trees and street detail remain nearby. Water appears independently of those slower layers and also
|
|
64
|
+
warms just outside the camera view. Byte-cache prefetch includes distant landcover at every available
|
|
65
|
+
map level, so revisiting an area can reuse that coverage as well as its elevation and water.
|
|
62
66
|
|
|
63
67
|
Metal and glass use a shared procedural sky/ground reflection environment by default. The viewer
|
|
64
68
|
reuses its filtered texture until lighting changes; camera movement does not regenerate it.
|
|
@@ -91,16 +95,27 @@ neutral olive.
|
|
|
91
95
|
|
|
92
96
|
Buildings, trees and landmarks cast sun shadows onto everything around what the camera frames:
|
|
93
97
|
the orbit target (sized to the view), or a little ahead of the walker, car or aircraft. The
|
|
94
|
-
shadow map follows that focus in whole texels
|
|
98
|
+
shadow map follows that focus in whole texels anchored to world coordinates, including through
|
|
99
|
+
floating-origin rebases. Its coverage changes in small steps with hysteresis, so camera bob and
|
|
100
|
+
minor altitude changes do not resize the texel grid every frame. Adaptive quality
|
|
95
101
|
turns shadows off at its two lowest levels; `shadows: false` turns them off entirely. Only layer
|
|
96
102
|
parts taller than `EARTH_SHADOW_CASTER_HEIGHT` (3.5 m) cast: shrubs, brambles and saplings stay
|
|
97
103
|
out of the shadow pass, where their shadows would mostly fall inside the canopy's.
|
|
98
104
|
|
|
99
105
|
In flight the shadow footprint widens with height above the local ground: its half-width is
|
|
100
|
-
four times that height, capped at 5 km
|
|
106
|
+
four times that height, capped at 5 km. Below 8 m the half-width is 24 m plus the height,
|
|
107
|
+
preserving aircraft and contact-shadow detail on the runway. The renderer rounds coverage up
|
|
108
|
+
to a stable size (and holds it through small changes). This pushes
|
|
101
109
|
the shadow boundary farther into the distance in aerial views, trading some shadow sharpness
|
|
102
110
|
for coverage at the same map resolution. Walking and driving keep their tighter footprints.
|
|
103
111
|
|
|
112
|
+
Earth viewers reserve a 4096-pixel sun map before preparing materials. WebGPU retains that
|
|
113
|
+
allocation across quality changes, so High really uses 4096 pixels even after starting at a
|
|
114
|
+
lower tier; WebGL can resize it with the tier. A chase camera 10 m above ground covers an
|
|
115
|
+
80 m square, giving roughly 2 cm shadow texels on High for wings, propellers and landing gear.
|
|
116
|
+
Chase views also reserve at least the camera-to-aircraft distance as their half-width, keeping
|
|
117
|
+
large airliners and their shadows inside the tighter runway footprint.
|
|
118
|
+
|
|
104
119
|
`touchJoystickContainer` adds an on-screen movement stick while walking, driving or flying. By default it
|
|
105
120
|
appears only on touch devices; pass `touchJoystick: 'always'` to show it everywhere.
|
|
106
121
|
|
|
@@ -180,8 +195,8 @@ geographic (`viewer`, poses, places) is stable across re-anchors.
|
|
|
180
195
|
```ts
|
|
181
196
|
view.setMode('walk', { at: { latitude, longitude, heading } }); // start here, facing heading
|
|
182
197
|
view.walker.place({ latitude, longitude }); // teleport (enters walk mode if needed)
|
|
183
|
-
view.walker.pose(); // { latitude, longitude, altitude, heading, speed, grounded } | undefined
|
|
184
|
-
view.walker.ready; //
|
|
198
|
+
view.walker.pose(); // { latitude, longitude, altitude, heading, speed, grounded, swimming } | undefined
|
|
199
|
+
view.walker.ready; // placed on streamed ground or water
|
|
185
200
|
```
|
|
186
201
|
|
|
187
202
|
A place inside the current frame drops the walker at once (it lands when the ground there has
|
|
@@ -190,6 +205,12 @@ another terrain region with `terrainSource`, re-anchors first: the mode is `walk
|
|
|
190
205
|
orbit camera holds over the destination while the frame rebuilds, and the walker lands when it is
|
|
191
206
|
done.
|
|
192
207
|
|
|
208
|
+
Walking into deep water automatically starts surface swimming; reaching shallow ground returns
|
|
209
|
+
to walking. The same movement controls apply, with Shift swimming faster. The camera stays above
|
|
210
|
+
the water, and `view.walker.pose()?.swimming` reports the transition without changing the `walk`
|
|
211
|
+
navigation mode. Water coverage comes from rendered water surfaces or the `waterAt` option,
|
|
212
|
+
including lakes above sea level.
|
|
213
|
+
|
|
193
214
|
```ts
|
|
194
215
|
view.walker.setAvatar({ figure: { preset: 'human.adult', height: 1.7, palette: { top: '#2f5a3b' } } });
|
|
195
216
|
view.walker.setAvatar({ type: 'my.app.character.guide' }); // an entity type with a `figure`
|
|
@@ -1019,7 +1040,11 @@ These regional forms are visual priors, not surveyed attributes of individual bu
|
|
|
1019
1040
|
is still warm when the view pans back.
|
|
1020
1041
|
- `stats().worldgen` counts styled building generation since the current terrain stream started
|
|
1021
1042
|
(with content packs): tiles generated, buildings drawn as geometry, and instanced stand-ins.
|
|
1022
|
-
-
|
|
1043
|
+
- Window blur and hidden tabs automatically pause simulation, rendering, queued GPU preparation,
|
|
1044
|
+
audio and prefetching. Returning to a visible, focused page resumes without simulation catch-up.
|
|
1045
|
+
`setPaused(true)` keeps the view paused even after focus returns; `setPaused(false)` releases
|
|
1046
|
+
that manual pause. Pass `pauseWhenInactive: false` for a host that manages activity itself.
|
|
1047
|
+
Resources stay loaded for quick resume; GPU memory is retained. `dispose()` releases the GPU
|
|
1023
1048
|
context, workers and listeners. Mounting is abortable through `signal`.
|
|
1024
1049
|
|
|
1025
1050
|
## Sound
|
|
@@ -1078,10 +1103,21 @@ the full contract and current prototype limits.
|
|
|
1078
1103
|
|
|
1079
1104
|
## Airport layouts
|
|
1080
1105
|
|
|
1106
|
+
Airport terrain is graded before terrain meshes, pavement and ground physics consume it. All
|
|
1107
|
+
runways of an airport and its mapped aerodrome grounds share a level surface, with shoulders
|
|
1108
|
+
and a smooth transition back to surrounding terrain. The height is inferred from fixed terrain
|
|
1109
|
+
samples along the runways; it is not surveyed runway elevation or slope data. The reference
|
|
1110
|
+
samples are independent of camera detail and tile load order. Hosts composing a pyramid stream
|
|
1111
|
+
can pass `transformHeightfield: createAirportTerrainGrading(content.airports)` alongside their
|
|
1112
|
+
`withEarthAirports` semantic renderers.
|
|
1113
|
+
|
|
1081
1114
|
The `molen.earth` content pack supplies a lazy worldwide runway catalog and a detailed Boeing
|
|
1082
1115
|
Field layout. Both Earth hosts use measured runway endpoints and widths, draw runway numbers,
|
|
1083
1116
|
thresholds and centre lines, and keep airport pavement visible from flight altitude. Mapped
|
|
1084
1117
|
taxiways and aprons have airport markings; airside areas do not become car parks or city streets.
|
|
1118
|
+
The pavement is drawn about half a metre above the terrain, and aircraft stand on it. A host
|
|
1119
|
+
placing its own objects there reads that height with `sampleAirportPavement(root, x, z, ground)`
|
|
1120
|
+
from `@bendyline/molen-terrain/client`, which returns undefined off the pavement.
|
|
1085
1121
|
The airport overlay also supplies mapped hangar/building footprints and suppresses inferred
|
|
1086
1122
|
vegetation and buildings on the airfield. Aircraft traffic uses the runway approach/departure
|
|
1087
1123
|
corridors and remains simulated, rather than live aviation tracking.
|
|
@@ -1090,8 +1126,9 @@ The runway snapshot covers 10,746 airports with complete endpoint and width reco
|
|
|
1090
1126
|
aprons, taxiways and hangars are currently bundled for Boeing Field; elsewhere these depend on
|
|
1091
1127
|
the map's coverage. Building heights and untagged taxiway widths are interpreted. Runways with
|
|
1092
1128
|
missing endpoints, closed runways and water runways are omitted. Supplemental airports also
|
|
1093
|
-
render when the basemap has no tile (
|
|
1094
|
-
coverage).
|
|
1129
|
+
render when the basemap has no tile (Itami lies outside the bundled Kyoto street-detail
|
|
1130
|
+
coverage). Seattle's street-detail coverage includes Boeing Field and its surroundings.
|
|
1131
|
+
No airport data is fetched without a supplied pack. Hosts composing their own
|
|
1095
1132
|
terrain renderer can use `withEarthAirports`
|
|
1096
1133
|
around semantic renderers and observers, passing `content.airports` from `loadEarthContent`.
|
|
1097
1134
|
|
|
@@ -1101,7 +1138,7 @@ of light aircraft, business aircraft and larger jets. Aircraft are fitted inside
|
|
|
1101
1138
|
with clearance from buildings, taxiways, runways, other aircraft and reserved diorama areas.
|
|
1102
1139
|
The fleet and parking positions are simulated, not live aircraft tracking or exact stand assignments.
|
|
1103
1140
|
|
|
1104
|
-
Walk to an aircraft's door and press **E** to board, **I** to start, and
|
|
1141
|
+
Walk to an aircraft's door and press **E** to board, **I** to start, and **=/−** to adjust
|
|
1105
1142
|
power. The same aircraft taxis and flies away; its original stand remains empty for the session.
|
|
1106
1143
|
Land, stop and shut down before exiting. Automatic parking keeps at most twelve unclaimed
|
|
1107
1144
|
aircraft within 1.8 km; claimed aircraft remain owned vehicles across terrain re-anchors.
|