@bendyline/molen-tooling 0.0.2 → 0.0.4
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 +4 -4
- package/dist/capture/harness.js +222 -222
- package/dist/capture/worldgen-preview.js +288 -288
- package/dist/cli.mjs +162 -10
- package/dist/docs-src/guide/3d-model-assets.md +35 -3
- 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 +28 -7
- package/dist/docs-src/guide/ambient-life.md +389 -0
- package/dist/docs-src/guide/audio.md +247 -0
- package/dist/docs-src/guide/browser-mount.md +8 -1
- package/dist/docs-src/guide/building-interiors.md +5 -4
- package/dist/docs-src/guide/capability-authoring.md +5 -0
- package/dist/docs-src/guide/determinism.md +35 -27
- package/dist/docs-src/guide/earth-view.md +492 -0
- package/dist/docs-src/guide/entities.md +9 -1
- package/dist/docs-src/guide/examples.md +6 -2
- package/dist/docs-src/guide/figures.md +3 -0
- package/dist/docs-src/guide/game-samples.md +22 -5
- 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 +55 -0
- package/dist/docs-src/guide/materials.md +10 -3
- package/dist/docs-src/guide/navigation.md +150 -0
- package/dist/docs-src/guide/project.md +1 -1
- package/dist/docs-src/guide/quickstart.md +2 -2
- package/dist/docs-src/guide/recognizable-places.md +3 -2
- package/dist/docs-src/guide/scripting.md +4 -2
- package/dist/docs-src/guide/sky.md +16 -0
- package/dist/docs-src/guide/source-bundles.md +0 -1
- package/dist/docs-src/guide/structure-library.md +2 -2
- package/dist/docs-src/guide/surface-rendering.md +4 -3
- package/dist/docs-src/guide/terrain.md +52 -2
- package/dist/docs-src/guide/vehicles.md +32 -10
- package/dist/docs-src/guide/worldgen.md +3 -3
- package/dist/docs-src/llms.txt +14 -5
- package/dist/docs-src/schemas/README.md +4 -0
- package/dist/docs-src/schemas/archive-set.md +175 -0
- package/dist/docs-src/schemas/components.md +1634 -2
- package/dist/docs-src/schemas/matgraph.md +6 -0
- package/dist/docs-src/schemas/scene.md +105 -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/docs-src/schemas/transport-network.md +351 -0
- package/dist/index.d.mts +49 -2
- package/dist/index.mjs +81 -4
- package/dist/{mcp-AOfIp89b.mjs → mcp-BtuworIW.mjs} +88 -3
- package/dist/{ops-C4BvDgP-.mjs → ops-DMGcWoL2.mjs} +1204 -93
- package/dist/templates/city-courier/README.md +14 -1
- package/dist/templates/city-courier/delivery-run.replay.json +151 -151
- package/dist/templates/city-courier/gen/molen-types.ts +223 -5
- package/dist/templates/city-courier/package.json +2 -0
- package/dist/templates/city-courier/scene.json +142 -246
- package/dist/templates/city-courier/scripts/game.ts +7 -15
- package/dist/templates/city-courier/scripts/molen-scripts.d.ts +252 -16
- package/dist/templates/city-courier/src/audio.ts +96 -0
- package/dist/templates/city-courier/src/game-shell.css +8 -0
- package/dist/templates/city-courier/src/main.ts +3 -0
- package/dist/templates/city-courier/src/worker.ts +3 -1
- package/dist/templates/city-courier/test/headless.test.ts +3 -2
- package/dist/templates/data-viz/README.md +1 -1
- package/dist/templates/index.json +22 -1
- package/dist/templates/skybound/README.md +13 -0
- package/dist/templates/skybound/first-leap.replay.json +152 -152
- package/dist/templates/skybound/gen/molen-types.ts +223 -5
- package/dist/templates/skybound/package.json +1 -0
- package/dist/templates/skybound/scene.json +40 -0
- package/dist/templates/skybound/scripts/game.ts +8 -5
- package/dist/templates/skybound/scripts/molen-scripts.d.ts +248 -5
- package/dist/templates/skybound/src/audio.ts +96 -0
- package/dist/templates/skybound/src/game-shell.css +8 -0
- package/dist/templates/skybound/src/main.ts +3 -0
- package/dist/templates/skybound/test/headless.test.ts +1 -1
- package/dist/templates/terrain-flyover/README.md +2 -2
- package/dist/templates/top-down-arena/README.md +15 -2
- package/dist/templates/top-down-arena/arena-skirmish.replay.json +152 -152
- package/dist/templates/top-down-arena/package.json +1 -0
- package/dist/templates/top-down-arena/scene.json +20 -0
- package/dist/templates/top-down-arena/scripts/combat.ts +1 -0
- package/dist/templates/top-down-arena/scripts/molen-scripts.d.ts +248 -5
- package/dist/templates/top-down-arena/src/audio.ts +96 -0
- package/dist/templates/top-down-arena/src/gen/molen-types.ts +223 -5
- package/dist/templates/top-down-arena/src/main.ts +3 -0
- package/dist/templates/top-down-arena/test/headless.test.ts +1 -1
- package/package.json +13 -12
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { A as inspectContentPack, B as
|
|
2
|
+
import { $ as formatPacked, A as inspectContentPack, B as searchDocs, C as checkTypesOp, D as buildContentPack, E as reserveNamespace, F as previewFigure, H as describeOps, I as listFigurePresets, J as checkSoundbank, K as planAudio, L as exportFrames, M as bakeNetwork, N as generateTypes, O as extractContentPack, Q as formatBytes, R as driveScene, S as rasterizeMaterial, T as projectInfo, U as formatOp, V as OPS_CATALOG, W as checkScripts, X as stageAssets, Z as screenshotAsset, _ as loadComponentRegistry, b as diffSnapshots, c as validateAsset, d as runSimulation, dt as playExperience, et as packAsset, f as screenshotScene, g as listSchemasOp, h as listComponentsOp, i as bakeWorldgen, it as importAsset, j as verifyContentPack, k as fetchContentPack, l as applyUvPaintOp, m as getSchemaOp, n as worldgenStats, nt as listAssets, p as getComponentOp, q as importSound, r as previewWorldgen, s as simWatch, t as formatWorldgenStats, tt as inspectAsset, u as testTypes, v as scaffoldExperience, w as listTypes, x as runReplayFile, y as listTemplates } from "./ops-DMGcWoL2.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
|
});
|
|
@@ -234,6 +234,7 @@ async function cmdSim(args) {
|
|
|
234
234
|
for (const [domain, entry] of Object.entries(result.content ?? {})) out(`content: ${domain} ${entry.hash}${entry.packs ? ` (${entry.packs.join(", ")})` : ""}`);
|
|
235
235
|
}
|
|
236
236
|
out(`events: ${result.eventCount}`);
|
|
237
|
+
if (result.ambient !== void 0) out(`ambient: ${Object.entries(result.ambient.agents).filter(([, n]) => n > 0).map(([kind, n]) => `${n} ${kind}`).join(", ") || "no agents"} on ${result.ambient.lanes} lanes (${result.ambient.spawned} spawned, ${result.ambient.despawned} removed)`);
|
|
237
238
|
if (result.physics !== void 0 && result.physics !== "none") out(result.physics === "rapier" ? "physics: rapier (deterministic same-build/same-platform only)" : `physics: ${result.physics} (cross-platform deterministic)`);
|
|
238
239
|
if (result.assertionsFormatted !== void 0) out(result.assertionsFormatted);
|
|
239
240
|
return result.ok ? 0 : 1;
|
|
@@ -418,7 +419,7 @@ async function cmdReplay(args) {
|
|
|
418
419
|
err(result.error);
|
|
419
420
|
return 1;
|
|
420
421
|
}
|
|
421
|
-
out(result.report ?? (result.ok ? "✓ replay matches" : "
|
|
422
|
+
out(result.report ?? (result.ok ? "✓ replay matches" : "× replay diverged"));
|
|
422
423
|
return result.ok ? 0 : 1;
|
|
423
424
|
}
|
|
424
425
|
async function cmdDiff(args) {
|
|
@@ -566,13 +567,18 @@ async function cmdAsset(args) {
|
|
|
566
567
|
if (sub === "import") {
|
|
567
568
|
const path = args.positionals[1];
|
|
568
569
|
if (path === void 0) {
|
|
569
|
-
err("usage: molen asset import <file.glb> [--id <asset-id>] [--trimesh] [--no-optimize] [--out-dir <d>] [--project <project.json>] [--force]");
|
|
570
|
+
err("usage: molen asset import <file.glb> [--id <asset-id>] [--trimesh] [--no-optimize] [--out-dir <d>] [--asset-dir <d>] [--project <project.json>] [--force]");
|
|
571
|
+
return 2;
|
|
572
|
+
}
|
|
573
|
+
if (args.flags["asset-dir"] !== void 0 && typeof args.flags["asset-dir"] !== "string") {
|
|
574
|
+
err("--asset-dir requires a directory value");
|
|
570
575
|
return 2;
|
|
571
576
|
}
|
|
572
577
|
const r = await importAsset({
|
|
573
578
|
path,
|
|
574
579
|
id: str(args.flags.id),
|
|
575
580
|
outDir: str(args.flags["out-dir"]),
|
|
581
|
+
assetDir: str(args.flags["asset-dir"]),
|
|
576
582
|
trimesh: args.flags.trimesh === true,
|
|
577
583
|
...args.flags["no-optimize"] === true ? { optimize: false } : {},
|
|
578
584
|
projectPath: str(args.flags.project),
|
|
@@ -704,6 +710,100 @@ async function cmdAsset(args) {
|
|
|
704
710
|
err("usage: molen asset import <file> | inspect <ref> [--verify] | list | shot <ref> --out-dir <d> | pack <ref>|--all | stage --out-dir <d>");
|
|
705
711
|
return 2;
|
|
706
712
|
}
|
|
713
|
+
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>";
|
|
714
|
+
function numFlag(v) {
|
|
715
|
+
if (typeof v !== "string") return void 0;
|
|
716
|
+
const n = Number(v);
|
|
717
|
+
return Number.isFinite(n) ? n : void 0;
|
|
718
|
+
}
|
|
719
|
+
async function cmdAudio(args) {
|
|
720
|
+
const [sub, target] = args.positionals;
|
|
721
|
+
if (sub === "plan" && target !== void 0) {
|
|
722
|
+
const ticks = typeof args.flags.ticks === "string" ? Number(args.flags.ticks) : 0;
|
|
723
|
+
if (!Number.isInteger(ticks) || ticks <= 0) {
|
|
724
|
+
err("--ticks <N> is required and must be a positive integer");
|
|
725
|
+
return 2;
|
|
726
|
+
}
|
|
727
|
+
const bank = str(args.flags.bank);
|
|
728
|
+
const r = await planAudio({
|
|
729
|
+
scenePath: target,
|
|
730
|
+
ticks,
|
|
731
|
+
...bank !== void 0 ? { bankPaths: bank.split(",").filter((b) => b.length > 0) } : {},
|
|
732
|
+
...str(args.flags.commands) !== void 0 ? { commandsPath: str(args.flags.commands) } : {},
|
|
733
|
+
...str(args.flags.setup) !== void 0 ? { setupModule: str(args.flags.setup) } : {},
|
|
734
|
+
...str(args.flags.listener) !== void 0 ? { listener: str(args.flags.listener) } : {},
|
|
735
|
+
...str(args.flags.mode) !== void 0 ? { mode: str(args.flags.mode) } : {},
|
|
736
|
+
...str(args.flags.weather) !== void 0 ? { weather: str(args.flags.weather) } : {},
|
|
737
|
+
...numFlag(args.flags.daylight) !== void 0 ? { daylight: numFlag(args.flags.daylight) } : {},
|
|
738
|
+
...str(args.flags.project) !== void 0 ? { projectPath: str(args.flags.project) } : {}
|
|
739
|
+
});
|
|
740
|
+
if (r.error !== void 0) {
|
|
741
|
+
err(r.error);
|
|
742
|
+
return 1;
|
|
743
|
+
}
|
|
744
|
+
if (args.flags.json === true) out(JSON.stringify(r, null, 2));
|
|
745
|
+
else out(r.timeline);
|
|
746
|
+
return r.ok ? 0 : 1;
|
|
747
|
+
}
|
|
748
|
+
if (sub === "import" && target !== void 0) {
|
|
749
|
+
const id = str(args.flags.id);
|
|
750
|
+
const bankPath = str(args.flags.bank);
|
|
751
|
+
const license = str(args.flags.license);
|
|
752
|
+
if (id === void 0 || bankPath === void 0 || license === void 0) {
|
|
753
|
+
err(AUDIO_USAGE);
|
|
754
|
+
return 2;
|
|
755
|
+
}
|
|
756
|
+
const optional = {
|
|
757
|
+
source: str(args.flags.source),
|
|
758
|
+
site: str(args.flags.site),
|
|
759
|
+
author: str(args.flags.author),
|
|
760
|
+
prompt: str(args.flags.prompt),
|
|
761
|
+
generator: str(args.flags.generator),
|
|
762
|
+
description: str(args.flags.description),
|
|
763
|
+
bus: str(args.flags.bus),
|
|
764
|
+
copyTo: str(args.flags["copy-to"]),
|
|
765
|
+
loopStart: numFlag(args.flags["loop-start"]),
|
|
766
|
+
loopEnd: numFlag(args.flags["loop-end"]),
|
|
767
|
+
gain: numFlag(args.flags.gain),
|
|
768
|
+
durationS: numFlag(args.flags.duration),
|
|
769
|
+
loop: args.flags.loop === true ? true : void 0,
|
|
770
|
+
append: args.flags.append === true ? true : void 0
|
|
771
|
+
};
|
|
772
|
+
const r = await importSound({
|
|
773
|
+
file: target,
|
|
774
|
+
id,
|
|
775
|
+
bankPath,
|
|
776
|
+
license,
|
|
777
|
+
...Object.fromEntries(Object.entries(optional).filter(([, v]) => v !== void 0))
|
|
778
|
+
});
|
|
779
|
+
for (const w of r.warnings) err(`! ${w}`);
|
|
780
|
+
if (!r.ok) {
|
|
781
|
+
err(r.error ?? "audio import failed");
|
|
782
|
+
return 1;
|
|
783
|
+
}
|
|
784
|
+
const d = r.entry?.durationS;
|
|
785
|
+
out(`${r.id}: ${r.clip}${d !== void 0 ? ` (${d}s)` : ""} -> ${r.bankPath}`);
|
|
786
|
+
return 0;
|
|
787
|
+
}
|
|
788
|
+
if (sub === "check" && target !== void 0) {
|
|
789
|
+
const r = await checkSoundbank({ bankPath: target });
|
|
790
|
+
if (r.error !== void 0) {
|
|
791
|
+
err(r.error);
|
|
792
|
+
return 1;
|
|
793
|
+
}
|
|
794
|
+
for (const issue of r.issues) (issue.severity === "error" ? err : out)(`${issue.severity === "error" ? "✗" : "·"} ${issue.path}: ${issue.message}`);
|
|
795
|
+
const licenses = Object.entries(r.licenses).map(([l, n]) => `${l} ×${n}`).join(", ");
|
|
796
|
+
const summary = `${r.sounds} sounds, ${r.clips} clips, ${formatBytes(r.bytes)}; ${licenses || "no sounds"}`;
|
|
797
|
+
if (!r.ok) {
|
|
798
|
+
err(`${r.id}: problems found (${summary})`);
|
|
799
|
+
return 1;
|
|
800
|
+
}
|
|
801
|
+
out(`✓ ${r.id}: ${summary}`);
|
|
802
|
+
return 0;
|
|
803
|
+
}
|
|
804
|
+
err(AUDIO_USAGE);
|
|
805
|
+
return 2;
|
|
806
|
+
}
|
|
707
807
|
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>]";
|
|
708
808
|
async function cmdPack(args) {
|
|
709
809
|
const [sub, target, ...rest] = args.positionals;
|
|
@@ -890,7 +990,7 @@ async function cmdScripts(args) {
|
|
|
890
990
|
return 1;
|
|
891
991
|
}
|
|
892
992
|
for (const d of r.diagnostics ?? []) err(`${d.file}:${d.line}:${d.column} ${d.code}: ${d.message}`);
|
|
893
|
-
out(r.ok ? `✓ ${r.checked ?? 0} script${r.checked === 1 ? "" : "s"} type-check clean` :
|
|
993
|
+
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)`);
|
|
894
994
|
return r.ok ? 0 : 1;
|
|
895
995
|
}
|
|
896
996
|
async function cmdTypes(args) {
|
|
@@ -913,7 +1013,7 @@ async function cmdTypes(args) {
|
|
|
913
1013
|
}
|
|
914
1014
|
if ((r.issues ?? []).length > 0) err(formatIssues("project types", r.issues ?? []));
|
|
915
1015
|
if (r.codegenStale === true) err("codegen is stale — run: molen types gen");
|
|
916
|
-
out(r.ok ? "✓ types check passed" : "
|
|
1016
|
+
out(r.ok ? "✓ types check passed" : "× types check failed");
|
|
917
1017
|
return r.ok ? 0 : 1;
|
|
918
1018
|
}
|
|
919
1019
|
if (sub === "reserve") {
|
|
@@ -947,7 +1047,7 @@ async function cmdTypes(args) {
|
|
|
947
1047
|
return 1;
|
|
948
1048
|
}
|
|
949
1049
|
if (args.flags.check === true) {
|
|
950
|
-
out(r.stale === true ?
|
|
1050
|
+
out(r.stale === true ? `× ${r.outPath} is stale — run: molen types gen` : "✓ codegen up to date");
|
|
951
1051
|
return r.ok ? 0 : 1;
|
|
952
1052
|
}
|
|
953
1053
|
out(`wrote ${r.outPath} (${r.componentCount} components, ${r.typeCount} types)`);
|
|
@@ -965,7 +1065,7 @@ async function cmdTypes(args) {
|
|
|
965
1065
|
return 1;
|
|
966
1066
|
}
|
|
967
1067
|
for (const t of r.results ?? []) {
|
|
968
|
-
out(`${t.ok ? "✓" : "
|
|
1068
|
+
out(`${t.ok ? "✓" : "×"} ${t.id}${t.error !== void 0 ? ` — ${t.error}` : ""}`);
|
|
969
1069
|
for (const issue of t.issues ?? []) out(` ${issue.path}: ${issue.message}`);
|
|
970
1070
|
}
|
|
971
1071
|
return r.ok ? 0 : 1;
|
|
@@ -1154,7 +1254,7 @@ async function cmdWorldgen(args) {
|
|
|
1154
1254
|
return 2;
|
|
1155
1255
|
}
|
|
1156
1256
|
async function cmdMcp() {
|
|
1157
|
-
const { startMcpServer } = await import("./mcp-
|
|
1257
|
+
const { startMcpServer } = await import("./mcp-BtuworIW.mjs");
|
|
1158
1258
|
await startMcpServer();
|
|
1159
1259
|
return 0;
|
|
1160
1260
|
}
|
|
@@ -1259,6 +1359,56 @@ async function runCli(argv) {
|
|
|
1259
1359
|
* server, and this table are cross-checked by test/catalog.test.ts — a new op must land on all
|
|
1260
1360
|
* three surfaces or that test fails.
|
|
1261
1361
|
*/
|
|
1362
|
+
async function cmdNetwork(args) {
|
|
1363
|
+
const sub = args.positionals[0];
|
|
1364
|
+
const usage = "usage: molen network bake <terrain-package.json> (--tile z/x/y [--radius n] | --bbox w,s,e,n) --out network.json [--classes road,rail,path] [--heights] [--json]";
|
|
1365
|
+
if (sub !== "bake") {
|
|
1366
|
+
err(usage);
|
|
1367
|
+
return 2;
|
|
1368
|
+
}
|
|
1369
|
+
const packagePath = args.positionals[1];
|
|
1370
|
+
const outPath = str(args.flags.out);
|
|
1371
|
+
if (packagePath === void 0 || outPath === void 0) {
|
|
1372
|
+
err(usage);
|
|
1373
|
+
return 2;
|
|
1374
|
+
}
|
|
1375
|
+
const bbox = str(args.flags.bbox)?.split(",").map(Number);
|
|
1376
|
+
if (bbox !== void 0 && (bbox.length !== 4 || bbox.some((v) => !Number.isFinite(v)))) {
|
|
1377
|
+
err("--bbox must be west,south,east,north in degrees");
|
|
1378
|
+
return 2;
|
|
1379
|
+
}
|
|
1380
|
+
const classes = str(args.flags.classes)?.split(",");
|
|
1381
|
+
if (classes?.some((c) => ![
|
|
1382
|
+
"road",
|
|
1383
|
+
"rail",
|
|
1384
|
+
"path"
|
|
1385
|
+
].includes(c))) {
|
|
1386
|
+
err("--classes takes road, rail and/or path");
|
|
1387
|
+
return 2;
|
|
1388
|
+
}
|
|
1389
|
+
const radius = str(args.flags.radius);
|
|
1390
|
+
const r = await bakeNetwork({
|
|
1391
|
+
packagePath,
|
|
1392
|
+
outPath,
|
|
1393
|
+
...str(args.flags.tile) !== void 0 ? { tile: str(args.flags.tile) } : {},
|
|
1394
|
+
...radius !== void 0 ? { radius: Number(radius) } : {},
|
|
1395
|
+
...bbox !== void 0 ? { bbox } : {},
|
|
1396
|
+
...classes !== void 0 ? { classes } : {},
|
|
1397
|
+
heights: args.flags.heights === true
|
|
1398
|
+
});
|
|
1399
|
+
if (!r.ok) {
|
|
1400
|
+
err(r.error ?? "network bake failed");
|
|
1401
|
+
return 1;
|
|
1402
|
+
}
|
|
1403
|
+
if (args.flags.json === true) out(JSON.stringify(r, null, 2));
|
|
1404
|
+
else {
|
|
1405
|
+
const counts = Object.entries(r.classes ?? {}).map(([cls, n]) => `${n} ${cls}`).join(", ");
|
|
1406
|
+
out(`wrote ${r.path}: ${r.ways} ways (${counts}) from ${r.tiles} tiles`);
|
|
1407
|
+
if (r.origin !== void 0) out(`origin ${r.origin.latitude}, ${r.origin.longitude}`);
|
|
1408
|
+
for (const w of r.warnings ?? []) out(` ! ${w}`);
|
|
1409
|
+
}
|
|
1410
|
+
return 0;
|
|
1411
|
+
}
|
|
1262
1412
|
const CLI_COMMANDS = {
|
|
1263
1413
|
validate: cmdValidate,
|
|
1264
1414
|
sim: cmdSim,
|
|
@@ -1275,6 +1425,7 @@ const CLI_COMMANDS = {
|
|
|
1275
1425
|
describe: cmdDescribe,
|
|
1276
1426
|
asset: cmdAsset,
|
|
1277
1427
|
pack: cmdPack,
|
|
1428
|
+
audio: cmdAudio,
|
|
1278
1429
|
drive: cmdDrive,
|
|
1279
1430
|
play: cmdPlay,
|
|
1280
1431
|
project: cmdProject,
|
|
@@ -1284,6 +1435,7 @@ const CLI_COMMANDS = {
|
|
|
1284
1435
|
templates: cmdTemplates,
|
|
1285
1436
|
figure: cmdFigure,
|
|
1286
1437
|
worldgen: cmdWorldgen,
|
|
1438
|
+
network: cmdNetwork,
|
|
1287
1439
|
mcp: cmdMcp
|
|
1288
1440
|
};
|
|
1289
1441
|
//#endregion
|
|
@@ -94,6 +94,22 @@ Use glTF 2.0 conventions and these Molen authoring expectations:
|
|
|
94
94
|
- prefer a self-contained GLB for reliable serving and capture;
|
|
95
95
|
- avoid extensions unless the client has the required decoder configuration.
|
|
96
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
|
+
|
|
97
113
|
The importer decodes supported input, then deduplicates, prunes, welds, and quantizes by default.
|
|
98
114
|
Use `--no-optimize` only to diagnose a transformation issue. Repeating UVs outside `[0,1]` are
|
|
99
115
|
valid, but the optimizer currently leaves those UV accessors unquantized and reports that choice.
|
|
@@ -134,12 +150,19 @@ npx molen asset inspect barn.weathered --verify
|
|
|
134
150
|
npx molen asset list
|
|
135
151
|
```
|
|
136
152
|
|
|
137
|
-
|
|
153
|
+
For a new asset, the importer writes
|
|
138
154
|
`assets/<id with dots as path>/model.glb`, creates `asset.json`, extracts per-node convex hulls,
|
|
139
155
|
and registers the sidecar in the surrounding `project.json`. Add `--trimesh` only when static,
|
|
140
156
|
concave collision justifies its extra size. Use `--project <project.json>` when project discovery
|
|
141
157
|
from the current directory would be ambiguous.
|
|
142
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
|
+
|
|
143
166
|
`asset inspect --verify` must pass before the asset is placed in a scene. Review its bounds,
|
|
144
167
|
triangle/vertex counts, material slots, textures, animation clips, extensions, and collision hulls;
|
|
145
168
|
“readable GLB” is not enough.
|
|
@@ -261,8 +284,8 @@ With `variant`, a convention-resolved id fetches `model.ktx2.glb` first and fall
|
|
|
261
284
|
uses Draco; canonical imported assets never do.
|
|
262
285
|
|
|
263
286
|
`molen asset stage` produces the runtime bundle in one step — every registered asset's runtime
|
|
264
|
-
files copied under an output directory
|
|
265
|
-
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:
|
|
266
289
|
|
|
267
290
|
```sh
|
|
268
291
|
molen asset stage --out-dir public --variant ktx2 --require-variant
|
|
@@ -275,6 +298,15 @@ release build; the app half is the normal Vite build.
|
|
|
275
298
|
|
|
276
299
|
## 9. Record evidence
|
|
277
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
|
+
|
|
278
310
|
Keep a concise README or machine-readable build report next to the source. Record:
|
|
279
311
|
|
|
280
312
|
- the original asset prompt and all material-generation prompts;
|
|
@@ -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.
|
|
@@ -107,6 +107,27 @@ and `airplane.yawStability` sets sideslip restoring response (1/s at reference a
|
|
|
107
107
|
The authored engine thrust axis is respected. Engine positions relative to the center of mass
|
|
108
108
|
produce thrust-induced yaw; wing position remains metadata rather than a distributed lift model.
|
|
109
109
|
|
|
110
|
+
## In an Earth view
|
|
111
|
+
|
|
112
|
+
`mountEarthView` flies the same aircraft without a practice airfield: `view.setMode('fly')` puts the
|
|
113
|
+
viewer in a P-51D already airborne over the current view, and `{ aircraft:
|
|
114
|
+
'molen.entities.aircraft.oh6' }` picks the helicopter. `view.vehicleStatus()` reports airspeed,
|
|
115
|
+
altitude, vertical speed, attitude, power and engine/gear/flap state for a HUD, and
|
|
116
|
+
`view.recover()` restarts the flight above an impact. See [Earth view](earth-view.md#modes).
|
|
117
|
+
Hosts composing their own view use `EarthAircraft` from `@bendyline/molen-earth/client`: it
|
|
118
|
+
spawns any aircraft type into the vehicles' ECS world, on the ground or with
|
|
119
|
+
`airborne: { speed, power }`, boards and releases the pilot, applies `EarthPilotControls` and
|
|
120
|
+
draws the models.
|
|
121
|
+
|
|
122
|
+
## Engine sound
|
|
123
|
+
|
|
124
|
+
The P-51D carries an `audioSource` that plays `aircraft.engine.piston`, a Rolls-Royce Merlin
|
|
125
|
+
recording. The OH-6 plays `aircraft.engine.helicopter`. Both take pitch and gain from
|
|
126
|
+
`aircraftState.rpm`: they are silent until `I` starts the engine, and spool up and down with it.
|
|
127
|
+
The OH-6 also leans a little on `aircraftInput.power`, since its governed rotor holds rpm while the
|
|
128
|
+
collective changes load. Any host that plays audio from the entity world hears them with no extra
|
|
129
|
+
code; see [Sound and music](audio.md).
|
|
130
|
+
|
|
110
131
|
## Multiple engines and engine failures
|
|
111
132
|
|
|
112
133
|
An airplane can keep the existing `spec.engine` (implicitly named `main`), or replace it with a
|