@bendyline/molen-tooling 0.0.2 → 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/dist/capture/harness.js +216 -216
- package/dist/capture/worldgen-preview.js +288 -288
- package/dist/cli.mjs +110 -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 +16 -7
- package/dist/docs-src/guide/audio.md +247 -0
- package/dist/docs-src/guide/browser-mount.md +3 -1
- package/dist/docs-src/guide/building-interiors.md +5 -4
- package/dist/docs-src/guide/determinism.md +12 -12
- package/dist/docs-src/guide/earth-view.md +444 -0
- package/dist/docs-src/guide/entities.md +1 -1
- package/dist/docs-src/guide/examples.md +2 -1
- package/dist/docs-src/guide/game-samples.md +21 -4
- 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 +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/terrain.md +45 -2
- package/dist/docs-src/guide/vehicles.md +18 -9
- package/dist/docs-src/guide/worldgen.md +3 -3
- package/dist/docs-src/llms.txt +10 -4
- package/dist/docs-src/schemas/README.md +3 -0
- 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 +5 -1
- package/dist/index.mjs +1 -1
- package/dist/{mcp-AOfIp89b.mjs → mcp-BTVwVKFb.mjs} +67 -3
- package/dist/{ops-C4BvDgP-.mjs → ops-BPdHodFR.mjs} +915 -29
- package/dist/templates/city-courier/README.md +13 -0
- package/dist/templates/city-courier/delivery-run.replay.json +151 -151
- package/dist/templates/city-courier/gen/molen-types.ts +142 -4
- package/dist/templates/city-courier/package.json +1 -0
- package/dist/templates/city-courier/scene.json +79 -0
- package/dist/templates/city-courier/scripts/game.ts +5 -1
- package/dist/templates/city-courier/scripts/molen-scripts.d.ts +167 -4
- 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/test/headless.test.ts +1 -1
- package/dist/templates/index.json +3 -0
- 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 +142 -4
- 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 +167 -4
- 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/top-down-arena/README.md +14 -1
- 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 +167 -4
- package/dist/templates/top-down-arena/src/audio.ts +96 -0
- package/dist/templates/top-down-arena/src/gen/molen-types.ts +142 -4
- 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 +11 -11
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { A as inspectContentPack, B as OPS_CATALOG, C as checkTypesOp, D as buildContentPack, E as reserveNamespace, F as listFigurePresets,
|
|
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) {
|
|
@@ -566,13 +566,18 @@ async function cmdAsset(args) {
|
|
|
566
566
|
if (sub === "import") {
|
|
567
567
|
const path = args.positionals[1];
|
|
568
568
|
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]");
|
|
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");
|
|
570
574
|
return 2;
|
|
571
575
|
}
|
|
572
576
|
const r = await importAsset({
|
|
573
577
|
path,
|
|
574
578
|
id: str(args.flags.id),
|
|
575
579
|
outDir: str(args.flags["out-dir"]),
|
|
580
|
+
assetDir: str(args.flags["asset-dir"]),
|
|
576
581
|
trimesh: args.flags.trimesh === true,
|
|
577
582
|
...args.flags["no-optimize"] === true ? { optimize: false } : {},
|
|
578
583
|
projectPath: str(args.flags.project),
|
|
@@ -704,6 +709,100 @@ async function cmdAsset(args) {
|
|
|
704
709
|
err("usage: molen asset import <file> | inspect <ref> [--verify] | list | shot <ref> --out-dir <d> | pack <ref>|--all | stage --out-dir <d>");
|
|
705
710
|
return 2;
|
|
706
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
|
+
}
|
|
707
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>]";
|
|
708
807
|
async function cmdPack(args) {
|
|
709
808
|
const [sub, target, ...rest] = args.positionals;
|
|
@@ -890,7 +989,7 @@ async function cmdScripts(args) {
|
|
|
890
989
|
return 1;
|
|
891
990
|
}
|
|
892
991
|
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` :
|
|
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)`);
|
|
894
993
|
return r.ok ? 0 : 1;
|
|
895
994
|
}
|
|
896
995
|
async function cmdTypes(args) {
|
|
@@ -913,7 +1012,7 @@ async function cmdTypes(args) {
|
|
|
913
1012
|
}
|
|
914
1013
|
if ((r.issues ?? []).length > 0) err(formatIssues("project types", r.issues ?? []));
|
|
915
1014
|
if (r.codegenStale === true) err("codegen is stale — run: molen types gen");
|
|
916
|
-
out(r.ok ? "✓ types check passed" : "
|
|
1015
|
+
out(r.ok ? "✓ types check passed" : "× types check failed");
|
|
917
1016
|
return r.ok ? 0 : 1;
|
|
918
1017
|
}
|
|
919
1018
|
if (sub === "reserve") {
|
|
@@ -947,7 +1046,7 @@ async function cmdTypes(args) {
|
|
|
947
1046
|
return 1;
|
|
948
1047
|
}
|
|
949
1048
|
if (args.flags.check === true) {
|
|
950
|
-
out(r.stale === true ?
|
|
1049
|
+
out(r.stale === true ? `× ${r.outPath} is stale — run: molen types gen` : "✓ codegen up to date");
|
|
951
1050
|
return r.ok ? 0 : 1;
|
|
952
1051
|
}
|
|
953
1052
|
out(`wrote ${r.outPath} (${r.componentCount} components, ${r.typeCount} types)`);
|
|
@@ -965,7 +1064,7 @@ async function cmdTypes(args) {
|
|
|
965
1064
|
return 1;
|
|
966
1065
|
}
|
|
967
1066
|
for (const t of r.results ?? []) {
|
|
968
|
-
out(`${t.ok ? "✓" : "
|
|
1067
|
+
out(`${t.ok ? "✓" : "×"} ${t.id}${t.error !== void 0 ? ` — ${t.error}` : ""}`);
|
|
969
1068
|
for (const issue of t.issues ?? []) out(` ${issue.path}: ${issue.message}`);
|
|
970
1069
|
}
|
|
971
1070
|
return r.ok ? 0 : 1;
|
|
@@ -1154,7 +1253,7 @@ async function cmdWorldgen(args) {
|
|
|
1154
1253
|
return 2;
|
|
1155
1254
|
}
|
|
1156
1255
|
async function cmdMcp() {
|
|
1157
|
-
const { startMcpServer } = await import("./mcp-
|
|
1256
|
+
const { startMcpServer } = await import("./mcp-BTVwVKFb.mjs");
|
|
1158
1257
|
await startMcpServer();
|
|
1159
1258
|
return 0;
|
|
1160
1259
|
}
|
|
@@ -1275,6 +1374,7 @@ const CLI_COMMANDS = {
|
|
|
1275
1374
|
describe: cmdDescribe,
|
|
1276
1375
|
asset: cmdAsset,
|
|
1277
1376
|
pack: cmdPack,
|
|
1377
|
+
audio: cmdAudio,
|
|
1278
1378
|
drive: cmdDrive,
|
|
1279
1379
|
play: cmdPlay,
|
|
1280
1380
|
project: cmdProject,
|
|
@@ -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,15 @@ 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
|
+
## 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
|
+
|
|
110
119
|
## Multiple engines and engine failures
|
|
111
120
|
|
|
112
121
|
An airplane can keep the existing `spec.engine` (implicitly named `main`), or replace it with a
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
# Sound and music
|
|
2
|
+
|
|
3
|
+
Sound in Molen is data. A sound bank names the clips, three components say when and where they
|
|
4
|
+
play, and scripts can fire one-shots with `molen.audio.play`. The client's audio director reads
|
|
5
|
+
all of it every frame and plays the result through Web Audio. Nothing about playback touches the
|
|
6
|
+
simulation, so sound never changes a state hash, and `molen audio plan` shows what a scene would
|
|
7
|
+
play without opening a browser.
|
|
8
|
+
|
|
9
|
+
## The pieces
|
|
10
|
+
|
|
11
|
+
| Piece | Where it lives | What it does |
|
|
12
|
+
| --- | --- | --- |
|
|
13
|
+
| `molen/soundbank@1` | a content pack (`provides.soundbank`) or a file beside the scene | Sound ids → clip files, loop points, gain, pitch range, bus, spatial defaults and provenance |
|
|
14
|
+
| `audioEnvironment` | one entity in the scene | Ambience layers, music playlist, event → sound mappings, footsteps, bus gains |
|
|
15
|
+
| `audioSource` | any entity | An emitter: loops follow the entity, pitch and gain follow signals, one-shots fire on triggers |
|
|
16
|
+
| `audioZone` | any entity | Area ambience that fades in as the listener approaches a sphere or box |
|
|
17
|
+
| `molen.audio.*` | scene scripts | `play`, `stop` and `music`, emitted as `audio.*` events |
|
|
18
|
+
| `@bendyline/molen-client/audio` | the page | `createAudioLayer` loads banks and plays what the rules ask for |
|
|
19
|
+
|
|
20
|
+
The `molen.sounds` content pack carries 63 CC0 sounds (ambience, vehicles, footsteps, impacts,
|
|
21
|
+
foley, UI, stings and six music tracks). Fetch it into a project with:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
npx molen pack fetch https://molen.dev/packs/index.json molen.sounds --out-dir public/packs
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
That writes `public/packs/index.json` and pins the pack in `project.json`, so CLI ops such as
|
|
28
|
+
`molen audio plan` find the bank without flags.
|
|
29
|
+
|
|
30
|
+
## Annotate a scene
|
|
31
|
+
|
|
32
|
+
Add one entity with an `audioEnvironment`. This one plays rain while it rains, birds on sunny
|
|
33
|
+
days, music throughout, and a crash sound on the `crash` event your script emits:
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"id": "audio",
|
|
38
|
+
"components": {
|
|
39
|
+
"audioEnvironment": {
|
|
40
|
+
"buses": { "music": 0.5 },
|
|
41
|
+
"ambience": [
|
|
42
|
+
{
|
|
43
|
+
"sound": "ambience.rain",
|
|
44
|
+
"when": { "weather.precipitation.kind": "rain" },
|
|
45
|
+
"gainFrom": { "signal": "weather.precipitation.intensity", "curve": [[0, 0], [1, 1]] }
|
|
46
|
+
},
|
|
47
|
+
{ "sound": "ambience.birds", "when": { "sky.daylight": { "min": 0.35 } }, "fadeS": 4 }
|
|
48
|
+
],
|
|
49
|
+
"music": { "playlist": ["music.ambient.first-light", "music.ambient.lifewave"], "mode": "shuffle" },
|
|
50
|
+
"events": { "crash": { "sound": "impact.metal.heavy" } }
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Give a moving thing its own voice with `audioSource`. The engine below follows the car, and its
|
|
57
|
+
pitch and loudness follow the car's state:
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"id": "player",
|
|
62
|
+
"components": {
|
|
63
|
+
"transform": { "pos": [0, 0.5, 0] },
|
|
64
|
+
"audioSource": {
|
|
65
|
+
"sound": "vehicle.engine.car",
|
|
66
|
+
"pitchFrom": { "signal": "vehicleState.speed", "curve": [[0, 0.8], [30, 1.7]] },
|
|
67
|
+
"gainFrom": { "signal": "vehicleInput.throttle", "curve": [[0, 0.5], [1, 1]] }
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Put the `audioSource` on an entity type and every instance gets it. The `molen.entities` vehicles
|
|
74
|
+
and aircraft carry their engines this way: cars run `vehicle.engine.car` or
|
|
75
|
+
`vehicle.engine.diesel` only while someone drives them (`"when": { "self.occupied": true }`), with
|
|
76
|
+
pitch from `vehicleState.speed` and gain from `vehicleInput.throttle`. The P-51 (a Merlin) and the
|
|
77
|
+
OH-6 take pitch and gain from `aircraftState.rpm`, so they are silent until the engine starts and
|
|
78
|
+
spool up and down with it. A loop whose gain is zero holds no voice.
|
|
79
|
+
|
|
80
|
+
Fire one-shots from a script when something happens that no component describes:
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
molen.onCommand('attack', () => {
|
|
84
|
+
molen.audio.play('weapon.slash');
|
|
85
|
+
});
|
|
86
|
+
if (delivered === total) molen.audio.play('sting.win');
|
|
87
|
+
const alarm = molen.audio.play('ui.error', { entity: 'door', loop: true });
|
|
88
|
+
molen.audio.stop(alarm, 0.5);
|
|
89
|
+
molen.audio.music('music.dungeon');
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
`molen.emit` works too: any event type listed under `audioEnvironment.events` plays its sound, at
|
|
93
|
+
the entity or position the payload names (`payload.entity`, `payload.position`, or `payload.a` for
|
|
94
|
+
collisions), or at the listener.
|
|
95
|
+
|
|
96
|
+
## Rules
|
|
97
|
+
|
|
98
|
+
Every rule is a small piece of data the director re-evaluates each frame.
|
|
99
|
+
|
|
100
|
+
| Field | Meaning |
|
|
101
|
+
| --- | --- |
|
|
102
|
+
| `when` | All conditions must hold. A value means equality, a list means any of, `{ "min", "max" }` is an inclusive range, `{ "exists": true }` tests presence |
|
|
103
|
+
| `gainFrom`, `pitchFrom` | `{ signal, curve, smoothS? }`: a piecewise-linear curve of `[input, output]` points, clamped at both ends. A list of them multiplies, so a sound can fade with height and with distance at once |
|
|
104
|
+
| `triggerFrom` | `{ signal, every?, onChange?, sound? }`: a one-shot each time the signal advances by `every` (footsteps by distance) or changes |
|
|
105
|
+
| `startTick` | Play once at that tick; changing it plays again |
|
|
106
|
+
| `fadeS` | Fade time for ambience layers (default 1.5 s) |
|
|
107
|
+
|
|
108
|
+
Sounds that come from the ground, such as birds in the trees or traffic on the roads, should get
|
|
109
|
+
quieter as the listener rises. List one curve for height and another for distance to the source:
|
|
110
|
+
|
|
111
|
+
```json
|
|
112
|
+
{
|
|
113
|
+
"sound": "ambience.city.traffic",
|
|
114
|
+
"gainFrom": [
|
|
115
|
+
{ "signal": "listener.heightAboveGround", "curve": [[3, 1], [30, 0.7], [100, 0.3], [300, 0.08], [500, 0]] },
|
|
116
|
+
{ "signal": "host.streetDistance", "curve": [[0, 1], [40, 0.55], [120, 0.2], [250, 0]] }
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
A layer turns on after its condition has held for 0.25 s and off after it has failed for 1 s, and
|
|
122
|
+
numeric ranges widen by 5% while a layer plays. A signal hovering at a threshold therefore never
|
|
123
|
+
makes a sound flicker.
|
|
124
|
+
|
|
125
|
+
## Signals
|
|
126
|
+
|
|
127
|
+
| Signal | Value |
|
|
128
|
+
| --- | --- |
|
|
129
|
+
| `<component>.<field>` | A field of a component on the source's entity, e.g. `vehicleState.speed`, `aircraftState.rpm`, `transform.pos.1`. In `audioEnvironment` rules it reads the `listenerEntity` |
|
|
130
|
+
| `self.speed`, `self.distance`, `self.x/y/z` | The source entity's measured speed (m/s), distance travelled (m) and position |
|
|
131
|
+
| `self.occupied` | true while someone rides the source entity (an entity's `mounted` component names it) |
|
|
132
|
+
| `listener.speed`, `listener.distance`, `listener.x/y/z`, `listener.altitude` | The listener's speed, odometer and position |
|
|
133
|
+
| `listener.heightAboveGround` | What the host reports as the listener's height above the terrain (m); 0 when it reports nothing |
|
|
134
|
+
| `listener.mode`, `listener.grounded`, `listener.surface`, `listener.indoors` | What the host reports: walk, drive, fly, pilot or orbit; on the ground; the surface underfoot; inside a building |
|
|
135
|
+
| `weather.precipitation.kind`, `weather.precipitation.intensity`, `weather.windSpeed`, `weather.visibility`, `weather.clouds.coverage` | The scene's weather; a scene without weather reads as clear and calm |
|
|
136
|
+
| `sky.daylight`, `sky.starVisibility`, `sky.sunElevation` | The sky; a scene without a sky reads as day |
|
|
137
|
+
| `time.seconds` | Seconds since the audio layer started |
|
|
138
|
+
| `host.<name>` | Anything the page passes in, e.g. `host.urban` |
|
|
139
|
+
|
|
140
|
+
An unknown built-in signal is reported with a did-you-mean suggestion by `molen audio plan` and
|
|
141
|
+
in the browser console.
|
|
142
|
+
|
|
143
|
+
## Check it headlessly
|
|
144
|
+
|
|
145
|
+
`molen audio plan` runs the scene for N ticks, feeds the director, and prints what would play:
|
|
146
|
+
|
|
147
|
+
```sh
|
|
148
|
+
npx molen audio plan scene.json --ticks 300 --commands commands.json
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
```text
|
|
152
|
+
300 ticks at 30 Hz, banks: molen.sounds@1.0.0:sounds.soundbank.json
|
|
153
|
+
loops:
|
|
154
|
+
[0 → end] music.racing bus music peak 0.80 pitch 1.00
|
|
155
|
+
[0 → end] vehicle.engine.car @player bus sfx peak 0.61 pitch 0.75–1.36
|
|
156
|
+
one-shots (1):
|
|
157
|
+
t=115 impact.metal.heavy (sfx)
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
It reports unknown sound ids with a suggestion, and exits non-zero when it finds one. Pass
|
|
161
|
+
`--weather rain`, `--daylight 0.1`, `--mode walk` or `--listener <entity>` to hear other
|
|
162
|
+
conditions. `--json` prints the full report, and the `plan_audio` MCP tool returns the same.
|
|
163
|
+
Script sounds are ordinary events, so assertions work on them too:
|
|
164
|
+
|
|
165
|
+
```json
|
|
166
|
+
{ "format": "molen/assert@1", "assertions": [{ "event": "audio.play", "op": "occurred" }] }
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Play it in the browser
|
|
170
|
+
|
|
171
|
+
A page with a Worker kernel creates one layer, attaches it to the client, and updates it each
|
|
172
|
+
frame. Sound starts on the first click or key press, as browsers require.
|
|
173
|
+
|
|
174
|
+
```ts
|
|
175
|
+
import { mountExperience } from '@bendyline/molen-client';
|
|
176
|
+
import {
|
|
177
|
+
attachAutoplayUnlock,
|
|
178
|
+
createAudioLayer,
|
|
179
|
+
loadPackSoundbanks,
|
|
180
|
+
} from '@bendyline/molen-client/audio';
|
|
181
|
+
import { createPackSet, openPack } from '@bendyline/molen-pack';
|
|
182
|
+
|
|
183
|
+
const { client } = await mountExperience({ link: worker, scene, canvas });
|
|
184
|
+
const index = await (await fetch('packs/index.json')).json();
|
|
185
|
+
const entry = index.packs['molen.sounds'];
|
|
186
|
+
const packs = createPackSet([await openPack(new URL(entry.file, new URL('packs/', location.href)).href)]);
|
|
187
|
+
const audio = createAudioLayer({
|
|
188
|
+
banks: await loadPackSoundbanks(packs),
|
|
189
|
+
provider: packs.assetProvider(),
|
|
190
|
+
renderer: client.renderer, // the camera is the listener; weather and sky come from here too
|
|
191
|
+
});
|
|
192
|
+
audio.attachClient(client);
|
|
193
|
+
attachAutoplayUnlock(audio);
|
|
194
|
+
requestAnimationFrame(function frame(now) {
|
|
195
|
+
audio.update(now);
|
|
196
|
+
requestAnimationFrame(frame);
|
|
197
|
+
});
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Every game sample does exactly this in its `src/audio.ts`. Hosts without a Worker kernel use
|
|
201
|
+
`audio.attachWorld(world)` for a main-thread `World`, or no source at all and pass the listener to
|
|
202
|
+
`update(now, { position, forward, mode, grounded, heightAboveGround })`. `setVolume`, `setMuted` and
|
|
203
|
+
`setBusGain('music', 0)` drive a settings menu.
|
|
204
|
+
|
|
205
|
+
`mountEarthView` plays the Earth soundscape on its own when its content includes the
|
|
206
|
+
`molen.sounds` pack: weather and time-of-day ambience, footsteps in walk mode, traffic near
|
|
207
|
+
streets, and engines on the cars and aircraft you board. Birds, crickets and traffic fade with
|
|
208
|
+
height above the terrain, and traffic also fades with distance from the nearest street. Pass `audio: false` to turn it off, and
|
|
209
|
+
use `view.audio` for volume. See [Earth view](earth-view.md).
|
|
210
|
+
|
|
211
|
+
## Make your own sounds
|
|
212
|
+
|
|
213
|
+
A sound bank is a JSON file beside its clips. Add clips with `molen audio import`, which copies the
|
|
214
|
+
file, hashes it, reads its duration, and records where it came from:
|
|
215
|
+
|
|
216
|
+
```sh
|
|
217
|
+
npx molen audio import rain.mp3 --id ambience.rain --bank sounds/sounds.soundbank.json \
|
|
218
|
+
--license CC0-1.0 --source https://freesound.org/s/000000/ --loop \
|
|
219
|
+
--description "Steady rain on leaves"
|
|
220
|
+
npx molen audio import step-2.mp3 --id footstep.wood --bank sounds/sounds.soundbank.json \
|
|
221
|
+
--license CC0-1.0 --append
|
|
222
|
+
npx molen audio check sounds/sounds.soundbank.json
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
A bank with a later position in `banks` overrides sounds with the same id, so a project can
|
|
226
|
+
re-skin `molen.sounds` by shipping only the sounds it changes. Every entry records its license.
|
|
227
|
+
A bank with `"license": "CC0-1.0"` rejects anything else, which is how `molen.sounds` stays public
|
|
228
|
+
domain.
|
|
229
|
+
|
|
230
|
+
> [!TIP]
|
|
231
|
+
> MP3 plays in every browser. Ogg Vorbis does not decode in older Safari. Keep one-shots mono so
|
|
232
|
+
> they pan cleanly, and set `loopStart`/`loopEnd` a few milliseconds inside a loop so encoder
|
|
233
|
+
> padding never plays.
|
|
234
|
+
|
|
235
|
+
Good places to find sounds:
|
|
236
|
+
|
|
237
|
+
- **[Freesound](https://freesound.org)** — the largest library; filter to Creative Commons 0.
|
|
238
|
+
- **[Kenney](https://kenney.nl/assets/category:Audio)** — CC0 packs of UI, impacts, footsteps and
|
|
239
|
+
jingles.
|
|
240
|
+
- **[OpenGameArt](https://opengameart.org/art-search-advanced)** — filter by license, then check
|
|
241
|
+
each page, since many items are CC-BY or GPL.
|
|
242
|
+
- **Generated clips** (ElevenLabs sound effects, Stable Audio Open) — record the prompt and the
|
|
243
|
+
generator in the entry's `source`, and check the service's terms for your use.
|
|
244
|
+
|
|
245
|
+
CC-BY sounds and music (Kevin MacLeod's, for example) are fine in your own bank if you show the
|
|
246
|
+
credit they require. Avoid the BBC Sound Effects archive (non-commercial licence) and libraries
|
|
247
|
+
that forbid redistribution.
|
|
@@ -101,7 +101,9 @@ and every sample template already carry the setting.
|
|
|
101
101
|
|
|
102
102
|
## Feedback from the simulation
|
|
103
103
|
|
|
104
|
-
The client exposes what a HUD, sound, or win screen needs — no wire-protocol parsing
|
|
104
|
+
The client exposes what a HUD, sound, or win screen needs — no wire-protocol parsing. For sound,
|
|
105
|
+
`createAudioLayer(...).attachClient(client)` from `@bendyline/molen-client/audio` plays a scene's
|
|
106
|
+
audio rules and `molen.audio.*` events; see [Sound and music](audio.md).
|
|
105
107
|
|
|
106
108
|
```ts
|
|
107
109
|
client.onEvent('collision', (e, tick) => flash());
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
# Inferred building interiors
|
|
2
2
|
|
|
3
|
-
World explorer enables lazy interiors in the styled **Human** layer
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
World explorer enables lazy interiors in the styled **Human** layer: choose **Walk**, approach
|
|
4
|
+
a building, and walk through its framed entrance. Near the entrance, the windows become
|
|
5
|
+
transparent and reveal the same interior you can enter.
|
|
6
|
+
|
|
7
|
+
`?interiors=0` disables this capability. `?synthetic=1&stores=1` provides a repeatable block of recognizable
|
|
7
8
|
stores; `test/visual/interiors.play.json` walks into and out of its fast-food restaurant and grocery store.
|
|
8
9
|
Use `?synthetic=1&houses=1` for a residential block with two-storey houses and a bungalow.
|
|
9
10
|
`test/visual/houses.play.json` walks through its entrance, climbs the stairs, and enters a bedroom.
|