incanto 0.21.0 → 0.23.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/dist/2d.js +3 -3
- package/dist/3d.d.ts +28 -0
- package/dist/3d.js +4 -3
- package/dist/{create-game-Ct86zczq.js → create-game-DrcEgRup.js} +3 -3
- package/dist/{create-game-xbxZRFwR.js → create-game-OyjhYUL3.js} +6 -3
- package/dist/{duplicate-BINwP0WG.js → duplicate-BgtFrFo4.js} +15 -1
- package/dist/gameplay-BJ5gXIks.js +5516 -0
- package/dist/gameplay.js +1 -1
- package/dist/index.js +3 -3
- package/dist/{particle-sim-CyUU7HVU.js → particle-sim-Bw7hB93B.js} +1 -15
- package/dist/{physics-2d-BiIdl51r.js → physics-2d-DiVFFlH3.js} +1 -1
- package/dist/{physics-3d-DHTZUrr0.js → physics-3d-CpIB9C-F.js} +2 -1
- package/dist/react.js +1 -1
- package/dist/{register-BC55Ez6I.js → register-CpJORtm4.js} +16 -3201
- package/dist/{register-Djwckzgx.js → register-CvpSUU3O.js} +2 -1
- package/dist/test.js +7 -7
- package/editor/assets/{agent8-Cdd8g6w6.js → agent8-C_pbgaQC.js} +1 -1
- package/editor/assets/{index-Dt44Z9ka.js → index-D-bWhSDj.js} +3036 -2926
- package/editor/index.html +1 -1
- package/package.json +1 -1
- package/schemas/scene.schema.json +4 -0
- package/skills/incanto-environment.md +68 -0
- package/skills/incanto-gameplay-behaviors.md +36 -1
- package/skills/incanto-node-reference.md +16 -0
- package/templates-app/beacon-isle-3d/package.json +1 -1
- package/templates-app/tps-3d/package.json +1 -1
- package/templates-app/village-quest-3d/package.json +1 -1
- package/dist/gameplay-sSqrUcnz.js +0 -1978
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-
|
|
8
|
+
<script type="module" crossorigin src="./assets/index-D-bWhSDj.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
|
@@ -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`) |
|
|
@@ -766,6 +767,73 @@ plane and samples it per fragment, so those things appear in the water:
|
|
|
766
767
|
- Geometry below the waterline is clipped out of the mirror pass, and the whole
|
|
767
768
|
pass is skipped while the camera is submerged.
|
|
768
769
|
|
|
770
|
+
### Under the surface
|
|
771
|
+
|
|
772
|
+
Swimming down is a different optical world, and the engine renders it as one:
|
|
773
|
+
|
|
774
|
+
- **Light shafts** hang in the water column toward the sun — `underwater.rays`
|
|
775
|
+
(`true` by default, a number sets the strength, `false` turns them off). The
|
|
776
|
+
composite marches each view ray and, at every step, walks UP the sun direction
|
|
777
|
+
to the surface: the pattern sampled there is what that beam carries down, so
|
|
778
|
+
shafts converge with depth and shimmer with the same surface that makes the
|
|
779
|
+
caustics. They need DEPTH to read — a knee-deep pool has no column to light.
|
|
780
|
+
- **Caustics** light what those beams land on (`underwater.caustics`).
|
|
781
|
+
- **Snell's window**: light can only leave into the air inside a ~48.6° cone,
|
|
782
|
+
so from below the surface is a bright disc of sky ringed by a mirror of the
|
|
783
|
+
water you are in. That image is what everyone recognises as "underwater", and
|
|
784
|
+
the surface shader draws it whenever the camera eye is submerged.
|
|
785
|
+
|
|
786
|
+
```json
|
|
787
|
+
{ "type": "Water3D", "props": { "preset": "ocean",
|
|
788
|
+
"underwater": { "visibility": 26, "rays": 0.8,
|
|
789
|
+
"caustics": { "intensity": 0.6 } } } }
|
|
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: `createGame3D({ pixelRatio: 1.5 })` — a retina display
|
|
824
|
+
renders **4× the pixels**, and water is fragment-heavy, so capping the ratio is
|
|
825
|
+
usually the single biggest win on a Mac; and `environment.bloom`, which adds a
|
|
826
|
+
full-resolution HDR pass of its own.
|
|
827
|
+
|
|
828
|
+
If a scene feels heavy, measure before guessing — the browser console has the
|
|
829
|
+
whole story:
|
|
830
|
+
|
|
831
|
+
```js
|
|
832
|
+
const gl = game.renderer.webgl;
|
|
833
|
+
gl.info.autoReset = false; gl.info.reset();
|
|
834
|
+
requestAnimationFrame(() => console.log(gl.info.render)); // calls + triangles for ONE frame
|
|
835
|
+
```
|
|
836
|
+
|
|
769
837
|
### Character interaction — `entered(body)` / `exited(body)`
|
|
770
838
|
|
|
771
839
|
With `interaction: true` the water scans the tree each frame for
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: incanto-gameplay-behaviors
|
|
3
|
-
description: The batteries-included game-logic library (incanto/gameplay) — ready-made Behaviors you wire from scene JSON with ZERO custom code. State & interaction: Health (hit points, i-frames, regen), Lifetime (self-destruct), ScoreKeeper (score/lives/win-lose hub), Pickup (collectibles), Collector (collect-N tally), DamageOnContact (projectiles/hazards), Interactable (press-to-use doors/levers/NPCs). Movement, AI, camera, spawning & juice: FollowCamera (camera tracks a target), Patrol (waypoint paths), Chase (homing enemy AI), Wander (seeded roaming), ZombieAI (wander-then-charge monster AI with proximity aggro), MoveTo (eased position tween), Oscillate (sine float/spin/pulse), Spawner (interval spawning), WaveSpawner (sequenced enemy waves), Projectile (straight-line motion). Use when a game needs health, score, pickups, damage, timers, interaction, enemy movement/AI, camera-follow, tweens,
|
|
3
|
+
description: The batteries-included game-logic library (incanto/gameplay) — ready-made Behaviors you wire from scene JSON with ZERO custom code. State & interaction: Health (hit points, i-frames, regen), Lifetime (self-destruct), ScoreKeeper (score/lives/win-lose hub), Pickup (collectibles), Collector (collect-N tally), DamageOnContact (projectiles/hazards), Interactable (press-to-use doors/levers/NPCs). Movement, AI, camera, spawning & juice: FollowCamera (camera tracks a target), Patrol (waypoint paths), Chase (homing enemy AI), Wander (seeded roaming), ZombieAI (wander-then-charge monster AI with proximity aggro), MoveTo (eased position tween), Oscillate (sine float/spin/pulse), Spawner (interval spawning), WaveSpawner (sequenced enemy waves), Projectile (straight-line motion), Buoyancy (float/bob/ride the swell on a Water3D). Use when a game needs health, score, pickups, damage, timers, interaction, enemy movement/AI, camera-follow, tweens, spawning, rafts/boats/floating objects — BEFORE hand-rolling them as custom behaviors.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Gameplay behaviors — the built-in logic library
|
|
@@ -460,6 +460,41 @@ pickups, spinning/pulsing coins. Drives one `axis` of `position`, `rotation`
|
|
|
460
460
|
"script": { "name": "Oscillate", "props": { "axis": "z", "amplitude": 180, "frequency": 0.5, "mode": "rotation" } } }
|
|
461
461
|
```
|
|
462
462
|
|
|
463
|
+
## Buoyancy
|
|
464
|
+
|
|
465
|
+
Float on water. Hangs on a `RigidBody3D` and asks the water how high it is at
|
|
466
|
+
each of the hull's sample points — the CPU twin of the surface the player is
|
|
467
|
+
actually looking at, waves included — then pushes up by how deep each point
|
|
468
|
+
sits, damped by how fast it is already rising. Archimedes plus drag, which is
|
|
469
|
+
all a raft, a buoy, a crate or a body needs to bob, settle and ride the swell.
|
|
470
|
+
|
|
471
|
+
| Prop | Default | Meaning |
|
|
472
|
+
|---|---|---|
|
|
473
|
+
| `water` | `""` | Water3D node path; empty = the first Water3D in the tree (a wrong path fails hard) |
|
|
474
|
+
| `draft` | `0.35` | how deep the hull sits at rest, in meters (its waterline below the body origin) |
|
|
475
|
+
| `stiffness` | `14` | float stiffness (1/s²) — higher snaps to the surface, lower wallows |
|
|
476
|
+
| `damping` | `3.5` | vertical damping (1/s) — how fast the bobbing settles |
|
|
477
|
+
| `drift` | `0.6` | how hard wave SLOPES carry the body along (0 = bob on the spot) |
|
|
478
|
+
| `drag` | `0.9` | horizontal drag while submerged (1/s) |
|
|
479
|
+
| `samples` | `4` | 1 = a buoy, 4 = a hull that reads the wave under it |
|
|
480
|
+
| `size` | `[1, 1]` | hull footprint [x, z] in meters — where those samples sit |
|
|
481
|
+
|
|
482
|
+
Signals: `submerged(node)` / `surfaced(node)` as it crosses the waterline —
|
|
483
|
+
wire them to a splash `Particles3D`, a sound, or a "you dropped the cargo" rule.
|
|
484
|
+
|
|
485
|
+
```json
|
|
486
|
+
{ "name": "Raft", "type": "RigidBody3D", "props": { "mass": 120 },
|
|
487
|
+
"script": { "name": "Buoyancy", "props": { "draft": 0.25, "size": [2.4, 1.4], "drift": 0.8 } } }
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
`drift` is the part players notice: a wave face is a slope, and a floating
|
|
491
|
+
thing slides down it, so a raft left alone wanders with the swell instead of
|
|
492
|
+
bobbing on the spot. The lift is capped at a few g — water pushes back, it
|
|
493
|
+
never launches a body that has been dragged deep.
|
|
494
|
+
|
|
495
|
+
For the water's own height anywhere (jetties, spawn heights, an AI deciding
|
|
496
|
+
where the shore is), `Water3D.heightAt(x, z)` answers the same surface.
|
|
497
|
+
|
|
463
498
|
## Spawner
|
|
464
499
|
|
|
465
500
|
Drip-feed clones of a TEMPLATE into the scene on a timer — enemy generators,
|
|
@@ -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 |
|
|
@@ -1001,6 +1002,21 @@ Ready-made `Behavior`s auto-registered by `createGame2D`/`createGame3D` (opt out
|
|
|
1001
1002
|
with `gameplay: false`). Attach via `"script": {"name": "...", "props": {...}}` and
|
|
1002
1003
|
wire their signals through scene `connections`. Full guide: `incanto-gameplay-behaviors.md`.
|
|
1003
1004
|
|
|
1005
|
+
### `Buoyancy`
|
|
1006
|
+
|
|
1007
|
+
| Prop | Default | Kind |
|
|
1008
|
+
|---|---|---|
|
|
1009
|
+
| `water` | `""` | string |
|
|
1010
|
+
| `draft` | `0.35` | number |
|
|
1011
|
+
| `stiffness` | `14` | number |
|
|
1012
|
+
| `damping` | `3.5` | number |
|
|
1013
|
+
| `drift` | `0.6` | number |
|
|
1014
|
+
| `drag` | `0.9` | number |
|
|
1015
|
+
| `samples` | `4` | number |
|
|
1016
|
+
| `size` | `[1,1]` | array |
|
|
1017
|
+
|
|
1018
|
+
Signals: `submerged` · `surfaced`
|
|
1019
|
+
|
|
1004
1020
|
### `CameraShake`
|
|
1005
1021
|
|
|
1006
1022
|
| Prop | Default | Kind |
|