@bendyline/molen-tooling 0.0.1 → 0.0.3
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/README.md +22 -4
- package/dist/capture/harness.js +216 -216
- package/dist/capture/worldgen-preview.js +288 -288
- package/dist/cli.mjs +134 -12
- package/dist/docs-src/guide/3d-art-guidelines.md +2 -2
- package/dist/docs-src/guide/3d-model-assets.md +49 -13
- package/dist/docs-src/guide/adaptive-performance.md +4 -0
- package/dist/docs-src/guide/agent-loop.md +6 -6
- package/dist/docs-src/guide/aircraft.md +25 -17
- package/dist/docs-src/guide/audio.md +247 -0
- package/dist/docs-src/guide/browser-mount.md +17 -1
- package/dist/docs-src/guide/building-interiors.md +7 -5
- package/dist/docs-src/guide/determinism.md +27 -22
- package/dist/docs-src/guide/earth-view.md +444 -0
- package/dist/docs-src/guide/entities.md +17 -6
- package/dist/docs-src/guide/examples.md +39 -23
- package/dist/docs-src/guide/experience-playback.md +2 -3
- package/dist/docs-src/guide/game-samples.md +50 -21
- package/dist/docs-src/guide/graphics-performance.md +40 -8
- package/dist/docs-src/guide/input.md +9 -0
- package/dist/docs-src/guide/markers.md +52 -0
- package/dist/docs-src/guide/materials.md +10 -3
- package/dist/docs-src/guide/navigation.md +144 -0
- package/dist/docs-src/guide/project.md +23 -3
- package/dist/docs-src/guide/quickstart.md +39 -30
- package/dist/docs-src/guide/recognizable-places.md +24 -17
- package/dist/docs-src/guide/rendering-backends.md +5 -4
- package/dist/docs-src/guide/scripting.md +8 -4
- package/dist/docs-src/guide/sky.md +26 -9
- package/dist/docs-src/guide/source-bundles.md +0 -1
- package/dist/docs-src/guide/structure-library.md +20 -10
- package/dist/docs-src/guide/terrain.md +51 -6
- package/dist/docs-src/guide/vehicles.md +27 -14
- package/dist/docs-src/guide/worldgen.md +34 -24
- package/dist/docs-src/llms.txt +35 -18
- package/dist/docs-src/schemas/README.md +4 -1
- package/dist/docs-src/schemas/archive-set.md +175 -0
- package/dist/docs-src/schemas/components.md +1104 -1
- package/dist/docs-src/schemas/matgraph.md +6 -0
- package/dist/docs-src/schemas/soundbank.md +251 -0
- package/dist/docs-src/schemas/structure-placements.md +496 -0
- package/dist/docs-src/schemas/terrain-package.md +120 -0
- package/dist/index.d.mts +31 -3
- package/dist/index.mjs +2 -2
- package/dist/{mcp-BFnCWrg0.mjs → mcp-BTVwVKFb.mjs} +78 -4
- package/dist/{ops-BGxhSP6w.mjs → ops-BPdHodFR.mjs} +1181 -61
- package/dist/templates/city-courier/README.md +66 -0
- package/dist/templates/city-courier/checks.json +20 -0
- package/dist/templates/city-courier/commands.json +32 -0
- package/dist/templates/city-courier/delivery-run.replay.json +214 -0
- package/dist/templates/city-courier/gen/molen-types.ts +1016 -0
- package/dist/templates/city-courier/index.html +2 -0
- package/dist/templates/city-courier/package.json +26 -0
- package/dist/templates/city-courier/project.json +8 -0
- package/dist/templates/city-courier/scene.json +3474 -0
- package/dist/templates/city-courier/scripts/game.ts +131 -0
- package/dist/templates/city-courier/scripts/molen-scripts.d.ts +1288 -0
- package/dist/templates/city-courier/scripts/tsconfig.json +16 -0
- package/dist/templates/city-courier/src/audio.ts +96 -0
- package/dist/templates/city-courier/src/game-shell.css +317 -0
- package/dist/templates/city-courier/src/main.ts +84 -0
- package/dist/templates/city-courier/src/scene.ts +17 -0
- package/dist/templates/city-courier/src/vite-env.d.ts +1 -0
- package/dist/templates/city-courier/src/worker.ts +5 -0
- package/dist/templates/city-courier/test/headless.test.ts +95 -0
- package/dist/templates/city-courier/test/playthrough.test.js +52 -0
- package/dist/templates/city-courier/test/replay.test.ts +22 -0
- package/dist/templates/city-courier/tsconfig.json +17 -0
- package/dist/templates/city-courier/vite.config.ts +19 -0
- package/dist/templates/cubes/README.md +51 -0
- package/dist/templates/cubes/index.html +16 -0
- package/dist/templates/cubes/package.json +24 -0
- package/dist/templates/cubes/scene.json +15 -0
- package/dist/templates/cubes/src/cubes.ts +100 -0
- package/dist/templates/cubes/src/main.ts +21 -0
- package/dist/templates/cubes/src/worker.ts +15 -0
- package/dist/templates/cubes/test/headless.test.ts +98 -0
- package/dist/templates/cubes/tsconfig.json +17 -0
- package/dist/templates/cubes/vite.config.ts +17 -0
- package/dist/templates/data-viz/README.md +47 -0
- package/dist/templates/data-viz/camera-track.json +12 -0
- package/dist/templates/data-viz/data.json +9 -0
- package/dist/templates/data-viz/index.html +16 -0
- package/dist/templates/data-viz/package.json +25 -0
- package/dist/templates/data-viz/scene.json +7 -0
- package/dist/templates/data-viz/src/main.ts +39 -0
- package/dist/templates/data-viz/src/viz.ts +91 -0
- package/dist/templates/data-viz/src/worker.ts +12 -0
- package/dist/templates/data-viz/test/headless.test.ts +75 -0
- package/dist/templates/data-viz/tsconfig.json +17 -0
- package/dist/templates/data-viz/vite.config.ts +16 -0
- package/dist/templates/figures-gallery/README.md +46 -0
- package/dist/templates/figures-gallery/index.html +16 -0
- package/dist/templates/figures-gallery/package.json +25 -0
- package/dist/templates/figures-gallery/scene.json +276 -0
- package/dist/templates/figures-gallery/src/main.ts +44 -0
- package/dist/templates/figures-gallery/src/worker.ts +17 -0
- package/dist/templates/figures-gallery/test/headless.test.ts +90 -0
- package/dist/templates/figures-gallery/tsconfig.json +17 -0
- package/dist/templates/figures-gallery/vite.config.ts +17 -0
- package/dist/templates/index.json +191 -0
- package/dist/templates/skybound/README.md +66 -0
- package/dist/templates/skybound/checks.json +24 -0
- package/dist/templates/skybound/commands.json +32 -0
- package/dist/templates/skybound/first-leap.replay.json +224 -0
- package/dist/templates/skybound/gen/molen-types.ts +1016 -0
- package/dist/templates/skybound/index.html +2 -0
- package/dist/templates/skybound/package.json +26 -0
- package/dist/templates/skybound/project.json +8 -0
- package/dist/templates/skybound/scene.json +1777 -0
- package/dist/templates/skybound/scripts/game.ts +122 -0
- package/dist/templates/skybound/scripts/molen-scripts.d.ts +1288 -0
- package/dist/templates/skybound/scripts/tsconfig.json +16 -0
- package/dist/templates/skybound/src/audio.ts +96 -0
- package/dist/templates/skybound/src/game-shell.css +317 -0
- package/dist/templates/skybound/src/main.ts +63 -0
- package/dist/templates/skybound/src/scene.ts +17 -0
- package/dist/templates/skybound/src/vite-env.d.ts +1 -0
- package/dist/templates/skybound/src/worker.ts +5 -0
- package/dist/templates/skybound/test/headless.test.ts +124 -0
- package/dist/templates/skybound/test/playthrough.test.js +38 -0
- package/dist/templates/skybound/test/replay.test.ts +22 -0
- package/dist/templates/skybound/tsconfig.json +17 -0
- package/dist/templates/skybound/vite.config.ts +19 -0
- package/dist/templates/terrain-flyover/README.md +46 -0
- package/dist/templates/terrain-flyover/index.html +16 -0
- package/dist/templates/terrain-flyover/package.json +26 -0
- package/dist/templates/terrain-flyover/src/flyover.ts +23 -0
- package/dist/templates/terrain-flyover/src/main.ts +93 -0
- package/dist/templates/terrain-flyover/terrain.json +15 -0
- package/dist/templates/terrain-flyover/test/headless.test.ts +72 -0
- package/dist/templates/terrain-flyover/tsconfig.json +17 -0
- package/dist/templates/terrain-flyover/vite.config.ts +15 -0
- package/dist/templates/top-down-arena/README.md +65 -0
- package/dist/templates/top-down-arena/arena-skirmish.replay.json +204 -0
- package/dist/templates/top-down-arena/index.html +16 -0
- package/dist/templates/top-down-arena/package.json +26 -0
- package/dist/templates/top-down-arena/project.json +10 -0
- package/dist/templates/top-down-arena/scene.json +182 -0
- package/dist/templates/top-down-arena/scripts/chase.ts +17 -0
- package/dist/templates/top-down-arena/scripts/combat.ts +13 -0
- package/dist/templates/top-down-arena/scripts/control.ts +8 -0
- package/dist/templates/top-down-arena/scripts/molen-scripts.d.ts +1258 -0
- package/dist/templates/top-down-arena/scripts/spawner.ts +11 -0
- package/dist/templates/top-down-arena/scripts/tsconfig.json +16 -0
- package/dist/templates/top-down-arena/src/arena.ts +8 -0
- package/dist/templates/top-down-arena/src/audio.ts +96 -0
- package/dist/templates/top-down-arena/src/gen/molen-types.ts +1020 -0
- package/dist/templates/top-down-arena/src/main.ts +34 -0
- package/dist/templates/top-down-arena/src/scene.ts +24 -0
- package/dist/templates/top-down-arena/src/vite-env.d.ts +1 -0
- package/dist/templates/top-down-arena/src/worker.ts +7 -0
- package/dist/templates/top-down-arena/test/headless.test.ts +87 -0
- package/dist/templates/top-down-arena/test/replay.test.ts +22 -0
- package/dist/templates/top-down-arena/tsconfig.json +17 -0
- package/dist/templates/top-down-arena/types/arena.types.json +54 -0
- package/dist/templates/top-down-arena/vite.config.ts +21 -0
- package/package.json +14 -14
|
@@ -12,7 +12,7 @@ The Earth catalog recognizes **44 mapped source businesses** by exact aliases an
|
|
|
12
12
|
IDs. Each match selects a generic descriptor model rather than a source-business sign: for example,
|
|
13
13
|
Walmart maps to `sign.mart_store`, Taco Bell maps to `sign.taco_place`, Best Buy maps to
|
|
14
14
|
`sign.electronics_store`, and The Home Depot maps to `sign.hardware_store`. The
|
|
15
|
-
[retail catalog](
|
|
15
|
+
[retail catalog](https://github.com/bendyline/molen/blob/main/content/earth/businesses/README.md) documents the
|
|
16
16
|
source data and mapping policy.
|
|
17
17
|
|
|
18
18
|
Nine generic treatments cover grocery, restaurant, cafe, pharmacy, shop, department store, shopping
|
|
@@ -21,7 +21,7 @@ Unknown identities keep the normal architectural fallback. This is a stylized de
|
|
|
21
21
|
not a complete global business database.
|
|
22
22
|
|
|
23
23
|
Matching lives in
|
|
24
|
-
[the Earth business catalog](
|
|
24
|
+
[the Earth business catalog](https://github.com/bendyline/molen/blob/main/content/earth/businesses/catalog.json).
|
|
25
25
|
A stable canonical ID selects an appearance; aliases and verified brand:wikidata IDs map source
|
|
26
26
|
records onto it. Explicit source IDs take precedence. An explicit conflicting ID blocks name-based
|
|
27
27
|
guesses. Name aliases must match exactly after punctuation/spacing normalization and pass category
|
|
@@ -50,17 +50,18 @@ generally absent from the archive.
|
|
|
50
50
|
|
|
51
51
|
The reusable definitions are JSON content, not package code. The landmarks ship in the
|
|
52
52
|
`molen.worldgen.default` content pack (role `landmarks`) and the business catalog in the
|
|
53
|
-
`molen.earth` pack (role `businesses`)
|
|
53
|
+
`molen.earth` pack (role `businesses`). `npx molen pack fetch https://molen.dev/packs/index.json`
|
|
54
|
+
brings both into a project. Their sources are in the engine repository's `content/`:
|
|
54
55
|
|
|
55
56
|
| What to edit | Source |
|
|
56
57
|
| --- | --- |
|
|
57
|
-
| Model index and file paths | [Landmark catalog](
|
|
58
|
-
| Burger-restaurant descriptor, source-inspired palette and frontage | [burger_restaurant.landmark.json](
|
|
59
|
-
| Unbranded grocery treatment | [grocery.landmark.json](
|
|
60
|
-
| Store aliases, source IDs and category matching | [Business catalog](
|
|
61
|
-
| Lamp, bench, rack and charger geometry recipes | [Landmark library](
|
|
62
|
-
| Base building proportions and architectural rules | [Generic store style](
|
|
63
|
-
| Shared surface patterns | [Material library](
|
|
58
|
+
| Model index and file paths | [Landmark catalog](https://github.com/bendyline/molen/blob/main/content/worldgen/landmarks/catalog.json) |
|
|
59
|
+
| Burger-restaurant descriptor, source-inspired palette and frontage | [burger_restaurant.landmark.json](https://github.com/bendyline/molen/blob/main/content/worldgen/landmarks/burger_restaurant.landmark.json) |
|
|
60
|
+
| Unbranded grocery treatment | [grocery.landmark.json](https://github.com/bendyline/molen/blob/main/content/worldgen/landmarks/grocery.landmark.json) |
|
|
61
|
+
| Store aliases, source IDs and category matching | [Business catalog](https://github.com/bendyline/molen/blob/main/content/earth/businesses/catalog.json) |
|
|
62
|
+
| Lamp, bench, rack and charger geometry recipes | [Landmark library](https://github.com/bendyline/molen/blob/main/content/worldgen/landmarks/README.md) |
|
|
63
|
+
| Base building proportions and architectural rules | [Generic store style](https://github.com/bendyline/molen/blob/main/content/worldgen/styles/generic/store.archstyle.json) |
|
|
64
|
+
| Shared surface patterns | [Material library](https://github.com/bendyline/molen/blob/main/content/worldgen/materials/README.md) |
|
|
64
65
|
|
|
65
66
|
A `molen/landmark@1` sign manifest contains its stable model ID, text, initial-based emblem, palette,
|
|
66
67
|
wall/accent appearance and default standalone/shared storefront widths. Its optional
|
|
@@ -88,11 +89,16 @@ Landmarks alone are `createLandmarkLibrary({ catalog, models })` from
|
|
|
88
89
|
`@bendyline/molen-worldgen/kernel`, or `resolveLandmarkCatalogDocuments(catalog, readDocument)` for
|
|
89
90
|
just the definitions; pass definitions to `generateLandmarkModel(id, definitions, tier)` or
|
|
90
91
|
`new ModelLibrary(assetLoader, definitions)`. A `ModelLibrary` without definitions serves no
|
|
91
|
-
landmark models.
|
|
92
|
-
|
|
92
|
+
landmark models. Editing is not runtime hot reload: change the documents, rebuild the pack with
|
|
93
|
+
`molen pack build`, and reload.
|
|
93
94
|
|
|
94
95
|
## Extending the library
|
|
95
96
|
|
|
97
|
+
In your own project, put new or overriding landmark and catalog documents in a content pack of
|
|
98
|
+
your own (`molen pack build <dir>`) and list it in project.json `packs` after the default packs:
|
|
99
|
+
when two packs provide the same id, the later one wins. The steps below are how the engine's own
|
|
100
|
+
catalogs are extended in the engine repository.
|
|
101
|
+
|
|
96
102
|
1. Copy the nearest `.landmark.json`, assign a stable ID, and edit its parameters.
|
|
97
103
|
Add the ID and relative file path to the landmark catalog. Adding a design that uses an
|
|
98
104
|
existing generator needs no manual TypeScript registration.
|
|
@@ -103,8 +109,9 @@ does it before `dev`); editing is not runtime hot reload.
|
|
|
103
109
|
title. Reserve other geometric marks for non-business category signs and props. A new silhouette
|
|
104
110
|
needs a bounded generator implementation and schema update.
|
|
105
111
|
4. Increment the edited document version to record the revision. Run `molen validate <file>`
|
|
106
|
-
for structural validation, then `pnpm -r build` to validate catalog
|
|
107
|
-
Content hashes handle cache invalidation independently of manual version
|
|
112
|
+
for structural validation, then `pnpm -r build` in the engine repository to validate catalog
|
|
113
|
+
cross-references. Content hashes handle cache invalidation independently of manual version
|
|
114
|
+
bumps.
|
|
108
115
|
5. For behavioral or visual changes, add positive and misleading-name cases, a standalone and
|
|
109
116
|
shared-building example, and inspect near/distant captures. Follow the
|
|
110
117
|
[3D art guidelines](3d-art-guidelines.md).
|
|
@@ -134,17 +141,17 @@ The ordinary Protomaps extract usually supplies position/category, not detailed
|
|
|
134
141
|
|
|
135
142
|
## Repeatable visual review
|
|
136
143
|
|
|
137
|
-
|
|
144
|
+
Open [World Explorer with `?synthetic=1&stores=1&style=default`](https://molen.dev/play/world-explorer/?synthetic=1&stores=1&style=default)
|
|
138
145
|
to inspect all 44 mapped descriptor variants, four additional retail-center treatments, mixed tenants and outdoor
|
|
139
146
|
props. The original eight stores and interior walkthrough coordinates remain in place; the new
|
|
140
147
|
chains occupy the southern blocks and the retail centers flank them.
|
|
141
|
-
|
|
148
|
+
In the engine repository, the [store-library batch fixture](https://github.com/bendyline/molen/blob/main/packages/worldgen-earth/test/fixtures/store-library.batch.json)
|
|
142
149
|
supports deterministic close views:
|
|
143
150
|
|
|
144
151
|
```sh
|
|
145
152
|
molen worldgen preview --batch packages/worldgen-earth/test/fixtures/store-library.batch.json --out .artifacts/store-library.png --angles 4
|
|
146
153
|
```
|
|
147
|
-
The [U.S. retail batch](
|
|
154
|
+
The [U.S. retail batch](https://github.com/bendyline/molen/blob/main/packages/worldgen-earth/test/fixtures/us-retail-library.batch.json)
|
|
148
155
|
includes all 40 additions plus Target, including a courtyard mall and independent mixed tenants:
|
|
149
156
|
|
|
150
157
|
```sh
|
|
@@ -169,8 +169,9 @@ The world explorer also accepts `gpuOptimizations=0` for an uncached WebGPU comp
|
|
|
169
169
|
|
|
170
170
|
## Testing the world explorer
|
|
171
171
|
|
|
172
|
-
|
|
173
|
-
|
|
172
|
+
Open [World Explorer](https://molen.dev/play/world-explorer/), then compare the same location
|
|
173
|
+
and settings using [`?backend=webgpu`](https://molen.dev/play/world-explorer/?backend=webgpu) and
|
|
174
|
+
[`?backend=webgl`](https://molen.dev/play/world-explorer/?backend=webgl). Omitting the
|
|
174
175
|
parameter, or using `?backend=auto`, enables automatic selection. The performance HUD displays
|
|
175
176
|
the backend that actually rendered and any automatic fallback reason; its
|
|
176
177
|
`#performance-status` element also exposes `data-backend` and `data-fallback-reason` for tests.
|
|
@@ -194,8 +195,8 @@ API/shader correctness and fallback testing, but their timings do not predict ha
|
|
|
194
195
|
Keep WebGL reference screenshots pinned to `backend=webgl`; test WebGPU separately rather than
|
|
195
196
|
silently regenerating a backend's visual baseline from another renderer.
|
|
196
197
|
|
|
197
|
-
|
|
198
|
-
suite. That suite's default launch uses explicit SwiftShader flags for portable software
|
|
198
|
+
In the engine repository, after building, `pnpm -r test:golden` runs browser regression coverage,
|
|
199
|
+
including the backend suite. That suite's default launch uses explicit SwiftShader flags for portable software
|
|
199
200
|
execution; WebGPU cases report a skip if Chromium cannot create an adapter/device, while the
|
|
200
201
|
WebGL and fallback cases still run. Require WebGPU and use the browser's normal hardware
|
|
201
202
|
selection with these PowerShell commands:
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
# Game logic: scripts and setup
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A Molen experience is **data plus scripts**. The scene manifest declares the world, the commands
|
|
4
4
|
it accepts, and its scripts; the scripts hold the logic. A code setup module exists for the rare
|
|
5
|
-
things scripts cannot express, and for typed TypeScript authoring inside a
|
|
5
|
+
things scripts cannot express, and for typed TypeScript authoring inside a project that installs
|
|
6
|
+
the engine packages.
|
|
6
7
|
|
|
7
8
|
## 1. Scene-data scripts (the default)
|
|
8
9
|
|
|
@@ -23,7 +24,8 @@ Erasure is whitespace-preserving, so the evaluated source keeps the exact line a
|
|
|
23
24
|
of the file you wrote and `script "chase" tick handler at tick 12: …` still points at the right
|
|
24
25
|
line. Nothing is emitted next to your source, and there is no build step to run by hand.
|
|
25
26
|
|
|
26
|
-
>
|
|
27
|
+
> [!NOTE]
|
|
28
|
+
> **Renamed.** The verb set was injected as `api` in earlier builds and is now `molen`. There is
|
|
27
29
|
> no alias — a script that references `api` throws at evaluation with the new name in the
|
|
28
30
|
> message, so the fix is a find-and-replace of `api.` with `molen.`.
|
|
29
31
|
|
|
@@ -86,6 +88,7 @@ A script may also declare `function setup(molen, config) { … }` instead of top
|
|
|
86
88
|
| `get` / `set` / `patch` / `remove` / `has` | `(id, component, …)` | component is a **string name**; `set` and the final shallow-merged `patch` value are validated against this world's vocabulary |
|
|
87
89
|
| `query` | `(...componentNames)` | iterable result with `.ids()`, `.count()`, `.first()`, `.without(...names)` |
|
|
88
90
|
| `emit` | `(type, payload)` | events reach other scripts, `molen.on` handlers, the client (`client.onEvent`), and `drive`/assert |
|
|
91
|
+
| `audio` | `molen.audio.play(sound, { entity?, position?, gain?, pitch?, bus?, loop? })` → handle / `stop(handle \| { entity?, sound? }, fadeS?)` / `music(playlist \| null)` | sound one-shots, loops and music; each call emits an `audio.*` event and never changes simulation state. See [audio.md](audio.md) |
|
|
89
92
|
| `raycast` / `overlapCircle` | spatial queries (kinematics layer) | |
|
|
90
93
|
| `after` / `every` | `(ticks, event, payload?)` | snapshot-safe world timers that EMIT (no callbacks); returns timer id. The handler receives `{ entity, timerId, payload }`. |
|
|
91
94
|
| `cancelTimer` | `(timerId, entity?)` | |
|
|
@@ -309,7 +312,8 @@ export default setup;
|
|
|
309
312
|
A setup module loaded from an arbitrary folder can't import the kernel (no `node_modules`
|
|
310
313
|
there), so it uses `world.spawnRaw(componentMap)`, `world.registerCommand`, `world.addSystem`,
|
|
311
314
|
and string-named component handles (`w.patch(id, { name: 'kinematicBody' }, …)`). Inside a
|
|
312
|
-
|
|
315
|
+
project that installs `@bendyline/molen-kernel` (anything `molen new` scaffolds) you can import
|
|
316
|
+
handles from it and use the typed
|
|
313
317
|
`world` API or `defineExperience({...})` (see [project.md](project.md)).
|
|
314
318
|
|
|
315
319
|
A command type may carry many handlers: a scene-declared `move` can be handled by a script and by
|
|
@@ -92,6 +92,22 @@ scene geometry that casts/receives shadows; their local frustum follows the came
|
|
|
92
92
|
light intensity to disable illumination. `sun.size` and `moon.size` are visual multipliers;
|
|
93
93
|
the default 1 preserves real angular size. Larger values help stylized scenes and small displays.
|
|
94
94
|
|
|
95
|
+
## Reflections
|
|
96
|
+
|
|
97
|
+
For metal and glass, pass `reflections: true` to `createViewer` or `mountExperience`.
|
|
98
|
+
The renderer shares one small procedural sky/ground environment across PBR materials on WebGL
|
|
99
|
+
and WebGPU. It follows the sky palette, solar direction and cloud cover, and refreshes only when
|
|
100
|
+
lighting changes visibly; moving the camera does not rebuild it. It is enabled by default in
|
|
101
|
+
`mountEarthView` and the world explorer. General viewers keep the legacy default (`false`).
|
|
102
|
+
The approximation provides sky reflections, not reflections of nearby buildings or trees.
|
|
103
|
+
Without `environment.sky`, it uses the ambient/sun rig and background color. Its filtered map
|
|
104
|
+
replaces the hemisphere's diffuse contribution during rendering to avoid lighting surfaces twice.
|
|
105
|
+
A host-supplied `renderer.scene.environment` takes precedence; the host retains ownership of that
|
|
106
|
+
texture and control of its light balance.
|
|
107
|
+
Custom host meshes should use `MeshStandardMaterial` or `MeshPhysicalMaterial` for this mode;
|
|
108
|
+
legacy Lambert/Phong materials do not receive the filtered sky's diffuse lighting. Unlit
|
|
109
|
+
materials remain unlit. Molen's built-in world surfaces and interiors use the PBR path.
|
|
110
|
+
|
|
95
111
|
## Other worlds
|
|
96
112
|
|
|
97
113
|
The shared sky dome, twilight gradient, star sphere and celestial-body rendering can use authored
|
|
@@ -133,9 +149,11 @@ Orthographic views use a 60° perspective sky oriented along the orthographic ca
|
|
|
133
149
|
|
|
134
150
|
## The star catalog is content
|
|
135
151
|
|
|
136
|
-
No package ships star data. The Earth catalog is the `molen.sky` content pack
|
|
137
|
-
|
|
138
|
-
|
|
152
|
+
No package ships star data. The Earth catalog is the `molen.sky` content pack: `stars.bin`, 8,404
|
|
153
|
+
stars in the 50 KB `molen/stars@1` binary format. Get it with
|
|
154
|
+
`npx molen pack fetch https://molen.dev/packs/index.json molen.sky`, serve the zip with your
|
|
155
|
+
app, load it once and hand it to the renderer; until then skies have no stars. Its source is
|
|
156
|
+
[`content/sky/`](https://github.com/bendyline/molen/tree/main/content/sky) in the engine repository.
|
|
139
157
|
|
|
140
158
|
```ts
|
|
141
159
|
import { createClient, decodeStarCatalog } from '@bendyline/molen-client';
|
|
@@ -167,9 +185,9 @@ from **Hoffleit, D. & Warren, W. H. Jr. (1991), Bright Star Catalogue, 5th Revis
|
|
|
167
185
|
The default magnitude cutoff is 6. Stellar colors approximate B−V; visual splat sizes are
|
|
168
186
|
exaggerated for visibility. J2000 coordinates receive precession and rotate with local sidereal
|
|
169
187
|
time. Proper motion, variability, stellar parallax and nutation are omitted. Positions are
|
|
170
|
-
quantized to about 0.005° and magnitudes to 0.04.
|
|
171
|
-
`node packages/client/scripts/generate-star-catalog.mjs
|
|
172
|
-
records the input checksum.
|
|
188
|
+
quantized to about 0.005° and magnitudes to 0.04. The engine repository regenerates
|
|
189
|
+
`content/sky/stars.bin` with `node packages/client/scripts/generate-star-catalog.mjs
|
|
190
|
+
/path/to/catalog.gz`; the pack's NOTICE records the input checksum.
|
|
173
191
|
|
|
174
192
|
No atmospheric refraction, horizon dip, terrain horizon calculation, eclipses, planetary bodies,
|
|
175
193
|
Milky Way texture, lunar libration or photographic lunar map are modeled. The procedural lunar
|
|
@@ -180,12 +198,11 @@ Volumetric atmospheric scattering remains future work.
|
|
|
180
198
|
|
|
181
199
|
## Try it
|
|
182
200
|
|
|
183
|
-
|
|
184
|
-
`http://localhost:5225/sky.html`. Choose a location, UTC date, time speed,
|
|
201
|
+
Open the [sky observatory](https://molen.dev/play/world-explorer/sky.html). Choose a location, UTC date, time speed,
|
|
185
202
|
or the authored Amethyst world; drag to look around and use **Face Sun** / **Face Moon**.
|
|
186
203
|
**Use current time** reads the host clock once and starts normal time flow.
|
|
187
204
|
`?backend=webgl` / `?backend=webgpu` select a backend; `?hud=0` hides controls for capture.
|
|
188
|
-
The terrain explorer
|
|
205
|
+
The terrain explorer, [World Explorer](https://molen.dev/play/world-explorer/), includes a 24-hour slider, date picker and Now button.
|
|
189
206
|
It starts at noon today and shows times in the browser's labeled local time zone. Scrubbing
|
|
190
207
|
keeps the camera fixed while the sky, celestial bodies and scene lighting follow the selected
|
|
191
208
|
instant and camera location. Use `?date=2024-03-25T05:00:00Z` for a repeatable instant or
|
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
# Default structure library
|
|
2
2
|
|
|
3
3
|
Molen ships **120 procedural structures**: the original 16 styles and 104 additional interpretations
|
|
4
|
-
of real-world buildings. They share
|
|
4
|
+
of real-world buildings. They share 51 material graphs and the existing footprint-driven worldgen
|
|
5
5
|
pipeline. Each entry has a stable style ID, taxonomy, country references, use, characteristic
|
|
6
6
|
details, and a representative footprint and floor count. These are original stylized studies,
|
|
7
7
|
not surveyed replicas or static meshes stretched to fit a parcel.
|
|
8
8
|
|
|
9
9
|
The generated runtime index is
|
|
10
|
-
[`structures/catalog.json`](
|
|
10
|
+
[`structures/catalog.json`](https://github.com/bendyline/molen/blob/main/content/worldgen/structures/catalog.json), shipped in the
|
|
11
11
|
`molen.worldgen.default` content pack (role `structures`). All 120 styles are
|
|
12
12
|
registered in the default style pack. The editable source for each logical building lives in its
|
|
13
13
|
own copyable directory under
|
|
14
|
-
[`source/structures/`](
|
|
14
|
+
[`source/structures/`](https://github.com/bendyline/molen/tree/main/content/worldgen/source/structures); its `source.json` inventories
|
|
15
15
|
the local recipe or archstyle and definition metadata. Supporting architectural references are
|
|
16
16
|
maintained in the collection-wide
|
|
17
|
-
[`catalog.json`](
|
|
17
|
+
[`catalog.json`](https://github.com/bendyline/molen/blob/main/content/worldgen/source/shared/structure-library/catalog.json)
|
|
18
|
+
in the engine repository. Get the pack itself with
|
|
19
|
+
`npx molen pack fetch https://molen.dev/packs/index.json`.
|
|
18
20
|
|
|
19
21
|
## See and reshape every structure
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
Open the [structure library](https://molen.dev/play/world-explorer/structures.html) in the
|
|
24
|
+
browser, or use the **Explore 120 structures** link in
|
|
25
|
+
[World Explorer](https://molen.dev/play/world-explorer/).
|
|
22
26
|
The collection renders the actual shipped generators and shared material graphs. Search by name,
|
|
23
27
|
country, construction material or description; filter by taxonomy; select any card to change
|
|
24
28
|
width, depth and storeys, orbit, compare front and rear, or inspect the silhouette without textures.
|
|
@@ -26,7 +30,7 @@ The detail menu uses the production geometry tiers. The sheet shows complete ext
|
|
|
26
30
|
enterable interiors are generated separately by the world renderer.
|
|
27
31
|
|
|
28
32
|
**Download model sheet** exports all 120 rendered entries as a labeled PNG. For reproducible
|
|
29
|
-
captures, build once and run:
|
|
33
|
+
captures in the engine repository, build once and run:
|
|
30
34
|
|
|
31
35
|
```sh
|
|
32
36
|
pnpm -r build
|
|
@@ -91,14 +95,20 @@ Details use the actual facade rhythm, a bounded perimeter allocation, and the ex
|
|
|
91
95
|
precedence. Dormers use `roof.features.dormers` on eligible pitched wings. Simplified budget
|
|
92
96
|
representations omit ornament while retaining their footprint, primary roof and measured envelope.
|
|
93
97
|
|
|
94
|
-
The [standard material catalog](
|
|
95
|
-
groups all
|
|
98
|
+
The [standard material catalog](https://github.com/bendyline/molen/blob/main/content/worldgen/materials/README.md)
|
|
99
|
+
groups all 51 shared graphs by construction. It includes several brick bonds, cut/rubble stone,
|
|
96
100
|
clapboard and board-and-batten, shingles, clay tiles, slate, thatch, rammed earth and metal roofs.
|
|
97
101
|
Physical repeat sizes live in `scripts/standard-materials.mjs`. Common textures are 256² and
|
|
98
102
|
prepared once per shared material set. Window graphs use cell UVs; solid surfaces use meter UVs.
|
|
99
103
|
|
|
100
|
-
|
|
101
|
-
|
|
104
|
+
To vary a structure in your own project, copy its `archstyle.json` (or write a new one), preview
|
|
105
|
+
it with `npx molen worldgen preview my.archstyle.json --out preview.png`, and ship your styles as
|
|
106
|
+
your own style pack with `molen pack build`. [Worldgen](worldgen.md) covers the format.
|
|
107
|
+
|
|
108
|
+
The library itself is maintained in the engine repository. Edit the applicable
|
|
109
|
+
`content/worldgen/source/structures/<style>/` bundle there. Generated styles use `recipe.json`;
|
|
110
|
+
the original styles carry their complete `archstyle.json`. After editing, from the repository
|
|
111
|
+
root:
|
|
102
112
|
|
|
103
113
|
```sh
|
|
104
114
|
node packages/worldgen/scripts/generate-structures.mjs
|
|
@@ -90,7 +90,16 @@ Earth packages use Web Mercator, which inflates horizontal distance by 1/cos(lat
|
|
|
90
90
|
projected frame by `metersPerUnit = cos(center latitude)` (recorded on the descriptor), so tiles,
|
|
91
91
|
meshes, semantic densities, character speeds, and entity XZ are all in ground meters. Convert
|
|
92
92
|
between world and projected space with `projectedToWorld` / `worldToProjected`; `webMercatorToWgs84`
|
|
93
|
-
takes projected coordinates (divide world XZ by `metersPerUnit` first).
|
|
93
|
+
takes projected coordinates (divide world XZ by `metersPerUnit` first). `wgs84ToWorld(metersPerUnit,
|
|
94
|
+
lon, lat)` and `worldToWgs84` do both steps for placing cameras, markers, and entities.
|
|
95
|
+
|
|
96
|
+
The scale is exact at one latitude, the **frame**. It defaults to the center of the package bounds,
|
|
97
|
+
which suits a regional package. A worldwide package centers on the equator, so pass the latitude you
|
|
98
|
+
are viewing: `createTerrainPackagePyramidStream(pkg, { frame: { latitude }, … })` (every package
|
|
99
|
+
open/descriptor helper accepts the same `frame`). `terrainPackageMetersPerUnit(pkg, frame)` returns the
|
|
100
|
+
matching scale for your own placement math and for worldgen's `metersPerUnit`. The error grows by
|
|
101
|
+
roughly 1–1.5% per degree of latitude away from the frame at mid-latitudes, so re-anchor — rebuild
|
|
102
|
+
the streams on a new frame — after moving more than about a degree north or south.
|
|
94
103
|
|
|
95
104
|
## 3. Render it (client side)
|
|
96
105
|
|
|
@@ -123,6 +132,10 @@ function frame(cameraPosition: [number, number, number]) {
|
|
|
123
132
|
}
|
|
124
133
|
```
|
|
125
134
|
|
|
135
|
+
`reverseDepthBuffer` preserves depth precision across a large view range. On WebGL devices without
|
|
136
|
+
`EXT_clip_control`, Molen automatically uses logarithmic depth on the same canvas and context.
|
|
137
|
+
Logarithmic depth costs early-fragment performance; devices supporting reversed depth keep it.
|
|
138
|
+
|
|
126
139
|
The source interface returns decoded height tiles, so archive readers, procedural worlds, and tests
|
|
127
140
|
do not change residency behavior. HTTP 404 is a stable missing tile; call `retryFailed()` only after
|
|
128
141
|
the backing data has changed. A *thrown* error is not: a dropped range request, a 503, or a CORS
|
|
@@ -167,12 +180,14 @@ calls, instances, loading/failure counts, and evictions for live quality diagnos
|
|
|
167
180
|
|
|
168
181
|
## 4. Screenshot it headlessly
|
|
169
182
|
|
|
170
|
-
```
|
|
183
|
+
```sh
|
|
171
184
|
molen shot scene.json --out island.png --camera 256,160,580 --look 256,20,256 --size 1280x720
|
|
172
185
|
```
|
|
173
186
|
|
|
174
187
|
(The `screenshotScene` op / `screenshot_scene` MCP tool also accept a `terrain` payload so the
|
|
175
|
-
flyover renders without any live entities.)
|
|
188
|
+
flyover renders without any live entities.) The terrain-flyover sample is the full slice:
|
|
189
|
+
[play it](https://molen.dev/play/terrain-flyover/), or copy it with
|
|
190
|
+
`npx @bendyline/molen-tooling new my-terrain --template terrain-flyover`.
|
|
176
191
|
|
|
177
192
|
### Walk through the world explorer
|
|
178
193
|
|
|
@@ -181,7 +196,7 @@ backends. At low altitude, the fade spans 2 to 20 kilometres, preserving nearby
|
|
|
181
196
|
while softening the horizon. Both distances extend at flight altitude and stay inside the streamed
|
|
182
197
|
range; it does not otherwise change with the terrain quality preset.
|
|
183
198
|
|
|
184
|
-
In
|
|
199
|
+
In [World Explorer](https://molen.dev/play/world-explorer/), select **Walk mode** to move from the aerial viewer to open ground
|
|
185
200
|
near your current position. The camera sits 1.7 meters above your feet, with a 5 cm near clipping
|
|
186
201
|
plane, so nearby buildings retain their real, human-scale dimensions. Human features turn on
|
|
187
202
|
when available; the terrain layer buttons remain independent of navigation.
|
|
@@ -213,6 +228,26 @@ Validate the manifest with `molen validate terrain-package.json`. A compiler/rel
|
|
|
213
228
|
also run `molen validate terrain-package.json --verify-files`; that streams every declared file
|
|
214
229
|
and checks directory containment, byte size, and SHA-256 without loading an archive into memory.
|
|
215
230
|
|
|
231
|
+
A source may also be a **split archive family**: `{ "kind": "pmtiles-set", "url": ".../archive-set.json" }`
|
|
232
|
+
(or a package-relative `path`) names a `molen/archive-set@1` document instead of one archive. Planet
|
|
233
|
+
data outgrows what CDNs cache as a single object, so producers cut it into a coarse `base` archive
|
|
234
|
+
plus detail archives, each owning a disjoint set of cells at `partitionLevel` (as run-length indices
|
|
235
|
+
`y * 2^partitionLevel + x`). The package adapter opens the document lazily and routes every tile to
|
|
236
|
+
the archive owning its ancestor cell, opening members on demand in a small LRU. Hosts with their own
|
|
237
|
+
transport call `createTerrainArchiveSetArchive(urlOrDocument, { openArchive })` from
|
|
238
|
+
`@bendyline/molen-terrain/client` and pass the result as `archive`, `landcoverArchive`, or
|
|
239
|
+
`featuresArchive`; `createTerrainArchiveSetRouter` in the kernel half is the pure routing function,
|
|
240
|
+
and `encodeTerrainArchiveSetPartitions` writes the run-length lists. Validate a set document with
|
|
241
|
+
`molen validate archive-set.json`.
|
|
242
|
+
|
|
243
|
+
Compilers write package archives with the portable PMTiles v3 writer in
|
|
244
|
+
`@bendyline/molen-terrain/kernel` (Node, Workers and browsers). `writePmtilesArchive(tiles,
|
|
245
|
+
{ tileType: 'png', bounds })` builds a whole archive in memory; for archives too large for memory,
|
|
246
|
+
stream the tile payloads to disk in tile-id order (`pmtilesTileId(z, x, y)`) and write
|
|
247
|
+
`createPmtilesPrefix(records, dataLength, options)` in front of them. Official readers fetch only the
|
|
248
|
+
first 16 KiB to find the root directory, so the writer moves entries into gzip-compressed leaf
|
|
249
|
+
directories once one root would overflow that window; archives of any size stay readable.
|
|
250
|
+
|
|
216
251
|
The optional `surface` block declares `seaLevel` and portable height/slope material bands. If it is
|
|
217
252
|
omitted, the projected-Earth adapter supplies a conservative dirt/sand/grass/rock/snow palette.
|
|
218
253
|
|
|
@@ -310,6 +345,16 @@ they share one `features` PMTiles sidecar. When both sections reference one MVT
|
|
|
310
345
|
renderer layers share one in-flight range read and full decode; decoded semantic documents are not
|
|
311
346
|
retained as a second long-lived cache.
|
|
312
347
|
|
|
348
|
+
The opposite split works too: when the terrain refines past a sidecar's last level (a zoom-13 vector
|
|
349
|
+
archive under zoom-14 elevation), the finer tiles overzoom the sidecar's finest tiles by default.
|
|
350
|
+
`overzoomTerrainSemanticTile` rescales an ancestor's normalized geometry onto the descendant, clips
|
|
351
|
+
roads, waterways and areas to it (plus a 1/64 buffer, like decoded tiles), and keeps each building
|
|
352
|
+
and point in exactly the one descendant that holds its center, so nothing is cut or drawn twice.
|
|
353
|
+
`createOverzoomTerrainSemanticSource` wraps any semantic source this way and keeps recently decoded
|
|
354
|
+
ancestors, since one ancestor serves up to four children at a time. Layers created by
|
|
355
|
+
`createTerrainPackageSemanticLayers` then reach the package's `maxLevel`; pass `overzoom: false`
|
|
356
|
+
to stop them at the sidecar's levels.
|
|
357
|
+
|
|
313
358
|
The package elevation pyramid may be sparse. `createTerrainPackagePyramidHeightSource` walks to the
|
|
314
359
|
nearest declared ancestor when an exact tile is absent, then crops and resamples that ancestor into
|
|
315
360
|
the requested tile bounds. This supports broad coarse coverage plus a small regional detail window
|
|
@@ -334,8 +379,8 @@ matrix, guarded horizontal-cone selection ahead of exact six-plane/horizon culli
|
|
|
334
379
|
decoder for unknown MVT/PNG8 profiles alongside the explicit built-in Protomaps MVT profile. TMS Y
|
|
335
380
|
addresses,
|
|
336
381
|
sidecar-header validation, normalized semantic meshes, and parent-safe adaptive refinement are
|
|
337
|
-
handled automatically. See the binding roadmap in
|
|
338
|
-
|
|
382
|
+
handled automatically. See the binding roadmap in the design plan,
|
|
383
|
+
[`docs/10-earth-terrain.md`](https://github.com/bendyline/molen/blob/main/docs/10-earth-terrain.md).
|
|
339
384
|
|
|
340
385
|
With parent fallback enabled, a package pyramid may extend above the elevation archive's
|
|
341
386
|
maximum zoom. For example, a zoom-15 vector archive can use cropped/resampled zoom-14 elevation
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
# Mountable vehicles and driving
|
|
2
2
|
|
|
3
|
-
For the P-51D Mustang and OH-6, see [Aircraft](aircraft.md). They share the mount/seat
|
|
4
|
-
foundation and add separate flight controls, physics, assets and cockpit cameras.
|
|
5
|
-
|
|
6
3
|
World explorer's parking cars are external entity types with stable IDs, metric dimensions, and five
|
|
7
|
-
models: compact, sedan, SUV, pickup and van.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
models: compact, sedan, SUV, pickup and van. You can walk up to one, get in and drive it.
|
|
5
|
+
|
|
6
|
+
Each type owns its GLB reference, complete physics configuration, seats, named visual bindings,
|
|
7
|
+
and optional deterministic scripts. Dormant cars use generic dimension-driven instance proxies;
|
|
8
|
+
approaching or entering one loads its independent GLB with its own interior and controls. See
|
|
9
|
+
[Vehicle interiors](vehicle-interiors.md). No concrete car model or handling catalog is compiled
|
|
10
|
+
into schema, kernel, or client. The P-51D Mustang and OH-6 share the same mount/seat foundation
|
|
11
|
+
and add separate flight controls, physics, assets and cockpit cameras; see [Aircraft](aircraft.md).
|
|
13
12
|
|
|
14
13
|
In **Walk mode**, approach a car and press **E** to enter its driver seat. **W/S** accelerate or
|
|
15
14
|
brake then reverse; **A/D** steer; **Space** brakes; **V** switches cockpit/chase views. Mouse look
|
|
@@ -86,6 +85,16 @@ All durable simulation state and mount relationships live in ECS components and
|
|
|
86
85
|
and replay. Install the same systems/environment when restoring. Host streaming and render resources
|
|
87
86
|
are separate from those checkpoints.
|
|
88
87
|
|
|
88
|
+
## Engine sound
|
|
89
|
+
|
|
90
|
+
Every `molen.entities` vehicle type carries an `audioSource`: the compact, sedan and SUV run
|
|
91
|
+
`vehicle.engine.car`, the pickup and van `vehicle.engine.diesel`, each with its own pitch. The
|
|
92
|
+
engine plays only while someone drives (`self.occupied`), rises in pitch with
|
|
93
|
+
`vehicleState.speed`, and grows louder with `vehicleInput.throttle`. Any host that plays audio from
|
|
94
|
+
the entity world, such as `mountEarthView` or a page with `createAudioLayer(...).attachWorld(world)`,
|
|
95
|
+
hears it with no extra code. Override the component on a type or entity to change the sound; see
|
|
96
|
+
[Sound and music](audio.md).
|
|
97
|
+
|
|
89
98
|
## Reusable views and parking data
|
|
90
99
|
|
|
91
100
|
`@bendyline/molen-client/vehicles` exports `createVehicleVisual`, `createParkedVehicleBatch`,
|
|
@@ -100,11 +109,15 @@ terrain-alignment `pitch` and `roll`. IDs derive from world-space bay positions
|
|
|
100
109
|
than tile IDs. Instance meshes retain `userData.vehicleIds` for promotion and duplicate suppression.
|
|
101
110
|
The worker transports the same placement records as synchronous generation.
|
|
102
111
|
|
|
103
|
-
For repeatable visual review
|
|
104
|
-
`
|
|
105
|
-
|
|
112
|
+
For repeatable visual review open
|
|
113
|
+
[World Explorer with `?synthetic=1&parking=1`](https://molen.dev/play/world-explorer/?synthetic=1&parking=1).
|
|
114
|
+
In the engine repository, the browser scenario
|
|
115
|
+
[`vehicles.play.json`](https://github.com/bendyline/molen/blob/main/examples/world-explorer/test/visual/vehicles.play.json)
|
|
116
|
+
visits a car, enters the cockpit, drives, turns in chase view, brakes, and exits; it is also a
|
|
117
|
+
working reference for scripting [`molen play`](experience-playback.md) against your own build:
|
|
106
118
|
|
|
107
119
|
```sh
|
|
108
|
-
|
|
109
|
-
|
|
120
|
+
# in the engine repository, from examples/world-explorer/
|
|
121
|
+
pnpm build
|
|
122
|
+
npx molen play dist --scenario test/visual/vehicles.play.json --out-dir .artifacts/vehicles
|
|
110
123
|
```
|
|
@@ -16,7 +16,7 @@ every entry and provides dimension, texture and detail controls.
|
|
|
16
16
|
|
|
17
17
|
For enterable buildings and lazy ground-floor furnishings, see [Building interiors](building-interiors.md).
|
|
18
18
|
|
|
19
|
-
```
|
|
19
|
+
```text
|
|
20
20
|
@bendyline/molen-worldgen world-agnostic core
|
|
21
21
|
/kernel formats, footprint analysis, roofs and walls, batch generator, GLB encoder, seeds
|
|
22
22
|
/client buffers to three.js meshes, instanced boxes, style-pack loader
|
|
@@ -25,12 +25,17 @@ For enterable buildings and lazy ground-floor furnishings, see [Building interio
|
|
|
25
25
|
/kernel molen/region-atlas@1, tile adapter, tile-edge ownership, budgets by quality
|
|
26
26
|
/client TerrainSemanticTileRenderer implementations, atlas loader
|
|
27
27
|
|
|
28
|
-
content
|
|
29
|
-
content
|
|
28
|
+
molen.worldgen.default content pack: the shipped looks (styles, scatter rules, structures)
|
|
29
|
+
molen.earth content pack: world.atlas.json (which style applies where), business catalog
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
The npm packages carry code only. The default looks are content packs (`molen/pack@1` zips)
|
|
33
|
-
|
|
32
|
+
The npm packages carry code only. The default looks are content packs (`molen/pack@1` zips),
|
|
33
|
+
published with each release at `https://molen.dev/packs/`. In a project,
|
|
34
|
+
`npx molen pack fetch https://molen.dev/packs/index.json` downloads them into `packs/` and pins
|
|
35
|
+
them in project.json, and an app serves the same zips from wherever it hosts them. Their sources
|
|
36
|
+
are [`content/worldgen`](https://github.com/bendyline/molen/tree/main/content/worldgen) and
|
|
37
|
+
[`content/earth`](https://github.com/bendyline/molen/tree/main/content/earth) in the engine
|
|
38
|
+
repository.
|
|
34
39
|
|
|
35
40
|
The core package has no terrain dependency and a test forbids map vocabulary in its sources. Core
|
|
36
41
|
inputs are `BuildingRequest` (identity, labels, outline, optional height/levels/minHeight) and
|
|
@@ -40,14 +45,13 @@ inputs are `BuildingRequest` (identity, labels, outline, optional height/levels/
|
|
|
40
45
|
|
|
41
46
|
## 2. Quick start
|
|
42
47
|
|
|
43
|
-
World explorer, real data:
|
|
48
|
+
World explorer, real data, in the browser:
|
|
44
49
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
```
|
|
50
|
+
- [molen.dev/play/world-explorer](https://molen.dev/play/world-explorer/): styled Sammamish
|
|
51
|
+
buildings in the Human mode.
|
|
52
|
+
- [`?synthetic=1&lineup=1`](https://molen.dev/play/world-explorer/?synthetic=1&lineup=1): one
|
|
53
|
+
building of every footprint class along a road.
|
|
54
|
+
- [`?style=none`](https://molen.dev/play/world-explorer/?style=none): flat extrusions, no pack.
|
|
51
55
|
|
|
52
56
|
From code, one building from one outline, no map involved:
|
|
53
57
|
|
|
@@ -82,15 +86,15 @@ const glb = encodeGlb(out.buildings); // core glTF 2.0, one primitive per mate
|
|
|
82
86
|
|
|
83
87
|
From the command line (or the MCP tools of the same names), without writing code. The commands
|
|
84
88
|
need a style pack: pass `--pack` (a content pack zip, a pack source directory, or a
|
|
85
|
-
`stylepack.json`), list one in the project's `packs`, or set `MOLEN_PACKS`. In
|
|
89
|
+
`stylepack.json`), list one in the project's `packs`, or set `MOLEN_PACKS`. In a project:
|
|
86
90
|
|
|
87
91
|
```sh
|
|
88
|
-
|
|
89
|
-
molen worldgen preview --out preview.png --angles 4 # the lineup of every shape class
|
|
90
|
-
molen worldgen preview my.archstyle.json --out preview.png # a style file, injected into the pack
|
|
91
|
-
molen worldgen bake
|
|
92
|
-
molen worldgen bake
|
|
93
|
-
molen worldgen stats
|
|
92
|
+
npx molen pack fetch https://molen.dev/packs/index.json # once: packs/ + project.json pins
|
|
93
|
+
npx molen worldgen preview --out preview.png --angles 4 # the lineup of every shape class
|
|
94
|
+
npx molen worldgen preview my.archstyle.json --out preview.png # a style file, injected into the pack
|
|
95
|
+
npx molen worldgen bake --outline "0,0;18,0;18,9;10,9;10,14;0,14" --style molen.worldgen.fantasy.hall --out assets --id keep
|
|
96
|
+
npx molen worldgen bake hall.batch.json --out assets --id hall # a molen/worldgen-batch@1 document
|
|
97
|
+
npx molen worldgen stats path/to/terrain-package.json --auto --dump tile.batch.json
|
|
94
98
|
```
|
|
95
99
|
|
|
96
100
|
`preview` generates in Node and renders the buffers, props, and scatter in headless Chromium
|
|
@@ -102,8 +106,10 @@ footprint and roof histograms, sizes, timings, and whether both runs hashed the
|
|
|
102
106
|
writes the adapted batch (`molen/worldgen-batch@1`, identities of clipped pieces suffixed so
|
|
103
107
|
they stay unique) for `preview` and `bake`. A `molen/worldgen-batch@1` document is the
|
|
104
108
|
interchange: ground (`flat` or `slope`), building requests, optional mapped props and a scatter request, rules,
|
|
105
|
-
and a detail tier. Two example batches live
|
|
106
|
-
|
|
109
|
+
and a detail tier; `molen schema get worldgen-batch` prints its schema. Two example batches live
|
|
110
|
+
in the engine repository's
|
|
111
|
+
[`content/worldgen/fixtures/`](https://github.com/bendyline/molen/tree/main/content/worldgen/fixtures),
|
|
112
|
+
beside the pack source but not packed.
|
|
107
113
|
|
|
108
114
|
## 3. Authoring a look: `molen/archstyle@1`
|
|
109
115
|
|
|
@@ -179,7 +185,7 @@ defaults, not recovered building measurements. Source heights and levels take pr
|
|
|
179
185
|
|
|
180
186
|
## 4. Seeds and identity
|
|
181
187
|
|
|
182
|
-
```
|
|
188
|
+
```text
|
|
183
189
|
building seed: wg1|b|<pack.name>@<pack.version>|<style.id>@<style.version>|<identity>
|
|
184
190
|
aspect seed: <building seed>|massing | roof | facade | palette:<name> | material:<part> | props:<id>
|
|
185
191
|
prop salt: wg1|p|<pack>@<version>|<scatter.id>@<version>|<rule.id> then hashCoord(cellX, cellZ, salt)
|
|
@@ -234,8 +240,12 @@ seeds are unchanged.
|
|
|
234
240
|
|
|
235
241
|
## 6. Packs: `molen/stylepack@1`
|
|
236
242
|
|
|
237
|
-
|
|
238
|
-
content/worldgen/
|
|
243
|
+
A style pack's source directory looks like this (the default pack's is
|
|
244
|
+
[`content/worldgen/`](https://github.com/bendyline/molen/tree/main/content/worldgen) in the engine
|
|
245
|
+
repository); `molen pack build <dir>` turns one into a content pack.
|
|
246
|
+
|
|
247
|
+
```text
|
|
248
|
+
my-stylepack/
|
|
239
249
|
stylepack.json name, version (seeds), namespace, id → path maps, defaults, imports
|
|
240
250
|
styles/**/*.archstyle.json
|
|
241
251
|
scatter/*.scatter.json
|