@bendyline/molen-tooling 0.0.15 → 0.0.17
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 +755 -406
- package/dist/capture/worldgen-preview.js +409 -298
- package/dist/docs-src/guide/3d-art-guidelines.md +15 -9
- package/dist/docs-src/guide/adaptive-performance.md +50 -23
- package/dist/docs-src/guide/aircraft.md +263 -29
- package/dist/docs-src/guide/ambient-life.md +36 -9
- package/dist/docs-src/guide/building-interiors.md +92 -8
- package/dist/docs-src/guide/determinism.md +1 -1
- package/dist/docs-src/guide/earth-view.md +215 -16
- package/dist/docs-src/guide/entities.md +42 -8
- package/dist/docs-src/guide/figures.md +32 -4
- package/dist/docs-src/guide/graphics-performance.md +122 -18
- package/dist/docs-src/guide/livery-catalog.md +137 -1
- package/dist/docs-src/guide/livery-gallery.md +136 -1
- package/dist/docs-src/guide/medium-fi.md +197 -12
- package/dist/docs-src/guide/night-lighting.md +13 -0
- package/dist/docs-src/guide/recognizable-places.md +47 -4
- package/dist/docs-src/guide/regional-fleets.md +27 -5
- package/dist/docs-src/guide/regional-world.md +19 -1
- package/dist/docs-src/guide/rendering-backends.md +28 -4
- package/dist/docs-src/guide/sky.md +28 -2
- package/dist/docs-src/guide/snow.md +231 -0
- package/dist/docs-src/guide/surface-rendering.md +333 -11
- package/dist/docs-src/guide/terrain.md +74 -5
- package/dist/docs-src/guide/typography.md +36 -0
- package/dist/docs-src/guide/vehicle-interiors.md +6 -0
- package/dist/docs-src/guide/vehicles.md +374 -46
- package/dist/docs-src/guide/weather.md +7 -1
- package/dist/docs-src/guide/worldgen.md +82 -3
- package/dist/docs-src/llms.txt +3 -2
- package/dist/docs-src/schemas/README.md +2 -0
- package/dist/docs-src/schemas/components.md +835 -57
- package/dist/docs-src/schemas/figure.md +30 -4
- package/dist/docs-src/schemas/interior-catalog.md +56 -3
- package/dist/docs-src/schemas/map-overrides.md +658 -0
- package/dist/docs-src/schemas/sign-looks.md +174 -0
- package/dist/docs-src/schemas/structure-placement-data.md +195 -0
- package/dist/docs-src/schemas/structure-placements.md +195 -0
- package/dist/docs-src/schemas/worldgen-batch.md +95 -0
- package/dist/templates/city-courier/gen/molen-types.ts +121 -4
- package/dist/templates/city-courier/scripts/molen-scripts.d.ts +120 -3
- package/dist/templates/figures-gallery/test/headless.test.ts +3 -2
- package/dist/templates/index.json +17 -17
- package/dist/templates/skybound/gen/molen-types.ts +121 -4
- package/dist/templates/skybound/scripts/molen-scripts.d.ts +120 -3
- package/dist/templates/top-down-arena/scripts/molen-scripts.d.ts +120 -3
- package/dist/templates/top-down-arena/src/gen/molen-types.ts +121 -4
- package/package.json +12 -12
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
# Regional vehicle fleets
|
|
2
2
|
|
|
3
3
|
Earth traffic and parked cars share a small fleet catalog. It assigns relative weights to existing
|
|
4
|
-
vehicle type IDs and contains no models. China, Japan, Korea,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
vehicle type IDs and contains no models. China, Japan, Korea, South Asia, mainland and maritime
|
|
5
|
+
Southeast Asia, the Philippines, Taiwan, several European, South American and African markets,
|
|
6
|
+
and North America have separate mixtures, including motorcycles, scooters, mopeds and
|
|
7
|
+
auto-rickshaws where they are common. These are visual approximations, not sales or registration
|
|
8
|
+
statistics. Unknown areas use a global fallback. Aircraft and ships keep their independent global
|
|
9
|
+
pools.
|
|
8
10
|
|
|
9
11
|
## Content and selection
|
|
10
12
|
|
|
@@ -50,6 +52,24 @@ Existing traffic changes naturally through despawning, without replacing a car b
|
|
|
50
52
|
`fleet.parkedAt` as the third argument of `createTerrainSurfaceRenderer`. Hosts without fleet
|
|
51
53
|
content retain their original behavior.
|
|
52
54
|
|
|
55
|
+
## Two- and three-wheelers
|
|
56
|
+
|
|
57
|
+
Motor two-wheelers and the auto-rickshaw are region-only: their `ambientRole` has a `weight` of 0,
|
|
58
|
+
so default traffic never picks them and the default parked list (`EarthContent.parkedVehicles`,
|
|
59
|
+
also used for garages) leaves them out. A fleet profile that weights them brings them in. Build
|
|
60
|
+
the fleet from `EarthContent.fleetParkedVehicles`, which adds seated motor two-wheelers and
|
|
61
|
+
region-only types to the parked candidates; `mountEarthView` does. Bicycles, kick scooters and
|
|
62
|
+
skateboards are never parked or in traffic: players ride them by choice.
|
|
63
|
+
|
|
64
|
+
Parked two-wheelers stand two or three to a car's bay, side by side and a little staggered, each
|
|
65
|
+
its own pick from the region's two-wheelers; an auto-rickshaw takes a bay like a car. At a
|
|
66
|
+
distance they draw as their own silhouettes, not as small cars. In traffic, a two- or
|
|
67
|
+
three-wheeler's driver is drawn on the saddle with the shared riding pose (hands on the bars,
|
|
68
|
+
which turn with the bend), and two-wheelers lean into turns up to their `cycle.maxLean`.
|
|
69
|
+
`ambientContentFromTypes` finds these riders (`EarthAmbientContent.riders`); custom hosts pass
|
|
70
|
+
them to `createAmbientRenderer` as `riders`. Riders share the skinned-figure budget with
|
|
71
|
+
pedestrians, so beyond it a two-wheeler draws riderless.
|
|
72
|
+
|
|
53
73
|
## Downloads and residency
|
|
54
74
|
|
|
55
75
|
World Explorer builds an entity archive for distribution and a versioned directory manifest for
|
|
@@ -85,7 +105,9 @@ exceptions, owned until removal. Aircraft keep their existing budget.
|
|
|
85
105
|
## Coverage and authoring
|
|
86
106
|
|
|
87
107
|
The initial expansion adds 24 shared models, predominantly 2024 plus the 2025 four-door Wuling
|
|
88
|
-
Hongguang MINI EV. Profiles also reuse older and US-market models.
|
|
108
|
+
Hongguang MINI EV. Profiles also reuse older and US-market models. Generic two- and three-wheelers
|
|
109
|
+
(an underbone moped, an electric moped, the motor scooter and standard motorcycle, and an
|
|
110
|
+
auto-rickshaw) stand in for each region's many local makes. Country-specific trim,
|
|
89
111
|
steering variants, fleet age distributions and local commercial coverage remain approximate.
|
|
90
112
|
The atlas groups the Korean peninsula; that fleet profile primarily represents South Korea.
|
|
91
113
|
Some shared models use export-market bodies or steering layouts. Road driving side comes from
|
|
@@ -58,6 +58,9 @@ returns linear RGB. An explicit host `style.ground` palette takes precedence in
|
|
|
58
58
|
Nature-reserve, national-park and protected-area designations retain their protection metadata,
|
|
59
59
|
but do not paint over the physical habitat beneath them. With no mapped physical cover, sparse
|
|
60
60
|
open-ground planting remains a prior, rather than inferred forest or a wildlife-presence claim.
|
|
61
|
+
A named neighborhood outline is read the same way. The Protomaps basemap reports one as land use
|
|
62
|
+
`other`, in place of any land use mapped on the same outline, so it paints nothing and labels no
|
|
63
|
+
ground. Unlike a protection boundary it also leaves yard trees and inferred homes alone.
|
|
61
64
|
|
|
62
65
|
## Composable catalogs
|
|
63
66
|
|
|
@@ -191,7 +194,22 @@ bare winter branching keep the same mature dimensions, instance positions, indiv
|
|
|
191
194
|
and placement seeds. The coarse calendar reverses the southern hemisphere and extends dormancy
|
|
192
195
|
at high latitudes. Tropical locations stay leaf-on; evergreen plants do not become bare. This
|
|
193
196
|
does not infer local weather, snow, tropical wet/dry seasons, crop harvest dates, or climate change.
|
|
194
|
-
Remount with another month to change appearance.
|
|
197
|
+
Remount with another month to change appearance. Snow on the ground is the weather's `snowCover`,
|
|
198
|
+
set and changed without a remount and independent of the month; it dusts every plant above its
|
|
199
|
+
snow line, leafless or not ([Snow cover](snow.md)).
|
|
200
|
+
|
|
201
|
+
### Alpine tree line
|
|
202
|
+
|
|
203
|
+
Mountain forest gives out with height. The Earth tile adapter gives scatter a tree line by
|
|
204
|
+
latitude, about 3,900 m in the tropics, 2,400 m at 45° N and 800 m at 65° N, and lower in the
|
|
205
|
+
southern hemisphere outside the tropics (1,300 m at 45° S). Trees and brush (the canopy and
|
|
206
|
+
understory layers) thin from full density to none over the 350 m below it, so closed forest opens
|
|
207
|
+
into scattered trees before it stops, and glaciers and summits stay bare. Ground cover and crops
|
|
208
|
+
are not limited, and individually mapped trees stay where the map puts them. It is a coarse
|
|
209
|
+
climatic prior, as the plant calendar is: no aspect, continentality or local species. The arctic
|
|
210
|
+
tree line at sea level comes from the ecological atlas's tundra, not from this. A scatter rule's
|
|
211
|
+
own `altitude` limits still apply; pass `treeline` to the worldgen kernel's scatter sampler to
|
|
212
|
+
use the mechanism elsewhere.
|
|
195
213
|
|
|
196
214
|
The ordinary architectural catalog supplies 294 recipes across 14 construction families and seven
|
|
197
215
|
uses: detached homes, attached homes, apartments, commercial, civic, industrial, and farm
|
|
@@ -146,8 +146,11 @@ instance-matrix buffers; camera, material, animation and other uniforms continue
|
|
|
146
146
|
normally. Revalidate this adapter before widening the three peer range. Large instance buffers retain Three's vertex-attribute path.
|
|
147
147
|
|
|
148
148
|
Use `renderer.createRenderGroup()` for independent opaque terrain/content chunks. It returns
|
|
149
|
-
a managed WebGPU `BundleGroup`, or a normal Three `Group` on WebGL
|
|
150
|
-
|
|
149
|
+
a managed WebGPU `BundleGroup`, or a normal Three `Group` on WebGL, which the renderer leaves out
|
|
150
|
+
of the scene walks and shadow maps its stated bounds cannot reach (see
|
|
151
|
+
[graphics performance](graphics-performance.md#staged-preparation-and-admission)). The pyramid
|
|
152
|
+
terrain stream accepts `createTileGroup: () => renderer.createRenderGroup()` and keeps each
|
|
153
|
+
tile's bounds; World Explorer already uses it.
|
|
151
154
|
The renderer checks command state on every frame, updating LOD and re-recording when the
|
|
152
155
|
camera, hierarchy, visibility, transforms, draw counts, geometry, materials or lighting change.
|
|
153
156
|
During camera motion it uses normal draw submission and skips command snapshots, retaining
|
|
@@ -167,6 +170,26 @@ Time-based node materials still receive Three's per-frame node updates.
|
|
|
167
170
|
|
|
168
171
|
The world explorer also accepts `gpuOptimizations=0` for an uncached WebGPU comparison.
|
|
169
172
|
|
|
173
|
+
## What differs between the backends
|
|
174
|
+
|
|
175
|
+
The same scene is not pixel-identical on the two. Sky and haze match to within a level or two of
|
|
176
|
+
255, and from the air the ground and far water come out a few levels brighter on WebGPU. The
|
|
177
|
+
differences with a known cause:
|
|
178
|
+
|
|
179
|
+
| | WebGL | WebGPU |
|
|
180
|
+
| --- | --- | --- |
|
|
181
|
+
| Far sun shadows (`setFarShadowCasters`) | A second, wider shadow map | None: scenery past the focused map stays sunlit |
|
|
182
|
+
| Sun shadow filter | PCF | Soft PCF, except at the low shadow quality |
|
|
183
|
+
| Ambient occlusion | None | `setAmbientOcclusion`, off by default |
|
|
184
|
+
| Cloud deck haze | Mixed in after tone mapping | Mixed in before it, so distant clouds are brighter |
|
|
185
|
+
| Earth view scene | Compact: half the plant scatter, and at High under half the building vertices | Full |
|
|
186
|
+
|
|
187
|
+
In World Explorer the main-thread work of a frame is higher on WebGPU for the same scene, and the
|
|
188
|
+
GPU time equal or lower: on one Windows laptop with an NVIDIA GPU at Balanced, about 9 ms against
|
|
189
|
+
13 to 15 ms a frame for a settled view from the air. About a quarter of the WebGPU frame is the
|
|
190
|
+
command-state check described under [WebGPU performance](#webgpu-performance), and
|
|
191
|
+
`gpuOptimizations=0` measures the same.
|
|
192
|
+
|
|
170
193
|
## Testing the world explorer
|
|
171
194
|
|
|
172
195
|
Open [World Explorer](https://molen.dev/play/world-explorer/), then compare the same location
|
|
@@ -174,8 +197,9 @@ and settings using [`?backend=webgpu`](https://molen.dev/play/world-explorer/?ba
|
|
|
174
197
|
[`?backend=webgl`](https://molen.dev/play/world-explorer/?backend=webgl). World Explorer defaults
|
|
175
198
|
to WebGL, as the embedded Earth view does: WebGPU currently builds node state for every new
|
|
176
199
|
instanced mesh, which can leave terrain preparation behind a fast aircraft despite low GPU draw
|
|
177
|
-
times. Explicit `?backend=auto` still negotiates WebGPU with fallback; `?backend=webgpu` pins it
|
|
178
|
-
|
|
200
|
+
times. Explicit `?backend=auto` still negotiates WebGPU with fallback; `?backend=webgpu` pins it.
|
|
201
|
+
Screen-space [ambient occlusion](sky.md#ambient-occlusion) exists only on WebGPU and stays off
|
|
202
|
+
unless `?ao=1` is added. The general client/viewer default remains `auto`.
|
|
179
203
|
The performance HUD displays
|
|
180
204
|
the backend that actually rendered and any automatic fallback reason; its
|
|
181
205
|
`#performance-status` element also exposes `data-backend` and `data-fallback-reason` for tests.
|
|
@@ -95,9 +95,25 @@ map resolution without rebuilding the environment, and `renderer.setShadowFocus(
|
|
|
95
95
|
radius })` aims them at a point in absolute world coordinates covering ±`radius` meters — for a
|
|
96
96
|
large world, what the camera frames rather than the camera itself. The box moves in whole
|
|
97
97
|
shadow-map texels so edges do not shimmer; `setShadowFocus(undefined)` restores the default.
|
|
98
|
+
A focused map sized for what is close ends close: over a city it stops a few hundred meters
|
|
99
|
+
out, and buildings gain their shadows as it reaches them. On WebGL a focus can name a second,
|
|
100
|
+
wider square, `far: { center, radius }`, drawn from the scenery a host passes to
|
|
101
|
+
`renderer.setFarShadowCasters(root)` (a terrain stream's object: ground, buildings, trees).
|
|
102
|
+
Surfaces past the focused map then read the far one, which fades out toward its own edge. Only
|
|
103
|
+
what is under `root` casts into it, because it is not drawn every frame: it is redrawn when its
|
|
104
|
+
center has moved an eighth of its radius, when the sun has moved, and once a second for scenery
|
|
105
|
+
that has arrived, so a moving caster would leave its shadow behind. It is at most 2048 texels
|
|
106
|
+
across (meters a texel: a house's shadow, not a chimney's) and costs under a millisecond of
|
|
107
|
+
main thread each time it is drawn. `renderer.farShadowInfo` reports its radius, how often it has
|
|
108
|
+
been drawn and how long the last drawing took.
|
|
109
|
+
`renderer.shadowTexelSize` reports the meters one texel covers as of the last frame (`undefined`
|
|
110
|
+
while sun shadows are off), for hosts that keep a subject the map cannot resolve out of the
|
|
111
|
+
shadow pass (see `AircraftVisual.updateShadows` in the aircraft guide).
|
|
98
112
|
`sun.visible`/`moon.visible` control the disks independently of lighting. Use the corresponding
|
|
99
113
|
light intensity to disable illumination. `sun.size` and `moon.size` are visual multipliers;
|
|
100
114
|
the default 1 preserves real angular size. Larger values help stylized scenes and small displays.
|
|
115
|
+
A soft glare surrounds the Sun disk, so it reads as a bright source at that real size; `sun.visible`
|
|
116
|
+
and `sun.size` apply to it as well.
|
|
101
117
|
|
|
102
118
|
## Ambient occlusion
|
|
103
119
|
|
|
@@ -126,7 +142,15 @@ the same target and copies the image out unshaded, so nothing is built again. Tu
|
|
|
126
142
|
with `setAmbientOcclusion` changes the target, and every object in view builds its shaders again,
|
|
127
143
|
mid-frame. The World Explorer suspends it above 24 m over the ground and resumes below 18 m, where
|
|
128
144
|
its creases are small but its passes still cost a full-screen share of each frame (about 3 ms of
|
|
129
|
-
a 44 ms rooftop frame on an Apple M2 at High)
|
|
145
|
+
a 44 ms rooftop frame on an Apple M2 at High).
|
|
146
|
+
|
|
147
|
+
> [!WARNING]
|
|
148
|
+
> With occlusion on, World Explorer's nearby buildings draw without their facade textures (blank
|
|
149
|
+
> walls, no windows) while their shaders are warmed through `prepareObject` and
|
|
150
|
+
> `prepareMaterialChange`; with occlusion off, or without the warm-up, they draw as they should.
|
|
151
|
+
> The cause is not found. The explorer keeps occlusion off unless `?ao=1` asks for it. Before
|
|
152
|
+
> turning it on in a host that warms shaders, look at materials that gain their textures after
|
|
153
|
+
> they are first drawn.
|
|
130
154
|
|
|
131
155
|
## Reflections
|
|
132
156
|
|
|
@@ -178,7 +202,9 @@ and render its `scene`/`camera` as a background pass before your scene. Dispose
|
|
|
178
202
|
`palette` also accepts `ground`, `sun`, and `moon`. `dome.brightness` (default 1) scales only the
|
|
179
203
|
drawn dome, not the sky light or reflections taken from the palette: under filmic tone mapping a
|
|
180
204
|
clear sky lit at the palette's brightness renders pale, and the Earth look draws it at about half
|
|
181
|
-
(`EARTH_SKY_DOME`). `moon.earthshine` controls the dark side's subtle visibility
|
|
205
|
+
(`EARTH_SKY_DOME`). `moon.earthshine` controls the dark side's subtle visibility at night. By day
|
|
206
|
+
the Moon's light adds to the sky in front of it, so its unlit side matches the sky around it while
|
|
207
|
+
the disk still covers the Sun. Stars support `enabled`, `magnitudeLimit` (up to the catalog limit of 6.5),
|
|
182
208
|
`intensity` and visual angular `size`. Stars disappear below the horizon and fade through
|
|
183
209
|
twilight; a bright visible Moon reduces their contrast. Moon disks occlude stars behind them.
|
|
184
210
|
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# Snow cover
|
|
2
|
+
|
|
3
|
+
Snow lying on the ground is part of the [weather](weather.md): a `snowCover` block on the
|
|
4
|
+
singleton `weather` component names a snow line, and everything above it is under snow. The
|
|
5
|
+
ground whitens, roofs and trees take a dusting, people wade, cars lose their grip and bog down,
|
|
6
|
+
and skis, a snowboard and a snowmobile come into their own. One value drives the simulation and
|
|
7
|
+
the picture, so they agree.
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"id": "conditions",
|
|
12
|
+
"components": {
|
|
13
|
+
"weather": {
|
|
14
|
+
"snowCover": { "level": 1000 }
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Lying snow is independent of falling snow. `precipitation.kind: "snow"` draws flakes in the air;
|
|
21
|
+
`snowCover` is what is on the ground, on a clear day as much as in a storm. Leave `snowCover`
|
|
22
|
+
out and the ground is bare.
|
|
23
|
+
|
|
24
|
+
## The snow line and the depth
|
|
25
|
+
|
|
26
|
+
| Field | Meaning |
|
|
27
|
+
| --- | --- |
|
|
28
|
+
| `level` | The snow line: absolute world Y in meters where lying snow begins. In an Earth view world Y is meters above sea level. Required. |
|
|
29
|
+
| `transition` | Height above the line over which cover builds from none to complete; default 150 m. Zero is a hard line. |
|
|
30
|
+
| `depth` | Depth where cover becomes complete, at the top of the transition; default 0.15 m. |
|
|
31
|
+
| `depthGain` | Extra depth for each 1000 m of height above that; default 0.6 m. |
|
|
32
|
+
| `maxDepth` | Greatest depth at any height; default 1.5 m. |
|
|
33
|
+
|
|
34
|
+
With the defaults and a line at 1000 m, ground at 1075 m is half covered and 7 cm deep, ground
|
|
35
|
+
at 1150 m is covered 15 cm deep, and at 2150 m the snow is 75 cm deep. A line below the lowest
|
|
36
|
+
ground with `transition: 0` covers everything evenly.
|
|
37
|
+
|
|
38
|
+
`snowCoverAt(cover, altitude)` from `@bendyline/molen-schema` returns `{ coverage, depth }` at a
|
|
39
|
+
height, `resolveSnowCover` fills in the defaults, and `resolveWeather(data).snowCover` is present
|
|
40
|
+
only while snow lies. The function uses arithmetic alone, so the kernel, a script and a renderer
|
|
41
|
+
get the same answer bit for bit:
|
|
42
|
+
|
|
43
|
+
```ts
|
|
44
|
+
import { snowCoverAt } from '@bendyline/molen-schema';
|
|
45
|
+
|
|
46
|
+
const { coverage, depth } = snowCoverAt({ level: 1000 }, 1400);
|
|
47
|
+
// coverage 1, depth 0.3
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
A script changes it like any weather: `molen.patch('conditions', 'weather', { snowCover: { level: 600 } })`.
|
|
51
|
+
It is in state hashes, checkpoints and replays with the rest of the component.
|
|
52
|
+
|
|
53
|
+
## What it does to movement
|
|
54
|
+
|
|
55
|
+
### On foot
|
|
56
|
+
|
|
57
|
+
`snowWalkingPace(depth)` is the share of a person's pace left in snow that deep: all of it up
|
|
58
|
+
to boot-sole depth, about 70% at 30 cm, 40% from 60 cm on. `WalkController.paceAt` takes
|
|
59
|
+
a function of the feet's position and applies it to walking and running (never swimming):
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
import { snowCoverAt, snowWalkingPace } from '@bendyline/molen-schema';
|
|
63
|
+
|
|
64
|
+
walker.paceAt = (_x, y) => snowWalkingPace(snowCoverAt(weather.snowCover, y).depth);
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
[Ambient pedestrians](ambient-life.md) slow the same way from the world's weather, on half the
|
|
68
|
+
depth: a footway is trodden down. In an Earth view the walker and the host's actors are wired
|
|
69
|
+
already (see [below](#in-an-earth-view)).
|
|
70
|
+
|
|
71
|
+
### On wheels
|
|
72
|
+
|
|
73
|
+
`installVehicles` reads the world's weather, so a car needs nothing more. Under snow:
|
|
74
|
+
|
|
75
|
+
- **Grip** falls toward the `snow` surface's 0.35 of dry pavement as cover builds (`looseSurfaceGrip`
|
|
76
|
+
wins some back). Snow falling onto lying snow costs at most 15% more.
|
|
77
|
+
- **Depth drags.** Within a few centimeters it is the rolling resistance of any soft ground.
|
|
78
|
+
Deeper, the wheels plough and the floor drags: the drag grows with the square of the depth
|
|
79
|
+
against the wheel's size, about 3 m/s² where the snow reaches 60% of the wheel's radius.
|
|
80
|
+
`snowDrag(depth, wheelRadius, tread)` returns both parts.
|
|
81
|
+
- **A car can be stuck.** Below a crawl, what the tires and the slope give has to beat the whole
|
|
82
|
+
of that drag, or the car stays where it is: `vehicleState.stuck` is true while the driver is
|
|
83
|
+
asking for drive and getting none. On untouched snow the stock sedan is held at 13 cm, the
|
|
84
|
+
all-wheel-drive SUV at 22 cm and the off-roader on its tread at 33 cm; on a ploughed road the
|
|
85
|
+
sedan keeps going until the snow beside it is 40 cm deep. A car that leaves the road at speed
|
|
86
|
+
ploughs on for a few lengths first.
|
|
87
|
+
- **Roads are ploughed.** A [surface](vehicles.md#surfaces) may say how much of the snow it
|
|
88
|
+
keeps: `VehicleSurface.snow`, 0.3 for the paved stock surfaces (`asphalt`, `concrete`, `paved`,
|
|
89
|
+
`stone`, `wood`, `metal`) and 1 for open ground and for a world with no surface callback.
|
|
90
|
+
|
|
91
|
+
`vehicleState.snowDepth` is the depth under the vehicle, absent on bare ground, and
|
|
92
|
+
`vehicleState.surfaceGrip` reports the grip whether or not a host names surfaces.
|
|
93
|
+
|
|
94
|
+
### On runners
|
|
95
|
+
|
|
96
|
+
`vehicle.spec.runners` is for what slides: skis, a snowboard, a snowmobile's skis and track.
|
|
97
|
+
|
|
98
|
+
```json
|
|
99
|
+
"runners": { "friction": 0.05, "bareDrag": 3.5, "pushSpeed": 4.5, "flat": true }
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
| Field | Meaning |
|
|
103
|
+
| --- | --- |
|
|
104
|
+
| `friction` | Sliding friction coefficient on snow; it resists as `friction` × g. About 0.05 for waxed skis, 0.12 for a snowmobile's track. |
|
|
105
|
+
| `bareDrag` | Resistance in m/s² off the snow, where runners scrape bare ground; default 3. |
|
|
106
|
+
| `pushSpeed` | Fastest the rider's own pushing drives it; gravity may take it on to `maxSpeed`. Absent, `engineForce` works up to `maxSpeed`. |
|
|
107
|
+
| `flat` | A cycle whose runners stay flat on the snow in a turn (a pair of skis) instead of banking as one plank (a snowboard). The lean stays in `vehicleState.bodyRoll` for the rider's pose. |
|
|
108
|
+
|
|
109
|
+
On lying snow a vehicle with runners keeps its full `grip` (edges and paddles bite), floats over
|
|
110
|
+
any depth, and is never stuck. Friction is Coulomb friction: it holds the vehicle on a slope too
|
|
111
|
+
gentle to beat it (about 3° for skis) and lets go on a steeper one, so skis pointed downhill
|
|
112
|
+
start by themselves unless the brake is on, accelerate under gravity along the slope, and settle
|
|
113
|
+
at the speed where air drag and friction balance it. Across the slope the edges hold a traverse.
|
|
114
|
+
Off the snow, runners scrape to a stop.
|
|
115
|
+
|
|
116
|
+
A cycle on runners also lies on the slope across it, where a wheeled cycle balances upright on
|
|
117
|
+
its tire line: `vehicleState.roll` follows the ground under the skis, and the standing rider's
|
|
118
|
+
pose stays plumb over them.
|
|
119
|
+
|
|
120
|
+
## The three rides
|
|
121
|
+
|
|
122
|
+
The `molen.entities` pack carries three types, drivable through `installVehicles` like any
|
|
123
|
+
[vehicle](vehicles.md):
|
|
124
|
+
|
|
125
|
+
| Type | What it is | Controls |
|
|
126
|
+
| --- | --- | --- |
|
|
127
|
+
| `molen.entities.cycle.skis` | A pair of 1.70 m all-mountain skis with bindings and two poles. The rider stands over them with a hand on each pole. | Point downhill to slide. Steering carves. Brake, or back on the throttle, stops on the edges. Throttle poles along the flat to 4.5 m/s. |
|
|
128
|
+
| `molen.entities.cycle.snowboard` | A 1.56 m twin-tip board with strap bindings. The rider stands across it, left foot forward. | As skis; the board banks into its turns, and throttle skates it along the flat to 3.5 m/s. |
|
|
129
|
+
| `molen.entities.vehicle.snowmobile` | A two-up trail sled: a lugged track, two steered skis, handlebars, a headlamp. | Throttle and brake as a car, reverse included. It floats over snow a car is stuck in, and drags on bare ground. |
|
|
130
|
+
|
|
131
|
+
On a 25° slope the skis reach about 105 km/h; their hard limit is `maxSpeed`, 38 m/s. The poles
|
|
132
|
+
stand planted at rest and swing back in the hands once moving. None of the three joins traffic
|
|
133
|
+
or parks on streets.
|
|
134
|
+
|
|
135
|
+
## Rendering
|
|
136
|
+
|
|
137
|
+
The renderer needs only the weather. `renderer.setWeather(data)` (the normal client mirrors the
|
|
138
|
+
component by itself) hands the snow line to every material that takes snow, on WebGL and WebGPU,
|
|
139
|
+
and changing or clearing it never rebuilds a shader.
|
|
140
|
+
|
|
141
|
+
- **Marked materials** take a dusting on what faces the sky: `enableSnowCover(material, amount,
|
|
142
|
+
facing)` from `@bendyline/molen-client/snow` marks a lit material once. `amount` (0–1) thins
|
|
143
|
+
the dusting, and `facing` is the range of the surface normal's up component over which a
|
|
144
|
+
face goes from bare to dusted: by default `[0.3, 0.75]`, so flat roofs are white and walls
|
|
145
|
+
stay clean. The `@bendyline/molen-worldgen` material sets mark generated buildings (roofs,
|
|
146
|
+
ledges and sills whiten, glass does not), landmark models, and the scatter material for
|
|
147
|
+
trees, shrubs and props, where the dusting is thinner so foliage still shows and reaches
|
|
148
|
+
down steeper faces (`[-0.05, 0.55]`), so a conifer's tiers carry snow. Parked cars and the
|
|
149
|
+
painted shell of a car you drive are marked too. Mark your own models the same way; leave
|
|
150
|
+
out anything that moves through the weather, such as an aircraft or a person.
|
|
151
|
+
- **Terrain ground and paving** draw their own snow. `setTerrainGroundSnow(material, snowCover,
|
|
152
|
+
worldOriginY)` from `@bendyline/molen-terrain/client` works on the materials from
|
|
153
|
+
`createTerrainGroundMaterialAsync` and `createTerrainPavementMaterialAsync`: open ground
|
|
154
|
+
whitens in patches through the transition and completely above it, faces steeper than about
|
|
155
|
+
58° shed it and show rock, and roads keep worn, greyer snow with the paving showing through.
|
|
156
|
+
Up close the snow surface has wind drifts a few meters long, which the sun and the sky's
|
|
157
|
+
light model: crests bright, hollows a little bluer.
|
|
158
|
+
|
|
159
|
+
The line is one function of world position on every surface, so a roof and the ground under it
|
|
160
|
+
agree on where the snow begins. It wanders by up to a third of the transition with broad noise,
|
|
161
|
+
so it does not follow a contour like a tide mark; the simulation uses the smooth line.
|
|
162
|
+
|
|
163
|
+
Trees do not stop at the snow line; they stop at the tree line. The Earth tile adapter thins
|
|
164
|
+
mountain forest out over the last 350 m below a latitude-dependent alpine tree line (about
|
|
165
|
+
2,250 m at Mount Rainier, 3,900 m in the tropics, lower in the southern hemisphere), so glaciers
|
|
166
|
+
and summits are bare whatever the snow level. See [regional world content](regional-world.md).
|
|
167
|
+
|
|
168
|
+
## In an Earth view
|
|
169
|
+
|
|
170
|
+
`mountEarthView` takes the weather at mount and changes it at once:
|
|
171
|
+
|
|
172
|
+
```ts
|
|
173
|
+
const view = await mountEarthView({
|
|
174
|
+
canvas,
|
|
175
|
+
terrain,
|
|
176
|
+
baseUrl,
|
|
177
|
+
content,
|
|
178
|
+
weather: { snowCover: { level: 2000 } },
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
view.setWeather({ ...view.weather, snowCover: { level: 500 } }); // a winter storm reaches town
|
|
182
|
+
view.setWeather(undefined); // clear skies, bare ground
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
That one call reaches the sky, the view's simulation (so cars slip and bog down and runners
|
|
186
|
+
glide), its ground and paving materials, the walker's pace and the pace of the host's
|
|
187
|
+
[actors](earth-view.md#actors-companions-and-npcs). On mapped roads and footways the walker and
|
|
188
|
+
cars meet the ploughed depth; off them, and where the map is empty, the full depth.
|
|
189
|
+
`view.vehicleStatus()` adds `snowDepth` and `stuck` for a car, and `EarthVehicles.snow` reports
|
|
190
|
+
the same for a host composing its own view, where `createSnowPace` builds the walker's
|
|
191
|
+
`paceAt`.
|
|
192
|
+
|
|
193
|
+
Put the viewer on skis as on any ride:
|
|
194
|
+
|
|
195
|
+
```ts
|
|
196
|
+
view.setMode('drive', { vehicle: 'molen.entities.cycle.skis', force: true });
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## World explorer
|
|
200
|
+
|
|
201
|
+
The Weather panel has a **Snow level** list: no snow, everywhere, sea level, and lines from
|
|
202
|
+
250 m to 4,000 m. `?snow=1500` sets a line in meters, `?snow=all` covers everything and
|
|
203
|
+
`?snow=off` clears it. Each region can open on a line of its own: the Seattle region, which
|
|
204
|
+
reaches east over the Cascade crest and south past Mount Rainier (4,392 m), opens with snow
|
|
205
|
+
above 2,000 m, as the mountain's glaciers keep it all year.
|
|
206
|
+
|
|
207
|
+
On foot on lying snow, **P** takes skis, then a snowboard, then a snowmobile from the bag (on
|
|
208
|
+
bare ground it is still the skateboard and scooter). `?ride=skis` starts on them, so this link
|
|
209
|
+
drops you onto the Muir Snowfield pointed downhill:
|
|
210
|
+
|
|
211
|
+
```text
|
|
212
|
+
https://molen.dev/play/world-explorer/?lat=46.822&lon=-121.728&yaw=1.57&navigation=walk&ride=skis&mode=human&weather=sunny
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
The status line shows the snow depth under the ride and says when a car is stuck.
|
|
216
|
+
|
|
217
|
+
## Limits
|
|
218
|
+
|
|
219
|
+
- Snow does not fall and build up, melt, drift or avalanche. The cover is authored: move the
|
|
220
|
+
line to change it.
|
|
221
|
+
- The depth depends on height alone. Aspect, wind and forest shelter do not change it, and
|
|
222
|
+
only the surface under a vehicle or walker tells a ploughed road from open ground.
|
|
223
|
+
- A stuck car stays stuck: step out and walk, or bring a snowmobile. There is no digging out,
|
|
224
|
+
no chains and no winter tires beyond `looseSurfaceGrip`.
|
|
225
|
+
- Lakes do not freeze, and no tracks are left in the snow.
|
|
226
|
+
- The dusting on marked materials follows the surface's facing, not what overhangs it: a
|
|
227
|
+
covered porch floor whitens with the roof above it.
|
|
228
|
+
- Skiing is a grounded glide: no jumps, falls, moguls or lifts. Ambient traffic drives on at
|
|
229
|
+
its usual pace.
|
|
230
|
+
- World Explorer draws no rider (it has no avatar), so its skis run without a skier in the
|
|
231
|
+
chase view; an Earth view with a walker avatar draws one.
|