incanto 0.22.0 → 0.24.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.
package/editor/index.html CHANGED
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Incanto Scene Editor</title>
7
7
  <link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><rect width='16' height='16' rx='3' fill='%236ee7dc'/><text x='8' y='12' text-anchor='middle' font-size='11' font-family='monospace' fill='%230e1018'>i</text></svg>" />
8
- <script type="module" crossorigin src="./assets/index-DAzNRDSQ.js"></script>
8
+ <script type="module" crossorigin src="./assets/index-B5y_MdYb.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="./assets/GameServer-C56iOUgF.js">
10
10
  <link rel="stylesheet" crossorigin href="./assets/index-D8QvwvOm.css">
11
11
  </head>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "incanto",
3
- "version": "0.22.0",
3
+ "version": "0.24.0",
4
4
  "description": "Vibe-coding-first web game engine SDK — JSON-driven scenes on three.js",
5
5
  "keywords": [
6
6
  "game-engine",
@@ -6583,6 +6583,10 @@
6583
6583
  "type": "boolean",
6584
6584
  "default": false
6585
6585
  },
6586
+ "mirrorInterval": {
6587
+ "type": "number",
6588
+ "default": 33
6589
+ },
6586
6590
  "swellSteepness": {
6587
6591
  "type": "number",
6588
6592
  "default": 0.35
@@ -50,7 +50,9 @@ One call does register → load → physics → input → renderer → start. Ph
50
50
  `'auto'`: Rapier is enabled iff the tree has physics bodies (force with
51
51
  `physics: true|false`). Keyboard attaches to `window` (`keyboard: false`
52
52
  disables); `pointer: { lockOnClick: false }` for look without lock. `seed` /
53
- `fixedHz` / `pixelRatio` pass through. The manual `Engine` + `loadScene` +
53
+ `fixedHz` / `pixelRatio` / `adaptiveResolution` pass through (adaptive
54
+ resolution is ON by default: slow frames render fewer pixels and recover
55
+ automatically — pass `false` for screenshots and pixel-diff tests). The manual `Engine` + `loadScene` +
54
56
  `Renderer3D` boot still exists for full control.
55
57
 
56
58
  Imperative per-frame logic can hang off `game.engine.updated.connect((dt) => { ... })`; for
@@ -699,6 +699,7 @@ hue reads grey.
699
699
  | `reflection` | `true` | live CubeCamera reflections (fancy only; needs a renderer) |
700
700
  | `reflectionInterval` | `1000` | ms between CubeCamera reflection re-renders |
701
701
  | `mirror` | `false` | TRUE planar reflection (see below) — the only way the dock, the boat and the player appear IN the water. One extra scene render per frame |
702
+ | `mirrorInterval` | `33` | ms between planar-mirror re-renders. A reflection seen through a rippling surface does not need 60 Hz; 33 halves the pass's cost. 0 = every frame |
702
703
  | `swellSteepness` | `0.35` | GERSTNER pinch on the swell: 0 = height-only trains, 1 = maximum trochoid (crests narrow to a peak, troughs broaden). It also decides where whitecaps break — the surface's Jacobian collapses on a folding crest, and that is where foam belongs |
703
704
  | `foam` | `true` | noise-broken shoreline foam band + crest foam near shores |
704
705
  | `interaction` | `true` | character interaction: bodies (CharacterBody3D/RigidBody3D) inside the XZ footprint whose FEET dip below the surface count as in-water — so a WADING character (origin above water, feet below, sized from its collider) splashes, not only a fully-submerged one. Entry/exit emit `entered`/`exited` + a splash ripple; striding through water trails a WAKE (a ripple every ~0.45 m); floating bodies bob gently. Ripples drive both shaders' `uRipples[8]` (fancy) and CPU-displace the mesh (`simple`) |
@@ -788,6 +789,63 @@ Swimming down is a different optical world, and the engine renders it as one:
788
789
  "caustics": { "intensity": 0.6 } } } }
789
790
  ```
790
791
 
792
+ ### What water COSTS, and every dial that lowers it
793
+
794
+ Fancy water is not one draw — it is extra SCENE RENDERS, and each one
795
+ re-submits the world. Measured on the lake template (1600×900, one Water3D
796
+ with grass, trees and a mirror):
797
+
798
+ | pass | when | size | scene submissions |
799
+ |---|---|---|---|
800
+ | refraction/depth grab | `quality: 'fancy'` | ½ buffer, ≤1024 | 2 (colour + depth completion) |
801
+ | planar mirror | `mirror: true` | ⅓ buffer, ≤640 | 1, throttled by `mirrorInterval` |
802
+ | cube reflection | `reflection: true` | 256² × 6 faces | 6, every `reflectionInterval` ms (≥2 s while `mirror` is on — it is only the off-screen fallback then) |
803
+ | the surface itself | always | — | a ~1.5 quads/m grid, capped 160² |
804
+
805
+ Grass, flowers, particles and trails are dropped from the side passes: they are
806
+ most of a meadow's triangles and none of what anyone reads in a reflection or a
807
+ depth mask.
808
+
809
+ **The dials, cheapest first.** Each is a normal prop, so a scene can trade look
810
+ for frames per water body:
811
+
812
+ | dial | effect |
813
+ |---|---|
814
+ | `quality: 'simple'` | ZERO extra passes — sine waves, fresnel sky tint, edge fade. The low-end/mobile answer |
815
+ | `mirror: false` | −1 scene render (the default) |
816
+ | `mirrorInterval` | ms between mirror re-renders (default 33 ≈ 30 Hz — halves the pass; 100 is still convincing on rippled water) |
817
+ | `reflection: false` | −6 cube faces; the surface falls back to its colour ramp |
818
+ | `reflectionInterval` | ms between cube refreshes (default 1000) |
819
+ | `refraction: false` | the grab colour is ignored (depth still drives absorption/foam) |
820
+ | `foam: false` | drops the shoreline foam work |
821
+ | `interaction: false` | stops the per-frame body scan |
822
+
823
+ Two more, outside water. **`environment.bloom`** adds a full-resolution HDR
824
+ pass of its own. And PIXELS: a retina display renders **4× the pixels** of a
825
+ 1× one, which is why a scene that profiles at 690k triangles and 270 draw calls
826
+ can still miss frames — it is fill-bound, not geometry-bound.
827
+
828
+ The engine handles that itself: **adaptive resolution is ON by default**. It
829
+ watches the median frame time over a window and, when frames run slow, renders
830
+ the same world at fewer pixels (down to 60% of the requested ratio, in 15%
831
+ steps), handing them straight back when the frames recover. One hitch never
832
+ moves it; a backgrounded tab never counts. Turn it off for screenshots, video
833
+ capture or pixel-diff tests — and pin the ratio yourself if you would rather
834
+ choose:
835
+
836
+ ```ts
837
+ createGame3D({ canvas, scene, adaptiveResolution: false, pixelRatio: 1.5 });
838
+ ```
839
+
840
+ If a scene feels heavy, measure before guessing — the browser console has the
841
+ whole story:
842
+
843
+ ```js
844
+ const gl = game.renderer.webgl;
845
+ gl.info.autoReset = false; gl.info.reset();
846
+ requestAnimationFrame(() => console.log(gl.info.render)); // calls + triangles for ONE frame
847
+ ```
848
+
791
849
  ### Character interaction — `entered(body)` / `exited(body)`
792
850
 
793
851
  With `interaction: true` the water scans the tree each frame for
@@ -974,6 +974,7 @@ Signals: `blocksChanged`
974
974
  | `reflection` | `true` | boolean |
975
975
  | `reflectionInterval` | `1000` | number |
976
976
  | `mirror` | `false` | boolean |
977
+ | `mirrorInterval` | `33` | number |
977
978
  | `swellSteepness` | `0.35` | number |
978
979
  | `foam` | `true` | boolean |
979
980
  | `interaction` | `true` | boolean |
@@ -14,7 +14,7 @@
14
14
  "@dimforge/rapier2d-compat": "0.19.3",
15
15
  "@dimforge/rapier3d-compat": "0.19.3",
16
16
  "@pixiv/three-vrm": "^3.5.3",
17
- "incanto": "^0.22.0",
17
+ "incanto": "^0.24.0",
18
18
  "three": "^0.184.0"
19
19
  },
20
20
  "devDependencies": {
@@ -13,7 +13,7 @@
13
13
  "@dimforge/rapier2d-compat": "0.19.3",
14
14
  "@dimforge/rapier3d-compat": "0.19.3",
15
15
  "@pixiv/three-vrm": "^3.5.3",
16
- "incanto": "^0.22.0",
16
+ "incanto": "^0.24.0",
17
17
  "three": "^0.184.0"
18
18
  },
19
19
  "devDependencies": {
@@ -13,7 +13,7 @@
13
13
  "@dimforge/rapier2d-compat": "0.19.3",
14
14
  "@dimforge/rapier3d-compat": "0.19.3",
15
15
  "@pixiv/three-vrm": "^3.5.3",
16
- "incanto": "^0.22.0",
16
+ "incanto": "^0.24.0",
17
17
  "three": "^0.184.0"
18
18
  },
19
19
  "devDependencies": {