incanto 0.30.0 → 0.32.0

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.
Files changed (49) hide show
  1. package/bin/incanto-play.mjs +7 -2
  2. package/dist/2d.d.ts +12 -5
  3. package/dist/2d.js +3 -3
  4. package/dist/3d.d.ts +67 -6
  5. package/dist/3d.js +4 -4
  6. package/dist/{audit-C6rMyict.js → audit-C4kmDK0o.js} +16 -0
  7. package/dist/{behavior-BAc0erXF.d.ts → behavior-D_jMpFh8.d.ts} +117 -55
  8. package/dist/{create-game-5z_QVtLx.js → create-game-bKHgHcsZ.js} +19 -10
  9. package/dist/{create-game-DuBTv2zI.js → create-game-gXI7PYl0.js} +61 -46
  10. package/dist/debug.d.ts +1 -1
  11. package/dist/debug.js +7 -2
  12. package/dist/{duplicate-BgtFrFo4.js → duplicate-KRPtUtzl.js} +1 -1
  13. package/dist/{editor-switch-B0wB_DSr.d.ts → editor-switch-BJb-CWfA.d.ts} +12 -1
  14. package/dist/{register-DJ0SByQg.js → environment-presets--DigHNg4.js} +42 -11
  15. package/dist/{gameplay-Cfr6aFZ1.js → gameplay-BftxM_It.js} +2 -2
  16. package/dist/gameplay.d.ts +1 -1
  17. package/dist/gameplay.js +1 -1
  18. package/dist/index.d.ts +13 -3
  19. package/dist/index.js +7 -7
  20. package/dist/{loader-B242FF6N.d.ts → loader-BYBrqTxP.d.ts} +1 -1
  21. package/dist/{loader-BZqOKfI2.js → loader-BlaRQGaA.js} +482 -6
  22. package/dist/net.d.ts +1 -1
  23. package/dist/net.js +3 -3
  24. package/dist/{pathfinding-BwD974Ss.d.ts → pathfinding-BwhqPD3i.d.ts} +1 -1
  25. package/dist/{physics-2d-3kOQCtgd.js → physics-2d-D9wquBvK.js} +4 -3
  26. package/dist/{physics-3d-CeRH-Ff_.js → physics-3d-CnPygVGo.js} +5 -4
  27. package/dist/react.d.ts +1 -1
  28. package/dist/react.js +1 -1
  29. package/dist/{register-MelqEdza.js → register-CUY284Is.js} +3 -3
  30. package/dist/{register-BTg0EM7s.js → register-Dzkd6-os.js} +56 -380
  31. package/dist/{register-DWcWq4QG.js → register-tkR_8tWg.js} +4 -4
  32. package/dist/{registry-BVJ2HbCn.js → registry-CJdGpT2V.js} +6 -2
  33. package/dist/test-WwRIlXsK.js +642 -0
  34. package/dist/test.d.ts +55 -8
  35. package/dist/test.js +3 -364
  36. package/dist/{touch-031PxtCR.js → touch-BoNg_MnF.js} +2 -1
  37. package/dist/vite.js +1 -1
  38. package/editor/assets/{agent8-CAp0i5qn.js → agent8-C5k1nTCH.js} +1 -1
  39. package/editor/assets/{debug-BoEYfbqK.js → debug-BT_0mjk-.js} +3 -2
  40. package/editor/assets/{index-BO6WU8by.js → index-gfyrByWw.js} +90 -90
  41. package/editor/index.html +1 -1
  42. package/package.json +1 -1
  43. package/skills/README.md +14 -2
  44. package/skills/incanto-building-2d-games.md +16 -0
  45. package/skills/incanto-building-3d-games.md +16 -0
  46. package/skills/incanto-verifying-your-game.md +118 -0
  47. package/templates-app/beacon-isle-3d/package.json +1 -1
  48. package/templates-app/tps-3d/package.json +1 -1
  49. package/templates-app/village-quest-3d/package.json +1 -1
@@ -1,13 +1,13 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
2
- import { _ as registerBehavior, n as loadScene } from "./loader-BZqOKfI2.js";
3
- import { l as AudioPlayer, u as Engine } from "./register-BTg0EM7s.js";
2
+ import { m as diagnose, n as loadScene, y as registerBehavior } from "./loader-BlaRQGaA.js";
3
+ import { l as AudioPlayer, u as Engine } from "./register-Dzkd6-os.js";
4
4
  import { t as IncantoError } from "./errors-BpWbnbb_.js";
5
- import { i as resolveRendering, n as attachTouchControls } from "./touch-031PxtCR.js";
5
+ import { i as resolveRendering, n as attachTouchControls } from "./touch-BoNg_MnF.js";
6
6
  import { a as poseFromRenderer, i as openBundledEditor, n as crossFade, r as devServerLibrary, t as teardown } from "./teardown-ByzfDPyu.js";
7
- import { B as createCausticsQuad, F as PhysicsBody3D, R as Node3D, n as registerGameplayBehaviors } from "./gameplay-Cfr6aFZ1.js";
7
+ import { B as createCausticsQuad, F as PhysicsBody3D, R as Node3D, n as registerGameplayBehaviors } from "./gameplay-BftxM_It.js";
8
8
  import { t as debugSources } from "./debug-draw-BM3DsvtT.js";
9
- import { T as Camera3D, _ as DirectionalLight3D, h as ModelInstance3D, t as registerNodes3D } from "./register-DJ0SByQg.js";
10
- import { n as enablePhysics3D } from "./physics-3d-CeRH-Ff_.js";
9
+ import { E as Camera3D, g as ModelInstance3D, n as registerNodes3D, t as resolveEnvironmentHdri, v as DirectionalLight3D } from "./environment-presets--DigHNg4.js";
10
+ import { n as enablePhysics3D } from "./physics-3d-CnPygVGo.js";
11
11
  import { ACESFilmicToneMapping, AmbientLight, Box3, BufferAttribute, BufferGeometry, Color, DepthTexture, EquirectangularReflectionMapping, FloatType, Fog, HalfFloatType, LineBasicMaterial, LineSegments, Matrix4, Mesh, PCFShadowMap, PMREMGenerator, PerspectiveCamera, PlaneGeometry, Quaternion, Raycaster, Scene, ShaderMaterial, Vector2, Vector3, WebGLRenderTarget, WebGLRenderer } from "three";
12
12
  import { VRMLoaderPlugin, VRMUtils } from "@pixiv/three-vrm";
13
13
  import { GLTFLoader } from "three/addons/loaders/GLTFLoader.js";
@@ -25,15 +25,47 @@ import { Sky } from "three/examples/jsm/objects/Sky.js";
25
25
  * @pixiv/three-vrm (VRM 0.x facing fixed via rotateVRM0).
26
26
  */
27
27
  var AssetStore3D = class {
28
+ engine;
28
29
  models = /* @__PURE__ */ new Map();
29
30
  animations = /* @__PURE__ */ new Map();
30
31
  modelKeys = /* @__PURE__ */ new Map();
31
32
  animationKeys = /* @__PURE__ */ new Map();
32
33
  loader;
33
- constructor() {
34
+ /**
35
+ * `engine` is optional only so a bare store still constructs in tests. Give it
36
+ * one and every load failure lands in `engine.log` — where the debug overlay,
37
+ * `runScript()` and any agent tool can see it. Without it a 404'd GLB was a
38
+ * console line and an invisible model.
39
+ */
40
+ constructor(engine = null) {
41
+ this.engine = engine;
34
42
  this.loader = new GLTFLoader();
35
43
  this.loader.register((parser) => new VRMLoaderPlugin(parser));
36
44
  }
45
+ /**
46
+ * Every asset that failed, with the reason — the answer to "why is my model
47
+ * not there". Empty is the healthy case.
48
+ */
49
+ errors() {
50
+ const out = [];
51
+ for (const [ref, url] of this.modelKeys) {
52
+ const entry = this.models.get(url);
53
+ if (entry?.error) out.push({
54
+ ref,
55
+ url,
56
+ error: String(entry.error)
57
+ });
58
+ }
59
+ for (const [ref, decl] of this.animationKeys) {
60
+ const entry = this.animations.get(decl.url);
61
+ if (entry?.error) out.push({
62
+ ref,
63
+ url: decl.url,
64
+ error: String(entry.error)
65
+ });
66
+ }
67
+ return out;
68
+ }
37
69
  /** Map a scene's `assets` header. */
38
70
  load(assets) {
39
71
  for (const [key, def] of Object.entries(assets)) {
@@ -83,7 +115,7 @@ var AssetStore3D = class {
83
115
  }, void 0, (error) => {
84
116
  entry.status = "error";
85
117
  entry.error = error instanceof Error ? error.message : String(error);
86
- console.error(`incanto: failed to load model '${url}':`, error);
118
+ diagnose(this.engine, "error", `incanto: failed to load model '${url}':`, error);
87
119
  });
88
120
  return entry;
89
121
  }
@@ -103,11 +135,11 @@ var AssetStore3D = class {
103
135
  entry.clips = gltf.animations ?? [];
104
136
  entry.scene = gltf.scene;
105
137
  entry.status = "ready";
106
- if (entry.clips.length === 0) console.warn(`incanto: animation asset '${def.url}' contains no clips`);
138
+ if (entry.clips.length === 0) diagnose(this.engine, "warn", `incanto: animation asset '${def.url}' contains no clips`);
107
139
  }, void 0, (error) => {
108
140
  entry.status = "error";
109
141
  entry.error = error instanceof Error ? error.message : String(error);
110
- console.error(`incanto: failed to load animation '${def.url}':`, error);
142
+ diagnose(this.engine, "error", `incanto: failed to load animation '${def.url}':`, error);
111
143
  });
112
144
  return entry;
113
145
  }
@@ -884,37 +916,6 @@ function lerp(a, b, t) {
884
916
  return a + (b - a) * t;
885
917
  }
886
918
  //#endregion
887
- //#region src/3d/environment-presets.ts
888
- /**
889
- * drei-compatible environment presets: each name maps to a 1k HDRI (the exact
890
- * Poly Haven CC0 files @react-three/drei ships), so `preset="sunset"` lights the
891
- * same here. Served from the agent8 CDN (the only sanctioned external host, same
892
- * as the terrain splat) — set `environment.hdri` to override with your own URL.
893
- */
894
- const CDN = "https://agent8-games.verse8.io/assets/3D/default/textures/hdri";
895
- const ENVIRONMENT_PRESETS = {
896
- apartment: "lebombo_1k.hdr",
897
- city: "potsdamer_platz_1k.hdr",
898
- dawn: "kiara_1_dawn_1k.hdr",
899
- forest: "forest_slope_1k.hdr",
900
- lobby: "st_fagans_interior_1k.hdr",
901
- night: "dikhololo_night_1k.hdr",
902
- park: "rooitou_park_1k.hdr",
903
- studio: "studio_small_03_1k.hdr",
904
- sunset: "venice_sunset_1k.hdr",
905
- warehouse: "empty_warehouse_01_1k.hdr"
906
- };
907
- /** Resolve `environment.preset` / `environment.hdri` to the HDR url (or null). */
908
- function resolveEnvironmentHdri(env) {
909
- if (typeof env.hdri === "string" && env.hdri !== "") return env.hdri;
910
- if (typeof env.preset === "string") {
911
- const file = ENVIRONMENT_PRESETS[env.preset];
912
- if (!file) throw new Error(`Unknown environment preset '${env.preset}'. Available: ${Object.keys(ENVIRONMENT_PRESETS).join(", ")}.`);
913
- return `${CDN}/${file}`;
914
- }
915
- return null;
916
- }
917
- //#endregion
918
919
  //#region src/3d/environment-3d.ts
919
920
  /** Shadow ortho half-extent when the env header forces a light to cast and the
920
921
  * light node configured nothing itself. One static box around the origin — no
@@ -1499,6 +1500,11 @@ var Renderer3D = class {
1499
1500
  engine;
1500
1501
  disconnect;
1501
1502
  canvas;
1503
+ /**
1504
+ * The model/animation store. Public so a game (and an agent's tool) can ask
1505
+ * `renderer.assets.errors()` why a model is not there — it used to be private,
1506
+ * so a 404'd GLB was unanswerable from outside.
1507
+ */
1502
1508
  assets;
1503
1509
  ownsAssets;
1504
1510
  loadedAssetScenes = /* @__PURE__ */ new WeakSet();
@@ -1545,14 +1551,19 @@ var Renderer3D = class {
1545
1551
  this.canvas = opts.canvas;
1546
1552
  this.engine = opts.engine;
1547
1553
  this.ownsAssets = !opts.assets;
1548
- this.assets = opts.assets ?? new AssetStore3D();
1554
+ this.assets = opts.assets ?? new AssetStore3D(this.engine);
1549
1555
  const rendering = resolveRendering(opts.engine.scene?.environment, {
1550
1556
  antialias: true,
1551
- pixelRatio: Math.min(globalThis.devicePixelRatio ?? 1, 2)
1552
- }, globalThis.devicePixelRatio ?? 1, { pixelRatio: opts.pixelRatio });
1557
+ pixelRatio: Math.min(globalThis.devicePixelRatio ?? 1, 2),
1558
+ preserveDrawingBuffer: false
1559
+ }, globalThis.devicePixelRatio ?? 1, {
1560
+ pixelRatio: opts.pixelRatio,
1561
+ preserveDrawingBuffer: opts.preserveDrawingBuffer
1562
+ });
1553
1563
  this.webgl = new WebGLRenderer({
1554
1564
  canvas: opts.canvas,
1555
- antialias: rendering.antialias
1565
+ antialias: rendering.antialias,
1566
+ preserveDrawingBuffer: rendering.preserveDrawingBuffer
1556
1567
  });
1557
1568
  this.webgl.info.autoReset = false;
1558
1569
  this.basePixelRatio = rendering.pixelRatio;
@@ -2188,7 +2199,8 @@ async function createGame3D(opts) {
2188
2199
  canvas: opts.canvas,
2189
2200
  engine,
2190
2201
  ...opts.pixelRatio !== void 0 ? { pixelRatio: opts.pixelRatio } : {},
2191
- ...opts.adaptiveResolution !== void 0 ? { adaptiveResolution: opts.adaptiveResolution } : {}
2202
+ ...opts.adaptiveResolution !== void 0 ? { adaptiveResolution: opts.adaptiveResolution } : {},
2203
+ ...opts.preserveDrawingBuffer !== void 0 ? { preserveDrawingBuffer: opts.preserveDrawingBuffer } : {}
2192
2204
  });
2193
2205
  await report(.14, "renderer");
2194
2206
  const wantDebug = opts.debug ?? false;
@@ -2265,6 +2277,9 @@ async function createGame3D(opts) {
2265
2277
  sourceJson,
2266
2278
  renderer,
2267
2279
  physics,
2280
+ assetErrors() {
2281
+ return renderer.assets?.errors() ?? [];
2282
+ },
2268
2283
  stats() {
2269
2284
  return {
2270
2285
  triangles: 0,
package/dist/debug.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { C as RendererStats, E as LogLevel, v as Engine } from "./behavior-BAc0erXF.js";
1
+ import { C as RendererStats, et as LogLevel, v as Engine } from "./behavior-D_jMpFh8.js";
2
2
 
3
3
  //#region src/debug/panel.d.ts
4
4
  /** Minimal document surface the overlay needs (injectable for tests). */
package/dist/debug.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as jsonClone } from "./json-BLk7H2Qa.js";
2
- import { s as mergeStaticProps } from "./registry-BVJ2HbCn.js";
2
+ import { s as mergeStaticProps } from "./registry-CJdGpT2V.js";
3
3
  import { t as debugSources } from "./debug-draw-BM3DsvtT.js";
4
4
  //#region src/debug/panel.ts
5
5
  /** Keep a panel rect on screen and above the minimum usable size. */
@@ -913,8 +913,13 @@ function compactCount(n) {
913
913
  }
914
914
  function stringify(part) {
915
915
  if (typeof part === "string") return part;
916
+ if (part instanceof Error) {
917
+ const first = part.stack?.split("\n")[1]?.trim();
918
+ return `${part.name}: ${part.message}${first ? ` (${first})` : ""}`;
919
+ }
916
920
  try {
917
- return JSON.stringify(part);
921
+ const text = JSON.stringify(part);
922
+ return text === "{}" || text === void 0 ? String(part) : text;
918
923
  } catch {
919
924
  return String(part);
920
925
  }
@@ -1,4 +1,4 @@
1
- import { i as serializeNode, t as buildNodeJson } from "./loader-BZqOKfI2.js";
1
+ import { i as serializeNode, t as buildNodeJson } from "./loader-BlaRQGaA.js";
2
2
  //#region src/core/order-groups.ts
3
3
  const ORDER_GROUP_BASE = {
4
4
  background: -2e3,
@@ -1,5 +1,16 @@
1
1
  import { s as JsonObject } from "./schema-CcoWb32N.js";
2
2
 
3
+ //#region src/core/diagnostics.d.ts
4
+ /** The minimum an engine has to look like to receive a diagnostic. */
5
+ interface DiagnosticSink {
6
+ log: {
7
+ warn(...parts: unknown[]): void;
8
+ error(...parts: unknown[]): void;
9
+ info(...parts: unknown[]): void;
10
+ debug(...parts: unknown[]): void;
11
+ };
12
+ }
13
+ //#endregion
3
14
  //#region src/core/editor-switch.d.ts
4
15
  /** Where a camera is and what it looks at, in world space. */
5
16
  interface CameraPose {
@@ -56,4 +67,4 @@ type LibrarySearch = (query: {
56
67
  total?: number;
57
68
  }>;
58
69
  //#endregion
59
- export { EditorSwitchOptions as t };
70
+ export { DiagnosticSink as n, EditorSwitchOptions as t };
@@ -1,10 +1,10 @@
1
- import { t as registerCoreNodes } from "./register-BTg0EM7s.js";
1
+ import { t as registerCoreNodes } from "./register-Dzkd6-os.js";
2
2
  import { t as IncantoError } from "./errors-BpWbnbb_.js";
3
3
  import { t as Rng } from "./rng-DP-SR7eg.js";
4
- import { i as getNodeSchema, l as registerNode } from "./registry-BVJ2HbCn.js";
4
+ import { i as getNodeSchema, l as registerNode } from "./registry-CJdGpT2V.js";
5
5
  import { t as createNoise2D } from "./noise-CGUMx44x.js";
6
6
  import { i as applyParticlePreset, r as PARTICLE_PRESET_NAMES, t as ParticleSim } from "./particle-sim-Bw7hB93B.js";
7
- import { A as Water3D, F as PhysicsBody3D, H as colliderFootDrop, I as RigidBody3D, L as StaticBody3D, M as WaterCutout3D, N as Area3D, P as CharacterBody3D, R as Node3D } from "./gameplay-Cfr6aFZ1.js";
7
+ import { A as Water3D, F as PhysicsBody3D, H as colliderFootDrop, I as RigidBody3D, L as StaticBody3D, M as WaterCutout3D, N as Area3D, P as CharacterBody3D, R as Node3D } from "./gameplay-BftxM_It.js";
8
8
  import { n as splatWeights, t as buildHeightmap } from "./heightmap-CRK0M4jT.js";
9
9
  import { AdditiveBlending, AnimationClip, AnimationMixer, Box3, BoxGeometry, BufferAttribute, BufferGeometry, CanvasTexture, CapsuleGeometry, Color, ConeGeometry, CylinderGeometry, DataTexture, DirectionalLight, DoubleSide, DynamicDrawUsage, Euler, Group, IcosahedronGeometry, ImageBitmapLoader, InstancedBufferAttribute, InstancedMesh, LinearFilter, LoopOnce, LoopRepeat, Matrix4, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshPhysicalMaterial, MeshStandardMaterial, NearestFilter, NoBlending, NormalBlending, PerspectiveCamera, PlaneGeometry, PointLight, Points, PointsMaterial, Quaternion, QuaternionKeyframeTrack, RGBADepthPacking, RGBAFormat, RepeatWrapping, SRGBColorSpace, ShaderChunk, ShaderMaterial, SphereGeometry, Texture, TextureLoader, UniformsLib, UniformsUtils, Vector3, Vector4, VectorKeyframeTrack } from "three";
10
10
  import { clone } from "three/addons/utils/SkeletonUtils.js";
@@ -6068,7 +6068,7 @@ var ModelInstance3D = class extends Node3D {
6068
6068
  if (entry.claimedBy && entry.claimedBy !== this) {
6069
6069
  if (!this.warnedClaim) {
6070
6070
  this.warnedClaim = true;
6071
- console.warn(`incanto: VRM '${this.model}' is already displayed by another node — a VRM asset can back only one ModelInstance3D.`);
6071
+ this.diagnose("warn", `incanto: VRM '${this.model}' is already displayed by another node — a VRM asset can back only one ModelInstance3D.`);
6072
6072
  }
6073
6073
  return;
6074
6074
  }
@@ -6119,7 +6119,7 @@ var ModelInstance3D = class extends Node3D {
6119
6119
  const scale = size.y > 0 ? this.targetHeight / size.y : prev;
6120
6120
  if (scale < .05 || scale > 20) {
6121
6121
  this.fitGroup.scale.setScalar(1);
6122
- console.warn(`[incanto] ModelInstance3D '${this.name}': targetHeight fit measured an implausible scale (${scale.toFixed(2)}x) — skinned rigs defeat bounding-box measurement. Rendering at the model's authored scale instead.`);
6122
+ this.diagnose("warn", `[incanto] ModelInstance3D '${this.name}': targetHeight fit measured an implausible scale (${scale.toFixed(2)}x) — skinned rigs defeat bounding-box measurement. Rendering at the model's authored scale instead.`);
6123
6123
  } else this.fitGroup.scale.setScalar(scale);
6124
6124
  } else this.fitGroup.scale.setScalar(1);
6125
6125
  }
@@ -6193,7 +6193,7 @@ var ModelInstance3D = class extends Node3D {
6193
6193
  const cached = this.entry.retargeted.get(ref);
6194
6194
  if (cached) return cached;
6195
6195
  const result = retargetClipToVrm(source, anim.scene, this.entry.vrm);
6196
- if (result.skippedBones.length > 0) console.warn(`incanto: retarget '${ref}' skipped bones: ${result.skippedBones.join(", ")}`);
6196
+ if (result.skippedBones.length > 0) this.diagnose("warn", `incanto: retarget '${ref}' skipped bones: ${result.skippedBones.join(", ")}`);
6197
6197
  this.entry.retargeted.set(ref, result.clip);
6198
6198
  return result.clip;
6199
6199
  }
@@ -6258,7 +6258,7 @@ var ModelInstance3D = class extends Node3D {
6258
6258
  action.crossFadeFrom(this.currentAction, ANIM_CROSSFADE, warp);
6259
6259
  }
6260
6260
  this.currentAction = action;
6261
- } else console.warn(`incanto: model '${this.model}' has no animation '${this.animation}' — embedded: ${this.entry.animations.map((c) => c.name).join(", ") || "(none)"}; assets: ${assets.animationRefs().join(", ") || "(none)"}`);
6261
+ } else this.diagnose("warn", `incanto: model '${this.model}' has no animation '${this.animation}' — embedded: ${this.entry.animations.map((c) => c.name).join(", ") || "(none)"}; assets: ${assets.animationRefs().join(", ") || "(none)"}`);
6262
6262
  }
6263
6263
  /** The upper-body layer: masked clip on the `upperBodyRoot` subtree. */
6264
6264
  syncUpperAnimation(assets) {
@@ -6272,13 +6272,13 @@ var ModelInstance3D = class extends Node3D {
6272
6272
  const resolved = this.resolveClip(this.animationUpper, assets);
6273
6273
  if (resolved === "loading") return;
6274
6274
  if (!resolved) {
6275
- console.warn(`incanto: model '${this.model}' has no animation '${this.animationUpper}' for the upper layer.`);
6275
+ this.diagnose("warn", `incanto: model '${this.model}' has no animation '${this.animationUpper}' for the upper layer.`);
6276
6276
  this.playingUpper = this.animationUpper;
6277
6277
  return;
6278
6278
  }
6279
6279
  const variants = this.layerVariants(resolved);
6280
6280
  if (!variants) {
6281
- console.warn(`incanto: upperBodyRoot '${this.upperBodyRoot}' not found in '${this.model}' — upper layer skipped.`);
6281
+ this.diagnose("warn", `incanto: upperBodyRoot '${this.upperBodyRoot}' not found in '${this.model}' — upper layer skipped.`);
6282
6282
  this.playingUpper = this.animationUpper;
6283
6283
  return;
6284
6284
  }
@@ -8306,7 +8306,7 @@ var River3D = class River3D extends Node3D {
8306
8306
  if (gaps.length * 3 < this.rings.length) return;
8307
8307
  this.warnedCoverage = true;
8308
8308
  const worst = gaps.reduce((a, b) => b.wettedHalfWidth - b.carriedHalfWidth > a.wettedHalfWidth - a.carriedHalfWidth ? b : a);
8309
- console.warn(`[incanto] River3D '${this.name}': the course is too tight for the water it holds — ${gaps.length} of ${this.rings.length} stations leave bare channel beside the ribbon (worst at ${worst.along.toFixed(0)} m: ground wet to ${worst.wettedHalfWidth.toFixed(1)} m from the centre, a bend that can only carry ${worst.carriedHalfWidth.toFixed(1)} m). Fix by EASING THE BENDS in \`path\` (fewer, straighter points), NARROWING \`widths\` there, or placing standing water (a Water3D) if that reach is really a pool.`);
8309
+ this.diagnose("warn", `[incanto] River3D '${this.name}': the course is too tight for the water it holds — ${gaps.length} of ${this.rings.length} stations leave bare channel beside the ribbon (worst at ${worst.along.toFixed(0)} m: ground wet to ${worst.wettedHalfWidth.toFixed(1)} m from the centre, a bend that can only carry ${worst.carriedHalfWidth.toFixed(1)} m). Fix by EASING THE BENDS in \`path\` (fewer, straighter points), NARROWING \`widths\` there, or placing standing water (a Water3D) if that reach is really a pool.`);
8310
8310
  }
8311
8311
  warnedCoverage = false;
8312
8312
  rebuildIfNeeded(mesh) {
@@ -11878,4 +11878,35 @@ function registerNodes3D() {
11878
11878
  registerNode(CharacterBody3D);
11879
11879
  }
11880
11880
  //#endregion
11881
- export { DEFAULT_TERRAIN_TEXTURE_BASE as A, movementState as B, FLOWER_VARIETIES as C, BoneAttachment3D as D, BoneLookAt3D as E, MeshInstance3D as F, buildMeshGeometry as I, QUARTER_PITCH as L, terrainThemeLayers as M, Joint3D as N, Billboard3D as O, InstancedMesh3D as P, cameraRelative as R, resolveFlowerDensity as S, Camera3D as T, rigPose as V, DirectionalLight3D as _, Trail3D as a, DENSITY_PRESETS as b, findRiverCoverageGaps as c, riverStepFor as d, smoothCourse as f, LoftMesh3D as g, ModelInstance3D as h, Tree3D as i, TERRAIN_THEMES as j, Terrain3D as k, projectToRiver as l, Particles3D as m, VOXEL_PALETTE as n, River3D as o, traceDownhillPath as p, VoxelGrid3D as r, buildRiverRings as s, registerNodes3D as t, riverCarveChannels as u, OmniLight3D as v, CharacterController3D as w, Flowers3D as x, Foliage3D as y, keyboardIntensity as z };
11881
+ //#region src/3d/environment-presets.ts
11882
+ /**
11883
+ * drei-compatible environment presets: each name maps to a 1k HDRI (the exact
11884
+ * Poly Haven CC0 files @react-three/drei ships), so `preset="sunset"` lights the
11885
+ * same here. Served from the agent8 CDN (the only sanctioned external host, same
11886
+ * as the terrain splat) — set `environment.hdri` to override with your own URL.
11887
+ */
11888
+ const CDN = "https://agent8-games.verse8.io/assets/3D/default/textures/hdri";
11889
+ const ENVIRONMENT_PRESETS = {
11890
+ apartment: "lebombo_1k.hdr",
11891
+ city: "potsdamer_platz_1k.hdr",
11892
+ dawn: "kiara_1_dawn_1k.hdr",
11893
+ forest: "forest_slope_1k.hdr",
11894
+ lobby: "st_fagans_interior_1k.hdr",
11895
+ night: "dikhololo_night_1k.hdr",
11896
+ park: "rooitou_park_1k.hdr",
11897
+ studio: "studio_small_03_1k.hdr",
11898
+ sunset: "venice_sunset_1k.hdr",
11899
+ warehouse: "empty_warehouse_01_1k.hdr"
11900
+ };
11901
+ /** Resolve `environment.preset` / `environment.hdri` to the HDR url (or null). */
11902
+ function resolveEnvironmentHdri(env) {
11903
+ if (typeof env.hdri === "string" && env.hdri !== "") return env.hdri;
11904
+ if (typeof env.preset === "string") {
11905
+ const file = ENVIRONMENT_PRESETS[env.preset];
11906
+ if (!file) throw new Error(`Unknown environment preset '${env.preset}'. Available: ${Object.keys(ENVIRONMENT_PRESETS).join(", ")}.`);
11907
+ return `${CDN}/${file}`;
11908
+ }
11909
+ return null;
11910
+ }
11911
+ //#endregion
11912
+ export { Terrain3D as A, keyboardIntensity as B, resolveFlowerDensity as C, BoneLookAt3D as D, Camera3D as E, InstancedMesh3D as F, rigPose as H, MeshInstance3D as I, buildMeshGeometry as L, TERRAIN_THEMES as M, terrainThemeLayers as N, BoneAttachment3D as O, Joint3D as P, QUARTER_PITCH as R, Flowers3D as S, CharacterController3D as T, movementState as V, LoftMesh3D as _, Tree3D as a, Foliage3D as b, buildRiverRings as c, riverCarveChannels as d, riverStepFor as f, ModelInstance3D as g, Particles3D as h, VoxelGrid3D as i, DEFAULT_TERRAIN_TEXTURE_BASE as j, Billboard3D as k, findRiverCoverageGaps as l, traceDownhillPath as m, registerNodes3D as n, Trail3D as o, smoothCourse as p, VOXEL_PALETTE as r, River3D as s, resolveEnvironmentHdri as t, projectToRiver as u, DirectionalLight3D as v, FLOWER_VARIETIES as w, DENSITY_PRESETS as x, OmniLight3D as y, cameraRelative as z };
@@ -1,7 +1,7 @@
1
- import { _ as registerBehavior, f as Node, m as Behavior, n as loadScene } from "./loader-BZqOKfI2.js";
1
+ import { f as Node, g as Behavior, n as loadScene, y as registerBehavior } from "./loader-BlaRQGaA.js";
2
2
  import { t as IncantoError } from "./errors-BpWbnbb_.js";
3
3
  import { t as jsonClone } from "./json-BLk7H2Qa.js";
4
- import { r as effectiveOrder, t as duplicateNode } from "./duplicate-BgtFrFo4.js";
4
+ import { r as effectiveOrder, t as duplicateNode } from "./duplicate-KRPtUtzl.js";
5
5
  import { Color, CubeCamera, DepthTexture, DoubleSide, Euler, FloatType, Frustum, HalfFloatType, LinearMipmapLinearFilter, MathUtils, Matrix4, Mesh, MeshDepthMaterial, Object3D, PerspectiveCamera, Plane, PlaneGeometry, Quaternion, ShaderMaterial, Sphere, Vector2, Vector3, Vector4, WebGLCubeRenderTarget, WebGLRenderTarget } from "three";
6
6
  //#region src/3d/frustum.ts
7
7
  const scratchFrustum = new Frustum();
@@ -1,5 +1,5 @@
1
+ import { X as Node, l as PropSchema, n as BehaviorCtor, t as Behavior, v as Engine } from "./behavior-D_jMpFh8.js";
1
2
  import { c as JsonValue, s as JsonObject } from "./schema-CcoWb32N.js";
2
- import { $ as Node, l as PropSchema, n as BehaviorCtor, t as Behavior, v as Engine } from "./behavior-BAc0erXF.js";
3
3
 
4
4
  //#region src/gameplay/chase.d.ts
5
5
  /**
package/dist/gameplay.js CHANGED
@@ -1,2 +1,2 @@
1
- import { C as FollowCamera, D as Health, E as DamageOnContact, O as Collector, S as restartScene, T as phaseOf, _ as hitStop, a as Wander, b as GameFlow, c as Projectile, d as PathFollow, f as Oscillate, g as Cooldown, h as CameraShake, i as WaveSpawner, k as Chase, l as Pickup, m as Lifetime, n as registerGameplayBehaviors, o as Spawner, p as MoveTo, r as ZombieAI, s as ScoreKeeper, t as GAMEPLAY_BEHAVIORS, u as Patrol, v as screenFlash, w as DayNight, x as goToScene, y as Interactable } from "./gameplay-Cfr6aFZ1.js";
1
+ import { C as FollowCamera, D as Health, E as DamageOnContact, O as Collector, S as restartScene, T as phaseOf, _ as hitStop, a as Wander, b as GameFlow, c as Projectile, d as PathFollow, f as Oscillate, g as Cooldown, h as CameraShake, i as WaveSpawner, k as Chase, l as Pickup, m as Lifetime, n as registerGameplayBehaviors, o as Spawner, p as MoveTo, r as ZombieAI, s as ScoreKeeper, t as GAMEPLAY_BEHAVIORS, u as Patrol, v as screenFlash, w as DayNight, x as goToScene, y as Interactable } from "./gameplay-BftxM_It.js";
2
2
  export { CameraShake, Chase, Collector, Cooldown, DamageOnContact, DayNight, FollowCamera, GAMEPLAY_BEHAVIORS, GameFlow, Health, Interactable, Lifetime, MoveTo, Oscillate, PathFollow, Patrol, Pickup, Projectile, ScoreKeeper, Spawner, Wander, WaveSpawner, ZombieAI, goToScene, hitStop, phaseOf, registerGameplayBehaviors, restartScene, screenFlash };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
+ import { $ as LogEntry, A as VoicePreset, B as SfxParams, C as RendererStats, D as SfxPlayOptions, E as SfxEngine, F as Vec3, G as MusicManager, H as SynthOptions, I as spatialGain, J as AudioBuses, K as MusicTrack, L as spatialPan, M as ROLLOFF_MODELS, N as RolloffModel, O as isAudioContextAvailable, P as SpatialParams, Q as SceneTree, R as SFX_PRESETS, S as GameStats, T as InputMap, U as synthSfx, V as SfxWave, W as MusicBackend, X as Node, Y as BusName, Z as NodeLifecycle, _ as registeredTypes, a as registerBehavior, b as Scheduler, c as PropDef, d as createNode, et as LogLevel, f as getNodeSchema, g as registerNode, h as mergeStaticSignals, i as getBehavior, j as Listener, k as Voice, l as PropSchema, m as getNodeType, n as BehaviorCtor, nt as Signal, o as registeredBehaviors, p as getNodeSignals, q as PlayMusicOptions, r as clearBehaviors, rt as SignalListener, s as NodeCtor, t as Behavior, tt as LogManager, u as clearRegistry, v as Engine, w as Scene, x as EngineStats, y as EngineOptions, z as SFX_PRESET_NAMES } from "./behavior-D_jMpFh8.js";
1
2
  import { a as Rng, c as JsonValue, d as jsonKind, i as SceneJson, l as jsonClone, n as NodeJson, o as JsonKind, r as SCENE_FORMAT, s as JsonObject, t as ConnectionJson, u as jsonEquals } from "./schema-CcoWb32N.js";
2
- import { $ as Node, A as SfxPlayOptions, B as spatialPan, C as RendererStats, D as LogManager, E as LogLevel, F as ROLLOFF_MODELS, G as SynthOptions, H as SFX_PRESET_NAMES, I as RolloffModel, J as MusicManager, K as synthSfx, L as SpatialParams, M as Voice, N as VoicePreset, O as InputMap, P as Listener, Q as BusName, R as Vec3, S as GameStats, T as LogEntry, U as SfxParams, V as SFX_PRESETS, W as SfxWave, X as PlayMusicOptions, Y as MusicTrack, Z as AudioBuses, _ as registeredTypes, a as registerBehavior, b as Scheduler, c as PropDef, d as createNode, et as NodeLifecycle, f as getNodeSchema, g as registerNode, h as mergeStaticSignals, i as getBehavior, j as isAudioContextAvailable, k as SfxEngine, l as PropSchema, m as getNodeType, n as BehaviorCtor, nt as SignalListener, o as registeredBehaviors, p as getNodeSignals, q as MusicBackend, r as clearBehaviors, rt as SceneTree, s as NodeCtor, t as Behavior, tt as Signal, u as clearRegistry, v as Engine, w as Scene, x as EngineStats, y as EngineOptions, z as spatialGain } from "./behavior-BAc0erXF.js";
3
- import { n as loadScene, t as LoadSceneOptions } from "./loader-B242FF6N.js";
3
+ import { n as loadScene, t as LoadSceneOptions } from "./loader-BYBrqTxP.js";
4
4
  import { n as ParticleSimConfig, r as ParticleView, t as ParticleSim } from "./particle-sim-CwJ5rI_P.js";
5
- import { a as AudioElementLike, i as gridFromRows, n as PathGrid, o as AudioPlayer, r as findPath, t as FindPathOptions } from "./pathfinding-BwD974Ss.js";
5
+ import { a as AudioElementLike, i as gridFromRows, n as PathGrid, o as AudioPlayer, r as findPath, t as FindPathOptions } from "./pathfinding-BwhqPD3i.js";
6
6
  import { i as auditScene, n as IncantoErrorCode, r as IncantoErrorDetails, t as IncantoError } from "./errors-1dXlIwoR.js";
7
7
 
8
8
  //#region src/core/audio/crossfade.d.ts
@@ -401,10 +401,20 @@ declare function registerCoreNodes(): void;
401
401
  interface ResolvedRendering {
402
402
  antialias: boolean;
403
403
  pixelRatio: number;
404
+ /**
405
+ * Keep the drawing buffer readable after a frame (default false).
406
+ *
407
+ * WebGL clears it as soon as the frame is composited, so `canvas.toDataURL()`
408
+ * — and therefore ANY screenshot a driver takes — comes back blank. Turning
409
+ * this on costs a buffer copy per frame, which is why it is off for games and
410
+ * on for the run where something is trying to LOOK at the output.
411
+ */
412
+ preserveDrawingBuffer: boolean;
404
413
  }
405
414
  declare function resolveRendering(environment: JsonObject | undefined, fallback: ResolvedRendering, devicePixelRatio: number, explicit?: {
406
415
  antialias?: boolean;
407
416
  pixelRatio?: number;
417
+ preserveDrawingBuffer?: boolean;
408
418
  }): ResolvedRendering;
409
419
  //#endregion
410
420
  //#region src/core/replay.d.ts
package/dist/index.js CHANGED
@@ -1,14 +1,14 @@
1
- import { _ as registerBehavior, a as SCENE_FORMAT, c as SceneTree, d as resolveConstants, f as Node, g as getBehavior, h as clearBehaviors, i as serializeNode, l as CONST_REF_KEY, m as Behavior, n as loadScene, o as computeViewport, p as parseNodePath, r as Scene, s as resolveViewport, u as isConstRef, v as registeredBehaviors, y as Signal } from "./loader-BZqOKfI2.js";
2
- import { C as crossfadeGains, S as WebAudioMusicBackend, T as AudioBuses, _ as spatialPan, a as HudLayer, b as synthSfx, c as UiText, d as LogManager, f as InputMap, g as spatialGain, h as ROLLOFF_MODELS, i as UiDialogue, l as AudioPlayer, m as isAudioContextAvailable, n as Timer, o as UiBanner, p as SfxEngine, r as UiButton, s as UiBar, t as registerCoreNodes, u as Engine, v as SFX_PRESETS, w as fadeGain, x as MusicManager, y as SFX_PRESET_NAMES } from "./register-BTg0EM7s.js";
1
+ import { _ as clearBehaviors, a as SCENE_FORMAT, b as registeredBehaviors, c as SceneTree, d as resolveConstants, f as Node, g as Behavior, h as InputMap, i as serializeNode, l as CONST_REF_KEY, n as loadScene, o as computeViewport, p as parseNodePath, r as Scene, s as resolveViewport, u as isConstRef, v as getBehavior, x as Signal, y as registerBehavior } from "./loader-BlaRQGaA.js";
2
+ import { C as fadeGain, S as crossfadeGains, _ as SFX_PRESETS, a as HudLayer, b as MusicManager, c as UiText, d as LogManager, f as SfxEngine, g as spatialPan, h as spatialGain, i as UiDialogue, l as AudioPlayer, m as ROLLOFF_MODELS, n as Timer, o as UiBanner, p as isAudioContextAvailable, r as UiButton, s as UiBar, t as registerCoreNodes, u as Engine, v as SFX_PRESET_NAMES, w as AudioBuses, x as WebAudioMusicBackend, y as synthSfx } from "./register-Dzkd6-os.js";
3
3
  import { t as IncantoError } from "./errors-BpWbnbb_.js";
4
4
  import { t as Rng } from "./rng-DP-SR7eg.js";
5
- import { t as auditScene } from "./audit-C6rMyict.js";
5
+ import { t as auditScene } from "./audit-C4kmDK0o.js";
6
6
  import { n as jsonEquals, r as jsonKind, t as jsonClone } from "./json-BLk7H2Qa.js";
7
- import { a as getNodeSignals, c as mergeStaticSignals, i as getNodeSchema, l as registerNode, n as clearRegistry, o as getNodeType, r as createNode, u as registeredTypes } from "./registry-BVJ2HbCn.js";
7
+ import { a as getNodeSignals, c as mergeStaticSignals, i as getNodeSchema, l as registerNode, n as clearRegistry, o as getNodeType, r as createNode, u as registeredTypes } from "./registry-CJdGpT2V.js";
8
8
  import { t as createNoise2D } from "./noise-CGUMx44x.js";
9
- import { n as ORDER_GROUP_BASE, r as effectiveOrder, t as duplicateNode } from "./duplicate-BgtFrFo4.js";
9
+ import { n as ORDER_GROUP_BASE, r as effectiveOrder, t as duplicateNode } from "./duplicate-KRPtUtzl.js";
10
10
  import { i as applyParticlePreset, n as PARTICLE_PRESETS, r as PARTICLE_PRESET_NAMES, t as ParticleSim } from "./particle-sim-Bw7hB93B.js";
11
- import { i as resolveRendering, n as attachTouchControls, r as joystickVector, t as TouchControls } from "./touch-031PxtCR.js";
11
+ import { i as resolveRendering, n as attachTouchControls, r as joystickVector, t as TouchControls } from "./touch-BoNg_MnF.js";
12
12
  //#region src/core/pathfinding.ts
13
13
  /**
14
14
  * A* from `from` to `to` (inclusive cell coords). Returns the cell path
@@ -295,6 +295,6 @@ function newUid() {
295
295
  //#endregion
296
296
  //#region src/index.ts
297
297
  /** Engine version. Kept in sync with package.json by the release pipeline. */
298
- const VERSION = "0.30.0";
298
+ const VERSION = "0.32.0";
299
299
  //#endregion
300
300
  export { AudioBuses, AudioPlayer, Behavior, CONST_REF_KEY, Engine, HudLayer, IncantoError, InputMap, LogManager, MusicManager, Node, ORDER_GROUP_BASE, PARTICLE_PRESETS, PARTICLE_PRESET_NAMES, ParticleSim, ROLLOFF_MODELS, Rng, SCENE_FORMAT, SFX_PRESETS, SFX_PRESET_NAMES, Scene, SceneTree, SfxEngine, Signal, Timer, TouchControls, UiBanner, UiBar, UiButton, UiDialogue, UiText, VERSION, WebAudioMusicBackend, applyParticlePreset, assetUrls, attachTouchControls, auditScene, clearBehaviors, clearRegistry, computeViewport, createNode, createNoise2D, createSaveStore, crossfadeGains, duplicateNode, effectiveOrder, fadeGain, findPath, getBehavior, getNodeSchema, getNodeSignals, getNodeType, gridFromRows, isAudioContextAvailable, isConstRef, joystickVector, jsonClone, jsonEquals, jsonKind, loadScene, mergeStaticSignals, newUid, parseNodePath, preloadUrls, registerBehavior, registerCoreNodes, registerNode, registeredBehaviors, registeredTypes, replay, resolveConstants, resolveRendering, resolveViewport, serializeNode, spatialGain, spatialPan, startRecording, synthSfx };
@@ -1,5 +1,5 @@
1
+ import { v as Engine, w as Scene } from "./behavior-D_jMpFh8.js";
1
2
  import { i as SceneJson } from "./schema-CcoWb32N.js";
2
- import { v as Engine, w as Scene } from "./behavior-BAc0erXF.js";
3
3
 
4
4
  //#region src/core/scene/loader.d.ts
5
5
  interface LoadSceneOptions {