@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
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
# Medium-fi style guide
|
|
2
|
+
|
|
3
|
+
Molen's Earth view draws the real planet at full scale in a browser, with thousands of buildings,
|
|
4
|
+
trees, vehicles and landmarks on screen at once. Its look is **medium-fi**: a bright, polygonal
|
|
5
|
+
model-railroad version of the world. This page sets the standard for every model, building
|
|
6
|
+
style, palette and prop made for it, and ends with the review an agent runs before submitting one.
|
|
7
|
+
|
|
8
|
+
Medium-fi sits between two looks it avoids. It is not low-fi, meaning voxels, pixel art or bare
|
|
9
|
+
grey boxes. It is not high-fi either: photoreal surfaces, or even the most detail the engine can
|
|
10
|
+
draw. The nearest reference is an open-world game of the early 2000s, Grand Theft Auto III or Vice
|
|
11
|
+
City. Proportions are realistic, faces are visibly polygonal, and shared textures are simple under
|
|
12
|
+
a strong sun. Every object reads clearly, the whole frame is coherent, and it holds 60 frames per
|
|
13
|
+
second on ordinary laptops.
|
|
14
|
+
|
|
15
|
+
## Why medium-fi
|
|
16
|
+
|
|
17
|
+
Three constraints decide the style, and every rule below follows from one of them:
|
|
18
|
+
|
|
19
|
+
- **Scale.** A city view holds 20,000–35,000 procedural buildings and a few dozen landmarks.
|
|
20
|
+
Budgets are spent per frame across all of them, not per model.
|
|
21
|
+
- **The browser.** WebGPU or WebGL on integrated laptop GPUs, phones and the occasional
|
|
22
|
+
software rasterizer. Memory, draw calls and shader cost are tight.
|
|
23
|
+
- **Coherence.** Most buildings are generated from map footprints. Hand-made landmarks,
|
|
24
|
+
vehicles and props must sit beside those procedural shells without looking like they came from
|
|
25
|
+
a different game.
|
|
26
|
+
|
|
27
|
+
## The five rules
|
|
28
|
+
|
|
29
|
+
1. **Recognizable shape first.** Silhouette, proportion and two or three identity features carry
|
|
30
|
+
recognition, not surface detail. The P-51 is unmistakably a P-51, like a good model-railroad
|
|
31
|
+
P-51: correct planform, spinner and canopy, chunky but true. If a model is not recognizable
|
|
32
|
+
with textures off and flat-shaded, more detail will not fix it.
|
|
33
|
+
2. **Shared, low-frequency textures.** Surfaces use a small library of shared 256² material
|
|
34
|
+
graphs tinted by palette, never a unique texture per building. Hundreds of distinct models
|
|
35
|
+
then cost a handful of textures.
|
|
36
|
+
3. **Fit any footprint.** Procedural buildings are generated from whatever outline the map
|
|
37
|
+
supplies: L-shapes, courtyards, slivers and curves. A style has to stay coherent on all of
|
|
38
|
+
them, so it is built from simple, rule-driven parts.
|
|
39
|
+
4. **Low-poly with levels of detail.** Cars are a little chunky, trees show their facets, and
|
|
40
|
+
buildings carry few adornments. LODs add detail as the camera approaches. High-priority
|
|
41
|
+
entities, such as the vehicle the player is in, earn more polygons than ambient copies.
|
|
42
|
+
5. **Three rendering modes.** Economy, Medium and High (see
|
|
43
|
+
[Rendering modes](#rendering-modes)) change resolution, shadows and level of detail. They
|
|
44
|
+
never change the palette or the style, so every mode looks like the same world.
|
|
45
|
+
|
|
46
|
+
## The look the engine provides
|
|
47
|
+
|
|
48
|
+
Author against the lighting the Earth view actually uses. Both Earth hosts share one rig:
|
|
49
|
+
`mountEarthView`, and viewers that compose their own, such as the World Explorer. The rig is
|
|
50
|
+
exported from `@bendyline/molen-earth/client` as `EARTH_SKY_PALETTE`, `EARTH_LIGHTING`,
|
|
51
|
+
`EARTH_TONE_MAPPING`, `EARTH_EXPOSURE`, `EARTH_WATER_COLOR` and `earthHazeColor`.
|
|
52
|
+
|
|
53
|
+
| Element | Value | What it means for an asset |
|
|
54
|
+
| --- | --- | --- |
|
|
55
|
+
| Sun | Warm white `#fff1d8`, intensity 3.5 | Sunlit horizontal faces render near their authored color |
|
|
56
|
+
| Sky fill | `dayAmbient` 2 from the sky dome, warm ground bounce `#7a7258` | Faces in shade sit at roughly a third of lit faces, cool-tinted |
|
|
57
|
+
| Tone mapping | Khronos PBR Neutral, exposure 1 | Authored colors keep their hue and saturation below the highlights |
|
|
58
|
+
| Cast shadows | On from the Medium tier up, in a shadow map that follows the camera | Do not bake shadows or ambient occlusion into colors or textures |
|
|
59
|
+
| Sky | Saturated zenith `#2f7fd3` over a pale horizon `#c4dcec` | Large pure-white surfaces outshine it; prefer off-whites and creams |
|
|
60
|
+
| Haze | The sky's own horizon color, from about 2 km | Distant ground dissolves into the horizon; do not add a fog color of your own |
|
|
61
|
+
| Water | `#286d83` with a soft sky reflection | Lakes and bays read clearly blue, never grey |
|
|
62
|
+
|
|
63
|
+
Two consequences matter for authoring:
|
|
64
|
+
|
|
65
|
+
- **Walls receive less light than roofs.** Under a high sun a vertical wall gets about half the
|
|
66
|
+
light a roof gets. A wall palette therefore needs to be lighter than the color you want to see.
|
|
67
|
+
- **Shadows do the grounding.** A building, tree or car is seated by its cast shadow. Never fake
|
|
68
|
+
contact shading with a dark gradient or soot band at the base of a model; a foundation is its
|
|
69
|
+
own material, not a shadow.
|
|
70
|
+
|
|
71
|
+
### Color spaces
|
|
72
|
+
|
|
73
|
+
Getting color spaces wrong is the most common reason a model looks washed out or muddy next to
|
|
74
|
+
its neighbors.
|
|
75
|
+
|
|
76
|
+
- **Hex palettes are sRGB.** Archstyle palettes, scatter surface colors, terrain bands, landmark
|
|
77
|
+
manifests and identity colors are sRGB hex. The client decodes them to linear before the GPU
|
|
78
|
+
sees them, so a swatch renders as that swatch.
|
|
79
|
+
- **glTF vertex colors (`COLOR_0`) and `baseColorFactor` are linear.** Writing `[0.5, 0.5, 0.5]`
|
|
80
|
+
gives the light grey `#bcbcbc`; the mid grey `#808080` is linear `0.216`. Convert from sRGB
|
|
81
|
+
when you move a palette color into a GLB.
|
|
82
|
+
- **Base-color textures are sRGB; normal, roughness, metalness and occlusion maps are linear.**
|
|
83
|
+
- **Multiply tinting darkens.** A palette tint multiplies its material graph. The shared siding,
|
|
84
|
+
render and shingle graphs average about 0.85 in sRGB (0.65 linear), so a tinted surface renders
|
|
85
|
+
about 15% darker than its swatch. Author tints a step lighter, or keep a graph near white.
|
|
86
|
+
Distant flat levels and loading placeholders multiply by the same mean
|
|
87
|
+
(`TEXTURED_SURFACE_MEAN`), so a building's brightness holds as its detail changes; a new
|
|
88
|
+
graph far from that mean will brighten or darken visibly at the switch.
|
|
89
|
+
|
|
90
|
+
## Color and palette
|
|
91
|
+
|
|
92
|
+
The palette is clean, coherent and realistic. Each kind of surface uses a narrow band of
|
|
93
|
+
lightness. Houses carry most of the color; downtown blocks are mostly light neutrals with color
|
|
94
|
+
where real buildings have it. Avoid both grey-on-grey and candy color.
|
|
95
|
+
|
|
96
|
+
| Surface | HSL lightness | HSL saturation | Reference swatches |
|
|
97
|
+
| --- | --- | --- | --- |
|
|
98
|
+
| Painted wall, siding, render | 60–90% | 15–60% | sage `#a3b78f`, slate blue `#8199b2`, cream `#efe3c4`, butter `#e6cf86` |
|
|
99
|
+
| Urban wall: concrete, panel, limestone | 55–90% | 0–25% | light concrete `#d2cec5`, limestone `#ddd6c6`, cool grey `#b8bfc4`, graphite `#8f9397` |
|
|
100
|
+
| Masonry, brick, timber walls | 45–65% | 25–45% | brick `#a8634b`, sandstone `#c9ab84`, cedar `#a77a54` |
|
|
101
|
+
| Pitched roof (shingle, tile, slate) | 35–50% | 6–40% | charcoal `#575c62`, brown `#725c49`, moss `#5a6d55`, terracotta `#a5644b` |
|
|
102
|
+
| Flat roof (membrane, gravel) | 62–80% | 0–12% | gravel `#a9a59c`, membrane `#c4c0b6` |
|
|
103
|
+
| Trim and frames | 85–95% or 22–30% | 0–30% | white `#f4f1ea`, dark frame `#3b3e42` |
|
|
104
|
+
| Untextured window glass | 35–45% | 20–30% | blue-grey pane `#4d6178` |
|
|
105
|
+
| Lawn and residential ground | 45–55% | 25–35% | lawn `#8aa065`, grass `#7fa258`, park `#6c9a55` |
|
|
106
|
+
| Paved and commercial ground | 60–70% | 5–12% | paving `#aaa59a` |
|
|
107
|
+
| Forest floor and conifers | 30–40% | 25–35% | forest `#3c6a3f`, fir `#3e7052` |
|
|
108
|
+
| Asphalt | 25–32% | 0–10% | road `#41484d`, with markings `#eee9d4` and `#e8bd57` |
|
|
109
|
+
| Identity and wayfinding accents | 35–60% | 55–90% | signal red `#b81d18`, chrome yellow `#e7b52a` |
|
|
110
|
+
|
|
111
|
+
Palette rules:
|
|
112
|
+
|
|
113
|
+
- **Houses carry the hue; urban blocks stay mostly neutral.** A house palette gives at least a
|
|
114
|
+
third of its weight to colors with saturation of 25% or more, so a street of procedural houses
|
|
115
|
+
never reads as grey concrete. Commercial, office and apartment palettes reverse that: about
|
|
116
|
+
three quarters light neutrals (concrete, limestone, off-white, warm and cool greys), with clear
|
|
117
|
+
hue as the minority. A downtown should read as a clean, light skyline, not a patchwork.
|
|
118
|
+
- **Tie color to material.** Brick colors belong on brick and concrete colors on concrete, so a
|
|
119
|
+
style that mixes them names a `palette` on each material choice. Keep red and brown brick to
|
|
120
|
+
about a tenth of an urban style's weight. Dark red and brown towers read as heavy blocks across
|
|
121
|
+
a whole skyline.
|
|
122
|
+
- **No black and no white on large surfaces.** Large surfaces stay between 22% and 94% lightness.
|
|
123
|
+
A near-black roof reads as a hole in the frame, and a pure white wall blooms in sun.
|
|
124
|
+
- **Roofs are darker than walls; flat commercial roofs are lighter.** Pitched roofs sit 15–35
|
|
125
|
+
lightness points below their walls, so a neighborhood seen from above reads as roofs. Large
|
|
126
|
+
flat roofs are light membranes and gravel, as they are in reality. A pitched style declares
|
|
127
|
+
`materials.flatRoof` so its flat fallback is membrane, not shingle tinted charcoal.
|
|
128
|
+
- **Reserve saturated accents.** Strong saturation belongs to identity: a store's sign band, a
|
|
129
|
+
landmark's signature color, a bus livery, a fire station. Use one accent per object.
|
|
130
|
+
- **Real landmarks use their real colors.** The Tacoma Narrows towers are green and the Golden
|
|
131
|
+
Gate is International Orange. A generic recipe must never repaint a known structure.
|
|
132
|
+
- **Jitter gently.** Per-building variation of ±0.012 hue, ±0.05 saturation and ±0.05 lightness
|
|
133
|
+
keeps a street from looking cloned without drifting out of the palette.
|
|
134
|
+
- **Regional palettes stay in band.** A desert region is warmer and a Japanese street is cooler
|
|
135
|
+
and darker-roofed, but every region uses the same lightness bands.
|
|
136
|
+
|
|
137
|
+
## Geometry and polygon budgets
|
|
138
|
+
|
|
139
|
+
Budgets are per model and per level of detail. The scene and tile budgets in
|
|
140
|
+
[adaptive rendering performance](adaptive-performance.md) still decide how many instances fit.
|
|
141
|
+
|
|
142
|
+
| Asset | Near | Medium | Far |
|
|
143
|
+
| --- | --- | --- | --- |
|
|
144
|
+
| Procedural building | Style tier 0: roof, windows, trim, dormers, props | Tier 1: roof and windows, no trim or props | Tier 2 or an instanced stand-in box |
|
|
145
|
+
| Landmark or authored structure | Closeup ≤ 64,000 | Street ≤ 16,000, district ≤ 4,000 | Skyline ≤ 1,000 |
|
|
146
|
+
| Small static building | 1,000–8,000 | 500–2,000 | Box or silhouette ≤ 200 |
|
|
147
|
+
| Hero vehicle (player car, aircraft) | 10,000–60,000 | 5,000–15,000 | ≤ 2,000 |
|
|
148
|
+
| Ambient car or bus | ≤ 2,000 drawn | — | Proxy ≤ 160 |
|
|
149
|
+
| Tree | 240–450 | 120–140 | 12–20 |
|
|
150
|
+
| Street furniture (lamp, bench, rack) | 50–500 | 50–150 | 36–72 or none |
|
|
151
|
+
| Ground cover (tussock, fern, stone) | 20–70 | None | None |
|
|
152
|
+
| Figure (person or animal) | 1,000–4,000 | 600–900 | 100–300 rigid |
|
|
153
|
+
|
|
154
|
+
Geometry rules:
|
|
155
|
+
|
|
156
|
+
- **Flat shading.** Every face reads as a plane, with hard normals on architecture, vehicles and
|
|
157
|
+
vegetation alike. Use smooth normals only on intentionally round forms, such as a fuselage, a
|
|
158
|
+
dome or a storage tank, and give them enough sides that the silhouette stays clean.
|
|
159
|
+
- **Facet counts.** Cylinders and cones get 6–8 sides far, 12–16 near and 24–32 on a hero
|
|
160
|
+
model. Spheres and domes follow the same rings. An octagonal column reads as round at street
|
|
161
|
+
distance.
|
|
162
|
+
- **Nothing thinner than it can draw.** At the distance a level is used, an element must be at
|
|
163
|
+
least a pixel or two wide. Cables, mullions, railings, guy wires and lattice members that fall
|
|
164
|
+
below that move into a texture, merge into a solid panel, or drop out of that level. Sub-pixel
|
|
165
|
+
geometry shimmers and costs as much as solid geometry.
|
|
166
|
+
- **No micro-bevels.** Chamfer only the largest edges of a hero model, and only once.
|
|
167
|
+
- **One draw per material.** Merge a model's parts by material. Two to five materials is
|
|
168
|
+
typical; more than eight needs a reason.
|
|
169
|
+
- **Instance repeats.** Seats, windows, bollards, lamps and trees are instanced or merged, never
|
|
170
|
+
thousands of separate meshes.
|
|
171
|
+
- **Ground contact.** The base sits at Y=0, or on a declared attachment plane, with no floating
|
|
172
|
+
gap and no deep embedding.
|
|
173
|
+
|
|
174
|
+
## Textures and materials
|
|
175
|
+
|
|
176
|
+
- Use the shared material graphs in the default style pack (brick, siding, render, concrete,
|
|
177
|
+
shingle, tile, slate, metal, glazing) before adding one. Their
|
|
178
|
+
[catalog](https://github.com/bendyline/molen/blob/main/content/worldgen/materials/README.md)
|
|
179
|
+
lists repeat sizes and intended use.
|
|
180
|
+
- Textures are 256² seamless and low contrast, with true physical repeats: a 2 m facade holds
|
|
181
|
+
2 m of brick courses, not two giant bricks.
|
|
182
|
+
- A material graph that will be tinted averages near white (sRGB 0.85 or above), so palettes
|
|
183
|
+
keep their meaning.
|
|
184
|
+
- Never bake directional light, shadows, ambient occlusion or dirt gradients into base color.
|
|
185
|
+
- Glass is a dark blue-grey pane with a modest reflection, not a mirror. Identity lettering is
|
|
186
|
+
geometry or vertex color, not a texture per business.
|
|
187
|
+
- Photographs from research are evidence, not textures, and never ship inside a model.
|
|
188
|
+
|
|
189
|
+
## Procedural buildings that fit any footprint
|
|
190
|
+
|
|
191
|
+
A style is a set of rules applied to arbitrary outlines, so its parts must survive every shape:
|
|
192
|
+
|
|
193
|
+
- **Build from the outline.** Walls extrude from the footprint. Bays repeat at 2.6–4 m along each
|
|
194
|
+
wall, and windows sit in those bays. Nothing assumes a rectangle.
|
|
195
|
+
- **Have a roof fallback.** Gable and hip roofs apply only where the footprint analysis allows
|
|
196
|
+
them; anything else falls back to a flat roof with a parapet. The fallback must look as
|
|
197
|
+
intentional as the main roof.
|
|
198
|
+
- **Keep details sparse and local.** Porches, dormers, balconies and shutters attach to
|
|
199
|
+
qualifying walls and stop cleanly at corners, seams and courtyards. A detail that would cross
|
|
200
|
+
a clipped edge is skipped.
|
|
201
|
+
- **Respect mapped data.** Keep the footprint, height, levels and minimum height. Missing height
|
|
202
|
+
falls back to a conservative default for the category, not to the style's tallest form.
|
|
203
|
+
- **Declare the LOD tiers.** Each style lists which feature groups survive at tiers 0, 1 and 2,
|
|
204
|
+
so distant buildings keep their roof shape and window rhythm after trim and props drop.
|
|
205
|
+
|
|
206
|
+
The [worldgen guide](worldgen.md) and the
|
|
207
|
+
[structure library](structure-library.md) cover the archstyle format and the 120 shipped styles.
|
|
208
|
+
|
|
209
|
+
## Landmarks and authored structures
|
|
210
|
+
|
|
211
|
+
A landmark earns its own model because people know it. Spend its budget on recognition, in this
|
|
212
|
+
order:
|
|
213
|
+
|
|
214
|
+
1. **Three identity features at skyline distance.** For the Space Needle that is the hourglass
|
|
215
|
+
legs with a narrow waist, the flared halo of the top house, and the spire. For a suspension
|
|
216
|
+
bridge it is the tower shape, the cable sag and the deck color. For a stadium it is the roof
|
|
217
|
+
form and the bowl outline. The 1,000-triangle skyline level must still show all three, so
|
|
218
|
+
author it by hand when automatic simplification loses them.
|
|
219
|
+
2. **Correct proportion and massing** at the district level, with up to 4,000 triangles.
|
|
220
|
+
3. **Rhythm and openings** (window bands, arches, truss bays) at street level, with up to 16,000.
|
|
221
|
+
4. **Selected detail** close up, with up to 64,000. More than that needs a written reason, and
|
|
222
|
+
the levels below it must still meet their own targets.
|
|
223
|
+
|
|
224
|
+
Runtime levels come from the engine repository's landmark LOD generator, which meets these
|
|
225
|
+
targets for you where it can. It simplifies each level at its natural error first; if that
|
|
226
|
+
leaves the level more than 15% over target, it raises the error budget and prunes isolated parts
|
|
227
|
+
(seat rows, mullions, cables) until the level fits, up to 2% of the model's extent for district,
|
|
228
|
+
0.6% for street and 0.15% for closeup. A closeup that still does not fit stays over target
|
|
229
|
+
rather than blur; that is a master to re-author, not a level to force. A master already under
|
|
230
|
+
the closeup target ships as its own closeup only if it draws in 12 calls or fewer (an instanced
|
|
231
|
+
mesh counts once per primitive); otherwise it gets the material-merged derivative. The audit
|
|
232
|
+
`node packages/tooling/scripts/check-medium-fi.mjs` (in the engine repository) reports level
|
|
233
|
+
budgets, material counts, draw calls and near-black or pure-white surfaces for every structure.
|
|
234
|
+
|
|
235
|
+
Further rules:
|
|
236
|
+
|
|
237
|
+
- **Signature color.** Use the structure's documented paint and cladding colors, converted to
|
|
238
|
+
linear for `COLOR_0`.
|
|
239
|
+
- **Repeated structural members.** Model a stadium's seat tiers as stepped bands, not
|
|
240
|
+
individual seats (the stadium generators' `seatBand` draws a row as one band per aisle
|
|
241
|
+
section). Model truss and lattice work as a few members plus a texture or panel, and
|
|
242
|
+
cables as a few thick strands that thin out by level.
|
|
243
|
+
- **Nothing below the closeup's error.** The closeup level may drop detail smaller than 0.15% of
|
|
244
|
+
the model's extent (about 40 cm on a 260 m tower), so do not author it: 3–7 cm window frames,
|
|
245
|
+
stone joints, baluster rails and glazing bars on a tall building never reach the screen, and
|
|
246
|
+
the generator cannot remove them for you, because each one is a closed little part.
|
|
247
|
+
- **Draw a curtain wall once.** A facade of framed cells is one glass face with its mullions as
|
|
248
|
+
full-length strips just proud of it (the signature-tower `grid` and `facetedGlazing` helpers),
|
|
249
|
+
not an inset pane and frame ring per cell. Per-cell panels made towers carry 300,000 to
|
|
250
|
+
1,000,000 triangles that no level could simplify; as one face the same wall is a few hundred
|
|
251
|
+
and looks the same.
|
|
252
|
+
- **Sit in the palette.** A landmark is the most saturated thing in its block only where its
|
|
253
|
+
real color demands it.
|
|
254
|
+
|
|
255
|
+
## Ground
|
|
256
|
+
|
|
257
|
+
Large map polygons (a lawn, a meadow, a forest floor) are one color edge to edge, so the ground
|
|
258
|
+
gets variation from two cheap sources rather than from per-polygon textures:
|
|
259
|
+
|
|
260
|
+
- **The ground shader.** `createTerrainGroundMaterialAsync` from `@bendyline/molen-terrain/client`
|
|
261
|
+
multiplies terrain and landcover vertex colors by world-space value noise: broad 64 m mottling,
|
|
262
|
+
16 m patches, 4 m clumps and 1 m grain, plus straw-colored dry areas and darker lush ones on
|
|
263
|
+
green ground only, so paving, sand and rock keep their hue. Finer layers fade out before they
|
|
264
|
+
fall below a pixel. It costs no geometry, texture or upload. The Earth view uses it by default;
|
|
265
|
+
the World Explorer's `?ground=flat` turns it off for comparison.
|
|
266
|
+
- **Ground cover.** Knee-high tussocks, ferns, small shrubs and stones from scatter rules on the
|
|
267
|
+
`groundcover` layer (see [worldgen](worldgen.md)). They draw near the camera only, under 70
|
|
268
|
+
triangles each, from their own budget so they never thin the trees, and not at Economy quality.
|
|
269
|
+
|
|
270
|
+
New ground palettes stay inside the lawn and forest bands in the palette table: the shader
|
|
271
|
+
already brightens and darkens them by about ±12% and tints dry patches toward straw.
|
|
272
|
+
|
|
273
|
+
## Vehicles, aircraft, trees and figures
|
|
274
|
+
|
|
275
|
+
- **Hero entities get more.** The car or aircraft the player controls may use the high end of
|
|
276
|
+
its budget, smooth hulls where the real object is curved, and an interior. Ambient copies of
|
|
277
|
+
the same type use a lower level of detail and a proxy at distance.
|
|
278
|
+
- **Vehicles are chunky but true.** Wheel arches, glasshouse and stance carry the type. Paint is
|
|
279
|
+
one shared material with per-instance color from a palette of real car colors. Glass is one
|
|
280
|
+
dark material.
|
|
281
|
+
- **Trees are faceted.** Use 6–12-sided conifers and icosahedral crowns with flat shading, a
|
|
282
|
+
slightly darker base, and varied heights. Never use alpha-card foliage.
|
|
283
|
+
- **Figures stay stylized.** Mitten hands, disc eyes and block shoes keep them out of the uncanny
|
|
284
|
+
valley; see [figures](figures.md).
|
|
285
|
+
|
|
286
|
+
## Rendering modes
|
|
287
|
+
|
|
288
|
+
The adaptive controller picks one of six tiers from measured frame times. They group into three
|
|
289
|
+
modes. Every mode keeps the same palette and style; only cost changes.
|
|
290
|
+
|
|
291
|
+
| Mode | Tiers | Resolution | Sun shadows | Objects | What it is for |
|
|
292
|
+
| --- | --- | --- | --- | --- | --- |
|
|
293
|
+
| Economy | Minimum, Low | 50–65% scale, ≤ 0.7 megapixels | Off | Simplified procedural tiers, stand-in boxes sooner, 6–8 px LOD error | Phones, weak integrated GPUs, software rendering |
|
|
294
|
+
| Medium | Medium, Balanced | 80–100% scale, ≤ 1.8 megapixels | Medium, then high | Balanced worldgen preset, 2.5–4 px error | Typical laptops |
|
|
295
|
+
| High | High, Ultra | 100–125% scale, ≤ 4 megapixels | High | Full detail, 1.5–2 px error | Discrete GPUs and capture |
|
|
296
|
+
|
|
297
|
+
Economy has no cast shadows, so it must still look good without them. That is one more reason to
|
|
298
|
+
keep roofs darker than walls and to avoid baked shading. Hosts choose a fixed mode with
|
|
299
|
+
`quality: 'economy' | 'balanced' | 'high'`, or let `'auto'` adapt; see
|
|
300
|
+
[adaptive rendering performance](adaptive-performance.md).
|
|
301
|
+
|
|
302
|
+
## Review before submitting
|
|
303
|
+
|
|
304
|
+
Run this review for every new or changed model, style or palette. A successful build is not a
|
|
305
|
+
visual approval.
|
|
306
|
+
|
|
307
|
+
1. **Silhouette.** Render with textures off and flat shading. Name the object from the
|
|
308
|
+
silhouette alone, at skyline distance.
|
|
309
|
+
2. **Budget.** Record triangles, materials and draw calls per level, and check them against the
|
|
310
|
+
tables above. A level far over target usually means the master repeats a framed part per
|
|
311
|
+
cell or per floor; find the helper that emits most of the triangles before tuning anything.
|
|
312
|
+
3. **Palette.** Every large surface falls inside its band. Hex palettes are sRGB, and colors
|
|
313
|
+
moved into a GLB are converted to linear.
|
|
314
|
+
4. **Context.** View the model in an Earth scene beside procedural buildings at three distances
|
|
315
|
+
(street, block, skyline), and at noon and late afternoon. It should look like it belongs.
|
|
316
|
+
Neither the brightest nor the dullest thing in the frame, unless it is meant to be.
|
|
317
|
+
5. **Modes.** Check the Economy mode (no shadows) as well as High.
|
|
318
|
+
6. **Distance behavior.** Watch the switches between levels for popping, shimmer on thin parts,
|
|
319
|
+
and floating or sinking at the base.
|
|
320
|
+
|
|
321
|
+
Useful captures from a project:
|
|
322
|
+
|
|
323
|
+
```sh
|
|
324
|
+
npx molen asset shot assets/my-model/asset.json --out-dir review --angles 8 # one asset, eight angles
|
|
325
|
+
npx molen worldgen preview my.archstyle.json --out style.png # a style on sample footprints
|
|
326
|
+
npx molen figure preview --preset human.adult --angles review --out figure.png
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
In the engine repository, the World Explorer is the reference scene. Its structure sheet renders
|
|
330
|
+
all 120 styles under the same light, `node examples/world-explorer/scripts/capture-structure-sheet.mjs`.
|
|
331
|
+
|
|
332
|
+
## Read next
|
|
333
|
+
|
|
334
|
+
- [3D art guidelines](3d-art-guidelines.md): scale, pivots, the material library and review captures
|
|
335
|
+
- [3D model assets](3d-model-assets.md): prompt-to-glTF authoring, import and hosting
|
|
336
|
+
- [Worldgen](worldgen.md): archstyles, palettes and LOD tiers in detail
|
|
337
|
+
- [Earth view](earth-view.md): the host these rules are written for
|
|
@@ -68,6 +68,14 @@ npx molen pack fetch https://molen.dev/packs/index.json molen.entities # just
|
|
|
68
68
|
the project's `packs`, so the project keeps working offline and a later re-publish never changes
|
|
69
69
|
it underneath you. A browser app serves the same zips from wherever it hosts its static files.
|
|
70
70
|
|
|
71
|
+
molen.dev lists the core packs only. The default style pack's landmark models (regional model
|
|
72
|
+
archives, several GB in all) are on the rolling
|
|
73
|
+
[`packs` release](https://github.com/bendyline/molen/releases/tag/packs) with every other pack:
|
|
74
|
+
`npx molen pack fetch https://github.com/bendyline/molen/releases/download/packs/index.json
|
|
75
|
+
<ids…>`. A browser can't read those downloads directly (GitHub sends no CORS headers); host the
|
|
76
|
+
zips yourself, or read the unzipped copy at `https://qualla.com/_a/index.json`. Without its model
|
|
77
|
+
archives, the style pack draws landmarks as procedural buildings.
|
|
78
|
+
|
|
71
79
|
A project lists the packs it uses, in order, and their types join the registry like the
|
|
72
80
|
project's own:
|
|
73
81
|
|
|
@@ -106,7 +106,10 @@ lighting changes visibly; moving the camera does not rebuild it. It is enabled b
|
|
|
106
106
|
`mountEarthView` and the world explorer. General viewers keep the legacy default (`false`).
|
|
107
107
|
The approximation provides sky reflections, not reflections of nearby buildings or trees.
|
|
108
108
|
Without `environment.sky`, it uses the ambient/sun rig and background color. Its filtered map
|
|
109
|
-
replaces the hemisphere
|
|
109
|
+
replaces the hemisphere light, which stays hidden (`visible` false, its intensity as authored)
|
|
110
|
+
while the map is the scene environment so surfaces are not lit twice. The map carries the same
|
|
111
|
+
irradiance: `sky.lighting.dayAmbient` and `nightAmbient` (or
|
|
112
|
+
`environment.ambient.intensity`) set the sky fill whether reflections are on or off.
|
|
110
113
|
A host-supplied `renderer.scene.environment` takes precedence; the host retains ownership of that
|
|
111
114
|
texture and control of its light balance.
|
|
112
115
|
Custom host meshes should use `MeshStandardMaterial` or `MeshPhysicalMaterial` for this mode;
|
|
@@ -203,7 +203,10 @@ These are approximate interiors, not surveyed tunnel geometry. Semantic provider
|
|
|
203
203
|
Fragments are clipped out of their tile buffers and joined across neighboring tiles before
|
|
204
204
|
grading, so tile boundaries do not create portals or conflicting floor heights. Searches are
|
|
205
205
|
bounded to 16 tiles. Unresolved long routes and branches are omitted rather than assigning a
|
|
206
|
-
terrain height to an underground tile boundary.
|
|
206
|
+
terrain height to an underground tile boundary. A route end counts as a portal only where an
|
|
207
|
+
ordinary (non-tunnel) line continues from it: a gap between fragments of a longer buried line,
|
|
208
|
+
such as a city subway split into thousands of pieces, would otherwise grade the bore to the
|
|
209
|
+
street there and open the ground along its whole length. Tunnel inference runs at the finest source
|
|
207
210
|
feature level and above. Hiding the Human layer also removes its portal cuts and navigation
|
|
208
211
|
support; the original elevation heightfield always remains available for surface anchoring.
|
|
209
212
|
|
|
@@ -93,10 +93,12 @@ bind the loaded names explicitly. Two bindings cannot write the same node/proper
|
|
|
93
93
|
|
|
94
94
|
Aircraft signals are `airspeed` (m/s), `altitude`/`altitudeAGL` (m), `verticalSpeed` (m/s),
|
|
95
95
|
`heading`/`pitch`/`roll` (radians), `rpm`/`power` (0–1), `pitchInput`/`rollInput`/`yawInput`
|
|
96
|
-
(-1–1),
|
|
96
|
+
and `elevator` (-1–1), `gear`/`flaps` (the positions 0–1 as they travel, 0 up), and
|
|
97
|
+
`engine`/`brake`/`grounded` (0 or 1). Calibration belongs to each model.
|
|
97
98
|
Cars supply `steering` and `wheelAngle` (radians); their optional third `update` argument accepts
|
|
98
99
|
additional signals. World explorer passes `speed` (signed m/s), `heading`/`pitch`/`roll` (radians),
|
|
99
|
-
`throttle` (-1–1)
|
|
100
|
+
`throttle` (-1–1), `brake` (0 or 1) and the sprung body's `bodyRoll`/`bodyPitch` (radians), which
|
|
101
|
+
the car visual also uses to keep its wheels on the road.
|
|
100
102
|
|
|
101
103
|
An interior can also include `sources`, using the same component/path mappings as `model.signals`.
|
|
102
104
|
World explorer resolves these for each vehicle and merges them over the convenience signals,
|
|
@@ -117,6 +119,42 @@ Legacy explicit `controlStick`, `collective` and `steeringWheelNode` bindings wo
|
|
|
117
119
|
convention is removed: assets must list instruments explicitly. `airspeedGaugeMax` remains
|
|
118
120
|
legacy metadata and no longer drives a gauge.
|
|
119
121
|
|
|
122
|
+
## Exterior animation
|
|
123
|
+
|
|
124
|
+
Landing gear, doors, flaps and control surfaces are bound the same way, in an `animation` block
|
|
125
|
+
beside `interior`: `aircraft.spec.visual.animation` or `vehicle.visual.animation`, with the same
|
|
126
|
+
`sources` and `bindings` and the same signals. The interior and the animation may not bind the
|
|
127
|
+
same node channel.
|
|
128
|
+
|
|
129
|
+
A binding can replace `scale` and `offset` with a keyframed curve: `keys` are `[signal,
|
|
130
|
+
displacement]` pairs with strictly ascending signals, and the displacement holds the first or
|
|
131
|
+
last value outside them. `"ease": "smooth"` eases out of and into every key, the way a hydraulic
|
|
132
|
+
actuator starts and stops; the default is `linear`. Keys let one signal sequence several parts.
|
|
133
|
+
The P-51's gear position runs from 0 (up) to 1 (down); its inner wheel doors open over the first
|
|
134
|
+
and last eighth of that travel and stay open in between, while the legs swing:
|
|
135
|
+
|
|
136
|
+
```json
|
|
137
|
+
{
|
|
138
|
+
"animation": {
|
|
139
|
+
"bindings": [
|
|
140
|
+
{ "node": "wheel-door-1", "source": "gear", "property": "rotation", "axis": "x",
|
|
141
|
+
"keys": [[0, 0], [0.12, 1.5], [0.88, 1.5], [1, 0]], "ease": "smooth" },
|
|
142
|
+
{ "node": "gear-1", "source": "gear", "property": "rotation", "axis": "x",
|
|
143
|
+
"keys": [[0.12, 1.5708], [0.88, 0]], "ease": "smooth" },
|
|
144
|
+
{ "node": "rudder", "source": "yawInput", "property": "rotation", "axis": "y", "scale": 0.44 }
|
|
145
|
+
]
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Each moving part rotates about one local axis, so the model gives it a parent frame aligned with
|
|
151
|
+
its hinge: a canted trunnion, a door's edge. Author the GLB in the at-rest pose (gear down,
|
|
152
|
+
doors as they stand on the ground); keys are displacements from it. A model whose retracted parts
|
|
153
|
+
would show through the skin can also list them in `visual.gearNodes`, hidden while the gear is
|
|
154
|
+
fully up. Simulated gear and flap positions come from `airplane.gearTransitTime` and
|
|
155
|
+
`flapTransitTime` (see [Aircraft](aircraft.md)); a script can drive any other part by publishing
|
|
156
|
+
a component and naming it in `sources`.
|
|
157
|
+
|
|
120
158
|
## Exterior views and detail levels
|
|
121
159
|
|
|
122
160
|
Cockpit and chase views share the GLB. An interior can be a high-detail portion of that model,
|
|
@@ -11,8 +11,15 @@ into schema, kernel, or client. The P-51D Mustang and OH-6 share the same mount/
|
|
|
11
11
|
and add separate flight controls, physics, assets and cockpit cameras; see [Aircraft](aircraft.md).
|
|
12
12
|
|
|
13
13
|
In **Walk mode**, approach a car and press **E** to enter its driver seat. **W/S** accelerate or
|
|
14
|
-
brake then reverse; **A/D** steer; **Space** brakes; **
|
|
15
|
-
works while seated. Stop and press **E** to exit.
|
|
14
|
+
brake then reverse; **A/D** steer; **Space** brakes; **Shift** pulls the handbrake; **V** switches
|
|
15
|
+
cockpit/chase views. Mouse look works while seated. Stop and press **E** to exit.
|
|
16
|
+
|
|
17
|
+
Cars drive on their tires. Push one past its grip and it slides: a front-drive sedan runs wide, a
|
|
18
|
+
rear-drive pickup on full power swings its tail round, and steering with the handbrake up throws
|
|
19
|
+
the back out for a handbrake turn. Brakes are anti-lock, so you can still steer while stopping.
|
|
20
|
+
Rain and snow from the Weather setting make the road slippery (about 40% and 100% longer stops),
|
|
21
|
+
and gusts push on the body. The body dives under braking, squats under power and leans out of
|
|
22
|
+
turns. Hitting a wall or another car bounces you off it, and a corner hit spins you. The controller checks both sides and then the rear;
|
|
16
23
|
blocked exits leave the rider seated. Switching to Fly also requires a safe stopped exit.
|
|
17
24
|
|
|
18
25
|
Modified cars stay where they were left throughout the current explorer session, even when their
|
|
@@ -58,7 +65,8 @@ Outside a scene, resolve a type's components from the pack's type documents with
|
|
|
58
65
|
`@bendyline/molen-kernel/content`, and spawn a copy.
|
|
59
66
|
|
|
60
67
|
Declare commands and input bindings in the scene using the normal input schema. Give `drive`
|
|
61
|
-
a payload schema with `throttle` and `steering` numbers in [-1,1]
|
|
68
|
+
a payload schema with `throttle` and `steering` numbers in [-1,1], a boolean `brake` and an
|
|
69
|
+
optional boolean `handbrake`.
|
|
62
70
|
Run this setup through `buildWorld`, the Worker, or `molen sim run --setup`.
|
|
63
71
|
|
|
64
72
|
`mountable.seats` is reusable for passenger seats or non-car mounts. Each seat has a unique
|
|
@@ -67,21 +75,52 @@ ordered local foot positions; `reach` limits mounting distance. A seat accepts o
|
|
|
67
75
|
only the current driver can submit vehicle intent. Mounted actors bypass the kernel character
|
|
68
76
|
and kinematics solvers. When the mount disappears, the rider is detached.
|
|
69
77
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
78
|
+
Passenger seats: every stock car carries a `passenger` seat beside the driver, mirrored across
|
|
79
|
+
the centreline, and the OH-6 one on the pilot's left; the P-51D has a rear `passenger` seat behind
|
|
80
|
+
the pilot, like the TF-51D trainer. Only the `driver` seat controls the vehicle.
|
|
81
|
+
|
|
82
|
+
The solver is a dynamic bicycle model substepped at 120 Hz or finer. Each axle's tires turn slip
|
|
83
|
+
angle into side force (`corneringStiffness` per unit load per radian) up to the road's grip, then
|
|
84
|
+
let go to about 85% of it as they slide. Side grip is `grip` (m/s², so `grip / 9.81` is the
|
|
85
|
+
friction coefficient); straight-line grip is 15% higher, and drive and brakes share it with
|
|
86
|
+
cornering, so a car braking or under power at the limit steers less. `drive` picks the front,
|
|
87
|
+
rear or all wheels; drive beyond the grip spins them. Anti-lock brakes split by `brakeBias` and
|
|
88
|
+
stop just short of the limit. `handbrake` locks the rear wheels, which then slide. State carries
|
|
89
|
+
the forward `speed`, the sideways `lateralSpeed`, `yawRate` and a 0–1 `skid` for tire sounds or
|
|
90
|
+
effects.
|
|
91
|
+
|
|
92
|
+
Weight moves between the axles through the suspension: the sprung body pitches by
|
|
93
|
+
`pitchStiffness` and rolls by `rollStiffness` (radians per g) on springs of
|
|
94
|
+
`suspensionFrequency` and `suspensionDamping`, so braking loads the front tires and lifting off
|
|
95
|
+
in a turn can tighten it. `bodyPitch` and `bodyRoll` add to the terrain `pitch` and `roll` in the
|
|
96
|
+
transform, so the cockpit view feels them too. Passed to the car visual as signals, they become
|
|
97
|
+
suspension travel: the wheels move against the lean and stay on the road. Steering lock and steering speed fade with road
|
|
98
|
+
speed (`steeringFadeSpeed`), and full lock never asks for more than half again the cornering the
|
|
99
|
+
tires can give, so a keyboard tap changes lanes instead of spinning the car. At walking pace the
|
|
100
|
+
car simply rolls where its wheels point, so it never turns in place and parks exactly.
|
|
101
|
+
|
|
102
|
+
`installVehicles` reads the world's `weather`: rain takes up to 30% of the grip and snow up to 60%
|
|
103
|
+
(`weatherGrip(weather)`), and the wind field, gusts included, pushes on the body's long side.
|
|
104
|
+
Engine force, top and reverse speeds, rolling and air resistance, mass, wheel geometry and terrain
|
|
105
|
+
tolerances come from `vehicle.spec` as before, and `yawInertia` defaults from the body size.
|
|
106
|
+
|
|
107
|
+
Collision probes run at 120 Hz or finer through the host's `canOccupy` adapter. When it refuses a
|
|
108
|
+
move, the solver finds which way is open by probing around the car, and answers with an impulse at
|
|
109
|
+
the corner that struck: a bounce that grows with impact speed (none below walking pace, so a car
|
|
110
|
+
can rest against a wall), scraping friction along the obstacle, and a spin. `installVehicles` emits
|
|
111
|
+
`vehicle-impact` (5 m/s or more) and `vehicle-bump` (1.5 m/s or more) with the car's `entity` and
|
|
112
|
+
the closing `speed`; the Earth soundscape plays a metal impact for each. World explorer uses an
|
|
113
|
+
oriented chassis against other cars and nearby triangles for walls, fixtures and buildings; the
|
|
114
|
+
car it hits stays put. Terrain gaps pause motion; abrupt steps and slopes above 35 degrees stop
|
|
77
115
|
the car. Cockpit views use the full chassis quaternion; chase views shorten at obstructions.
|
|
78
116
|
|
|
79
|
-
This is a grounded driving
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
117
|
+
This is a grounded driving model. It does not implement airborne rotation, rollovers, crash
|
|
118
|
+
deformation or damage, pushing other cars, per-surface friction (grass and gravel grip like the
|
|
119
|
+
road), passenger animation, multiplayer ownership, or disk persistence. Background traffic is a
|
|
120
|
+
separate package: [ambient life](ambient-life.md) moves NPC cars along lanes without this solver,
|
|
121
|
+
and they stop for a car someone is driving. Without collision hooks, the reusable kernel solver
|
|
122
|
+
supplies terrain driving only. Do not attach a second physics body to the same vehicle; the
|
|
123
|
+
vehicle solver owns its transform.
|
|
85
124
|
|
|
86
125
|
All durable simulation state and mount relationships live in ECS components and survive keyframes
|
|
87
126
|
and replay. Install the same systems/environment when restoring. Host streaming and render resources
|
|
@@ -98,9 +137,63 @@ ground (under open sky, never a roof or deck), `board(id)` without walking to th
|
|
|
98
137
|
in. The entity's `vehicle.color`, when set, paints the model's `paintMaterial`; without one the
|
|
99
138
|
authored paint stays.
|
|
100
139
|
|
|
140
|
+
Passengers use the same mount contract. A `mountable` lists seats with a role: `driver` seats
|
|
141
|
+
drive, `passenger` seats ride. `mountEntity(world, actor, vehicle, 'passenger')` seats someone
|
|
142
|
+
beside the driver (stopped vehicle, within `reach` of the seat), the `mounted-seats` system carries
|
|
143
|
+
them along, and `unmountEntity` lets any seat out by the exits once the vehicle has stopped. A
|
|
144
|
+
passenger climbing in or out leaves the driver's controls alone; the driver leaving idles them.
|
|
145
|
+
`driveVehicle` accepts input only from a driver seat, and `self.occupied` engine sounds count only
|
|
146
|
+
non-passenger seats. The entities pack's cars and the OH-6 have a `passenger` seat and the P-51D a
|
|
147
|
+
rear one. In the Earth view, actors board and leave them (`{ kind: 'board', vehicle }` and
|
|
148
|
+
`{ kind: 'alight' }`; see [actors](earth-view.md#actors-companions-and-npcs)), and
|
|
149
|
+
`EarthVehicles.unmount(actor)` steps any mounted entity out by those rules.
|
|
150
|
+
|
|
151
|
+
## Riding cycles
|
|
152
|
+
|
|
153
|
+
The entities pack includes six rideable types: `molen.entities.cycle.standard_motorcycle`,
|
|
154
|
+
`cruiser_motorcycle`, `motor_scooter`, `city_bicycle`, `road_bicycle` and `cargo_bicycle` (the same
|
|
155
|
+
namespace prefix applies to each). Mount, drive and exit them with the same APIs as cars. In the
|
|
156
|
+
Earth view example, select a cycle beside **Drive**, then press **Drive**. **W** supplies motor or
|
|
157
|
+
pedal power, **S** and **Space** brake, **A/D** steer, **V** changes view, and **E** steps off once
|
|
158
|
+
stopped. These cycles have no powered reverse. The Earth view API accepts the full type ID:
|
|
159
|
+
|
|
160
|
+
```js
|
|
161
|
+
view.setMode('drive', { vehicle: 'molen.entities.cycle.city_bicycle', force: true });
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
`vehicle.spec.cycle` opts into two centreline tire contacts and automatic balance: the cycle
|
|
165
|
+
leans into the turn, limited by `maxLean`, and returns upright as it stops. Lean follows lateral
|
|
166
|
+
acceleration through damped springs; `g * tan(maxLean)` also limits steering at speed, so reducing the lean
|
|
167
|
+
limit increases the minimum turning radius. Braking, tire grip, weather, terrain gaps, collision hooks and safe exits use the existing solver. Bicycles have
|
|
168
|
+
lighter mass and lower power and speed limits. `cycle.pedals.ratio` specifies wheel revolutions
|
|
169
|
+
per crank revolution; snapshot-safe `vehicleState.pedalAngle` advances under forward power and
|
|
170
|
+
holds while coasting or braking. Wheel spin continues while coasting.
|
|
171
|
+
|
|
172
|
+
The driver seat is a pelvis anchor. `cycle.riderLean`, `handlebarPivot`, `grips`, `footrests` and
|
|
173
|
+
optional `pedals` describe metric contact points in model space. The figures capability and
|
|
174
|
+
Earth avatar renderer share the same pose evaluator: hands follow the turning handlebars and
|
|
175
|
+
feet follow the pedals or footrests. At low-speed steering lock the rider counterweights at the
|
|
176
|
+
saddle and turns the shoulders to keep both grips within reach. The stock dimensions fit an adult human; unusually small
|
|
177
|
+
or large figures may not reach every contact point. The cockpit uses `spec.driverEye` separately
|
|
178
|
+
from the saddle. `vehicle.visual.animation` binds the moving parts in Earth; `model.signals`
|
|
179
|
+
provides the same steering, wheel and pedal animation in ordinary Molen scenes.
|
|
180
|
+
|
|
181
|
+
Cycles use the existing `molenVehicle(types, id)` helper and are enumerated separately by
|
|
182
|
+
`MOLEN_CYCLE_ENTITY_IDS`; `MOLEN_VEHICLE_ENTITY_IDS` continues to enumerate cars and trucks.
|
|
183
|
+
Cycles are excluded from automatic car parking and ambient traffic. Balance is assisted; this
|
|
184
|
+
is grounded riding, without falls, wheelies, jumps, gears or stunt simulation.
|
|
185
|
+
|
|
186
|
+
For a repeatable mounted-rider review in the engine repository:
|
|
187
|
+
|
|
188
|
+
```sh
|
|
189
|
+
molen validate content/entities/scenes/cycles.scene.json
|
|
190
|
+
molen sim run content/entities/scenes/cycles.scene.json --setup content/entities/scenes/cycles.setup.mjs --ticks 120 --hash
|
|
191
|
+
molen shot content/entities/scenes/cycles.scene.json --setup content/entities/scenes/cycles.setup.mjs --ticks 60 --out content/entities/shots/cycles.png
|
|
192
|
+
```
|
|
193
|
+
|
|
101
194
|
## Engine sound
|
|
102
195
|
|
|
103
|
-
|
|
196
|
+
The original five road vehicle types carry an `audioSource`: the compact, sedan and SUV run
|
|
104
197
|
`vehicle.engine.car`, the pickup and van `vehicle.engine.diesel`, each with its own pitch. The
|
|
105
198
|
engine plays only while someone drives (`self.occupied`), rises in pitch with
|
|
106
199
|
`vehicleState.speed`, and grows louder with `vehicleInput.throttle`. Any host that plays audio from
|
|
@@ -112,8 +205,10 @@ hears it with no extra code. Override the component on a type or entity to chang
|
|
|
112
205
|
|
|
113
206
|
`@bendyline/molen-client/vehicles` exports `createVehicleVisual`, `createParkedVehicleBatch`,
|
|
114
207
|
and `vehicleCameraPose`. `createVehicleVisual(loadedGlb, vehicleData)` binds wheel, steering, and
|
|
115
|
-
paint nodes named by `vehicle.visual`; dynamic visuals expose `update(steer, wheelAngle)`
|
|
116
|
-
`dispose()`.
|
|
208
|
+
paint nodes named by `vehicle.visual`; dynamic visuals expose `update(steer, wheelAngle, signals)`
|
|
209
|
+
and `dispose()`. `signals` feeds the interior and `vehicle.visual.animation` bindings (see
|
|
210
|
+
[exterior animation](vehicle-interiors.md#exterior-animation)); `bodyRoll` and `bodyPitch` among
|
|
211
|
+
them keep the wheels planted. The camera helper accepts a transform, `vehicle.spec`, view, look offsets, and an
|
|
117
212
|
optional obstruction-distance callback.
|
|
118
213
|
|
|
119
214
|
Surface objects expose `userData.vehicles: VehiclePlacement[]`; each record has an `id`, external
|
|
@@ -134,3 +229,10 @@ working reference for scripting [`molen play`](experience-playback.md) against y
|
|
|
134
229
|
pnpm build
|
|
135
230
|
npx molen play dist --scenario test/visual/vehicles.play.json --out-dir .artifacts/vehicles
|
|
136
231
|
```
|
|
232
|
+
|
|
233
|
+
## Boats
|
|
234
|
+
|
|
235
|
+
[Boats and water](boats.md) use the same mounting, passenger seats and camera controls with a
|
|
236
|
+
separate hull solver. `mountable.entries` optionally locates a gangway away from the seat;
|
|
237
|
+
boat exits are checked against their local deck height. Earth view and World Explorer share
|
|
238
|
+
boat launching, driving and dry dockside exits through `EarthVehicles`.
|