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
package/dist/env.d.ts
ADDED
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
import { a as Rng, i as SceneJson, n as NodeJson, s as JsonObject } from "./schema-CcoWb32N.js";
|
|
2
|
+
|
|
3
|
+
//#region src/env/arena.d.ts
|
|
4
|
+
/** Valid `generateArena` themes — drives the catalog options AND validation. */
|
|
5
|
+
declare const ARENA_THEMES: readonly ["boxes", "ruins", "garden"];
|
|
6
|
+
type ArenaTheme = (typeof ARENA_THEMES)[number];
|
|
7
|
+
interface ArenaOptions {
|
|
8
|
+
/** Determinism seed — the same seed always emits the same JSON. */
|
|
9
|
+
seed: number;
|
|
10
|
+
/** Floor extent along x, meters (default 30). */
|
|
11
|
+
width?: number;
|
|
12
|
+
/** Floor extent along z, meters (default 30). */
|
|
13
|
+
depth?: number;
|
|
14
|
+
/** Perimeter wall height, meters (default 3). */
|
|
15
|
+
wallHeight?: number;
|
|
16
|
+
/** Box obstacles strewn inside the walls (default 8). */
|
|
17
|
+
obstacles?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Visual theme over the same floor/walls/obstacles skeleton:
|
|
20
|
+
* 'boxes' (default, colorful crates), 'ruins' (stone palette, broken
|
|
21
|
+
* colonnade rows), 'garden' (hedge walls, grass patches, a center pool).
|
|
22
|
+
*/
|
|
23
|
+
theme?: ArenaTheme;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A 3D FPS stage: floor + 4 perimeter walls + N obstacles (every body a
|
|
27
|
+
* StaticBody3D box collider with a MeshInstance3D 'Skin' child — the
|
|
28
|
+
* canonical visible+collidable composition) + sun/fill/lamp lighting, dressed
|
|
29
|
+
* by `theme`: 'boxes' strews colorful crates, 'ruins' lays broken stone
|
|
30
|
+
* colonnade rows, 'garden' grows hedge blocks plus Foliage3D grass patches
|
|
31
|
+
* and a Water3D pool at the center.
|
|
32
|
+
*/
|
|
33
|
+
declare function generateArena(opts: ArenaOptions): NodeJson;
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/env/catalog.d.ts
|
|
36
|
+
interface GeneratorParamMeta {
|
|
37
|
+
type: "number" | "string" | "boolean";
|
|
38
|
+
default: number | string | boolean;
|
|
39
|
+
min?: number;
|
|
40
|
+
max?: number;
|
|
41
|
+
options?: string[];
|
|
42
|
+
}
|
|
43
|
+
interface GeneratorMeta {
|
|
44
|
+
description: string;
|
|
45
|
+
dimension: "2d" | "3d";
|
|
46
|
+
params: Record<string, GeneratorParamMeta>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The generator catalog: name → description, dimension and CLI-typed params.
|
|
50
|
+
* Drives the `incanto-env` CLI (`--list`, generic `--<param>` flags) and any
|
|
51
|
+
* editor UI, so help text can never drift from the code. `seed` is implicit
|
|
52
|
+
* — every generator requires it.
|
|
53
|
+
*
|
|
54
|
+
* The 3D set is EXACTLY arena/terrain/maze — themes do the heavy lifting
|
|
55
|
+
* (the old meadow/forest/island/rocks/clouds generators became terrain/arena
|
|
56
|
+
* themes; their functions live on in the library, deprecated). Tuple-typed
|
|
57
|
+
* library options (scatter items, platforms2d ranges) and the voxel-world
|
|
58
|
+
* `generateVoxelTerrain` stay library-only and are not listed.
|
|
59
|
+
*/
|
|
60
|
+
declare const GENERATORS: Record<string, GeneratorMeta>;
|
|
61
|
+
type GeneratorOpts = Record<string, unknown> & {
|
|
62
|
+
seed: number;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Invoke any catalog generator uniformly by name (what the CLI and editor
|
|
66
|
+
* call). Unknown names are a hard error listing the valid ones; option
|
|
67
|
+
* validation stays with each generator.
|
|
68
|
+
*/
|
|
69
|
+
declare function runGenerator(name: string, opts: GeneratorOpts): NodeJson;
|
|
70
|
+
//#endregion
|
|
71
|
+
//#region src/env/clouds.d.ts
|
|
72
|
+
interface CloudsOptions {
|
|
73
|
+
/** Determinism seed — the same seed always emits the same JSON. */
|
|
74
|
+
seed: number;
|
|
75
|
+
/** Clouds (puff groups) in the sky (default 8). */
|
|
76
|
+
count?: number;
|
|
77
|
+
/** Sky area centered on the origin — a number is square, or [x, z] meters (default [60, 60]). */
|
|
78
|
+
area?: number | [number, number];
|
|
79
|
+
/** Base altitude, meters — each cloud floats ±3 around it (default 18). */
|
|
80
|
+
altitude?: number;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Soft sky clouds: each a Node3D group of 3–5 overlapping white sphere puffs
|
|
84
|
+
* stretched wide and squashed flat, floating around `altitude`. Pure visuals
|
|
85
|
+
* — no colliders, no physics.
|
|
86
|
+
*
|
|
87
|
+
* @deprecated The island terrain theme ships its own cloud layer — use
|
|
88
|
+
* `runGenerator('terrain', { seed, theme: 'island' })` for whole worlds.
|
|
89
|
+
* Kept for custom library compositions (other themes, custom skies).
|
|
90
|
+
*/
|
|
91
|
+
declare function generateClouds(opts: CloudsOptions): NodeJson;
|
|
92
|
+
//#endregion
|
|
93
|
+
//#region src/env/dungeon-2d.d.ts
|
|
94
|
+
interface Dungeon2DOptions {
|
|
95
|
+
/** Determinism seed — the same seed always emits the same JSON. */
|
|
96
|
+
seed: number;
|
|
97
|
+
/** Rooms to place — fewer land if the map is crowded (default 5). */
|
|
98
|
+
rooms?: number;
|
|
99
|
+
/** Map extent in px — a number is square, or [width, height] (default [960, 720]). */
|
|
100
|
+
size?: number | [number, number];
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* A roguelike 2D dungeon: rectangular rooms connected by 1-tile L-corridors
|
|
104
|
+
* (horizontal leg, then vertical), rasterized onto a 32px tile grid. Floors
|
|
105
|
+
* are ColorRect2D rects ('Room1'…, 'Corridor1H'/'Corridor1V'…); every
|
|
106
|
+
* non-floor tile touching a floor tile becomes a StaticBody2D wall segment
|
|
107
|
+
* (merged into runs along x) with a ColorRect2D skin. Centered on the origin.
|
|
108
|
+
*/
|
|
109
|
+
declare function generateDungeon2D(opts: Dungeon2DOptions): NodeJson;
|
|
110
|
+
//#endregion
|
|
111
|
+
//#region src/env/forest.d.ts
|
|
112
|
+
interface ForestOptions {
|
|
113
|
+
/** Determinism seed — the same seed always emits the same JSON. */
|
|
114
|
+
seed: number;
|
|
115
|
+
/** Square ground extent, meters (default 48). */
|
|
116
|
+
size?: number;
|
|
117
|
+
/** Trees to plant — fewer land when the clearing rejects spots (default 40). */
|
|
118
|
+
trees?: number;
|
|
119
|
+
/** Radius of the tree-free central clearing, meters; 0 disables (default 6). */
|
|
120
|
+
clearing?: number;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* A primitive-tree forest: a ground slab planted with StaticBody3D
|
|
124
|
+
* trunk+canopy trees whose density falls off into an optional central
|
|
125
|
+
* clearing (hard-empty inside `clearing`, ramping to full density at 1.5×),
|
|
126
|
+
* softened by a few Foliage3D grass patches, lit by sun/fill.
|
|
127
|
+
*
|
|
128
|
+
* @deprecated Use `runGenerator('terrain', { seed, theme: 'forest' })` — the
|
|
129
|
+
* Terrain3D forest (dense mixed Tree3D groves, central clearing, grass
|
|
130
|
+
* patches, heightfield collider) replaced this flat-slab version in the
|
|
131
|
+
* catalog.
|
|
132
|
+
*/
|
|
133
|
+
declare function generateForest(opts: ForestOptions): NodeJson;
|
|
134
|
+
//#endregion
|
|
135
|
+
//#region src/env/insert.d.ts
|
|
136
|
+
/**
|
|
137
|
+
* PURE insertion: a NEW scene JSON with `node` appended under the node at
|
|
138
|
+
* `at` (default: the scene root). Neither input is mutated.
|
|
139
|
+
*
|
|
140
|
+
* `at` is the '/'-joined chain of node NAMES from the root, ROOT INCLUDED —
|
|
141
|
+
* 'Root/Level' targets the root's child 'Level' (NodePath semantics applied
|
|
142
|
+
* to the JSON tree). A missing path is a hard NODE_NOT_FOUND listing what IS
|
|
143
|
+
* there. Sibling name clashes are fine — the loader uniquifies on load.
|
|
144
|
+
*/
|
|
145
|
+
declare function insertIntoScene(scene: SceneJson, node: NodeJson, at?: string): SceneJson;
|
|
146
|
+
//#endregion
|
|
147
|
+
//#region src/env/island.d.ts
|
|
148
|
+
interface IslandOptions {
|
|
149
|
+
/** Determinism seed — the same seed always emits the same JSON. */
|
|
150
|
+
seed: number;
|
|
151
|
+
/** Island radius in blocks (default 16). */
|
|
152
|
+
radius?: number;
|
|
153
|
+
/** Peak height in blocks (default 8). */
|
|
154
|
+
height?: number;
|
|
155
|
+
/** Surround the shore with a Water3D ring (default true). */
|
|
156
|
+
water?: boolean;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* A voxel island: the terrain value noise shaped by a radial dome falloff —
|
|
160
|
+
* tall grassy center, sandy shore where columns dip to the waterline, bedrock
|
|
161
|
+
* base — with an optional Water3D ring lapping the beach and sun/fill lights.
|
|
162
|
+
* Colliders stay the game's job (chunk trimeshes near the player — see the
|
|
163
|
+
* minecraft template).
|
|
164
|
+
*
|
|
165
|
+
* @deprecated Use `runGenerator('terrain', { seed, theme: 'island' })` — the
|
|
166
|
+
* Terrain3D island (smooth heightfield, splatted beach/cliffs/snow, computed
|
|
167
|
+
* drownable sea level, heightfield collider) replaced this in the catalog.
|
|
168
|
+
* Kept for voxel-world library users.
|
|
169
|
+
*/
|
|
170
|
+
declare function generateIsland(opts: IslandOptions): NodeJson;
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region src/env/maze.d.ts
|
|
173
|
+
/** Valid `generateMaze` themes — drives the catalog options AND validation. */
|
|
174
|
+
declare const MAZE_THEMES: readonly ["stone", "hedge", "canyon"];
|
|
175
|
+
type MazeTheme = (typeof MAZE_THEMES)[number];
|
|
176
|
+
interface MazeOptions {
|
|
177
|
+
/** Determinism seed — the same seed always emits the same JSON. */
|
|
178
|
+
seed: number;
|
|
179
|
+
/** Corridor cells along x (default 8). */
|
|
180
|
+
width?: number;
|
|
181
|
+
/** Corridor cells along z (default 8). */
|
|
182
|
+
depth?: number;
|
|
183
|
+
/** Tile size, meters — corridors and walls are one tile wide (default 2). */
|
|
184
|
+
cellSize?: number;
|
|
185
|
+
/** Wall height, meters (default 2.5). */
|
|
186
|
+
wallHeight?: number;
|
|
187
|
+
/**
|
|
188
|
+
* Visual theme over the same carved layout: 'stone' (default, brick walls +
|
|
189
|
+
* stone floor + coping caps), 'hedge' (foliage walls with grass tops +
|
|
190
|
+
* lawn floor), 'canyon' (sandstone walls + sand floor + rim boulders).
|
|
191
|
+
*/
|
|
192
|
+
theme?: MazeTheme;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* The environment header that matches a maze theme — the terrainEnvironment
|
|
196
|
+
* contract (spread into the scene's `environment`; scene keys layer on top),
|
|
197
|
+
* tuned MOODY at corridor level: low hazy sun, sub-1 exposure, dim ambient
|
|
198
|
+
* and a fog window that closes in on the walls. 'stone' is the coolest and
|
|
199
|
+
* foggiest (dungeon courtyard), 'hedge' an overcast garden, 'canyon' a warm
|
|
200
|
+
* dusk. `span` is the maze's world extent ((2·width+1)·cellSize, default 34).
|
|
201
|
+
*/
|
|
202
|
+
declare function mazeEnvironment(theme: MazeTheme, span?: number): JsonObject;
|
|
203
|
+
/**
|
|
204
|
+
* A 3D maze: recursive-backtracker corridors (entrance on the west edge,
|
|
205
|
+
* exit on the east) as chunky one-tile-thick StaticBody3D walls over a
|
|
206
|
+
* textured floor slab, plus sun/fill lights. Consecutive wall tiles merge
|
|
207
|
+
* into single boxes along x to keep the node count down. Same algorithm as
|
|
208
|
+
* `generateMaze2D`; `theme` swaps the materials and dressing over the
|
|
209
|
+
* IDENTICAL carved layout — every theme gets textured walls/floor (worldspace
|
|
210
|
+
* brick/grass/sandstone tiling), junction pillars, and a pillar-framed
|
|
211
|
+
* entrance/exit with a tinted path tile; 'stone' adds coping caps on every
|
|
212
|
+
* run, 'hedge' grows grass strips along the wall tops + corridor patches,
|
|
213
|
+
* 'canyon' perches boulders on the rim. Deterministic from `seed`.
|
|
214
|
+
*/
|
|
215
|
+
declare function generateMaze(opts: MazeOptions): NodeJson;
|
|
216
|
+
//#endregion
|
|
217
|
+
//#region src/env/maze-2d.d.ts
|
|
218
|
+
interface Maze2DOptions {
|
|
219
|
+
/** Determinism seed — the same seed always emits the same JSON. */
|
|
220
|
+
seed: number;
|
|
221
|
+
/** Corridor cells along x (default 10). */
|
|
222
|
+
cols?: number;
|
|
223
|
+
/** Corridor cells along y (default 8). */
|
|
224
|
+
rows?: number;
|
|
225
|
+
/** Tile size in px — corridors and walls are one tile wide (default 64). */
|
|
226
|
+
cellPx?: number;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* The 2D twin of `generateMaze` — the SAME recursive-backtracker grid
|
|
230
|
+
* (entrance west, exit east) emitted as a ColorRect2D floor backdrop plus
|
|
231
|
+
* StaticBody2D wall bodies with ColorRect2D skins (px, y-down, centered on
|
|
232
|
+
* the origin). Consecutive wall tiles merge into single bodies along x.
|
|
233
|
+
*/
|
|
234
|
+
declare function generateMaze2D(opts: Maze2DOptions): NodeJson;
|
|
235
|
+
//#endregion
|
|
236
|
+
//#region src/env/maze-grid.d.ts
|
|
237
|
+
interface MazeGrid {
|
|
238
|
+
/** Corridor cells per axis. */
|
|
239
|
+
cols: number;
|
|
240
|
+
rows: number;
|
|
241
|
+
/** (2·rows+1) × (2·cols+1) booleans indexed [z][x] — true = passage. */
|
|
242
|
+
cells: boolean[][];
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Recursive-backtracker maze (the classic): carve from cell (0,0), always
|
|
246
|
+
* advancing to a random unvisited neighbor and knocking down the wall
|
|
247
|
+
* between, backtracking when stuck — every cell ends up reachable. Then the
|
|
248
|
+
* entrance (west wall of the first cell) and exit (east wall of the last)
|
|
249
|
+
* are opened. Shared by `generateMaze` (3D) and `generateMaze2D`; games can
|
|
250
|
+
* BFS over `cells` for pathing or item placement.
|
|
251
|
+
*/
|
|
252
|
+
declare function carveMaze(rng: Rng, cols: number, rows: number): MazeGrid;
|
|
253
|
+
//#endregion
|
|
254
|
+
//#region src/env/meadow.d.ts
|
|
255
|
+
interface MeadowOptions {
|
|
256
|
+
/** Determinism seed — the same seed always emits the same JSON. */
|
|
257
|
+
seed: number;
|
|
258
|
+
/** Square ground extent, meters (default 40). */
|
|
259
|
+
size?: number;
|
|
260
|
+
/** Field mix — 'grass' (default), 'flowers', or 'mixed' (grass + a flower patch). */
|
|
261
|
+
foliage?: "grass" | "flowers" | "mixed";
|
|
262
|
+
/** Boulders strewn across the ground (default 6). */
|
|
263
|
+
rocks?: number;
|
|
264
|
+
/** Primitive trees around the field (default 4). */
|
|
265
|
+
trees?: number;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* A grass field (잔디밭): a StaticBody3D ground slab carpeted with an
|
|
269
|
+
* instanced Foliage3D field, plus scattered boulders, primitive trees and
|
|
270
|
+
* sun/fill lighting. 'mixed' lays the full grass field with a smaller flower
|
|
271
|
+
* patch on top.
|
|
272
|
+
*
|
|
273
|
+
* @deprecated Use `runGenerator('terrain', { seed, theme: 'meadow' })` — the
|
|
274
|
+
* rolling Terrain3D meadow (blade carpets, broadleaf groves, rocks, a real
|
|
275
|
+
* heightfield collider) replaced this flat-slab version in the catalog.
|
|
276
|
+
*/
|
|
277
|
+
declare function generateMeadow(opts: MeadowOptions): NodeJson;
|
|
278
|
+
//#endregion
|
|
279
|
+
//#region src/env/platforms-2d.d.ts
|
|
280
|
+
interface Platforms2DOptions {
|
|
281
|
+
/** Determinism seed — the same seed always emits the same JSON. */
|
|
282
|
+
seed: number;
|
|
283
|
+
/** Platforms in the course (default 10). */
|
|
284
|
+
count?: number;
|
|
285
|
+
/** Platform width range in px (default [80, 160]). */
|
|
286
|
+
width?: [number, number];
|
|
287
|
+
/** Edge-to-edge horizontal gap range in px (default [40, 120]). */
|
|
288
|
+
gapX?: [number, number];
|
|
289
|
+
/** Vertical step range in px, y-DOWN: negative climbs (default [-80, 40]). */
|
|
290
|
+
stepY?: [number, number];
|
|
291
|
+
/** First platform center [x, y] in px (default [0, 300]). */
|
|
292
|
+
start?: [number, number];
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* A left-to-right 2D platform course: StaticBody2D rect colliders with
|
|
296
|
+
* ColorRect2D 'Skin' children. Spacing is caller-tunable — keep `gapX` and
|
|
297
|
+
* `stepY` inside your character's jump arc for a reachable course (px,
|
|
298
|
+
* y-down: world gravity pulls +y, so negative `stepY` steps UP).
|
|
299
|
+
*/
|
|
300
|
+
declare function generatePlatforms2D(opts: Platforms2DOptions): NodeJson;
|
|
301
|
+
//#endregion
|
|
302
|
+
//#region src/env/rocks.d.ts
|
|
303
|
+
interface RocksOptions {
|
|
304
|
+
/** Determinism seed — the same seed always emits the same JSON. */
|
|
305
|
+
seed: number;
|
|
306
|
+
/** Boulders to place (default 12). */
|
|
307
|
+
count?: number;
|
|
308
|
+
/** Ground area centered on the origin — a number is square, or [x, z] meters (default [24, 24]). */
|
|
309
|
+
area?: number | [number, number];
|
|
310
|
+
/** Boulder radius range, meters (default [0.4, 1.6]). */
|
|
311
|
+
sizeRange?: [number, number];
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Clustered boulders: a few cluster anchors with rocks scattered tightly
|
|
315
|
+
* around them — squashed, gray-jittered MeshInstance3D spheres (visual props,
|
|
316
|
+
* no colliders; wrap one in a StaticBody3D yourself if it must block).
|
|
317
|
+
*
|
|
318
|
+
* @deprecated The terrain themes scatter their own rocks (alpine snow-band
|
|
319
|
+
* boulders, desert/plains/meadow clusters) — use `runGenerator('terrain',
|
|
320
|
+
* { seed, theme })` for whole worlds. Kept for custom library compositions.
|
|
321
|
+
*/
|
|
322
|
+
declare function generateRocks(opts: RocksOptions): NodeJson;
|
|
323
|
+
//#endregion
|
|
324
|
+
//#region src/env/scatter.d.ts
|
|
325
|
+
interface ScatterItem {
|
|
326
|
+
/** Registered node type of the template ('MeshInstance3D', 'ModelInstance3D', …). */
|
|
327
|
+
type: string;
|
|
328
|
+
/** Template props — position x/z, rotation and scale are overwritten per instance. */
|
|
329
|
+
props?: JsonObject;
|
|
330
|
+
/** Relative pick probability (default 1). */
|
|
331
|
+
weight?: number;
|
|
332
|
+
}
|
|
333
|
+
interface ScatterOptions {
|
|
334
|
+
/** Determinism seed — the same seed always emits the same JSON. */
|
|
335
|
+
seed: number;
|
|
336
|
+
/** Instances to place (default 20). */
|
|
337
|
+
count?: number;
|
|
338
|
+
/** Ground area [x extent, z extent] centered on the origin (default [20, 20]). */
|
|
339
|
+
area?: [number, number];
|
|
340
|
+
/** WHAT to scatter — weighted node JSON templates (at least one). */
|
|
341
|
+
items: ScatterItem[];
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* Scatter N instances of caller-provided node templates over an XZ area:
|
|
345
|
+
* random position, y-rotation, and uniform scale jitter (multiplied onto the
|
|
346
|
+
* template's own scale). The template's `position[1]` survives as the ground
|
|
347
|
+
* offset. Library-only — the items make it too open-ended for CLI flags.
|
|
348
|
+
*/
|
|
349
|
+
declare function generateScatter(opts: ScatterOptions): NodeJson;
|
|
350
|
+
//#endregion
|
|
351
|
+
//#region src/env/terrain.d.ts
|
|
352
|
+
/** Valid `generateTerrain` themes — drives the catalog options AND validation. */
|
|
353
|
+
declare const TERRAIN_GENERATOR_THEMES: readonly ["island", "alpine", "plains", "desert", "meadow", "forest", "savanna", "snow", "wetland", "volcanic"];
|
|
354
|
+
/** A `generateTerrain` theme (the GENERATOR'S knob — Terrain3D has its own). */
|
|
355
|
+
type TerrainTheme = (typeof TERRAIN_GENERATOR_THEMES)[number];
|
|
356
|
+
interface TerrainOptions {
|
|
357
|
+
/** Determinism seed — the same seed always emits the same JSON. */
|
|
358
|
+
seed: number;
|
|
359
|
+
/**
|
|
360
|
+
* One knob, big payoff: which world to dress the heightfield as.
|
|
361
|
+
* 'island' (default) | 'alpine' | 'plains' | 'desert' | 'meadow' | 'forest'
|
|
362
|
+
* | 'savanna' | 'snow' | 'wetland' | 'volcanic'.
|
|
363
|
+
*/
|
|
364
|
+
theme?: TerrainTheme;
|
|
365
|
+
/** Square extent in meters (default 200). */
|
|
366
|
+
size?: number;
|
|
367
|
+
/**
|
|
368
|
+
* Terrain3D height SCALE (realized heights land at ~2–8× this).
|
|
369
|
+
* 0 or undefined = the theme's default — island 4.5, alpine 8, plains 4,
|
|
370
|
+
* desert 5, meadow 1.2, forest 2.5. Islands additionally auto-fit DOWN so
|
|
371
|
+
* a drownable sea level always exists (see the two-sided rim constraint).
|
|
372
|
+
*/
|
|
373
|
+
maxHeight?: number;
|
|
374
|
+
/**
|
|
375
|
+
* Add a calm valley lake to non-island themes (default false). The island
|
|
376
|
+
* theme ALWAYS ships its sea — without it the edge-wrap skirt is bare cliff.
|
|
377
|
+
*/
|
|
378
|
+
water?: boolean;
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* The environment header that matches a generator theme — sky, horizon fog
|
|
382
|
+
* and shadows composed for the same world `generateTerrain` emits (fog
|
|
383
|
+
* distances scale with `size`). Spread it into the scene's `environment`;
|
|
384
|
+
* scene-specific keys (ambient, background fallback) layer on top.
|
|
385
|
+
*/
|
|
386
|
+
declare function terrainEnvironment(theme: TerrainTheme, size?: number): JsonObject;
|
|
387
|
+
/**
|
|
388
|
+
* A complete heightfield world from one seed + one theme: the canonical
|
|
389
|
+
* physics recipe (`StaticBody3D{heightfield}` with a `Terrain3D` child) plus
|
|
390
|
+
* theme dressing placed ON the surface via the same heightmap the node will
|
|
391
|
+
* build at runtime — trees probe `heightAt` and reject steep/sand/snow cells,
|
|
392
|
+
* the island sea level is COMPUTED from border probes (two-sided constraint:
|
|
393
|
+
* above every rim cliff top, inside the sand band), rocks/foliage sit at
|
|
394
|
+
* their sampled ground height. Sun/fill lights round out every theme.
|
|
395
|
+
*
|
|
396
|
+
* Replaces the old voxel terrain in the catalog — that lives on as the
|
|
397
|
+
* library-only `generateVoxelTerrain` for minecraft-style block worlds.
|
|
398
|
+
*/
|
|
399
|
+
declare function generateTerrain(opts: TerrainOptions): NodeJson;
|
|
400
|
+
//#endregion
|
|
401
|
+
//#region src/env/voxel-terrain.d.ts
|
|
402
|
+
interface VoxelTerrainOptions {
|
|
403
|
+
/** Determinism seed — the same seed always emits the same JSON. */
|
|
404
|
+
seed: number;
|
|
405
|
+
/** Square extent in blocks (default 32). */
|
|
406
|
+
size?: number;
|
|
407
|
+
/** Max column height in blocks (default 8). */
|
|
408
|
+
height?: number;
|
|
409
|
+
/** Add a Water3D plane at ~35% of the max height (default false). */
|
|
410
|
+
water?: boolean;
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* A voxel heightfield for minecraft-style worlds: smooth-ish value noise (a
|
|
414
|
+
* seeded lattice, bilinearly interpolated with a smoothstep fade) baked into
|
|
415
|
+
* a VoxelGrid3D `voxels` prop as [x,y,z,tile] tuples — solid columns of
|
|
416
|
+
* bedrock/dirt/grass centered on the origin. Colliders stay the game's job
|
|
417
|
+
* (chunk trimeshes near the player — see the minecraft template).
|
|
418
|
+
*
|
|
419
|
+
* Library-only by design: the `terrain` catalog generator emits a smooth
|
|
420
|
+
* Terrain3D heightfield instead — reach for THIS when blocks are the point
|
|
421
|
+
* (digging, building, VoxelGrid3D worlds).
|
|
422
|
+
*/
|
|
423
|
+
declare function generateVoxelTerrain(opts: VoxelTerrainOptions): NodeJson;
|
|
424
|
+
/**
|
|
425
|
+
* Value noise over [0,size)² in [0,1] — random lattice + smooth interpolation.
|
|
426
|
+
* Shared with `generateIsland` (which shapes it with a radial falloff).
|
|
427
|
+
*/
|
|
428
|
+
declare function makeValueNoise(rng: Rng, size: number): (x: number, z: number) => number;
|
|
429
|
+
//#endregion
|
|
430
|
+
export { ARENA_THEMES, type ArenaOptions, type ArenaTheme, type CloudsOptions, type Dungeon2DOptions, type ForestOptions, GENERATORS, type GeneratorMeta, type GeneratorParamMeta, type IslandOptions, MAZE_THEMES, type Maze2DOptions, type MazeGrid, type MazeOptions, type MazeTheme, type MeadowOptions, type Platforms2DOptions, type RocksOptions, type ScatterItem, type ScatterOptions, TERRAIN_GENERATOR_THEMES, type TerrainOptions, type TerrainTheme, type VoxelTerrainOptions, carveMaze, generateArena, generateClouds, generateDungeon2D, generateForest, generateIsland, generateMaze, generateMaze2D, generateMeadow, generatePlatforms2D, generateRocks, generateScatter, generateTerrain, generateVoxelTerrain, insertIntoScene, makeValueNoise, mazeEnvironment, runGenerator, terrainEnvironment };
|