@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
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { $ as
|
|
2
|
+
import { $ as packAsset, A as inspectContentPack, B as OPS_CATALOG, C as checkTypesOp, D as buildContentPack, E as reserveNamespace, F as listFigurePresets, G as planAudio, H as formatOp, I as exportFrames, K as importSound, L as driveScene, M as generateTypes, O as extractContentPack, P as previewFigure, Q as formatPacked, S as rasterizeMaterial, T as projectInfo, U as checkScripts, V as describeOps, X as screenshotAsset, Y as stageAssets, Z as formatBytes, _ as loadComponentRegistry, b as diffSnapshots, c as validateAsset, d as runSimulation, et as inspectAsset, 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 checkSoundbank, r as previewWorldgen, rt as importAsset, s as simWatch, t as formatWorldgenStats, tt as listAssets, u as testTypes, ut as playExperience, v as scaffoldExperience, w as listTypes, x as runReplayFile, y as listTemplates, z as searchDocs } from "./ops-BPdHodFR.mjs";
|
|
3
3
|
import { dirname, join } from "node:path";
|
|
4
4
|
import { readFileSync } from "node:fs";
|
|
5
5
|
import { formatIssues } from "@bendyline/molen-schema";
|
|
@@ -198,8 +198,8 @@ async function cmdSim(args) {
|
|
|
198
198
|
projectPath: str(args.flags.project),
|
|
199
199
|
onRun: (result, diff) => {
|
|
200
200
|
const stamp = `— tick ${result.tick}, ${result.eventCount} events`;
|
|
201
|
-
if (result.error !== void 0) err(
|
|
202
|
-
else out(`${result.ok ? "✓" : "
|
|
201
|
+
if (result.error !== void 0) err(`× ${result.error}`);
|
|
202
|
+
else out(`${result.ok ? "✓" : "×"} ${stamp} [${diff}]`);
|
|
203
203
|
if (result.assertionsFormatted !== void 0) out(result.assertionsFormatted);
|
|
204
204
|
}
|
|
205
205
|
});
|
|
@@ -418,7 +418,7 @@ async function cmdReplay(args) {
|
|
|
418
418
|
err(result.error);
|
|
419
419
|
return 1;
|
|
420
420
|
}
|
|
421
|
-
out(result.report ?? (result.ok ? "✓ replay matches" : "
|
|
421
|
+
out(result.report ?? (result.ok ? "✓ replay matches" : "× replay diverged"));
|
|
422
422
|
return result.ok ? 0 : 1;
|
|
423
423
|
}
|
|
424
424
|
async function cmdDiff(args) {
|
|
@@ -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,18 +546,38 @@ 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") {
|
|
546
567
|
const path = args.positionals[1];
|
|
547
568
|
if (path === void 0) {
|
|
548
|
-
err("usage: molen asset import <file.glb> [--id <asset-id>] [--trimesh] [--no-optimize] [--out-dir <d>] [--project <project.json>] [--force]");
|
|
569
|
+
err("usage: molen asset import <file.glb> [--id <asset-id>] [--trimesh] [--no-optimize] [--out-dir <d>] [--asset-dir <d>] [--project <project.json>] [--force]");
|
|
570
|
+
return 2;
|
|
571
|
+
}
|
|
572
|
+
if (args.flags["asset-dir"] !== void 0 && typeof args.flags["asset-dir"] !== "string") {
|
|
573
|
+
err("--asset-dir requires a directory value");
|
|
549
574
|
return 2;
|
|
550
575
|
}
|
|
551
576
|
const r = await importAsset({
|
|
552
577
|
path,
|
|
553
578
|
id: str(args.flags.id),
|
|
554
579
|
outDir: str(args.flags["out-dir"]),
|
|
580
|
+
assetDir: str(args.flags["asset-dir"]),
|
|
555
581
|
trimesh: args.flags.trimesh === true,
|
|
556
582
|
...args.flags["no-optimize"] === true ? { optimize: false } : {},
|
|
557
583
|
projectPath: str(args.flags.project),
|
|
@@ -683,6 +709,100 @@ async function cmdAsset(args) {
|
|
|
683
709
|
err("usage: molen asset import <file> | inspect <ref> [--verify] | list | shot <ref> --out-dir <d> | pack <ref>|--all | stage --out-dir <d>");
|
|
684
710
|
return 2;
|
|
685
711
|
}
|
|
712
|
+
const AUDIO_USAGE = "usage: molen audio plan <scene|name> --ticks <N> [--bank b.json,…] [--listener id] [--mode m] [--weather w] [--daylight d] [--json] | import <file> --id <id> --bank <bank.json> --license <spdx> [options] | check <bank.json>";
|
|
713
|
+
function numFlag(v) {
|
|
714
|
+
if (typeof v !== "string") return void 0;
|
|
715
|
+
const n = Number(v);
|
|
716
|
+
return Number.isFinite(n) ? n : void 0;
|
|
717
|
+
}
|
|
718
|
+
async function cmdAudio(args) {
|
|
719
|
+
const [sub, target] = args.positionals;
|
|
720
|
+
if (sub === "plan" && target !== void 0) {
|
|
721
|
+
const ticks = typeof args.flags.ticks === "string" ? Number(args.flags.ticks) : 0;
|
|
722
|
+
if (!Number.isInteger(ticks) || ticks <= 0) {
|
|
723
|
+
err("--ticks <N> is required and must be a positive integer");
|
|
724
|
+
return 2;
|
|
725
|
+
}
|
|
726
|
+
const bank = str(args.flags.bank);
|
|
727
|
+
const r = await planAudio({
|
|
728
|
+
scenePath: target,
|
|
729
|
+
ticks,
|
|
730
|
+
...bank !== void 0 ? { bankPaths: bank.split(",").filter((b) => b.length > 0) } : {},
|
|
731
|
+
...str(args.flags.commands) !== void 0 ? { commandsPath: str(args.flags.commands) } : {},
|
|
732
|
+
...str(args.flags.setup) !== void 0 ? { setupModule: str(args.flags.setup) } : {},
|
|
733
|
+
...str(args.flags.listener) !== void 0 ? { listener: str(args.flags.listener) } : {},
|
|
734
|
+
...str(args.flags.mode) !== void 0 ? { mode: str(args.flags.mode) } : {},
|
|
735
|
+
...str(args.flags.weather) !== void 0 ? { weather: str(args.flags.weather) } : {},
|
|
736
|
+
...numFlag(args.flags.daylight) !== void 0 ? { daylight: numFlag(args.flags.daylight) } : {},
|
|
737
|
+
...str(args.flags.project) !== void 0 ? { projectPath: str(args.flags.project) } : {}
|
|
738
|
+
});
|
|
739
|
+
if (r.error !== void 0) {
|
|
740
|
+
err(r.error);
|
|
741
|
+
return 1;
|
|
742
|
+
}
|
|
743
|
+
if (args.flags.json === true) out(JSON.stringify(r, null, 2));
|
|
744
|
+
else out(r.timeline);
|
|
745
|
+
return r.ok ? 0 : 1;
|
|
746
|
+
}
|
|
747
|
+
if (sub === "import" && target !== void 0) {
|
|
748
|
+
const id = str(args.flags.id);
|
|
749
|
+
const bankPath = str(args.flags.bank);
|
|
750
|
+
const license = str(args.flags.license);
|
|
751
|
+
if (id === void 0 || bankPath === void 0 || license === void 0) {
|
|
752
|
+
err(AUDIO_USAGE);
|
|
753
|
+
return 2;
|
|
754
|
+
}
|
|
755
|
+
const optional = {
|
|
756
|
+
source: str(args.flags.source),
|
|
757
|
+
site: str(args.flags.site),
|
|
758
|
+
author: str(args.flags.author),
|
|
759
|
+
prompt: str(args.flags.prompt),
|
|
760
|
+
generator: str(args.flags.generator),
|
|
761
|
+
description: str(args.flags.description),
|
|
762
|
+
bus: str(args.flags.bus),
|
|
763
|
+
copyTo: str(args.flags["copy-to"]),
|
|
764
|
+
loopStart: numFlag(args.flags["loop-start"]),
|
|
765
|
+
loopEnd: numFlag(args.flags["loop-end"]),
|
|
766
|
+
gain: numFlag(args.flags.gain),
|
|
767
|
+
durationS: numFlag(args.flags.duration),
|
|
768
|
+
loop: args.flags.loop === true ? true : void 0,
|
|
769
|
+
append: args.flags.append === true ? true : void 0
|
|
770
|
+
};
|
|
771
|
+
const r = await importSound({
|
|
772
|
+
file: target,
|
|
773
|
+
id,
|
|
774
|
+
bankPath,
|
|
775
|
+
license,
|
|
776
|
+
...Object.fromEntries(Object.entries(optional).filter(([, v]) => v !== void 0))
|
|
777
|
+
});
|
|
778
|
+
for (const w of r.warnings) err(`! ${w}`);
|
|
779
|
+
if (!r.ok) {
|
|
780
|
+
err(r.error ?? "audio import failed");
|
|
781
|
+
return 1;
|
|
782
|
+
}
|
|
783
|
+
const d = r.entry?.durationS;
|
|
784
|
+
out(`${r.id}: ${r.clip}${d !== void 0 ? ` (${d}s)` : ""} -> ${r.bankPath}`);
|
|
785
|
+
return 0;
|
|
786
|
+
}
|
|
787
|
+
if (sub === "check" && target !== void 0) {
|
|
788
|
+
const r = await checkSoundbank({ bankPath: target });
|
|
789
|
+
if (r.error !== void 0) {
|
|
790
|
+
err(r.error);
|
|
791
|
+
return 1;
|
|
792
|
+
}
|
|
793
|
+
for (const issue of r.issues) (issue.severity === "error" ? err : out)(`${issue.severity === "error" ? "✗" : "·"} ${issue.path}: ${issue.message}`);
|
|
794
|
+
const licenses = Object.entries(r.licenses).map(([l, n]) => `${l} ×${n}`).join(", ");
|
|
795
|
+
const summary = `${r.sounds} sounds, ${r.clips} clips, ${formatBytes(r.bytes)}; ${licenses || "no sounds"}`;
|
|
796
|
+
if (!r.ok) {
|
|
797
|
+
err(`${r.id}: problems found (${summary})`);
|
|
798
|
+
return 1;
|
|
799
|
+
}
|
|
800
|
+
out(`✓ ${r.id}: ${summary}`);
|
|
801
|
+
return 0;
|
|
802
|
+
}
|
|
803
|
+
err(AUDIO_USAGE);
|
|
804
|
+
return 2;
|
|
805
|
+
}
|
|
686
806
|
const PACK_USAGE = "usage: molen pack build <sourceDir> --out-dir <d> [--no-solid] | inspect <source> | verify <source> | extract <source> --out-dir <d> | fetch <url> [ids…] [--out-dir <d>] [--project <path>]";
|
|
687
807
|
async function cmdPack(args) {
|
|
688
808
|
const [sub, target, ...rest] = args.positionals;
|
|
@@ -869,7 +989,7 @@ async function cmdScripts(args) {
|
|
|
869
989
|
return 1;
|
|
870
990
|
}
|
|
871
991
|
for (const d of r.diagnostics ?? []) err(`${d.file}:${d.line}:${d.column} ${d.code}: ${d.message}`);
|
|
872
|
-
out(r.ok ? `✓ ${r.checked ?? 0} script${r.checked === 1 ? "" : "s"} type-check clean` :
|
|
992
|
+
out(r.ok ? `✓ ${r.checked ?? 0} script${r.checked === 1 ? "" : "s"} type-check clean` : `× ${(r.diagnostics ?? []).length} problem(s) in ${r.checked ?? 0} script(s)`);
|
|
873
993
|
return r.ok ? 0 : 1;
|
|
874
994
|
}
|
|
875
995
|
async function cmdTypes(args) {
|
|
@@ -892,7 +1012,7 @@ async function cmdTypes(args) {
|
|
|
892
1012
|
}
|
|
893
1013
|
if ((r.issues ?? []).length > 0) err(formatIssues("project types", r.issues ?? []));
|
|
894
1014
|
if (r.codegenStale === true) err("codegen is stale — run: molen types gen");
|
|
895
|
-
out(r.ok ? "✓ types check passed" : "
|
|
1015
|
+
out(r.ok ? "✓ types check passed" : "× types check failed");
|
|
896
1016
|
return r.ok ? 0 : 1;
|
|
897
1017
|
}
|
|
898
1018
|
if (sub === "reserve") {
|
|
@@ -926,7 +1046,7 @@ async function cmdTypes(args) {
|
|
|
926
1046
|
return 1;
|
|
927
1047
|
}
|
|
928
1048
|
if (args.flags.check === true) {
|
|
929
|
-
out(r.stale === true ?
|
|
1049
|
+
out(r.stale === true ? `× ${r.outPath} is stale — run: molen types gen` : "✓ codegen up to date");
|
|
930
1050
|
return r.ok ? 0 : 1;
|
|
931
1051
|
}
|
|
932
1052
|
out(`wrote ${r.outPath} (${r.componentCount} components, ${r.typeCount} types)`);
|
|
@@ -944,7 +1064,7 @@ async function cmdTypes(args) {
|
|
|
944
1064
|
return 1;
|
|
945
1065
|
}
|
|
946
1066
|
for (const t of r.results ?? []) {
|
|
947
|
-
out(`${t.ok ? "✓" : "
|
|
1067
|
+
out(`${t.ok ? "✓" : "×"} ${t.id}${t.error !== void 0 ? ` — ${t.error}` : ""}`);
|
|
948
1068
|
for (const issue of t.issues ?? []) out(` ${issue.path}: ${issue.message}`);
|
|
949
1069
|
}
|
|
950
1070
|
return r.ok ? 0 : 1;
|
|
@@ -1133,7 +1253,7 @@ async function cmdWorldgen(args) {
|
|
|
1133
1253
|
return 2;
|
|
1134
1254
|
}
|
|
1135
1255
|
async function cmdMcp() {
|
|
1136
|
-
const { startMcpServer } = await import("./mcp-
|
|
1256
|
+
const { startMcpServer } = await import("./mcp-BTVwVKFb.mjs");
|
|
1137
1257
|
await startMcpServer();
|
|
1138
1258
|
return 0;
|
|
1139
1259
|
}
|
|
@@ -1254,12 +1374,14 @@ const CLI_COMMANDS = {
|
|
|
1254
1374
|
describe: cmdDescribe,
|
|
1255
1375
|
asset: cmdAsset,
|
|
1256
1376
|
pack: cmdPack,
|
|
1377
|
+
audio: cmdAudio,
|
|
1257
1378
|
drive: cmdDrive,
|
|
1258
1379
|
play: cmdPlay,
|
|
1259
1380
|
project: cmdProject,
|
|
1260
1381
|
types: cmdTypes,
|
|
1261
1382
|
scripts: cmdScripts,
|
|
1262
1383
|
new: cmdNew,
|
|
1384
|
+
templates: cmdTemplates,
|
|
1263
1385
|
figure: cmdFigure,
|
|
1264
1386
|
worldgen: cmdWorldgen,
|
|
1265
1387
|
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
|
|
|
@@ -91,6 +94,22 @@ Use glTF 2.0 conventions and these Molen authoring expectations:
|
|
|
91
94
|
- prefer a self-contained GLB for reliable serving and capture;
|
|
92
95
|
- avoid extensions unless the client has the required decoder configuration.
|
|
93
96
|
|
|
97
|
+
World-viewer structures can also bind reusable surfaces through material
|
|
98
|
+
`extras.molenSurface`, preserving a portable fallback inside the GLB. See
|
|
99
|
+
[shared architectural surfaces](earth-view.md#shared-architectural-surfaces) for the
|
|
100
|
+
reference contract, metric UV scale, tinting and shared texture lifetime. Keep unique signs,
|
|
101
|
+
murals and facade art as their own materials. Inspect the model in the Earth renderer as well
|
|
102
|
+
as its portable asset preview when it uses these bindings.
|
|
103
|
+
|
|
104
|
+
Choose a continuous surface for individually modeled stones: `stone_limestone_raw` has subtle
|
|
105
|
+
pores and mineral mottling with a 1.2 × 1.2 m repeat. `stone_limestone_weathered` uses the same
|
|
106
|
+
scale with stronger mineral variation, dark patina and open pores for exposed ancient stones.
|
|
107
|
+
Both keep the stone joints in the geometry. The separate `stone_limestone` graph includes
|
|
108
|
+
ashlar joints and belongs on a wall where the courses are supplied by the material.
|
|
109
|
+
`stone_sandstone_raw` and `stone_basalt_raw` provide continuous sediment grain and volcanic
|
|
110
|
+
grain at the same 1.2 m repeat for modeled stones. Their coursed counterparts supply block
|
|
111
|
+
joints for simpler wall meshes. Keep sediment bands horizontal with metric, surface-aligned UVs.
|
|
112
|
+
|
|
94
113
|
The importer decodes supported input, then deduplicates, prunes, welds, and quantizes by default.
|
|
95
114
|
Use `--no-optimize` only to diagnose a transformation issue. Repeating UVs outside `[0,1]` are
|
|
96
115
|
valid, but the optimizer currently leaves those UV accessors unquantized and reports that choice.
|
|
@@ -123,21 +142,27 @@ tools complement GLB-embedded PBR textures; they do not generate model geometry.
|
|
|
123
142
|
|
|
124
143
|
## 5. Import through the project
|
|
125
144
|
|
|
126
|
-
|
|
145
|
+
From inside the asset's Molen project, run:
|
|
127
146
|
|
|
128
147
|
```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
|
|
148
|
+
npx molen asset import asset-src/red-barn/model-source.glb --id barn.weathered
|
|
149
|
+
npx molen asset inspect barn.weathered --verify
|
|
150
|
+
npx molen asset list
|
|
132
151
|
```
|
|
133
152
|
|
|
134
|
-
|
|
135
|
-
the repository, `node <repo>/packages/tooling/dist/cli.mjs`. The importer writes
|
|
153
|
+
For a new asset, the importer writes
|
|
136
154
|
`assets/<id with dots as path>/model.glb`, creates `asset.json`, extracts per-node convex hulls,
|
|
137
155
|
and registers the sidecar in the surrounding `project.json`. Add `--trimesh` only when static,
|
|
138
156
|
concave collision justifies its extra size. Use `--project <project.json>` when project discovery
|
|
139
157
|
from the current directory would be ambiguous.
|
|
140
158
|
|
|
159
|
+
To organize bundles independently of stable asset IDs, pass `--asset-dir <directory>`
|
|
160
|
+
(MCP/API: `assetDir`) for the exact folder containing `asset.json`, `model.glb` and collision data.
|
|
161
|
+
Relative paths resolve from the working directory. Reimporting an existing ID with `--force`
|
|
162
|
+
and neither directory override preserves its registered path. `--out-dir` instead selects an
|
|
163
|
+
assets root and appends the dotted ID as directories; it cannot be combined with `--asset-dir`.
|
|
164
|
+
A destination belonging to a different asset ID is rejected even with `--force`.
|
|
165
|
+
|
|
141
166
|
`asset inspect --verify` must pass before the asset is placed in a scene. Review its bounds,
|
|
142
167
|
triangle/vertex counts, material slots, textures, animation clips, extensions, and collision hulls;
|
|
143
168
|
“readable GLB” is not enough.
|
|
@@ -259,8 +284,8 @@ With `variant`, a convention-resolved id fetches `model.ktx2.glb` first and fall
|
|
|
259
284
|
uses Draco; canonical imported assets never do.
|
|
260
285
|
|
|
261
286
|
`molen asset stage` produces the runtime bundle in one step — every registered asset's runtime
|
|
262
|
-
files copied under an output directory
|
|
263
|
-
plus `assets.index.json` for the client's `index` option:
|
|
287
|
+
files copied under an output directory with their registered relative layout
|
|
288
|
+
plus `assets.index.json` for the client's `index` option. Use that index for custom bundle paths:
|
|
264
289
|
|
|
265
290
|
```sh
|
|
266
291
|
molen asset stage --out-dir public --variant ktx2 --require-variant
|
|
@@ -273,6 +298,15 @@ release build; the app half is the normal Vite build.
|
|
|
273
298
|
|
|
274
299
|
## 9. Record evidence
|
|
275
300
|
|
|
301
|
+
For a landmark collection whose buildings occupy separate sites, keep each building as an
|
|
302
|
+
independent asset and geographic placement. The repository's next-1,000 catalog declares
|
|
303
|
+
required members in `content/worldgen/source/next-1000/collections.json`; the authoring/import
|
|
304
|
+
commands expand a collection ID to its authored members, while readiness requires every
|
|
305
|
+
declared member's own current source, import and inspected render/placement evidence. A
|
|
306
|
+
collection never supplies a composite GLB or centroid placement. Reuse an existing exact
|
|
307
|
+
building identity when one is already registered. Runtime spatial selection still operates on
|
|
308
|
+
individual placements and fetches only the nearby models.
|
|
309
|
+
|
|
276
310
|
Keep a concise README or machine-readable build report next to the source. Record:
|
|
277
311
|
|
|
278
312
|
- the original asset prompt and all material-generation prompts;
|
|
@@ -282,5 +316,7 @@ Keep a concise README or machine-readable build report next to the source. Recor
|
|
|
282
316
|
- exact import/inspect/validate/sim/shot commands and their outcomes;
|
|
283
317
|
- visible QA notes, known compromises, and the final screenshot path.
|
|
284
318
|
|
|
285
|
-
The runnable library asset
|
|
286
|
-
|
|
319
|
+
The runnable library asset
|
|
320
|
+
[`assets/structures/red-barn/`](https://github.com/bendyline/molen/tree/main/assets/structures/red-barn) in the engine
|
|
321
|
+
repository demonstrates this complete path with three embedded PBR textures and real-time Molen
|
|
322
|
+
shadows.
|
|
@@ -13,6 +13,10 @@ and slow-frame/p90 statistics, and waits for warmup and sustained overload befor
|
|
|
13
13
|
Memory pressure can also lower detail. Recovery requires stable headroom, no pending streaming,
|
|
14
14
|
and memory margin in displayed content; failed upward probes increase the recovery delay. Hidden intervals and
|
|
15
15
|
isolated long pauses reset or bypass measurements instead of being mistaken for normal rendering.
|
|
16
|
+
While content streams, slow frames lower detail only when the measured CPU/GPU frame work is itself
|
|
17
|
+
heavy: streaming work runs outside the frame, and a lower tier would restart it. After a memory
|
|
18
|
+
step, the controller lets that step's lower-detail replacements load (up to the recovery delay)
|
|
19
|
+
before stepping again, since retained content keeps displayed bytes high until they arrive.
|
|
16
20
|
|
|
17
21
|
The explorer applies each tier to drawing-buffer resolution, terrain screen-space error and
|
|
18
22
|
range, selected/resident tile limits, terrain and semantic request concurrency, worldgen cache
|
|
@@ -36,7 +36,7 @@ project scene names too: `molen sim run main --ticks 30`.
|
|
|
36
36
|
|
|
37
37
|
## 2. Validate (the inner loop — cheap, do it constantly)
|
|
38
38
|
|
|
39
|
-
```
|
|
39
|
+
```sh
|
|
40
40
|
molen validate scene.json
|
|
41
41
|
```
|
|
42
42
|
|
|
@@ -45,7 +45,7 @@ did-you-mean. Fix and repeat until clean.
|
|
|
45
45
|
|
|
46
46
|
## 3. Simulate N ticks headlessly
|
|
47
47
|
|
|
48
|
-
```
|
|
48
|
+
```sh
|
|
49
49
|
molen sim run scene.json --ticks 300 --setup ./setup.mjs --hash
|
|
50
50
|
```
|
|
51
51
|
|
|
@@ -65,7 +65,7 @@ Author an assertion document (`checks.json`) and pass `--assert`:
|
|
|
65
65
|
] }
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
```
|
|
68
|
+
```sh
|
|
69
69
|
molen sim run scene.json --ticks 300 --setup ./setup.mjs --assert checks.json
|
|
70
70
|
```
|
|
71
71
|
|
|
@@ -74,7 +74,7 @@ like `.health.hp` or `.transform.pos[1]`. The command exits non-zero if any asse
|
|
|
74
74
|
|
|
75
75
|
## 5. Screenshot (then look at it)
|
|
76
76
|
|
|
77
|
-
```
|
|
77
|
+
```sh
|
|
78
78
|
molen shot scene.json --ticks 300 --setup ./setup.mjs --camera 0,6,24 --look 0,0,0 --size 1280x720 --out shot.png
|
|
79
79
|
```
|
|
80
80
|
|
|
@@ -84,7 +84,7 @@ right; read the PNG when you need to judge appearance.
|
|
|
84
84
|
|
|
85
85
|
## 6. PLAY it (drive: commands in, frames out)
|
|
86
86
|
|
|
87
|
-
```
|
|
87
|
+
```sh
|
|
88
88
|
molen drive scene.json --actions actions.json --out-dir shots/ --assert checks.json
|
|
89
89
|
```
|
|
90
90
|
|
|
@@ -116,7 +116,7 @@ itself — what reproduces at which level, what breaks it, and what is not promi
|
|
|
116
116
|
[determinism.md](determinism.md). To debug a specific run, record a `*.replay.json` fixture
|
|
117
117
|
(scene + command log), then:
|
|
118
118
|
|
|
119
|
-
```
|
|
119
|
+
```sh
|
|
120
120
|
molen replay demo.replay.json --setup ./setup.mjs # ✓ matches, or localizes divergence
|
|
121
121
|
molen replay demo.replay.json --setup ./setup.mjs --record # (re)record expected hashes
|
|
122
122
|
```
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# Aircraft in the world explorer
|
|
2
2
|
|
|
3
|
-
See [Vehicle interiors and instruments](vehicle-interiors.md) for cockpit source files,
|
|
4
|
-
per-model instrument bindings and the shared exterior/seated GLB contract.
|
|
5
|
-
|
|
6
3
|
The world explorer includes a P-51D Mustang and OH-6 interpretation, each with an editable
|
|
7
|
-
GLB, reusable entity type, flight physics, an instrumented cockpit and a chase camera.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
GLB, reusable entity type, flight physics, an instrumented cockpit and a chase camera.
|
|
5
|
+
|
|
6
|
+
Use the **P-51 Mustang** or **OH-6** buttons to visit the practice airfield, then press **E** to
|
|
7
|
+
board. The aircraft buttons also work from the example hub's world view. A direct link can use
|
|
8
|
+
`?aircraft=p51d` or `?aircraft=oh6`. See [Vehicle interiors and instruments](vehicle-interiors.md)
|
|
9
|
+
for cockpit source files, per-model instrument bindings and the shared exterior/seated GLB
|
|
10
|
+
contract.
|
|
11
11
|
|
|
12
12
|
The practice airfield is a raised 900-meter runway and helipad near the initial camera position.
|
|
13
13
|
Its foundation clears streamed buildings; it is a fictional practice location, not a mapped airport.
|
|
@@ -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
|
|
@@ -108,6 +107,15 @@ and `airplane.yawStability` sets sideslip restoring response (1/s at reference a
|
|
|
108
107
|
The authored engine thrust axis is respected. Engine positions relative to the center of mass
|
|
109
108
|
produce thrust-induced yaw; wing position remains metadata rather than a distributed lift model.
|
|
110
109
|
|
|
110
|
+
## Engine sound
|
|
111
|
+
|
|
112
|
+
The P-51D carries an `audioSource` that plays `aircraft.engine.piston`, a Rolls-Royce Merlin
|
|
113
|
+
recording. The OH-6 plays `aircraft.engine.helicopter`. Both take pitch and gain from
|
|
114
|
+
`aircraftState.rpm`: they are silent until `I` starts the engine, and spool up and down with it.
|
|
115
|
+
The OH-6 also leans a little on `aircraftInput.power`, since its governed rotor holds rpm while the
|
|
116
|
+
collective changes load. Any host that plays audio from the entity world hears them with no extra
|
|
117
|
+
code; see [Sound and music](audio.md).
|
|
118
|
+
|
|
111
119
|
## Multiple engines and engine failures
|
|
112
120
|
|
|
113
121
|
An airplane can keep the existing `spec.engine` (implicitly named `main`), or replace it with a
|
|
@@ -206,10 +214,10 @@ geometry; it does not model deformation or distant unloaded obstacles.
|
|
|
206
214
|
|
|
207
215
|
## Reproducible review
|
|
208
216
|
|
|
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
|
|
217
|
+
The source brief, generator, provenance and verification notes are in the engine repository, in
|
|
218
|
+
the copyable [P-51 source bundle](https://github.com/bendyline/molen/blob/main/content/entities/source/aircraft/p-51/README.md) and
|
|
219
|
+
[OH-6 source bundle](https://github.com/bendyline/molen/blob/main/content/entities/source/aircraft/oh-6/README.md).
|
|
220
|
+
`content/entities/scenes/aircraft.scene.json` there is the neutral apron scene. The browser flight
|
|
213
221
|
scenario is `examples/world-explorer/test/visual/aircraft.play.json`.
|
|
214
222
|
|
|
215
223
|
`packages/kernel/test/aircraft-performance.test.ts` exercises level acceleration, part-throttle
|