@bendyline/molen-tooling 0.0.1 → 0.0.2
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/cli.mjs +26 -4
- package/dist/docs-src/guide/3d-art-guidelines.md +2 -2
- package/dist/docs-src/guide/3d-model-assets.md +15 -11
- package/dist/docs-src/guide/aircraft.md +9 -10
- package/dist/docs-src/guide/browser-mount.md +14 -0
- package/dist/docs-src/guide/building-interiors.md +2 -1
- package/dist/docs-src/guide/determinism.md +16 -11
- package/dist/docs-src/guide/entities.md +16 -5
- package/dist/docs-src/guide/examples.md +38 -23
- package/dist/docs-src/guide/experience-playback.md +2 -3
- package/dist/docs-src/guide/game-samples.md +30 -18
- package/dist/docs-src/guide/project.md +22 -2
- package/dist/docs-src/guide/quickstart.md +37 -28
- package/dist/docs-src/guide/recognizable-places.md +21 -15
- package/dist/docs-src/guide/rendering-backends.md +5 -4
- package/dist/docs-src/guide/scripting.md +4 -2
- package/dist/docs-src/guide/sky.md +10 -9
- package/dist/docs-src/guide/structure-library.md +18 -8
- package/dist/docs-src/guide/terrain.md +6 -4
- package/dist/docs-src/guide/vehicles.md +9 -5
- package/dist/docs-src/guide/worldgen.md +31 -21
- package/dist/docs-src/llms.txt +26 -15
- package/dist/docs-src/schemas/README.md +1 -1
- package/dist/index.d.mts +26 -2
- package/dist/index.mjs +2 -2
- package/dist/{mcp-BFnCWrg0.mjs → mcp-AOfIp89b.mjs} +12 -2
- package/dist/{ops-BGxhSP6w.mjs → ops-C4BvDgP-.mjs} +267 -33
- package/dist/templates/city-courier/README.md +53 -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 +878 -0
- package/dist/templates/city-courier/index.html +2 -0
- package/dist/templates/city-courier/package.json +25 -0
- package/dist/templates/city-courier/project.json +8 -0
- package/dist/templates/city-courier/scene.json +3395 -0
- package/dist/templates/city-courier/scripts/game.ts +127 -0
- package/dist/templates/city-courier/scripts/molen-scripts.d.ts +1125 -0
- package/dist/templates/city-courier/scripts/tsconfig.json +16 -0
- package/dist/templates/city-courier/src/game-shell.css +309 -0
- package/dist/templates/city-courier/src/main.ts +81 -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 +188 -0
- package/dist/templates/skybound/README.md +53 -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 +878 -0
- package/dist/templates/skybound/index.html +2 -0
- package/dist/templates/skybound/package.json +25 -0
- package/dist/templates/skybound/project.json +8 -0
- package/dist/templates/skybound/scene.json +1737 -0
- package/dist/templates/skybound/scripts/game.ts +119 -0
- package/dist/templates/skybound/scripts/molen-scripts.d.ts +1125 -0
- package/dist/templates/skybound/scripts/tsconfig.json +16 -0
- package/dist/templates/skybound/src/game-shell.css +309 -0
- package/dist/templates/skybound/src/main.ts +60 -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 +52 -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 +25 -0
- package/dist/templates/top-down-arena/project.json +10 -0
- package/dist/templates/top-down-arena/scene.json +162 -0
- package/dist/templates/top-down-arena/scripts/chase.ts +17 -0
- package/dist/templates/top-down-arena/scripts/combat.ts +12 -0
- package/dist/templates/top-down-arena/scripts/control.ts +8 -0
- package/dist/templates/top-down-arena/scripts/molen-scripts.d.ts +1095 -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/gen/molen-types.ts +882 -0
- package/dist/templates/top-down-arena/src/main.ts +31 -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
package/README.md
CHANGED
|
@@ -46,21 +46,39 @@ physics: kinematics (cross-platform deterministic)
|
|
|
46
46
|
The hash is the determinism check: same build, same ticks, same hash. `molen replay <fixture>`
|
|
47
47
|
compares a recorded command log tick by tick and names the first tick that diverges.
|
|
48
48
|
|
|
49
|
+
### Start from a sample
|
|
50
|
+
|
|
51
|
+
The small samples ship inside this package as templates, so starting from one needs no clone of
|
|
52
|
+
the engine repository. `molen templates` lists them (`--json` for the structured list); each
|
|
53
|
+
scaffolds as a standalone npm project with its scene, scripts, headless tests and replay fixtures:
|
|
54
|
+
|
|
55
|
+
```sh
|
|
56
|
+
npx @bendyline/molen-tooling templates
|
|
57
|
+
npx @bendyline/molen-tooling new my-arena --template top-down-arena && cd my-arena
|
|
58
|
+
npm install && npm test && npm run dev
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
`molen new` prints the project's own headless loop, and every scaffolded project — template or
|
|
62
|
+
starter — carries an `AGENTS.md` that points a coding agent at the version-locked docs bundle in
|
|
63
|
+
`node_modules/@bendyline/molen-tooling/dist/docs-src/llms.txt` and at that loop.
|
|
64
|
+
|
|
49
65
|
## What's in it
|
|
50
66
|
|
|
51
67
|
| Surface | For |
|
|
52
68
|
|---|---|
|
|
53
|
-
| the `molen` bin |
|
|
69
|
+
| the `molen` bin | 43 operations, including `validate`, `sim run`, `sim watch`, `shot`, `frames`, `drive`, `play`, `replay`, `diff`, `new`, `templates`, `asset import`/`inspect`/`pack`/`stage`/`shot`, `pack build`/`inspect`/`verify`/`extract`/`fetch`, `project info`, `types list`/`check`/`reserve`/`gen`/`test`, `scripts check`, `material bake`, `uvpaint apply`, `worldgen preview`/`bake`/`stats`, `figure preview` |
|
|
54
70
|
| `molen mcp` | every operation but the file watcher, as MCP tools over stdio; `drive_scene`, `play_experience`, `worldgen_preview` and `figure_preview` return frames as images |
|
|
55
71
|
| `molen describe [op]` | the machine-readable contract for every operation, CLI flags and MCP tool name side by side — the surface to build an agent against |
|
|
56
72
|
| discovery, no source reading | `molen schema list`/`get`, `molen components`/`component <name>`, `molen docs search <q>` over the engine docs bundle shipped inside this package |
|
|
57
|
-
| `.` (the ops library) | every op as a plain async `(input) => output`: `validateAsset`, `runSimulation`, `screenshotScene`, `runReplayFile`, `driveScene`, `playExperience`, `rasterizeMaterial`, `checkScripts`, `generateTypes`, `importAsset`, `scaffoldExperience`, … plus `OPS_CATALOG`, and `compareGolden`/`diffImages` for your own image tests |
|
|
73
|
+
| `.` (the ops library) | every op as a plain async `(input) => output`: `validateAsset`, `runSimulation`, `screenshotScene`, `runReplayFile`, `driveScene`, `playExperience`, `rasterizeMaterial`, `checkScripts`, `generateTypes`, `importAsset`, `scaffoldExperience`, `listTemplates`, … plus `OPS_CATALOG`, and `compareGolden`/`diffImages` for your own image tests |
|
|
58
74
|
|
|
59
75
|
Ops that need content (entity types, a style pack, a region atlas) read it from content packs,
|
|
60
76
|
never from npm packages: the project's `project.json` `packs` list (paths or pinned URLs), then
|
|
61
77
|
`MOLEN_PACKS`, plus `--pack` on the worldgen commands. URL packs are cached in
|
|
62
|
-
`MOLEN_CACHE_DIR`, and `MOLEN_OFFLINE=1` never fetches.
|
|
63
|
-
|
|
78
|
+
`MOLEN_CACHE_DIR`, and `MOLEN_OFFLINE=1` never fetches. Molen's own packs are published at
|
|
79
|
+
molen.dev: `npx molen pack fetch https://molen.dev/packs/index.json` downloads them into a project
|
|
80
|
+
and pins them in `project.json`. `molen pack build` makes a pack of your own from a directory with
|
|
81
|
+
a `molen-pack.source.json`.
|
|
64
82
|
|
|
65
83
|
The CLI and the MCP server act with the authority of the process that runs them. Path arguments
|
|
66
84
|
are trusted user intent, read, written or imported as given wherever they point, and a scene's
|
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { A as inspectContentPack, B as OPS_CATALOG, C as checkTypesOp, D as buildContentPack, E as reserveNamespace, F as listFigurePresets, H as formatOp, I as exportFrames, J as formatBytes, K as stageAssets, L as driveScene, M as generateTypes, O as extractContentPack, P as previewFigure, Q as listAssets, S as rasterizeMaterial, T as projectInfo, U as checkScripts, V as describeOps, X as packAsset, Y as formatPacked, Z as inspectAsset, _ as loadComponentRegistry, b as diffSnapshots, c as validateAsset, d as runSimulation, et as importAsset, f as screenshotScene, g as listSchemasOp, h as listComponentsOp, i as bakeWorldgen, j as verifyContentPack, k as fetchContentPack, l as applyUvPaintOp, m as getSchemaOp, n as worldgenStats, p as getComponentOp, q as screenshotAsset, r as previewWorldgen, s as simWatch, st as playExperience, t as formatWorldgenStats, u as testTypes, v as scaffoldExperience, w as listTypes, x as runReplayFile, y as listTemplates, z as searchDocs } from "./ops-C4BvDgP-.mjs";
|
|
3
3
|
import { dirname, join } from "node:path";
|
|
4
4
|
import { readFileSync } from "node:fs";
|
|
5
5
|
import { formatIssues } from "@bendyline/molen-schema";
|
|
@@ -522,13 +522,19 @@ function cmdDescribe(args) {
|
|
|
522
522
|
async function cmdNew(args) {
|
|
523
523
|
const name = args.positionals[0];
|
|
524
524
|
if (name === void 0) {
|
|
525
|
-
err("usage: molen new <name> [--dir <path>] [--force]");
|
|
525
|
+
err("usage: molen new <name> [--template <id>] [--dir <path>] [--force]");
|
|
526
526
|
return 2;
|
|
527
527
|
}
|
|
528
|
+
if (args.flags.template === true) {
|
|
529
|
+
err("--template needs a template id (molen templates lists them)");
|
|
530
|
+
return 2;
|
|
531
|
+
}
|
|
532
|
+
const template = str(args.flags.template);
|
|
528
533
|
const result = await scaffoldExperience({
|
|
529
534
|
name,
|
|
530
535
|
dir: str(args.flags.dir),
|
|
531
|
-
force: args.flags.force === true
|
|
536
|
+
force: args.flags.force === true,
|
|
537
|
+
...template !== void 0 ? { template } : {}
|
|
532
538
|
});
|
|
533
539
|
if (!result.ok) {
|
|
534
540
|
err(result.error ?? "scaffold failed");
|
|
@@ -540,6 +546,21 @@ async function cmdNew(args) {
|
|
|
540
546
|
for (const step of result.nextSteps ?? []) out(` ${step}`);
|
|
541
547
|
return 0;
|
|
542
548
|
}
|
|
549
|
+
async function cmdTemplates(args) {
|
|
550
|
+
const result = await listTemplates();
|
|
551
|
+
if (!result.ok) {
|
|
552
|
+
err(result.error ?? "failed to list templates");
|
|
553
|
+
return 1;
|
|
554
|
+
}
|
|
555
|
+
if (args.flags.json === true) {
|
|
556
|
+
out(JSON.stringify(result.templates, null, 2));
|
|
557
|
+
return 0;
|
|
558
|
+
}
|
|
559
|
+
const width = Math.max(...result.templates.map((t) => t.id.length)) + 2;
|
|
560
|
+
for (const t of result.templates) out(`${t.id.padEnd(width)}${t.description}`);
|
|
561
|
+
out("\nstart from one: molen new <name> --template <id>");
|
|
562
|
+
return 0;
|
|
563
|
+
}
|
|
543
564
|
async function cmdAsset(args) {
|
|
544
565
|
const sub = args.positionals[0];
|
|
545
566
|
if (sub === "import") {
|
|
@@ -1133,7 +1154,7 @@ async function cmdWorldgen(args) {
|
|
|
1133
1154
|
return 2;
|
|
1134
1155
|
}
|
|
1135
1156
|
async function cmdMcp() {
|
|
1136
|
-
const { startMcpServer } = await import("./mcp-
|
|
1157
|
+
const { startMcpServer } = await import("./mcp-AOfIp89b.mjs");
|
|
1137
1158
|
await startMcpServer();
|
|
1138
1159
|
return 0;
|
|
1139
1160
|
}
|
|
@@ -1260,6 +1281,7 @@ const CLI_COMMANDS = {
|
|
|
1260
1281
|
types: cmdTypes,
|
|
1261
1282
|
scripts: cmdScripts,
|
|
1262
1283
|
new: cmdNew,
|
|
1284
|
+
templates: cmdTemplates,
|
|
1263
1285
|
figure: cmdFigure,
|
|
1264
1286
|
worldgen: cmdWorldgen,
|
|
1265
1287
|
mcp: cmdMcp
|
|
@@ -107,7 +107,7 @@ rather than copying a linear buffer value into an sRGB authoring field.
|
|
|
107
107
|
|
|
108
108
|
Reuse the default pack's stable material IDs before adding another texture. The library already
|
|
109
109
|
contains brick, stucco, concrete, siding, stone, roofing and glazing; the
|
|
110
|
-
[material catalog](
|
|
110
|
+
[material catalog](https://github.com/bendyline/molen/blob/main/content/worldgen/materials/README.md) records intended
|
|
111
111
|
uses and physical repeat sizes.
|
|
112
112
|
|
|
113
113
|
Use 256² or 512² seamless procedural maps for common repeated surfaces. Larger textures belong
|
|
@@ -123,7 +123,7 @@ Runtime matgraph textures remain small and shared; they do not pass through asse
|
|
|
123
123
|
## Persisting reusable models
|
|
124
124
|
|
|
125
125
|
Store individual sign and furniture definitions in the default pack's
|
|
126
|
-
[landmark manifests](
|
|
126
|
+
[landmark manifests](https://github.com/bendyline/molen/blob/main/content/worldgen/landmarks/README.md), with stable IDs,
|
|
127
127
|
versioned parameters and shared generators. Keep source-ID/name matching in the Earth business
|
|
128
128
|
catalog. Reuse architectural styles and material graphs instead of copying their rules into each
|
|
129
129
|
mapped-business descriptor. A new store palette or an existing sign-symbol variation should be a
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
# 3D model assets
|
|
2
2
|
|
|
3
3
|
This is the shipped, agent-facing workflow for turning a prompt or supplied model into a textured
|
|
4
|
-
Molen asset. It covers the current engine
|
|
5
|
-
|
|
4
|
+
Molen asset. It covers the current engine and runs entirely from the published CLI
|
|
5
|
+
(`npx molen …` in a project that installs `@bendyline/molen-tooling`). Proposed pipeline
|
|
6
|
+
improvements live in the design plan,
|
|
7
|
+
[`docs/11-3d-model-assets.md`](https://github.com/bendyline/molen/blob/main/docs/11-3d-model-assets.md), which is historical and
|
|
8
|
+
may lag the code.
|
|
6
9
|
|
|
7
10
|
## What “done” means
|
|
8
11
|
|
|
@@ -76,7 +79,7 @@ Generators should preserve hand edits before writing any outputs. Record generat
|
|
|
76
79
|
hashes separately from the current imported source hash so an artist can edit and re-import a
|
|
77
80
|
master without rewriting its provenance. Verify the current source/runtime relationship with
|
|
78
81
|
Node checks; keep Python/DCC reproducibility checks in the optional authoring workflow. The
|
|
79
|
-
[Lantern Vault example contract](
|
|
82
|
+
[Lantern Vault example contract](https://github.com/bendyline/molen/blob/main/examples/ASSETS.md) implements both paths.
|
|
80
83
|
|
|
81
84
|
## 3. Author geometry for glTF
|
|
82
85
|
|
|
@@ -123,16 +126,15 @@ tools complement GLB-embedded PBR textures; they do not generate model geometry.
|
|
|
123
126
|
|
|
124
127
|
## 5. Import through the project
|
|
125
128
|
|
|
126
|
-
|
|
129
|
+
From inside the asset's Molen project, run:
|
|
127
130
|
|
|
128
131
|
```sh
|
|
129
|
-
molen asset import asset-src/red-barn/model-source.glb --id barn.weathered
|
|
130
|
-
molen asset inspect barn.weathered --verify
|
|
131
|
-
molen asset list
|
|
132
|
+
npx molen asset import asset-src/red-barn/model-source.glb --id barn.weathered
|
|
133
|
+
npx molen asset inspect barn.weathered --verify
|
|
134
|
+
npx molen asset list
|
|
132
135
|
```
|
|
133
136
|
|
|
134
|
-
|
|
135
|
-
the repository, `node <repo>/packages/tooling/dist/cli.mjs`. The importer writes
|
|
137
|
+
The importer writes
|
|
136
138
|
`assets/<id with dots as path>/model.glb`, creates `asset.json`, extracts per-node convex hulls,
|
|
137
139
|
and registers the sidecar in the surrounding `project.json`. Add `--trimesh` only when static,
|
|
138
140
|
concave collision justifies its extra size. Use `--project <project.json>` when project discovery
|
|
@@ -282,5 +284,7 @@ Keep a concise README or machine-readable build report next to the source. Recor
|
|
|
282
284
|
- exact import/inspect/validate/sim/shot commands and their outcomes;
|
|
283
285
|
- visible QA notes, known compromises, and the final screenshot path.
|
|
284
286
|
|
|
285
|
-
The runnable library asset
|
|
286
|
-
|
|
287
|
+
The runnable library asset
|
|
288
|
+
[`assets/structures/red-barn/`](https://github.com/bendyline/molen/tree/main/assets/structures/red-barn) in the engine
|
|
289
|
+
repository demonstrates this complete path with three embedded PBR textures and real-time Molen
|
|
290
|
+
shadows.
|
|
@@ -53,13 +53,12 @@ rotors, controls, gear, flaps and ailerons animate from simulation state.
|
|
|
53
53
|
|
|
54
54
|
## Reuse in another experience
|
|
55
55
|
|
|
56
|
-
Both aircraft ship in the `molen.entities` content pack
|
|
57
|
-
|
|
58
|
-
types; in a browser, open it with `openPack` from `@bendyline/molen-pack` and pass
|
|
56
|
+
Both aircraft ship in the `molen.entities` content pack, with their type documents and models.
|
|
57
|
+
`npx molen pack fetch https://molen.dev/packs/index.json molen.entities` downloads it and lists it
|
|
58
|
+
in your project.json `packs`, and the CLI then resolves the types; in a browser, open it with `openPack` from `@bendyline/molen-pack` and pass
|
|
59
59
|
`createPackSet([pack]).assetProvider()` as the client's asset provider. The entity type IDs and
|
|
60
|
-
glTF refs are `molen.entities.aircraft.p51d` and `molen.entities.aircraft.oh6`.
|
|
61
|
-
|
|
62
|
-
required to launch it.
|
|
60
|
+
glTF refs are `molen.entities.aircraft.p51d` and `molen.entities.aircraft.oh6`. Fly both in
|
|
61
|
+
[World Explorer](https://molen.dev/play/world-explorer/) to see the finished integration.
|
|
63
62
|
|
|
64
63
|
These are not kernel presets. Each type document contains the concrete aircraft's mass and center
|
|
65
64
|
of gravity, engine and thrust geometry, wing or rotor geometry, control response, lift/drag or
|
|
@@ -206,10 +205,10 @@ geometry; it does not model deformation or distant unloaded obstacles.
|
|
|
206
205
|
|
|
207
206
|
## Reproducible review
|
|
208
207
|
|
|
209
|
-
The source brief, generator, provenance and verification notes are in
|
|
210
|
-
the copyable [P-51 source bundle](
|
|
211
|
-
[OH-6 source bundle](
|
|
212
|
-
`content/entities/scenes/aircraft.scene.json` is the neutral apron scene. The browser flight
|
|
208
|
+
The source brief, generator, provenance and verification notes are in the engine repository, in
|
|
209
|
+
the copyable [P-51 source bundle](https://github.com/bendyline/molen/blob/main/content/entities/source/aircraft/p-51/README.md) and
|
|
210
|
+
[OH-6 source bundle](https://github.com/bendyline/molen/blob/main/content/entities/source/aircraft/oh-6/README.md).
|
|
211
|
+
`content/entities/scenes/aircraft.scene.json` there is the neutral apron scene. The browser flight
|
|
213
212
|
scenario is `examples/world-explorer/test/visual/aircraft.play.json`.
|
|
214
213
|
|
|
215
214
|
`packages/kernel/test/aircraft-performance.test.ts` exercises level acceleration, part-throttle
|
|
@@ -37,6 +37,10 @@ export default defineConfig({
|
|
|
37
37
|
plugins: [molenScripts()],
|
|
38
38
|
// Worker bundles have their own plugin pipeline in Vite, and the kernel runs in the Worker.
|
|
39
39
|
worker: { format: 'es', plugins: () => [molenScripts()] },
|
|
40
|
+
build: {
|
|
41
|
+
// Keep three.js and the client out of the entry chunk; see "Production builds" below.
|
|
42
|
+
rollupOptions: { output: { manualChunks: { vendor: ['three', '@bendyline/molen-client'] } } },
|
|
43
|
+
},
|
|
40
44
|
});
|
|
41
45
|
```
|
|
42
46
|
|
|
@@ -85,6 +89,16 @@ that actually initialized, and `client.renderer.fallbackReason` explains a fallb
|
|
|
85
89
|
[rendering backends](rendering-backends.md) for strict selection, material compatibility and
|
|
86
90
|
diagnostics.
|
|
87
91
|
|
|
92
|
+
### Production builds
|
|
93
|
+
|
|
94
|
+
A page that mounts with a top-level `await`, as above, needs three.js and
|
|
95
|
+
`@bendyline/molen-client` in a chunk of their own (the `manualChunks` line in the Vite config
|
|
96
|
+
above). The client lazy-loads its WebGPU driver. If the bundler leaves three.js and the client in
|
|
97
|
+
the entry chunk, that lazy chunk imports the entry while the entry is still suspended at the
|
|
98
|
+
`await`, the import never settles, and the built page stays blank in every browser with WebGPU,
|
|
99
|
+
with no error. The dev server does not bundle, so only the production build shows it. `molen new`
|
|
100
|
+
and every sample template already carry the setting.
|
|
101
|
+
|
|
88
102
|
## Feedback from the simulation
|
|
89
103
|
|
|
90
104
|
The client exposes what a HUD, sound, or win screen needs — no wire-protocol parsing:
|
|
@@ -56,7 +56,8 @@ cooperatively on the main thread; exterior generation continues through the exis
|
|
|
56
56
|
`molen/interior-catalog@1` is a registered JSON format. Validate it with
|
|
57
57
|
`molen validate catalog.json`; discover its fields with `molen schema get interior-catalog`.
|
|
58
58
|
The default style pack's `interiors/catalog.json` (in the `molen.worldgen.default` content pack,
|
|
59
|
-
source `content/worldgen/interiors/`) is a complete
|
|
59
|
+
source [`content/worldgen/interiors/`](https://github.com/bendyline/molen/tree/main/content/worldgen/interiors)) is a complete
|
|
60
|
+
editable starting catalog with 15 profiles:
|
|
60
61
|
|
|
61
62
|
| Program | Algorithm and furnishings |
|
|
62
63
|
| --- | --- |
|
|
@@ -132,7 +132,7 @@ Two constants live in `packages/kernel/src/version.ts` and they do different job
|
|
|
132
132
|
|
|
133
133
|
| Constant | Today | Role |
|
|
134
134
|
|---|---|---|
|
|
135
|
-
| `ENGINE_VERSION` | `0.0.
|
|
135
|
+
| `ENGINE_VERSION` | `0.0.2` | metadata. Written into a keyframe's `engine` field so a save says which build wrote it. **Never compared on load, never hashed.** |
|
|
136
136
|
| `STATE_FORMAT` | `1` | the gate. Written into a keyframe under the reserved `plugins.$format` key, compared by `applyKeyframeTo`, and folded into `stateHash` as `stateFormat`. |
|
|
137
137
|
|
|
138
138
|
So a release — even one that moves every package on the fixed version line — keeps your keyframes
|
|
@@ -188,10 +188,13 @@ identity the keyframe recorded.
|
|
|
188
188
|
|
|
189
189
|
## How to check it yourself
|
|
190
190
|
|
|
191
|
+
The commands below run in a copy of the Skybound sample, made from the npm packages with
|
|
192
|
+
`npx @bendyline/molen-tooling new skybound --template skybound` (then `cd skybound && npm install`).
|
|
193
|
+
|
|
191
194
|
**One run, one hash.**
|
|
192
195
|
|
|
193
196
|
```
|
|
194
|
-
molen sim run
|
|
197
|
+
npx molen sim run scene.json --ticks 30 --hash
|
|
195
198
|
```
|
|
196
199
|
|
|
197
200
|
```
|
|
@@ -210,7 +213,7 @@ same-JS-engine overall. Use the table above for the whole scene.
|
|
|
210
213
|
command log, and `expected.stateHash` plus `expected.tickHashes`.
|
|
211
214
|
|
|
212
215
|
```
|
|
213
|
-
molen replay
|
|
216
|
+
npx molen replay first-leap.replay.json
|
|
214
217
|
```
|
|
215
218
|
|
|
216
219
|
```
|
|
@@ -234,8 +237,8 @@ classifies what it finds:
|
|
|
234
237
|
→ if the change was intentional, re-record with: molen replay <fixture> --record
|
|
235
238
|
```
|
|
236
239
|
|
|
237
|
-
**Two regression artifacts per
|
|
238
|
-
|
|
240
|
+
**Two regression artifacts per sample, doing different jobs.** A pinned `stateHash` literal in a
|
|
241
|
+
sample's `test/headless.test.ts` freezes one run of the current build; a run compared with itself
|
|
239
242
|
only proves reproducibility, so that literal is what catches a refactor that quietly moved the
|
|
240
243
|
whole simulation. The committed `*.replay.json` beside the scene freezes the command log and the
|
|
241
244
|
per-tick hashes, so a failure names the tick. Keep both.
|
|
@@ -245,12 +248,14 @@ two snapshots, including continuation differences under the reserved `$world` ps
|
|
|
245
248
|
`molen sim watch scene.json --ticks N` reruns on every file change and reports hash flips, event
|
|
246
249
|
deltas and assertion transitions.
|
|
247
250
|
|
|
248
|
-
**Golden images** are a different mechanism with a different guarantee. `
|
|
249
|
-
|
|
250
|
-
PNG with a perceptual tolerance (per-pixel threshold 0.1, at most 0.3%
|
|
251
|
-
missing golden **fails** rather than adopting the candidate.
|
|
252
|
-
|
|
253
|
-
|
|
251
|
+
**Golden images** are a different mechanism with a different guarantee. `compareGolden` from
|
|
252
|
+
`@bendyline/molen-tooling` compares a render (from `molen shot`, or `screenshotScene` in a test)
|
|
253
|
+
against a committed PNG with a perceptual tolerance (per-pixel threshold 0.1, at most 0.3%
|
|
254
|
+
differing pixels by default). A missing golden **fails** rather than adopting the candidate.
|
|
255
|
+
Record with `UPDATE_GOLDENS=1`. The engine's own golden suites (`pnpm -r test:golden` in the
|
|
256
|
+
engine repository) render in a pinned headless Chromium on a software rasterizer, and their
|
|
257
|
+
authoritative refresh is the `update-goldens` workflow, which records on the same Ubuntu 24.04
|
|
258
|
+
runner as the CI golden job. Record your own goldens on one pinned machine for the same reason.
|
|
254
259
|
|
|
255
260
|
## What is not promised
|
|
256
261
|
|
|
@@ -7,12 +7,23 @@ there is no second entity or asset runtime.
|
|
|
7
7
|
The initial nature collection contains pine, fir, oak, birch, shrub, and boulder models under the
|
|
8
8
|
stable `molen.entities.*` namespace. Every model is a deterministic texture-free GLB with a
|
|
9
9
|
hash-verified sidecar, meter-scale bounds, a conservative collision hull, and a type definition.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
The npm package `@bendyline/molen-entities` carries only the id lists and helpers, no models or
|
|
11
|
+
type documents. Get the pack itself into a project with:
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
npx molen pack fetch https://molen.dev/packs/index.json molen.entities
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
That downloads the zip into `packs/` and pins it in project.json's `packs`, so `molen validate`,
|
|
18
|
+
`sim run` and the other ops resolve `molen.entities.*` types (`molen project info` lists them).
|
|
19
|
+
Serve the same zip with your app for the browser. The headless capture ops (`shot`, `drive`,
|
|
20
|
+
`frames`) draw only the models in the project's own `assets` today, so a pack model renders in the
|
|
21
|
+
browser through the asset provider below but not yet in a CLI capture. The pack's
|
|
22
|
+
source is [`content/entities/`](https://github.com/bendyline/molen/tree/main/content/entities) in
|
|
23
|
+
the engine repository, where its gallery scene is both an example and a headless render check.
|
|
13
24
|
|
|
14
25
|
Every concrete thing is authored as a [logical source bundle](source-bundles.md) under
|
|
15
|
-
`content/entities/source/<category>/<thing
|
|
26
|
+
[`content/entities/source/<category>/<thing>/`](https://github.com/bendyline/molen/tree/main/content/entities/source). Its local `source.json` inventories the definition,
|
|
16
27
|
model master or recipe, scripts, textures, sounds, and documentation. The package generator builds
|
|
17
28
|
the aggregate registry and gallery from those bundles; the aggregate files are compatibility and
|
|
18
29
|
runtime outputs, not a second authoring authority.
|
|
@@ -36,7 +47,7 @@ The entity type id and renderable asset ref are identical, such as
|
|
|
36
47
|
In code, read the documents the manifest `provides` as `types` and pass them to
|
|
37
48
|
`createTypeLibrary` from `@bendyline/molen-kernel/content`.
|
|
38
49
|
|
|
39
|
-
|
|
50
|
+
In the engine repository, run `molen asset list` in `content/entities`, `molen types check --project
|
|
40
51
|
content/entities/project.json`, or render `content/entities/scenes/gallery.scene.json` with
|
|
41
52
|
`molen shot`. The package generator is deterministic and its build fails when a checked-in GLB,
|
|
42
53
|
sidecar, types document, project, or gallery scene is stale.
|
|
@@ -1,33 +1,47 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Samples gallery
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
one demo.
|
|
3
|
+
Every sample is simultaneously a browser demo and a headless regression test, and each one is
|
|
4
|
+
meant to be copied. Three ways in, none of which needs a clone of the engine repository:
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
- **Play** any sample in the browser at [molen.dev/play](https://molen.dev/play/).
|
|
7
|
+
- **Copy** a sample into your own npm project with `--template`. The templates ship inside
|
|
8
|
+
`@bendyline/molen-tooling`, locked to the engine version you install, so they work offline:
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
```
|
|
11
|
+
npx @bendyline/molen-tooling new my-game --template skybound
|
|
12
|
+
cd my-game && npm install && npm run dev
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
`molen templates` lists them. A copy keeps whatever the sample has (scene, scripts, commands,
|
|
16
|
+
checks, replay fixture, headless tests), so `npx molen sim run`, `npx molen replay` and
|
|
17
|
+
`npm test` work in it straight away.
|
|
18
|
+
- **Read** the source on [GitHub](https://github.com/bendyline/molen/tree/main/examples).
|
|
19
|
+
|
|
20
|
+
| Sample | Shows | Play | Template |
|
|
12
21
|
|---|---|---|---|
|
|
13
|
-
| Cubes |
|
|
14
|
-
| Data viz |
|
|
15
|
-
|
|
|
16
|
-
|
|
|
17
|
-
| Figures gallery |
|
|
18
|
-
|
|
|
22
|
+
| Cubes | ~50 spinning/drifting cubes; a `spawn_cube` command; determinism across runs | [play](https://molen.dev/play/cubes/) | `cubes` |
|
|
23
|
+
| Data viz | data-driven entities (one per row) + a camera track | [play](https://molen.dev/play/data-viz/) | `data-viz` |
|
|
24
|
+
| Top-down arena | a complete small game as **pure data**: `scene.json` declares kinematics, the `move` command + WASD input, and four scripts (control/spawner/chaser/combat); no setup module | [play](https://molen.dev/play/top-down-arena/) | `top-down-arena` |
|
|
25
|
+
| Terrain flyover | chunked LOD terrain from a descriptor + deterministic 16-bit heightmap | [play](https://molen.dev/play/terrain-flyover/) | `terrain-flyover` |
|
|
26
|
+
| Figures gallery | a lineup of every figure preset, a body-type sweep, a hat on a head socket and a rider on a horse; `?walk=1` (or the `set_gait` command) animates the gaits in place | [play](https://molen.dev/play/figures-gallery/) | `figures-gallery` |
|
|
27
|
+
| World explorer | streamed Web Mercator terrain with adaptive package LOD, bare / land-classification / human-feature modes, and styled buildings from the default worldgen pack (`?style=`, `?synthetic=1&lineup=1`) | [play](https://molen.dev/play/world-explorer/) | [source](https://github.com/bendyline/molen/tree/main/examples/world-explorer) |
|
|
19
28
|
|
|
20
29
|
## Playable game samples
|
|
21
30
|
|
|
22
31
|
[Three complete games, one authoring path](game-samples.md) explains the shared infrastructure.
|
|
23
32
|
|
|
24
|
-
| Game |
|
|
25
|
-
|
|
26
|
-
| City Courier |
|
|
27
|
-
| The Lantern Vault |
|
|
28
|
-
| Skybound |
|
|
33
|
+
| Game | Demonstrates | Play | Template |
|
|
34
|
+
|---|---|---|---|
|
|
35
|
+
| City Courier | Arcade driving, traffic, five deliveries, damage, a time limit and restart | [play](https://molen.dev/play/city-courier/) | `city-courier` |
|
|
36
|
+
| The Lantern Vault | First-person exploration, melee rolls, inventory, a locked gate and victory | [play](https://molen.dev/play/lantern-dungeon/) | [source](https://github.com/bendyline/molen/tree/main/examples/lantern-dungeon) |
|
|
37
|
+
| Skybound | Side-scrolling jumps, one-way ledges, seeds, stomps, hazards and checkpoints | [play](https://molen.dev/play/skybound/) | `skybound` |
|
|
38
|
+
|
|
39
|
+
Each includes a command-only victory regression (`test/playthrough.test.js`) that proves the game
|
|
40
|
+
is winnable without a browser.
|
|
29
41
|
|
|
30
|
-
|
|
42
|
+
World Explorer and The Lantern Vault are not templates. They carry content (terrain tiles and 28
|
|
43
|
+
GLB models), and npm packages never include content. Their scenes and code are still the best
|
|
44
|
+
reference for streaming and for a glTF asset pipeline, so read them on GitHub.
|
|
31
45
|
|
|
32
46
|
## Capability layers used
|
|
33
47
|
|
|
@@ -53,6 +67,7 @@ Each includes a command-only victory regression and a real-browser gameplay test
|
|
|
53
67
|
|
|
54
68
|
## Start from scratch
|
|
55
69
|
|
|
56
|
-
`molen new <name>` scaffolds a runnable experience (scene with
|
|
57
|
-
setup + commands + checks + a Vite browser app) that already
|
|
58
|
-
and mounts in a page ([browser-mount.md](browser-mount.md)).
|
|
70
|
+
`molen new <name>` without `--template` scaffolds a minimal runnable experience (scene with
|
|
71
|
+
camera/input/commands + scripts + setup + commands + checks + a Vite browser app) that already
|
|
72
|
+
runs the [agent loop](agent-loop.md) and mounts in a page ([browser-mount.md](browser-mount.md)).
|
|
73
|
+
Then iterate.
|
|
@@ -5,9 +5,8 @@ experience, performs player-like inputs, and leaves screenshots plus diagnostics
|
|
|
5
5
|
inspect.
|
|
6
6
|
|
|
7
7
|
```sh
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
--out-dir .artifacts/world-explorer
|
|
8
|
+
npm run build # your app's static build, e.g. Vite's dist/
|
|
9
|
+
npx molen play dist --scenario walkthrough.play.json --out-dir .artifacts/walkthrough
|
|
11
10
|
```
|
|
12
11
|
|
|
13
12
|
The host uses an ephemeral localhost port and supports HTTP byte ranges, so PMTiles and other
|
|
@@ -4,17 +4,29 @@ The new samples exercise the same scene → `buildWorld` → Worker → `mountEx
|
|
|
4
4
|
CLI. Each is JSON data + scene scripts, with declared command/component schemas, input
|
|
5
5
|
bindings, semantic prefabs, durable state, a HUD, restart, and a tested win condition.
|
|
6
6
|
|
|
7
|
-
| Sample | Play
|
|
7
|
+
| Sample | Play | Loop | Engine services |
|
|
8
8
|
|---|---|---|---|
|
|
9
|
-
| City Courier |
|
|
10
|
-
| The Lantern Vault |
|
|
11
|
-
| Skybound |
|
|
9
|
+
| City Courier | [molen.dev/play/city-courier](https://molen.dev/play/city-courier/) | Five deliveries, traffic, damage and a time limit | XZ kinematics, hierarchy, follow camera |
|
|
10
|
+
| The Lantern Vault | [molen.dev/play/lantern-dungeon](https://molen.dev/play/lantern-dungeon/) | Key, melee combat, healing, gate and relic | XZ kinematics/raycast, seeded RNG, hierarchy, tween, local follow camera |
|
|
11
|
+
| Skybound | [molen.dev/play/skybound](https://molen.dev/play/skybound/) | Islands, seeds, stomps, hazards, checkpoint and finish | XY platform controller, hierarchy, world follow camera |
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
To take one apart, copy it into your own npm project:
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
npx @bendyline/molen-tooling new my-courier --template city-courier # or skybound
|
|
17
|
+
cd my-courier && npm install
|
|
18
|
+
npx molen sim run scene.json --ticks 90 --commands commands.json --assert checks.json --hash
|
|
19
|
+
npm test # includes the playthrough
|
|
20
|
+
npm run dev
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The Lantern Vault is not a template, because its 28 GLB models are content and npm packages never
|
|
24
|
+
include content. Play it at molen.dev and read it
|
|
25
|
+
[on GitHub](https://github.com/bendyline/molen/tree/main/examples/lantern-dungeon).
|
|
26
|
+
|
|
27
|
+
Each sample's README documents controls and the exact validate/simulate/assert/screenshot
|
|
28
|
+
commands. `test/playthrough.test.js` in each sample proves its objective is reachable using player
|
|
29
|
+
commands alone. Headless tests also verify checkpoint continuation.
|
|
18
30
|
|
|
19
31
|
## Follow cameras
|
|
20
32
|
|
|
@@ -89,12 +101,12 @@ asset/component APIs as the headless tools. Three creatures participate in comba
|
|
|
89
101
|
ambient dressing. The project index maps every model to a sidecar under `public/assets/`, so Vite
|
|
90
102
|
serves the same files that CLI captures verify.
|
|
91
103
|
|
|
92
|
-
See the [illustrated catalog](
|
|
93
|
-
[editable sources and regeneration guide](
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
104
|
+
See the [illustrated catalog](https://github.com/bendyline/molen/blob/main/examples/lantern-dungeon/asset-src/CATALOG.md)
|
|
105
|
+
and the [editable sources and regeneration guide](https://github.com/bendyline/molen/blob/main/examples/lantern-dungeon/asset-src/README.md).
|
|
106
|
+
The [example asset contract](https://github.com/bendyline/molen/blob/main/examples/ASSETS.md)
|
|
107
|
+
keeps editable masters and optimized runtime copies separately. The dungeon supports hand-edited
|
|
108
|
+
GLBs, protects them from accidental regeneration, and checks source/runtime freshness with a
|
|
109
|
+
Node-only verification script. [3D model assets](3d-model-assets.md) describes the same workflow
|
|
110
|
+
for your own project with the published CLI (`molen asset import`, `asset inspect --verify`,
|
|
111
|
+
`asset shot`). All three game builds use relative URLs, so each one can be hosted beneath a
|
|
112
|
+
subdirectory, as molen.dev/play does.
|
|
@@ -48,8 +48,28 @@ the same trust and determinism rules as scene scripts apply.
|
|
|
48
48
|
## Content packs (`packs`)
|
|
49
49
|
|
|
50
50
|
Shared content (entity types and models, style packs, catalogs) is not in any npm package; it
|
|
51
|
-
comes in content packs, `molen/pack@1` zip files built with `molen pack build`.
|
|
52
|
-
|
|
51
|
+
comes in content packs, `molen/pack@1` zip files built with `molen pack build`. Molen's own packs
|
|
52
|
+
are published with each release at `https://molen.dev/packs/`, listed by a `molen/pack-index@1`
|
|
53
|
+
index:
|
|
54
|
+
|
|
55
|
+
| Pack | What it carries |
|
|
56
|
+
| --- | --- |
|
|
57
|
+
| `molen.entities` | Entity types and models: trees, a shrub, a boulder, aircraft and road vehicles ([entities](entities.md)) |
|
|
58
|
+
| `molen.worldgen.default` | The default style pack: archstyles, materials, scatter rules, landmarks, 120 structures ([worldgen](worldgen.md)) |
|
|
59
|
+
| `molen.earth` | The region atlas and the business identity catalog ([recognizable places](recognizable-places.md)) |
|
|
60
|
+
| `molen.sky` | The Bright Star Catalogue as `molen/stars@1` columns ([sky](sky.md)) |
|
|
61
|
+
|
|
62
|
+
```sh
|
|
63
|
+
npx molen pack fetch https://molen.dev/packs/index.json # all of them
|
|
64
|
+
npx molen pack fetch https://molen.dev/packs/index.json molen.entities # just one
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
`pack fetch` downloads into `packs/` beside project.json and pins each pack's `contentHash` in
|
|
68
|
+
the project's `packs`, so the project keeps working offline and a later re-publish never changes
|
|
69
|
+
it underneath you. A browser app serves the same zips from wherever it hosts its static files.
|
|
70
|
+
|
|
71
|
+
A project lists the packs it uses, in order, and their types join the registry like the
|
|
72
|
+
project's own:
|
|
53
73
|
|
|
54
74
|
```json
|
|
55
75
|
{
|