incanto 0.1.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/LICENSE +30 -0
- package/README.md +36 -0
- package/THIRD-PARTY-NOTICES.md +88 -0
- package/assets/audio/attacked.mp3 +0 -0
- package/assets/audio/explosion.mp3 +0 -0
- package/assets/audio/gold_loot.mp3 +0 -0
- package/assets/audio/heal.mp3 +0 -0
- package/assets/audio/hit_metal_bang.mp3 +0 -0
- package/assets/audio/ice_spear.mp3 +0 -0
- package/assets/audio/monster_died.mp3 +0 -0
- package/assets/audio/slash.mp3 +0 -0
- package/assets/audio/smite.mp3 +0 -0
- package/assets/audio/spells_cast.mp3 +0 -0
- package/assets/audio/ui_click.wav +0 -0
- package/assets/audio/walk.mp3 +0 -0
- package/assets/catalog.json +390 -0
- package/assets/characters/2dbasic.json +41 -0
- package/assets/characters/2dbasic.png +0 -0
- package/assets/characters/ghost.json +46 -0
- package/assets/characters/ghost.png +0 -0
- package/assets/characters/goblin.json +40 -0
- package/assets/characters/goblin.png +0 -0
- package/assets/characters/medieval-knight.json +41 -0
- package/assets/characters/medieval-knight.png +0 -0
- package/assets/effects/swoosh.png +0 -0
- package/assets/items/box.png +0 -0
- package/assets/items/buff_potion.png +0 -0
- package/assets/items/coin.png +0 -0
- package/assets/items/gem.png +0 -0
- package/assets/items/gold.png +0 -0
- package/assets/items/hp_potion.png +0 -0
- package/assets/items/locked_item_box.png +0 -0
- package/assets/items/map.png +0 -0
- package/assets/items/resurrection_potion.png +0 -0
- package/assets/items/super_box.png +0 -0
- package/assets/items/trap.png +0 -0
- package/assets/tiles/floor00.jpg +0 -0
- package/assets/tiles/minecraft-tiles.png +0 -0
- package/assets/tiles/wall00.jpg +0 -0
- package/assets/vegetation/ash_color.png +0 -0
- package/assets/vegetation/aspen_color.png +0 -0
- package/assets/vegetation/bark/birch_color_1k.jpg +0 -0
- package/assets/vegetation/bark/birch_normal_1k.jpg +0 -0
- package/assets/vegetation/bark/birch_roughness_1k.jpg +0 -0
- package/assets/vegetation/bark/oak_color_1k.jpg +0 -0
- package/assets/vegetation/bark/oak_normal_1k.jpg +0 -0
- package/assets/vegetation/bark/oak_roughness_1k.jpg +0 -0
- package/assets/vegetation/bark/pine_color_1k.jpg +0 -0
- package/assets/vegetation/bark/pine_normal_1k.jpg +0 -0
- package/assets/vegetation/bark/pine_roughness_1k.jpg +0 -0
- package/assets/vegetation/ground/dirt_color.jpg +0 -0
- package/assets/vegetation/ground/dirt_normal.jpg +0 -0
- package/assets/vegetation/ground/grass.jpg +0 -0
- package/assets/vegetation/oak_color.png +0 -0
- package/assets/vegetation/pine_color.png +0 -0
- package/bin/incanto-assets.mjs +107 -0
- package/bin/incanto-check.mjs +107 -0
- package/bin/incanto-editor.mjs +343 -0
- package/bin/incanto-env.mjs +144 -0
- package/bin/incanto-model.mjs +296 -0
- package/bin/incanto-play.mjs +219 -0
- package/bin/incanto-skills.mjs +71 -0
- package/dist/2d.d.ts +642 -0
- package/dist/2d.js +44 -0
- package/dist/3d.d.ts +1860 -0
- package/dist/3d.js +5 -0
- package/dist/agent8-DzU2fFyH.js +129 -0
- package/dist/audio-player-DqUR3XFs.d.ts +110 -0
- package/dist/behavior-BAQq7HGM.d.ts +851 -0
- package/dist/create-game-BdjpTHrW.js +1725 -0
- package/dist/create-game-CZHROKcT.js +527 -0
- package/dist/debug-draw-CZmOYjL2.js +13 -0
- package/dist/debug.d.ts +66 -0
- package/dist/debug.js +658 -0
- package/dist/duplicate-DP2WPYom.js +22 -0
- package/dist/env.d.ts +430 -0
- package/dist/env.js +3152 -0
- package/dist/errors-BMFaY68Q.d.ts +33 -0
- package/dist/errors-BpWbnbb_.js +13 -0
- package/dist/gameplay-Ccruc3Wd.js +1501 -0
- package/dist/gameplay.d.ts +543 -0
- package/dist/gameplay.js +2 -0
- package/dist/heightmap-CroQPEER.js +185 -0
- package/dist/index.d.ts +305 -0
- package/dist/index.js +62 -0
- package/dist/json-BLk7H2Qa.js +30 -0
- package/dist/loader-CGs_G-r0.js +919 -0
- package/dist/loader-Mo0KghCv.d.ts +41 -0
- package/dist/net.d.ts +427 -0
- package/dist/net.js +772 -0
- package/dist/noise-CGUMx44x.js +82 -0
- package/dist/particle-sim-CbN4YUuH.d.ts +63 -0
- package/dist/particle-sim-DYuSUxvK.js +1319 -0
- package/dist/physics-2d-KuMWPTf6.js +288 -0
- package/dist/physics-3d-Dl67vOLT.js +434 -0
- package/dist/react.d.ts +65 -0
- package/dist/react.js +209 -0
- package/dist/register-BuUV1_KB.js +561 -0
- package/dist/register-CNlYAS1_.js +10634 -0
- package/dist/register-DPEV9_9t.js +851 -0
- package/dist/register-Dasmnurl.js +374 -0
- package/dist/registry-BVJ2HbCn.js +132 -0
- package/dist/rng-DP-SR7eg.js +38 -0
- package/dist/rolldown-runtime-D7D4PA-g.js +13 -0
- package/dist/schema-CcoWb32N.d.ts +104 -0
- package/dist/test.d.ts +158 -0
- package/dist/test.js +275 -0
- package/dist/touch-031PxtCR.js +208 -0
- package/dist/vite.d.ts +26 -0
- package/dist/vite.js +57 -0
- package/editor/assets/GameServer-C56iOUgF.js +1 -0
- package/editor/assets/agent8-Bp7QFI7v.js +1 -0
- package/editor/assets/index-DF3tMeKJ.css +1 -0
- package/editor/assets/index-Dl2pjA8e.js +7365 -0
- package/editor/assets/rapier-CEuLKeCu.js +1 -0
- package/editor/assets/rapier-DE6a0vmv.js +1 -0
- package/editor/index.html +169 -0
- package/package.json +97 -0
- package/schemas/scene.schema.json +4254 -0
- package/skills/README.md +9 -0
- package/skills/incanto-3d-character.md +229 -0
- package/skills/incanto-3d-models.md +151 -0
- package/skills/incanto-assets.md +118 -0
- package/skills/incanto-audio.md +309 -0
- package/skills/incanto-behaviors-and-scripts.md +169 -0
- package/skills/incanto-building-2d-games.md +242 -0
- package/skills/incanto-building-3d-games.md +245 -0
- package/skills/incanto-editor.md +163 -0
- package/skills/incanto-environment.md +743 -0
- package/skills/incanto-gameplay-behaviors.md +707 -0
- package/skills/incanto-multiplayer.md +264 -0
- package/skills/incanto-node-reference.md +797 -0
- package/skills/incanto-physics-and-input.md +164 -0
- package/skills/incanto-scene-json-authoring.md +325 -0
- package/skills/incanto-verifying-your-game.md +191 -0
- package/skills/incanto-web-integration.md +96 -0
- package/templates/agent8-server.js +84 -0
- package/templates/agent8-server.ts +138 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { t as Rng } from "./rng-DP-SR7eg.js";
|
|
2
|
+
//#region src/core/noise.ts
|
|
3
|
+
/** Skewing factors for 2D simplex: F2 = (√3−1)/2, G2 = (3−√3)/6. */
|
|
4
|
+
const F2 = .5 * (Math.sqrt(3) - 1);
|
|
5
|
+
const G2 = (3 - Math.sqrt(3)) / 6;
|
|
6
|
+
/** The 8 unit-ish gradient directions of classic 2D simplex noise. */
|
|
7
|
+
const GRAD = new Float64Array([
|
|
8
|
+
1,
|
|
9
|
+
1,
|
|
10
|
+
-1,
|
|
11
|
+
1,
|
|
12
|
+
1,
|
|
13
|
+
-1,
|
|
14
|
+
-1,
|
|
15
|
+
-1,
|
|
16
|
+
1,
|
|
17
|
+
0,
|
|
18
|
+
-1,
|
|
19
|
+
0,
|
|
20
|
+
0,
|
|
21
|
+
1,
|
|
22
|
+
0,
|
|
23
|
+
-1
|
|
24
|
+
]);
|
|
25
|
+
/**
|
|
26
|
+
* Seeded 2D simplex noise (Ken Perlin's simplex, Gustavson's reference
|
|
27
|
+
* implementation) returning values in [-1, 1]. The permutation table is a
|
|
28
|
+
* Fisher–Yates shuffle drawn from our deterministic {@link Rng}, so an
|
|
29
|
+
* integer seed reproduces the identical field on every machine — the same
|
|
30
|
+
* contract as every other seeded generator in the engine. Pure math, no deps.
|
|
31
|
+
*/
|
|
32
|
+
function createNoise2D(seed) {
|
|
33
|
+
const rng = new Rng(seed);
|
|
34
|
+
const perm = new Uint8Array(512);
|
|
35
|
+
const table = new Uint8Array(256);
|
|
36
|
+
for (let i = 0; i < 256; i++) table[i] = i;
|
|
37
|
+
for (let i = 255; i > 0; i--) {
|
|
38
|
+
const j = rng.int(0, i);
|
|
39
|
+
const t = table[i];
|
|
40
|
+
table[i] = table[j];
|
|
41
|
+
table[j] = t;
|
|
42
|
+
}
|
|
43
|
+
for (let i = 0; i < 512; i++) perm[i] = table[i & 255];
|
|
44
|
+
return (x, y) => {
|
|
45
|
+
const s = (x + y) * F2;
|
|
46
|
+
const i = Math.floor(x + s);
|
|
47
|
+
const j = Math.floor(y + s);
|
|
48
|
+
const t = (i + j) * G2;
|
|
49
|
+
const x0 = x - (i - t);
|
|
50
|
+
const y0 = y - (j - t);
|
|
51
|
+
const i1 = x0 > y0 ? 1 : 0;
|
|
52
|
+
const j1 = x0 > y0 ? 0 : 1;
|
|
53
|
+
const x1 = x0 - i1 + G2;
|
|
54
|
+
const y1 = y0 - j1 + G2;
|
|
55
|
+
const x2 = x0 - 1 + 2 * G2;
|
|
56
|
+
const y2 = y0 - 1 + 2 * G2;
|
|
57
|
+
const ii = i & 255;
|
|
58
|
+
const jj = j & 255;
|
|
59
|
+
let n = 0;
|
|
60
|
+
let t0 = .5 - x0 * x0 - y0 * y0;
|
|
61
|
+
if (t0 > 0) {
|
|
62
|
+
t0 *= t0;
|
|
63
|
+
const g = perm[ii + perm[jj]] % 8 * 2;
|
|
64
|
+
n += t0 * t0 * (GRAD[g] * x0 + GRAD[g + 1] * y0);
|
|
65
|
+
}
|
|
66
|
+
let t1 = .5 - x1 * x1 - y1 * y1;
|
|
67
|
+
if (t1 > 0) {
|
|
68
|
+
t1 *= t1;
|
|
69
|
+
const g = perm[ii + i1 + perm[jj + j1]] % 8 * 2;
|
|
70
|
+
n += t1 * t1 * (GRAD[g] * x1 + GRAD[g + 1] * y1);
|
|
71
|
+
}
|
|
72
|
+
let t2 = .5 - x2 * x2 - y2 * y2;
|
|
73
|
+
if (t2 > 0) {
|
|
74
|
+
t2 *= t2;
|
|
75
|
+
const g = perm[ii + 1 + perm[jj + 1]] % 8 * 2;
|
|
76
|
+
n += t2 * t2 * (GRAD[g] * x2 + GRAD[g + 1] * y2);
|
|
77
|
+
}
|
|
78
|
+
return 70 * n;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
export { createNoise2D as t };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { a as Rng } from "./schema-CcoWb32N.js";
|
|
2
|
+
|
|
3
|
+
//#region src/core/particle-sim.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Deterministic particle pool — pure math, renderer-agnostic, headless-
|
|
6
|
+
* testable. 2D uses the xy plane (y-down, directionDeg 0 = +x, -90 = up);
|
|
7
|
+
* 3D feeds the same sim with a z spread.
|
|
8
|
+
*/
|
|
9
|
+
interface ParticleSimConfig {
|
|
10
|
+
/** Particles per second (0 = burst-only). */
|
|
11
|
+
rate: number;
|
|
12
|
+
/** Seconds, [min, max]. */
|
|
13
|
+
lifetime: [number, number];
|
|
14
|
+
/** Initial speed, [min, max] (units/sec — px in 2D, meters in 3D). */
|
|
15
|
+
speed: [number, number];
|
|
16
|
+
/** Emission direction center, degrees (0 = +x, -90 = up in y-down 2D). */
|
|
17
|
+
directionDeg: number;
|
|
18
|
+
/** Cone width, degrees (360 = all directions). */
|
|
19
|
+
spreadDeg: number;
|
|
20
|
+
/** Constant acceleration (y-down in 2D). */
|
|
21
|
+
gravity: [number, number, number];
|
|
22
|
+
/** Exponential velocity damping per second (0 = none). */
|
|
23
|
+
drag: number;
|
|
24
|
+
maxParticles: number;
|
|
25
|
+
/** Spread emission into the z axis too (3D). */
|
|
26
|
+
spreadZ?: boolean;
|
|
27
|
+
}
|
|
28
|
+
interface ParticleView {
|
|
29
|
+
x: number;
|
|
30
|
+
y: number;
|
|
31
|
+
z: number;
|
|
32
|
+
vx: number;
|
|
33
|
+
vy: number;
|
|
34
|
+
vz: number;
|
|
35
|
+
/** Seconds alive. */
|
|
36
|
+
age: number;
|
|
37
|
+
/** Total lifetime in seconds. */
|
|
38
|
+
life: number;
|
|
39
|
+
/** age/life in [0, 1] — drives size/color/alpha ramps. */
|
|
40
|
+
t: number;
|
|
41
|
+
/** Per-particle random in [0, 1) — stable for the particle's lifetime. */
|
|
42
|
+
seed: number;
|
|
43
|
+
}
|
|
44
|
+
declare class ParticleSim {
|
|
45
|
+
private readonly config;
|
|
46
|
+
private readonly rng;
|
|
47
|
+
private readonly data;
|
|
48
|
+
private alive;
|
|
49
|
+
private spawnAccumulator;
|
|
50
|
+
private everSpawned;
|
|
51
|
+
constructor(config: ParticleSimConfig, rng: Rng);
|
|
52
|
+
get count(): number;
|
|
53
|
+
/** True when nothing is alive and at least one particle has ever spawned. */
|
|
54
|
+
get done(): boolean;
|
|
55
|
+
/** Spawn n particles immediately (fireworks, explosions, flashes). */
|
|
56
|
+
burst(n: number): void;
|
|
57
|
+
update(dt: number): void;
|
|
58
|
+
forEach(fn: (p: ParticleView) => void): void;
|
|
59
|
+
private spawn;
|
|
60
|
+
private kill;
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
export { ParticleSimConfig as n, ParticleView as r, ParticleSim as t };
|