@bendyline/molen-tooling 0.0.8 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/capture/harness.js +276 -228
- package/dist/capture/worldgen-preview.js +215 -215
- package/dist/cli.mjs +6 -5
- package/dist/docs-src/guide/3d-art-guidelines.md +15 -11
- package/dist/docs-src/guide/adaptive-performance.md +18 -2
- package/dist/docs-src/guide/aircraft.md +113 -40
- package/dist/docs-src/guide/ambient-life.md +100 -11
- package/dist/docs-src/guide/audio.md +1 -1
- package/dist/docs-src/guide/boats.md +99 -0
- package/dist/docs-src/guide/determinism.md +1 -1
- package/dist/docs-src/guide/dioramas.md +167 -0
- package/dist/docs-src/guide/earth-view.md +265 -10
- package/dist/docs-src/guide/entities.md +32 -1
- package/dist/docs-src/guide/figures.md +7 -1
- package/dist/docs-src/guide/graphics-performance.md +16 -3
- package/dist/docs-src/guide/medium-fi.md +337 -0
- package/dist/docs-src/guide/project.md +8 -0
- package/dist/docs-src/guide/sky.md +4 -1
- package/dist/docs-src/guide/surface-rendering.md +4 -1
- package/dist/docs-src/guide/vehicle-interiors.md +40 -2
- package/dist/docs-src/guide/vehicles.md +121 -19
- package/dist/docs-src/guide/weather.md +45 -3
- package/dist/docs-src/guide/worldgen.md +22 -1
- package/dist/docs-src/llms.txt +7 -4
- package/dist/docs-src/schemas/archstyle.md +114 -0
- package/dist/docs-src/schemas/components.md +1592 -139
- package/dist/docs-src/schemas/scatter.md +9 -0
- package/dist/docs-src/schemas/scene.md +6 -3
- package/dist/docs-src/schemas/transport-network.md +4 -2
- package/dist/index.mjs +1 -1
- package/dist/{mcp-BbHk4ibu.mjs → mcp-BbxqqnD1.mjs} +3 -2
- package/dist/{ops-CErtZh2t.mjs → ops-b4Pag8U-.mjs} +7 -5
- package/dist/templates/city-courier/README.md +18 -0
- package/dist/templates/city-courier/gen/molen-types.ts +218 -16
- package/dist/templates/city-courier/index.html +1 -1
- package/dist/templates/city-courier/scripts/molen-scripts.d.ts +220 -18
- package/dist/templates/city-courier/src/audio.ts +26 -4
- package/dist/templates/city-courier/src/game-shell.css +7 -3
- package/dist/templates/city-courier/src/main.ts +25 -3
- package/dist/templates/city-courier/src/shared/accessibility.css +325 -0
- package/dist/templates/city-courier/src/shared/game-controls.ts +406 -0
- package/dist/templates/city-courier/src/shared/game-descriptions.ts +143 -0
- package/dist/templates/city-courier/src/shared/playback.ts +146 -0
- package/dist/templates/city-courier/src/worker.ts +5 -1
- package/dist/templates/cubes/index.html +6 -1
- package/dist/templates/cubes/src/main.ts +25 -2
- package/dist/templates/cubes/src/shared/accessibility.css +325 -0
- package/dist/templates/cubes/src/shared/playback.ts +146 -0
- package/dist/templates/cubes/src/vite-env.d.ts +1 -0
- package/dist/templates/cubes/src/worker.ts +1 -0
- package/dist/templates/data-viz/README.md +4 -0
- package/dist/templates/data-viz/index.html +6 -1
- package/dist/templates/data-viz/src/main.ts +53 -11
- package/dist/templates/data-viz/src/shared/accessibility.css +325 -0
- package/dist/templates/data-viz/src/shared/playback.ts +146 -0
- package/dist/templates/data-viz/src/vite-env.d.ts +1 -0
- package/dist/templates/data-viz/src/worker.ts +1 -0
- package/dist/templates/figures-gallery/index.html +6 -1
- package/dist/templates/figures-gallery/src/main.ts +21 -2
- package/dist/templates/figures-gallery/src/shared/accessibility.css +325 -0
- package/dist/templates/figures-gallery/src/shared/playback.ts +146 -0
- package/dist/templates/figures-gallery/src/vite-env.d.ts +1 -0
- package/dist/templates/figures-gallery/src/worker.ts +1 -0
- package/dist/templates/index.json +36 -16
- package/dist/templates/skybound/README.md +18 -0
- package/dist/templates/skybound/gen/molen-types.ts +218 -16
- package/dist/templates/skybound/index.html +1 -1
- package/dist/templates/skybound/scripts/molen-scripts.d.ts +220 -18
- package/dist/templates/skybound/src/audio.ts +26 -4
- package/dist/templates/skybound/src/game-shell.css +7 -3
- package/dist/templates/skybound/src/main.ts +25 -3
- package/dist/templates/skybound/src/shared/accessibility.css +325 -0
- package/dist/templates/skybound/src/shared/game-controls.ts +406 -0
- package/dist/templates/skybound/src/shared/game-descriptions.ts +143 -0
- package/dist/templates/skybound/src/shared/playback.ts +146 -0
- package/dist/templates/skybound/src/worker.ts +1 -1
- package/dist/templates/terrain-flyover/README.md +5 -1
- package/dist/templates/terrain-flyover/index.html +4 -1
- package/dist/templates/terrain-flyover/src/main.ts +40 -39
- package/dist/templates/top-down-arena/index.html +6 -1
- package/dist/templates/top-down-arena/scripts/molen-scripts.d.ts +220 -18
- package/dist/templates/top-down-arena/src/audio.ts +26 -4
- package/dist/templates/top-down-arena/src/gen/molen-types.ts +218 -16
- package/dist/templates/top-down-arena/src/main.ts +31 -5
- package/dist/templates/top-down-arena/src/shared/accessibility.css +325 -0
- package/dist/templates/top-down-arena/src/shared/playback.ts +146 -0
- package/dist/templates/top-down-arena/src/worker.ts +1 -1
- package/package.json +12 -12
|
@@ -135,7 +135,7 @@ Two constants live in `packages/kernel/src/version.ts` and they do different job
|
|
|
135
135
|
|
|
136
136
|
| Constant | Today | Role |
|
|
137
137
|
|---|---|---|
|
|
138
|
-
| `ENGINE_VERSION` | `0.0.
|
|
138
|
+
| `ENGINE_VERSION` | `0.0.7` | metadata. Written into a keyframe's `engine` field so a save says which build wrote it. **Never compared on load, never hashed.** |
|
|
139
139
|
| `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
140
|
|
|
141
141
|
So a release — even one that moves every package — keeps your keyframes
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# Dioramas: scripted set pieces
|
|
2
|
+
|
|
3
|
+
A diorama is an ordinary `molen/scene@3` scene played inside a bounded local space: figures,
|
|
4
|
+
props and script choreography that make a place look alive. `@bendyline/molen-dioramas/kernel`
|
|
5
|
+
runs it headlessly; `/client` selects nearby placements and draws them in an existing viewer.
|
|
6
|
+
There is no second scripting language or football simulator. Use normal `molen.on('tick')`,
|
|
7
|
+
transforms, figure descriptors, timers, state and events.
|
|
8
|
+
|
|
9
|
+
The content pack includes a high-school football stage: two uniform palettes, fourteen helmeted
|
|
10
|
+
players running a repeated play, sixty seated/standing spectators, stands, goalposts and a
|
|
11
|
+
scoreboard with changing digits and a pulsing light. Its 24-second cycle lines up, runs,
|
|
12
|
+
celebrates and returns. The scores are decorative choreography. Content lives in the separate
|
|
13
|
+
`molen.dioramas` content pack, outside the npm runtime. Five more scenes stage an airport ramp,
|
|
14
|
+
little league, fireworks, a fair and a Saturday market. Every scene is a self-contained source
|
|
15
|
+
bundle with a typed script, local bounds and fixed entity pools.
|
|
16
|
+
|
|
17
|
+
## Definition and local simulation
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { createDiorama } from '@bendyline/molen-dioramas/kernel';
|
|
21
|
+
|
|
22
|
+
const playback = createDiorama({
|
|
23
|
+
scene, // validated scene data; scripts[].path resolved to scripts[].code
|
|
24
|
+
bounds: { min: [-72, -8, -52], max: [72, 24, 52] },
|
|
25
|
+
maxEntities: 512,
|
|
26
|
+
});
|
|
27
|
+
const initial = playback.keyframe();
|
|
28
|
+
const delta = playback.advance(1 / 30);
|
|
29
|
+
playback.dispose();
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Each instance owns a separate seeded world, script state, entity ids, figures, timers and RNG.
|
|
33
|
+
Two stadiums can use identical entity ids. Moving or rotating the stage never changes its local
|
|
34
|
+
simulation. Fixed ticks make the same scene/seed/tick count reproducible. Mark checkpoint-safe
|
|
35
|
+
scripts with `checkpoint: 'state'`; store durable values in components or `molen.state`.
|
|
36
|
+
|
|
37
|
+
Bounds are an axis-aligned box in local meters, Y up. After initialization and each tick, origins
|
|
38
|
+
are clamped to this box. Mesh extents can cross it: include an appropriate margin and author
|
|
39
|
+
paths inside it. This is an authoring guard, not collision or a security boundary. Scripts follow
|
|
40
|
+
the normal [script trust](scripting.md#script-trust-a-script-runs-as-the-host-process) contract.
|
|
41
|
+
The prototype supports scripted and kinematic scenes with figures; terrain, ambient networks
|
|
42
|
+
and Rapier remain outside it. It does not share collisions, input commands or audio with the host.
|
|
43
|
+
|
|
44
|
+
## Lazy playback in a viewer
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
import {
|
|
48
|
+
createDioramaVisual, DioramaDirector, loadDioramaScene,
|
|
49
|
+
} from '@bendyline/molen-dioramas/client';
|
|
50
|
+
|
|
51
|
+
const director = new DioramaDirector({
|
|
52
|
+
maxActive: 2,
|
|
53
|
+
create: (definition, placement) => createDioramaVisual(definition, placement, {
|
|
54
|
+
root: viewer.renderer.worldRoot,
|
|
55
|
+
camera: viewer.renderer.camera,
|
|
56
|
+
// assets: a host-owned AssetCache, when the scene uses glTF refs
|
|
57
|
+
}),
|
|
58
|
+
onError: (error, id) => console.error(id, error),
|
|
59
|
+
});
|
|
60
|
+
director.add({
|
|
61
|
+
id: 'school-field',
|
|
62
|
+
position: [120, 4, 200],
|
|
63
|
+
yaw: 0.4,
|
|
64
|
+
enterDistance: 350,
|
|
65
|
+
exitDistance: 420,
|
|
66
|
+
load: (signal) => loadDioramaScene(new URL('./football/scene.json', contentBase), {
|
|
67
|
+
min: [-72, -8, -52], max: [72, 24, 52],
|
|
68
|
+
}, signal),
|
|
69
|
+
// Optional host-selected event window, in UTC epoch milliseconds:
|
|
70
|
+
active: (timeMs) => timeMs >= eventStartMs && timeMs < eventEndMs,
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// In the existing frame loop (camera position uses absolute world coordinates):
|
|
74
|
+
director.update(cameraPosition, elapsedSeconds, Date.now());
|
|
75
|
+
// On teardown:
|
|
76
|
+
director.dispose();
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The loader is a host callback: use an allowlisted dynamic import, HTTP URL or your pack reader.
|
|
80
|
+
The runtime never chooses content hosts. `loadDioramaScene` fetches the scene and relative `.js`
|
|
81
|
+
scripts with the supplied AbortSignal. For `.ts`, use `molenScripts()` with a lazy `?raw` import
|
|
82
|
+
and `inlineScriptSources`, or erase types when publishing the content. The scripting runtime is
|
|
83
|
+
itself dynamically imported on first activation. On a page that mounts with a top-level `await`,
|
|
84
|
+
add `@bendyline/molen-dioramas/client` (or `@bendyline/molen-earth/client`, when the page uses
|
|
85
|
+
`mountEarthView`) to the `vendor` chunk beside three.js and the client, as in
|
|
86
|
+
[Production builds](browser-mount.md#production-builds); otherwise the lazy runtime's chunk
|
|
87
|
+
imports the entry and never settles.
|
|
88
|
+
|
|
89
|
+
The director defaults to two active or loading instances, each with a default 512-entity budget.
|
|
90
|
+
Existing instances retain their slot until leaving the exit radius; vacant slots choose nearest
|
|
91
|
+
eligible placements. Distance includes camera altitude. No work runs while out of range or
|
|
92
|
+
outside the supplied schedule. Schedule time is host policy and does not enter the state hash.
|
|
93
|
+
`status(id)` reports `idle`, `loading`, `playing` or `failed`; `retry(id)` explicitly retries a
|
|
94
|
+
failure. Failures release their slot and never retry every frame. Removal, disposal and leaving
|
|
95
|
+
range cancel pending requests; late results cannot resurrect removed instances.
|
|
96
|
+
|
|
97
|
+
Leaving range destroys the local simulation and visual resources. Re-entry restarts from the
|
|
98
|
+
seed. There is no offline catch-up, persistent game result or synchronization between stadiums.
|
|
99
|
+
Frame stalls advance at most 0.2 seconds per call. Passing zero holds playback. Normal entities,
|
|
100
|
+
static batching and figure distance tiers are reused; local scenes cannot replace the viewer's
|
|
101
|
+
lighting, weather or sky clock.
|
|
102
|
+
|
|
103
|
+
## Earth placement
|
|
104
|
+
|
|
105
|
+
World Explorer enables the shipped placement catalog by default. Its **Living places** checkbox
|
|
106
|
+
controls playback; its place picker and **Visit** button open any of the six registered scenes.
|
|
107
|
+
Direct links accept `?diorama=football`, `airport`, `little-league`, `fireworks`, `fair` or `market`.
|
|
108
|
+
Visit framing adapts to the viewport and fits above the loaded terrain; explicit camera
|
|
109
|
+
parameters take precedence. `?dioramas=0` disables playback. Source locations and orientation are data in
|
|
110
|
+
`content/dioramas/placements.json`. Content and script text stay in a separate lazy chunk until
|
|
111
|
+
the camera approaches. The Earth view example uses the same catalog by default.
|
|
112
|
+
|
|
113
|
+
Hosts that compose their own terrain loop, as World Explorer does, can use the exported
|
|
114
|
+
`EarthDioramaDirector` directly: call `update` with the terrain root, camera, absolute observer
|
|
115
|
+
position, elapsed seconds, clock, geographic-to-world transform and ground-height sampler;
|
|
116
|
+
call `dispose` on teardown. It uses the same implementation as `mountEarthView`.
|
|
117
|
+
|
|
118
|
+
`mountEarthView` accepts `dioramas: { maxActive, placements }`. Its returned `view.dioramas`
|
|
119
|
+
also exposes `add`, `remove`, `list`, `status` and `retry`:
|
|
120
|
+
|
|
121
|
+
```ts
|
|
122
|
+
view.dioramas.add({
|
|
123
|
+
id: 'school-game',
|
|
124
|
+
latitude: 47.61,
|
|
125
|
+
longitude: -122.03,
|
|
126
|
+
yaw: 0,
|
|
127
|
+
enterDistance: 350,
|
|
128
|
+
load: loadFootball, // (signal) => Promise<{ scene, bounds, maxEntities? }>
|
|
129
|
+
});
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Choose a suitable mapped location in your host. Omitted `altitude` waits for terrain height at
|
|
133
|
+
the anchor; a supplied altitude is absolute meters. `groundFootprint: [71, 51]` samples the
|
|
134
|
+
center, corners and edge centers of a rotated footprint and anchors just above its highest
|
|
135
|
+
sample. The anchor follows terrain LOD refinement without resetting playback. Author a buried
|
|
136
|
+
foundation deep enough to close the resulting edges; this is intended for nearly flat sites.
|
|
137
|
+
The local stage stays flat; the prototype
|
|
138
|
+
does not reshape the terrain, fit arbitrary polygons or remove existing stadium geometry.
|
|
139
|
+
Local axes are east/up/south, and positive yaw rotates +Z toward east. Geographic registrations
|
|
140
|
+
survive terrain re-anchoring; old instances are disposed and recreated in the new frame.
|
|
141
|
+
Automatic matching of map features to dioramas is a future host policy, not silently enabled.
|
|
142
|
+
|
|
143
|
+
## Shipped performances
|
|
144
|
+
|
|
145
|
+
| Set piece | Geometry and roles | Choreography |
|
|
146
|
+
| --- | --- | --- |
|
|
147
|
+
| Airport apron | A bounded apron; tugs, baggage carts, service staff | A tug towing three baggage carts, a separate service van, a conveyor and walking crew |
|
|
148
|
+
| Little league | Diamond and spectator edge; two team palettes | Pitch/bat cues, a runner around bases, fielders out and back |
|
|
149
|
+
| Fireworks | Launch zone and audience zone | Three staggered launches, 96 reusable sparks, pulse lights and forty spectators |
|
|
150
|
+
| Fair | Booth strip and ride footprints | Rotating Ferris wheel with upright gondolas, bobbing carousel and circulating visitors |
|
|
151
|
+
| Saturday market | Stalls and pedestrian aisles | Eight produce stalls, browsing pauses, vendors and a moving handcart |
|
|
152
|
+
|
|
153
|
+
The performances do not claim to depict actual local events. Placement provenance is in the
|
|
154
|
+
catalog. The airport has elevation but sits outside the bundled detailed street extract.
|
|
155
|
+
Use the host time slider for dusk fireworks; scripts leave the host clock unchanged.
|
|
156
|
+
|
|
157
|
+
Keep motion and cue timing in scripts, uniforms/props in scene data, and geographic selection
|
|
158
|
+
and calendar policy in the host. Start with one convincing repeated vignette. Prefer a few
|
|
159
|
+
recognizable actions to full game rules, transport routing or crowd AI.
|
|
160
|
+
|
|
161
|
+
## Headless authoring loop
|
|
162
|
+
|
|
163
|
+
Use the existing `molen validate`, `molen scripts check`, `molen sim run --hash`, `molen replay`
|
|
164
|
+
and `molen shot` operations on the scene before placing it. These operate on the same script and
|
|
165
|
+
figures as the viewer. The runtime's additional confinement/budget guard is exercised by
|
|
166
|
+
`createDiorama` tests. Check both a wide view and an eye-level view, multiple points in the loop,
|
|
167
|
+
and leaving/re-entering range. No new CLI operation is needed.
|
|
@@ -56,6 +56,16 @@ reuses its filtered texture until lighting changes; camera movement does not reg
|
|
|
56
56
|
Pass `reflections: false` for the legacy light-only appearance. A host-assigned
|
|
57
57
|
`view.viewer.renderer.scene.environment` takes precedence if you supply your own HDR environment.
|
|
58
58
|
|
|
59
|
+
Without a `style`, the view uses the shared medium-fi look: a strong warm sun over a sky fill,
|
|
60
|
+
Khronos PBR Neutral tone mapping, and haze in the sky's horizon color. Its values are exported as
|
|
61
|
+
`EARTH_SKY_PALETTE`, `EARTH_LIGHTING`, `EARTH_TONE_MAPPING`, `EARTH_EXPOSURE` and
|
|
62
|
+
`EARTH_WATER_COLOR`, so a host that builds its own viewer can match it. `earthHazeColor` converts
|
|
63
|
+
a sky color into the fog color for the backend. Terrain and landcover share one ground material
|
|
64
|
+
from `createTerrainGroundMaterialAsync` (`@bendyline/molen-terrain/client`) with world-space
|
|
65
|
+
variation; a custom host passes it to the terrain stream's `material` and to `createEarthWorldgen`
|
|
66
|
+
as `groundMaterial`, and calls `setTerrainGroundOrigin` with the world origin each frame. The
|
|
67
|
+
[medium-fi style guide](medium-fi.md) explains the look and the rules models follow inside it.
|
|
68
|
+
|
|
59
69
|
`style` sets the look: `sky.sunElevation` and `sky.sunAzimuth` (degrees; the azimuth is a
|
|
60
70
|
compass bearing, 0 north and clockwise) place the sun, and unless `environment.sun.direction` is
|
|
61
71
|
given the sunlight comes from the same point, so lit faces agree with the glow in the sky. `fog`,
|
|
@@ -84,7 +94,8 @@ appears only on touch devices; pass `touchJoystick: 'always'` to show it everywh
|
|
|
84
94
|
adaptive quality.
|
|
85
95
|
- **walk**: `setMode('walk')` drops a walker at the view center. It has capsule collision against
|
|
86
96
|
terrain, buildings and props, WASD or the touch stick to move, mouse-look with pointer lock, and
|
|
87
|
-
Space to jump.
|
|
97
|
+
Space to jump. The camera is first person until the host gives the walker a body; then V
|
|
98
|
+
switches to a camera behind it (see [Walking](#walking-place-pose-avatar-and-third-person)).
|
|
88
99
|
- **drive**: while walking, press E (or `setMode('drive')`) next to a parked car to get in. W/S
|
|
89
100
|
drive, A/D steer, Space brakes, V switches between cockpit and chase views, and E gets out. A car
|
|
90
101
|
at rest with no throttle holds itself, even on a slope. Cars come from the entities content
|
|
@@ -108,13 +119,191 @@ mode menu passes `{ force: true }` to step out at once, which also removes a veh
|
|
|
108
119
|
added.
|
|
109
120
|
|
|
110
121
|
`view.vehicleStatus()` describes the car or aircraft the viewer is in for a HUD: speed and
|
|
111
|
-
heading for a car; airspeed, altitude and height above ground, vertical speed, attitude,
|
|
112
|
-
engine, gear, flaps and stall/impact flags for an aircraft (SI units,
|
|
122
|
+
heading for a car; airspeed, altitude and height above ground, vertical speed, attitude, load
|
|
123
|
+
factor (g), sideslip, power, engine, gear, flaps and stall/impact flags for an aircraft (SI units,
|
|
124
|
+
compass radians). An airplane started in flight is trimmed for level flight at its launch speed.
|
|
113
125
|
`view.setThrottle(power)` sets an aircraft's throttle or collective from an on-screen lever.
|
|
114
126
|
|
|
115
127
|
Listen for `modechange`. The input profile, clip planes and touch stick follow the mode
|
|
116
128
|
automatically.
|
|
117
129
|
|
|
130
|
+
## Hooks for game hosts
|
|
131
|
+
|
|
132
|
+
A game built on the view needs to know where the viewer is every frame, put the walker somewhere,
|
|
133
|
+
give it a body, keep a few vehicles and characters of its own, and hear the interact key. These are
|
|
134
|
+
the generic pieces; what they mean (missions, scores, dialogue) stays in the host.
|
|
135
|
+
|
|
136
|
+
### Per-frame hook and coordinates
|
|
137
|
+
|
|
138
|
+
```ts
|
|
139
|
+
view.on('frame', ({ dt, now, mode, viewer }) => {
|
|
140
|
+
// viewer: { latitude, longitude, altitude, heading, speed } — the walker's feet, the car, the
|
|
141
|
+
// aircraft, or the orbit target; altitude in meters above sea level, heading a compass bearing in
|
|
142
|
+
// radians, speed in m/s (0 in orbit).
|
|
143
|
+
needle.pointAt(bearing(viewer, destination));
|
|
144
|
+
});
|
|
145
|
+
const [x, z] = view.toWorld(47.6205, -122.3493); // world meters in the current frame
|
|
146
|
+
view.toGeo(x, z); // { latitude, longitude }
|
|
147
|
+
view.groundHeight(47.6205, -122.3493); // m ASL, or undefined until that ground has streamed
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
`frame` fires once per rendered frame, after the world has stepped and before the camera is set,
|
|
151
|
+
so markers and objects placed from it appear in the frame being drawn. World meters are relative to
|
|
152
|
+
the metric frame: they stay valid until the next `terrainchange` (a re-anchor), while everything
|
|
153
|
+
geographic (`viewer`, poses, places) is stable across re-anchors.
|
|
154
|
+
|
|
155
|
+
### Walking: place, pose, avatar and third person
|
|
156
|
+
|
|
157
|
+
```ts
|
|
158
|
+
view.setMode('walk', { at: { latitude, longitude, heading } }); // start here, facing heading
|
|
159
|
+
view.walker.place({ latitude, longitude }); // teleport (enters walk mode if needed)
|
|
160
|
+
view.walker.pose(); // { latitude, longitude, altitude, heading, speed, grounded } | undefined
|
|
161
|
+
view.walker.ready; // standing on streamed ground
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
A place inside the current frame drops the walker at once (it lands when the ground there has
|
|
165
|
+
streamed, as a walk start always does). A place more than about a degree of latitude away, or in
|
|
166
|
+
another terrain region with `terrainSource`, re-anchors first: the mode is `walk` immediately, the
|
|
167
|
+
orbit camera holds over the destination while the frame rebuilds, and the walker lands when it is
|
|
168
|
+
done.
|
|
169
|
+
|
|
170
|
+
```ts
|
|
171
|
+
view.walker.setAvatar({ figure: { preset: 'human.adult', height: 1.7, palette: { top: '#2f5a3b' } } });
|
|
172
|
+
view.walker.setAvatar({ type: 'my.app.character.guide' }); // an entity type with a `figure`
|
|
173
|
+
view.walker.setView('third'); // or 'first'; V toggles while walking with an avatar
|
|
174
|
+
view.walker.view; // 'first' | 'third'
|
|
175
|
+
view.walker.setAvatar(undefined); // no body (the default)
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
The walker has no body by default, and the view is first person. `setAvatar` gives it one: a
|
|
179
|
+
[figure](figures.md) descriptor, or `{ type }` naming an entity type from the content packs with a
|
|
180
|
+
`figure` component. In the third-person view a chase camera sits 4.5 m behind the feet, pulled in
|
|
181
|
+
front of any wall between it and the walker. Mouse-look turns the walker's heading and the camera
|
|
182
|
+
with it; vertical look tilts the camera and eases back. Movement stays relative to the camera, and
|
|
183
|
+
the body faces the way it walks (the camera's heading while standing). The avatar is drawn on foot
|
|
184
|
+
in the third-person view and seated at the wheel in a car's or aircraft's chase view; never in first
|
|
185
|
+
person or a cockpit.
|
|
186
|
+
|
|
187
|
+
### Owned vehicles
|
|
188
|
+
|
|
189
|
+
```ts
|
|
190
|
+
const car = view.vehicles.spawn({
|
|
191
|
+
id: 'car-1',
|
|
192
|
+
type: 'molen.entities.vehicle.sedan',
|
|
193
|
+
latitude, longitude, heading, color: '#b8362d',
|
|
194
|
+
});
|
|
195
|
+
await view.vehicles.whenPlaced(car); // the ground under it has streamed and the entity exists
|
|
196
|
+
view.vehicles.pose(car); // { kind, type, latitude, longitude, altitude, heading, speed, occupied, placed }
|
|
197
|
+
view.vehicles.board(car); // within reach of the door; { force: true } from anywhere
|
|
198
|
+
view.vehicles.release(); // step out at once; the car stays
|
|
199
|
+
view.vehicles.setColor(car, '#123456'); // cars only: the type's paintMaterial
|
|
200
|
+
view.vehicles.remove(car);
|
|
201
|
+
view.on('vehiclechange', ({ id, change }) => save(id, view.vehicles.pose(id)));
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Owned vehicles differ from the car `setMode('drive', { vehicle: true })` adds: they survive
|
|
205
|
+
stepping out, forced exits and re-anchors, and they are never removed by the view. The registry
|
|
206
|
+
is geographic: a vehicle whose ground has not streamed (parked out of view) is placed when the
|
|
207
|
+
viewer gets there, and after a long trip rebuilds the frame every owned vehicle is placed again
|
|
208
|
+
from its last known place. An aircraft spawned `airborne` flies once; after a re-anchor it is parked
|
|
209
|
+
where it was. `vehiclechange` reports `placed`, `boarded`, `left` (read `pose()` then to persist
|
|
210
|
+
where it was parked), `painted`, `removed` and `blocked` (no room within 30 m of the spot; the
|
|
211
|
+
view retries every few seconds). `type` must be a car (`vehicle`) or aircraft type from the content
|
|
212
|
+
packs; `spawn` throws otherwise, and when the id is already taken. `setMode('drive' | 'fly', {
|
|
213
|
+
board: id })` is the same boarding through the mode API. The entities pack's cars and the OH-6
|
|
214
|
+
carry a `passenger` seat and the P-51D a rear seat, so a companion can ride along (see
|
|
215
|
+
[Actors](#actors-companions-and-npcs)).
|
|
216
|
+
|
|
217
|
+
### Actors: companions and NPCs
|
|
218
|
+
|
|
219
|
+
```ts
|
|
220
|
+
const guide = view.actors.add({
|
|
221
|
+
id: 'guide',
|
|
222
|
+
figure: { preset: 'human.adult', height: 1.66, palette: { top: '#b0553a' } }, // or { type }
|
|
223
|
+
latitude, longitude, heading,
|
|
224
|
+
behaviour: { kind: 'follow', target: 'viewer' },
|
|
225
|
+
interactable: true,
|
|
226
|
+
});
|
|
227
|
+
view.actors.setBehaviour(guide, { kind: 'goTo', to: { latitude, longitude, heading } });
|
|
228
|
+
view.actors.lookAt(guide, 'viewer'); // a place, 'viewer', { actor: id }, or null
|
|
229
|
+
view.actors.pose(guide); // { latitude, longitude, altitude, heading, speed, mode, behaviour, mounted?, placed }
|
|
230
|
+
view.on('actorchange', ({ id, change, reason }) => {
|
|
231
|
+
// added | arrived | boarded | alighted | stuck | teleported | removed
|
|
232
|
+
});
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
Actors are characters the host keeps: a companion who follows the viewer, a guide waiting at a
|
|
236
|
+
door, a passenger. Each is a [figure](figures.md), placed by latitude and longitude once the ground
|
|
237
|
+
there has streamed (`pose().placed`), and kept, like owned vehicles, through drives and re-anchors
|
|
238
|
+
until `remove(id)`. A behaviour decides what it does:
|
|
239
|
+
|
|
240
|
+
| Behaviour | What the actor does |
|
|
241
|
+
|---|---|
|
|
242
|
+
| `{ kind: 'idle' }` | Stands, turning toward its `lookAt` target when that is behind it. The default. |
|
|
243
|
+
| `{ kind: 'wander', around, radius? }` | Strolls the mapped footways within `radius` (default 20 m) of a place, pausing between walks. It stands when ambient life is off or no footway is near. |
|
|
244
|
+
| `{ kind: 'follow', target, distance?, jogBeyond?, teleportBeyond? }` | Keeps `distance` (2.5 m) behind the viewer on foot or another actor (`{ actor: id }`), jogs past `jogBeyond` (8 m), and teleports behind the target past `teleportBeyond` (60 m; `Infinity` never). |
|
|
245
|
+
| `{ kind: 'goTo', to, arriveWithin? }` | Walks to a place, emits `arrived` within `arriveWithin` (1 m), then idles facing `to.heading`. |
|
|
246
|
+
| `{ kind: 'board', vehicle, seat?, force? }` | Walks to the door nearest the seat and sits: `seat` names one, otherwise the first free `passenger` seat. `force` seats it at once, from anywhere and whatever the vehicle is doing. |
|
|
247
|
+
| `{ kind: 'alight' }` | Steps out by the vehicle's exits once it has stopped, then idles. |
|
|
248
|
+
|
|
249
|
+
`stuck` carries a reason: `blocked` (a goal and no progress for three seconds), `target-mounted`,
|
|
250
|
+
`no-vehicle`, `no-seat`, `moving` (the vehicle has not stopped) or `unreachable`. Each is reported
|
|
251
|
+
once when it starts; the actor keeps trying. A follower whose target climbs into a vehicle stands
|
|
252
|
+
still and reports `target-mounted`, which is the host's cue:
|
|
253
|
+
|
|
254
|
+
```ts
|
|
255
|
+
view.on('actorchange', ({ id, change, reason }) => {
|
|
256
|
+
if (change === 'stuck' && reason === 'target-mounted') {
|
|
257
|
+
const vehicle = view.interactable().id; // aboard, the vehicle the viewer is in
|
|
258
|
+
if (vehicle) view.actors.setBehaviour(id, { kind: 'board', vehicle });
|
|
259
|
+
}
|
|
260
|
+
if (change === 'alighted') view.actors.setBehaviour(id, { kind: 'follow', target: 'viewer' });
|
|
261
|
+
});
|
|
262
|
+
view.on('modechange', ({ mode }) => {
|
|
263
|
+
if (mode === 'walk' && view.actors.pose('guide')?.mounted)
|
|
264
|
+
view.actors.setBehaviour('guide', { kind: 'alight' });
|
|
265
|
+
});
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
A seated actor rides along in the vehicle's seat (`mode: 'sit'`, `mounted: { vehicle, seat }`) and
|
|
269
|
+
is drawn sitting there. It waits in its seat whatever its behaviour until `alight`; boarding another
|
|
270
|
+
vehicle needs an `alight` first. When the vehicle is removed it stands where the vehicle was
|
|
271
|
+
(`alighted` with reason `vehicle-gone`). An actor seated in an owned vehicle is seated again when a
|
|
272
|
+
re-anchor places that vehicle again. A passenger never drives and does not start an engine sound.
|
|
273
|
+
|
|
274
|
+
Actors walk straight at their goal; there is no pathfinding, so a building between an actor and
|
|
275
|
+
its goal leaves it `stuck`. The few nearest the viewer walk with the walker's capsule collision
|
|
276
|
+
against buildings and props; the rest move over the bare terrain, through walls, until they come
|
|
277
|
+
close. `mountEarthView({ actors: { activeRadius, maxActive } })` sets how many and how near (60 m,
|
|
278
|
+
4). Actors do not collide with each other or the walker, and ambient cars stop for them like for the
|
|
279
|
+
walker. `actors.adopt(pedestrianId)` turns an ambient pedestrian into an actor (see
|
|
280
|
+
[Promoting a pedestrian](ambient-life.md#promoting-a-pedestrian)).
|
|
281
|
+
|
|
282
|
+
### Interaction
|
|
283
|
+
|
|
284
|
+
```ts
|
|
285
|
+
const view = await mountEarthView({ /* … */ interaction: { reach: 2.5, pedestrians: true } });
|
|
286
|
+
view.setInteraction({ pedestrians: false }); // change it later, e.g. only while a game runs
|
|
287
|
+
view.interactable(); // { kind: 'actor' | 'vehicle' | 'pedestrian' | 'none', id?, distance? }
|
|
288
|
+
view.on('interact', (interaction) => {
|
|
289
|
+
if (interaction.kind === 'actor') {
|
|
290
|
+
interaction.claim(); // the view does nothing else with this press
|
|
291
|
+
talkTo(interaction.id);
|
|
292
|
+
} else if (interaction.kind === 'pedestrian') {
|
|
293
|
+
const id = view.actors.adopt(interaction.id); // stop them and talk
|
|
294
|
+
if (id) talkTo(id);
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
The interact key (E, or F, or the right mouse button) emits `interact` first with what it found. On
|
|
300
|
+
foot that is the nearest of: a car or aircraft within reach of its door (aircraft can be boarded on
|
|
301
|
+
foot too), an interactable actor within `interaction.reach` (2.5 m) of the walker's eyes and in
|
|
302
|
+
sight, and, with `interaction.pedestrians`, an ambient pedestrian. Aboard, it is the vehicle the
|
|
303
|
+
viewer is in; otherwise `none`. A handler that calls `claim()` synchronously takes the press, and
|
|
304
|
+
nothing else happens. Unclaimed, the view boards or leaves a vehicle as it always did (or explains
|
|
305
|
+
why there is nothing to board), and does nothing for an actor or a pedestrian.
|
|
306
|
+
|
|
118
307
|
## Frames and long trips
|
|
119
308
|
|
|
120
309
|
Heights stay in meters. Horizontal distances are exact at the frame latitude and drift away from it
|
|
@@ -135,6 +324,11 @@ add styled architecture, recognizable businesses, street furniture, trees and dr
|
|
|
135
324
|
`molen.sky` and `molen.sounds` from a pack index you host.
|
|
136
325
|
- `loadEarthContent(packs)` reads them. A missing pack turns its feature off instead of failing.
|
|
137
326
|
|
|
327
|
+
Entity types come from every opened pack that provides `types` documents, merged into one
|
|
328
|
+
library with the entities pack first: pass your own pack's id in `ids` (for example
|
|
329
|
+
`[...Object.values(EARTH_PACK_IDS), 'my.app']`) and its figure or prop types sit beside the stock
|
|
330
|
+
cars and aircraft in `content.types`. A type id declared by two packs is an error that names both.
|
|
331
|
+
|
|
138
332
|
`openPacksFromIndex(indexUrl, ids, fetchImpl)` accepts a host fetch implementation for the index,
|
|
139
333
|
archive opening and subsequent asset requests. Landmark model bytes are loaded as nearby
|
|
140
334
|
placements need them. Large packs require HTTP Range support to retrieve those bytes selectively:
|
|
@@ -271,6 +465,45 @@ light-rail and airliner models near the camera. The car you drive stops against
|
|
|
271
465
|
and traffic waits for it. See [Ambient life](ambient-life.md) for the tier table and how the
|
|
272
466
|
simulation works.
|
|
273
467
|
|
|
468
|
+
## Airfields
|
|
469
|
+
|
|
470
|
+
`view.airfields` lists the runways the ambient layer's transport network holds and places things
|
|
471
|
+
on them. Everything it returns is latitude, longitude and a compass heading in radians, so a
|
|
472
|
+
result stays valid while the view re-anchors its metric frame as the camera travels; world
|
|
473
|
+
coordinates do not. A runway's id (`runway:<hash>` of its endpoints rounded to 1e-5°) is the same
|
|
474
|
+
each time its tile streams in.
|
|
475
|
+
|
|
476
|
+
```ts
|
|
477
|
+
const [runway] = await view.airfields.whenNear(47.53, -122.3, { radiusM: 3_000 });
|
|
478
|
+
if (runway !== undefined) {
|
|
479
|
+
const start = view.airfields.placement(runway.id, 'threshold', { end: 'a' });
|
|
480
|
+
// start: { latitude, longitude, heading, elevation }, 60 m in from end a, facing down the runway
|
|
481
|
+
const parked = view.airfields.placement(runway.id, 'beside'); // 40 m to the right of the threshold
|
|
482
|
+
}
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
- `near(latitude, longitude, radiusM)` returns the runways whose midpoint lies within the radius,
|
|
486
|
+
nearest first. Each has its `ends` (`a` then `b`), the `heading` from `a` to `b`, its geodesic
|
|
487
|
+
`length` in metres, its `elevation` above sea level, and the nearest `aerodrome` point of
|
|
488
|
+
interest within 3 km when one is mapped.
|
|
489
|
+
- `whenNear(latitude, longitude, { radiusM, timeoutMs, signal })` resolves as soon as `near` is
|
|
490
|
+
non-empty, with `[]` after the timeout (20 s by default), and rejects only when the signal
|
|
491
|
+
aborts.
|
|
492
|
+
- `placement(id, where, options)` gives a place with an `elevation`: `threshold` is 60 m in from
|
|
493
|
+
end `a` (or `options.end: 'b'`) facing down the runway toward the other end, `midpoint` is the
|
|
494
|
+
centre facing from `a` to `b`, and `beside` is the threshold moved `options.offsetM` (default
|
|
495
|
+
40) metres to the right of the runway, facing parallel to it. It returns `undefined` once no
|
|
496
|
+
registered tile carries that runway.
|
|
497
|
+
|
|
498
|
+
Runways exist only for the tiles the ambient layer has registered: those within its activity
|
|
499
|
+
radius plus 250 m of the viewer. Move the camera to the airport first (`flyTo` or `jumpTo`) and
|
|
500
|
+
keep the layer on: `ambient: { cars: false, pedestrians: false, rail: false, aircraft: false }`
|
|
501
|
+
still registers runways, while `ambient: false` removes the network. The map data carries no
|
|
502
|
+
aprons or taxiways, so `beside` is a parking approximation. Hosts composing their own view use
|
|
503
|
+
the same `EarthAirfields` class from `@bendyline/molen-earth/client`, built on an
|
|
504
|
+
`EarthAirfieldsSource` of callbacks (the network's runways, aerodromes and version, and the
|
|
505
|
+
world/geographic conversion) and ticked on their sync.
|
|
506
|
+
|
|
274
507
|
## Geographic structures and regional styles
|
|
275
508
|
|
|
276
509
|
The Earth pack may provide a `molen/structure-placements@1` document. Each record binds a
|
|
@@ -356,13 +589,20 @@ model eviction. `build-copernicus-bridge-evidence.py` and the capture runner's
|
|
|
356
589
|
neither capture set substitutes altered heights to make a bridge fit. These reports are research
|
|
357
590
|
evidence and are excluded from the Earth runtime pack.
|
|
358
591
|
|
|
359
|
-
If `replaceFootprint` is set,
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
592
|
+
If `replaceFootprint` is set, mapped buildings are suppressed only once the replacement model
|
|
593
|
+
has loaded; failed models keep the procedural building. In exact data a polygon goes when the
|
|
594
|
+
anchor falls inside it, when it lies wholly inside the loaded model's horizontal extent around the
|
|
595
|
+
anchor, or when at least half of it stands on the model's own ground footprint (its triangles
|
|
596
|
+
stamped on a 64-cell grid). The last two catch a landmark's off-centre mapped parts: a tower's
|
|
597
|
+
legs and observation level, a grandstand, a ballpark's parked roof. The footprint also reaches
|
|
598
|
+
neighbouring tiles, so a stadium anchored near a tile edge clears its mapped stands there too.
|
|
599
|
+
Those tiles regenerate their buildings when the landmark loads, and again when its tile is evicted.
|
|
600
|
+
A ring polygon whose hole holds the anchor (a stadium bowl, a cloister) goes under the size rule
|
|
601
|
+
below. Generalized sources (Protomaps below zoom 15, and tiles overzoomed from them) merge
|
|
602
|
+
neighboring footprints, so there the polygon must contain or ring the anchor, and is suppressed
|
|
603
|
+
only when neither side exceeds the loaded model's horizontal extent by more than 1.6 times plus
|
|
604
|
+
12 meters; a larger polygon is a merged block of other buildings and keeps its procedural shell.
|
|
605
|
+
An Earth pack without a placement document still loads.
|
|
366
606
|
|
|
367
607
|
For unsurveyed orientation, `orientation: 'mapped'` requires an explicit
|
|
368
608
|
`mapIdentity: { wikidata: 'Q…', maxDistance: 150 }`. The viewer admits that model only after a
|
|
@@ -656,3 +896,18 @@ The composing pieces are exported too, for hosts that build their own view: `cre
|
|
|
656
896
|
`EarthVehicles`, `EarthAmbient` with `observeSemanticTiles`, `createEarthSky`/`createEarthFog`,
|
|
657
897
|
`createEarthAudio`, `earthPerformanceTier` and `earthCredits`.
|
|
658
898
|
The [World Explorer](https://molen.dev/play/world-explorer/) sample is built from them.
|
|
899
|
+
|
|
900
|
+
## Boats and water conditions
|
|
901
|
+
|
|
902
|
+
Use `setMode('drive', { vehicle: 'molen.entities.watercraft.speedboat', force: true })` near
|
|
903
|
+
mapped water, or spawn an owned boat through `view.vehicles`. Actors can ride its passenger
|
|
904
|
+
seats. `water` configures deterministic swells and currents; `waterAt` can provide measured depths.
|
|
905
|
+
See [Boats and water](boats.md) for controls, mounting, limitations and the reusable kernel API.
|
|
906
|
+
|
|
907
|
+
## Dioramas
|
|
908
|
+
|
|
909
|
+
Use `dioramas: { maxActive, placements }` or `view.dioramas.add(...)` for bounded scripted set
|
|
910
|
+
pieces such as a football game, apron traffic or a market. Each geographic placement supplies
|
|
911
|
+
a lazy scene loader, optional calendar policy, and entry/exit distances. It waits for terrain,
|
|
912
|
+
plays nearby, and releases its local world when out of range. See [Dioramas](dioramas.md) for
|
|
913
|
+
the full contract and current prototype limits.
|
|
@@ -62,5 +62,36 @@ serves them like any other model. See [Aircraft](aircraft.md) for world-view con
|
|
|
62
62
|
`molen.entities.transit.bus` is a 12 m city bus, `molen.entities.transit.lightrail` a 27 m
|
|
63
63
|
two-section light-rail car, and `molen.entities.aircraft.airliner` a narrow-body airliner. They are
|
|
64
64
|
models for background traffic, not mountable vehicles. [Ambient life](ambient-life.md) spawns them
|
|
65
|
-
through their `ambientRole` component, as it does the pack's
|
|
65
|
+
through their `ambientRole` component, as it does the pack's road vehicles and the two aircraft above.
|
|
66
66
|
In the engine repository, `content/entities/scenes/transit.scene.json` shows them side by side.
|
|
67
|
+
|
|
68
|
+
## Road, cycle and water fleets
|
|
69
|
+
|
|
70
|
+
The road fleet has eleven mountable models. Alongside compact, sedan, SUV, pickup and van,
|
|
71
|
+
`molen.entities.vehicle.*` includes `sports_coupe`, `station_wagon`, `electric_hatchback`,
|
|
72
|
+
`taxi`, `offroad` and `box_truck`. They expose the usual wheel pivots, paint material, driver
|
|
73
|
+
seat and vehicle tuning, and join the ambient car pool.
|
|
74
|
+
|
|
75
|
+
`molen.entities.cycle.*` contains `standard_motorcycle`, `cruiser_motorcycle`, `motor_scooter`,
|
|
76
|
+
`city_bicycle`, `road_bicycle` and `cargo_bicycle`. These are rideable through the same vehicle/mount API as cars, with self-balancing
|
|
77
|
+
handling, saddle poses, animated steering and bicycle pedals. See [Riding cycles](vehicles.md#riding-cycles).
|
|
78
|
+
They do not spawn as ambient traffic or in car parking bays.
|
|
79
|
+
|
|
80
|
+
`molen.entities.watercraft.*` contains `speedboat`, `sailboat`, `fishing_boat`, `tugboat`,
|
|
81
|
+
`container_ship`, `bulk_carrier`, `passenger_ferry` and `car_ferry`. Their origin is **Y=0 at
|
|
82
|
+
the waterline**, with the hull extending below it. The two ferries have `ambientRole.role:
|
|
83
|
+
"ferry"`; the other vessels have `role: "boat"`. See [water traffic](ambient-life.md#water-traffic)
|
|
84
|
+
for routing and terminal stops. Each type also supplies a powered `boat` and driver/passenger
|
|
85
|
+
seats for [player boating](boats.md), swells, currents and dockside boarding. The sailboat uses
|
|
86
|
+
its auxiliary motor.
|
|
87
|
+
|
|
88
|
+
The id helpers `MOLEN_CYCLE_ENTITY_IDS` and `MOLEN_WATERCRAFT_ENTITY_IDS` enumerate the new
|
|
89
|
+
collections. All are in `MOLEN_ENTITY_IDS` and the pack's type documents.
|
|
90
|
+
|
|
91
|
+
In the engine repository, `content/entities/scenes/fleet.scene.json` displays the road and
|
|
92
|
+
cycle models; `content/entities/scenes/harbor.scene.json` displays the water fleet with moving
|
|
93
|
+
ferries. Each new bundle has an editable `models/recipe.json`; the shared authoring capability
|
|
94
|
+
`packages/entities/scripts/generate-fleet.mjs --ids=sports-coupe,tugboat` rebuilds selected
|
|
95
|
+
models. It preserves an artist-edited master that no longer matches its generator pin.
|
|
96
|
+
After importing, `node packages/entities/scripts/capture-fleet.mjs` renders four views of each
|
|
97
|
+
model and both demo scenes; `--ids=sports-coupe,tugboat` narrows the review to selected models.
|
|
@@ -112,7 +112,13 @@ anchored to a tick, so a steadily walking figure sends no deltas. `figureIntent.
|
|
|
112
112
|
mode; `lookAt` aims the head at a point or an entity.
|
|
113
113
|
|
|
114
114
|
Pedestrians in [ambient life](ambient-life.md) are figures moved this way: the ambient kernel
|
|
115
|
-
writes their transform along footways and `speedSource: 'transform'` animates the gait.
|
|
115
|
+
writes their transform along footways and `speedSource: 'transform'` animates the gait. The Earth
|
|
116
|
+
view, whose world steps on the main thread without the figures systems, poses its pedestrians,
|
|
117
|
+
[actors](earth-view.md#actors-companions-and-npcs) and the walker's avatar client-side with the
|
|
118
|
+
same `evaluatePose` from `@bendyline/molen-figures/client` (sitting in vehicle seats with the `eye`
|
|
119
|
+
anchor, and turning heads with `worldToFigure` look targets). Cycle drivers use a `pelvis`
|
|
120
|
+
anchor and `cycleRiderPose(vehicle, state, seat)` to reach the handlebars and pedals; the kernel,
|
|
121
|
+
figure kind and Earth avatar share that contact solver.
|
|
116
122
|
|
|
117
123
|
## Sockets and attachments
|
|
118
124
|
|
|
@@ -41,6 +41,14 @@ sample at 15 Hz and hidden meshes at 5 Hz by default; returning nearby updates i
|
|
|
41
41
|
Use `animation: false` for full-rate sampling everywhere. Snapshot/capture poses remain exact.
|
|
42
42
|
Finite local lights whose entire influence sphere lies outside the camera frustum are omitted.
|
|
43
43
|
An explicit light-count cap ranks remaining lights by intensity/distance and can change images.
|
|
44
|
+
On WebGPU, capped point lights without shadows use persistent shader slots: moving or turning
|
|
45
|
+
changes each slot's position, color and intensity instead of compiling a new lighting shader
|
|
46
|
+
for every selected combination. Unused slots have zero intensity. Shadow-casting lights and
|
|
47
|
+
spotlights retain their own objects.
|
|
48
|
+
|
|
49
|
+
Resuming a paused simulation re-anchors the interpolation clock while keeping its pose history.
|
|
50
|
+
Loading screens and paused manual turns therefore do not leave live motion snapping between
|
|
51
|
+
simulation ticks while the clock slowly catches up.
|
|
44
52
|
|
|
45
53
|
## Staged preparation and admission
|
|
46
54
|
|
|
@@ -126,9 +134,14 @@ and cell-preparation timings are reported separately. Compatible opaque groups a
|
|
|
126
134
|
by the resolved Three material, including groups with different authored references that resolve
|
|
127
135
|
to the same material. Transparent group order is preserved.
|
|
128
136
|
|
|
129
|
-
World
|
|
130
|
-
|
|
131
|
-
|
|
137
|
+
World props (trees, ground cover, rocks, rooftop and street props) keep one batch per model per
|
|
138
|
+
terrain tile: the tile is already the culling unit. On WebGPU, three.js builds a separate shader
|
|
139
|
+
for every `InstancedMesh`, about 6 ms on the main thread even when the material and geometry are
|
|
140
|
+
shared, so splitting each tile into culling cells multiplied that cost by cells times LOD levels
|
|
141
|
+
and starved terrain publication during fast flight. Every prop placement remains intact; whole-tile
|
|
142
|
+
batches trade some culling precision (more instanced triangles drawn) for far fewer shader builds
|
|
143
|
+
and draw submissions. `createInstancedPlacementLod` still accepts a finite `cellSize` for callers
|
|
144
|
+
that want spatial cells.
|
|
132
145
|
|
|
133
146
|
Terrain palettes compile once per mesh. Terrain index topology is immutable and shared in a
|
|
134
147
|
bounded CPU cache; use a copy before editing or transferring it. Grids and building cells use
|