@jgengine/assets 0.10.0 → 0.12.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/CHANGELOG.md +39 -2
- package/README.md +103 -50
- package/dist/aliases.d.ts +5 -0
- package/dist/aliases.js +28 -9
- package/dist/catalogs/build.d.ts +27 -0
- package/dist/catalogs/build.js +28 -2
- package/dist/catalogs/buildSprites.d.ts +10 -0
- package/dist/catalogs/buildSprites.js +15 -0
- package/dist/catalogs/starter.d.ts +5 -0
- package/dist/catalogs/starter.js +10 -1
- package/dist/cli/paths.d.ts +9 -1
- package/dist/cli/paths.js +11 -1
- package/dist/cli/pull.d.ts +12 -0
- package/dist/cli/pull.js +216 -25
- package/dist/collisionMeshAssets.d.ts +2 -0
- package/dist/collisionMeshAssets.js +6 -0
- package/dist/dims.d.ts +7 -0
- package/dist/dims.js +154 -0
- package/dist/download.d.ts +66 -7
- package/dist/download.js +264 -18
- package/dist/find.d.ts +20 -1
- package/dist/find.js +52 -2
- package/dist/generated/index.js +18 -6
- package/dist/generated/kaykit-adventurers.json +706 -0
- package/dist/generated/kaykit-city-builder.json +904 -0
- package/dist/generated/kaykit-dungeon.json +5002 -0
- package/dist/generated/kaykit-furniture.json +1168 -0
- package/dist/generated/kaykit-skeletons.json +410 -0
- package/dist/generated/kaykit-space-base.json +1199 -0
- package/dist/generated/quaternius-medieval-village.json +3698 -0
- package/dist/generated/quaternius-modular-scifi.json +4013 -0
- package/dist/generated/quaternius-stylized-nature.json +1498 -0
- package/dist/generated-sprites/index.d.ts +5 -0
- package/dist/generated-sprites/index.js +4 -0
- package/dist/index.d.ts +9 -2
- package/dist/index.js +9 -2
- package/dist/indexGen.d.ts +2 -2
- package/dist/indexGen.js +34 -10
- package/dist/manifest.d.ts +16 -1
- package/dist/materials.d.ts +61 -0
- package/dist/materials.js +98 -0
- package/dist/packs/starter.d.ts +46 -0
- package/dist/packs/starter.js +248 -0
- package/dist/provisioning.d.ts +88 -0
- package/dist/provisioning.js +74 -0
- package/dist/registry-catalog.json +35 -0
- package/dist/snippet.d.ts +4 -0
- package/dist/snippet.js +27 -0
- package/dist/sources/ambientcg.d.ts +5 -0
- package/dist/sources/ambientcg.js +64 -0
- package/dist/sources/gameicons.d.ts +10 -0
- package/dist/sources/gameicons.js +21 -0
- package/dist/sources/index.d.ts +9 -2
- package/dist/sources/index.js +11 -3
- package/dist/sources/kaykit.js +55 -6
- package/dist/sources/quaternius.js +60 -9
- package/dist/spriteIndexGen.d.ts +17 -0
- package/dist/spriteIndexGen.js +108 -0
- package/dist/verify.d.ts +1 -0
- package/dist/verify.js +38 -1
- package/package.json +4 -4
- package/skills/jgengine/SKILL.md +54 -0
- package/skills/jgengine/api.md +527 -0
- package/skills/jgengine/capabilities.md +131 -0
- package/skills/jgengine/recipes/minimal-game.md +88 -0
- package/skills/jgengine-assets/SKILL.md +45 -0
- package/skills/jgengine-assets/api.md +282 -0
- package/skills/jgengine-assets/capabilities.md +13 -0
- package/dist/generated/kenney-blaster.json +0 -362
- package/dist/generated/kenney-nature.json +0 -3292
- package/dist/generated/kenney-space.json +0 -1532
- package/dist/sources/kenney.d.ts +0 -2
- package/dist/sources/kenney.js +0 -36
- package/llms.txt +0 -1010
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
<!-- GENERATED by scripts/gen-capability-index.ts — do not edit. Regenerate: bun run gen:capabilities -->
|
|
2
|
+
|
|
3
|
+
# jgengine — capability index
|
|
4
|
+
|
|
5
|
+
Reach for these before hand-rolling. Each row is *the thing you need* → *the primitive that already does it*.
|
|
6
|
+
|
|
7
|
+
## authored-spawn — read spawn points and markers from the editor document
|
|
8
|
+
|
|
9
|
+
- `authoredSpawnPosition` (function) · `import { authoredSpawnPosition } from "@jgengine/shell/gameKit"`
|
|
10
|
+
|
|
11
|
+
## authored-triggers — schema'd on/action vocabulary on volumes and markers with runtime dispatch
|
|
12
|
+
|
|
13
|
+
- `collectAuthoredTriggers` (function) · `import { collectAuthoredTriggers } from "@jgengine/shell/gameKit"`
|
|
14
|
+
|
|
15
|
+
## collider-autofit — hitboxes and physical bodies fit each kind's rendered model bounds automatically — no hand-tuned sizes
|
|
16
|
+
|
|
17
|
+
- `GameContextModels` (interface) · `import { GameContextModels } from "@jgengine/core/runtime/gameContext"`
|
|
18
|
+
|
|
19
|
+
## define-game — single public game-authoring path — compose systems, world, presentation, and authored scene in one definition
|
|
20
|
+
|
|
21
|
+
- `defineGame` (function) · `import { defineGame } from "@jgengine/shell/gameKit"`
|
|
22
|
+
|
|
23
|
+
## define-system — composable game behavior — pure data + hooks the engine schedules; pass via `defineGame({ systems })`
|
|
24
|
+
|
|
25
|
+
- `defineSystem` (function) · `import { defineSystem } from "@jgengine/shell/gameKit"`
|
|
26
|
+
|
|
27
|
+
## editor-catalogs — Export typed gameplay catalogs for in-editor tuning.
|
|
28
|
+
|
|
29
|
+
- `EditorCatalogDefinition` (interface) · `import { EditorCatalogDefinition } from "@jgengine/shell/gameKit"`
|
|
30
|
+
|
|
31
|
+
## game-system — declare a composable capability with its own schedule and lifecycle
|
|
32
|
+
|
|
33
|
+
- `SystemDefinition` (interface) · `import { SystemDefinition } from "@jgengine/shell/gameKit"`
|
|
34
|
+
|
|
35
|
+
## headless-runner — play a real game loop with no renderer — tick, feed input, read the world snapshot
|
|
36
|
+
|
|
37
|
+
- `HeadlessRunner` (interface) · `import { HeadlessRunner } from "@jgengine/core/runtime/headlessRunner"`
|
|
38
|
+
|
|
39
|
+
## host-join-code-gate — membership-or-code gate for private hosted servers
|
|
40
|
+
|
|
41
|
+
- `canJoinPrivateServer` (function) · `import { canJoinPrivateServer } from "@jgengine/core/runtime/hostPolicy"`
|
|
42
|
+
|
|
43
|
+
## host-listing-filter — exclude private sessions from public browse results
|
|
44
|
+
|
|
45
|
+
- `isListablePublicly` (function) · `import { isListablePublicly } from "@jgengine/core/runtime/hostPolicy"`
|
|
46
|
+
|
|
47
|
+
## hud-canvas — the HUD root surface — design-resolution scaling plus live panel-placement editing (F2+C)
|
|
48
|
+
|
|
49
|
+
- `HudCanvas` (function) · `import { HudCanvas } from "@jgengine/shell/gameKit"`
|
|
50
|
+
|
|
51
|
+
## hud-clock — in-game time-of-day readout bound to the sim clock
|
|
52
|
+
|
|
53
|
+
- `Clock` (function) · `import { Clock } from "@jgengine/shell/gameKit"`
|
|
54
|
+
|
|
55
|
+
## hud-coins — currency counter widget bound to a currency id
|
|
56
|
+
|
|
57
|
+
- `Coins` (function) · `import { Coins } from "@jgengine/shell/gameKit"`
|
|
58
|
+
|
|
59
|
+
## hud-hotbar — optional inventory hotbar building block — games own slot chrome
|
|
60
|
+
|
|
61
|
+
- `Hotbar` (function) · `import { Hotbar } from "@jgengine/shell/gameKit"`
|
|
62
|
+
|
|
63
|
+
## hud-layout — persistent, live-editable HUD panel layout state for `HudCanvas`
|
|
64
|
+
|
|
65
|
+
- `useHudLayout` (function) · `import { useHudLayout } from "@jgengine/shell/gameKit"`
|
|
66
|
+
|
|
67
|
+
## hud-panel — anchored HUD slot — drop any widget in a named, player-movable panel
|
|
68
|
+
|
|
69
|
+
- `HudPanel` (function) · `import { HudPanel } from "@jgengine/shell/gameKit"`
|
|
70
|
+
|
|
71
|
+
## hud-stat-bar — optional stat-bound bar building block (health, mana, stamina) — prefer game-owned chrome
|
|
72
|
+
|
|
73
|
+
- `StatBar` (function) · `import { StatBar } from "@jgengine/shell/gameKit"`
|
|
74
|
+
|
|
75
|
+
## loot-table — validate a loot table definition for use with the registry
|
|
76
|
+
|
|
77
|
+
- `lootTable` (function) · `import { lootTable } from "@jgengine/core/authoring"`
|
|
78
|
+
|
|
79
|
+
## mount-game — mount a defined game in the browser — `<GameHost playable={game} editor={() => import("@jgengine/editor")} />`
|
|
80
|
+
|
|
81
|
+
- `GameHost` (function) · `import { GameHost } from "@jgengine/shell/gameKit"`
|
|
82
|
+
|
|
83
|
+
## multiplayer-offline — explicit solo adapter — omit `multiplayer` instead; offline is the shell default
|
|
84
|
+
|
|
85
|
+
- `offline` (function) · `import { offline } from "@jgengine/shell/gameKit"`
|
|
86
|
+
|
|
87
|
+
## multiplayer-p2p — serverless co-op over WebRTC — `multiplayer: p2p({ room })`
|
|
88
|
+
|
|
89
|
+
- `p2p` (function) · `import { p2p } from "@jgengine/core/runtime/adapter"`
|
|
90
|
+
|
|
91
|
+
## multiplayer-ws — server-hosted shared world over WebSocket — `multiplayer: ws({ authority: "server" })`
|
|
92
|
+
|
|
93
|
+
- `ws` (function) · `import { ws } from "@jgengine/core/runtime/adapter"`
|
|
94
|
+
|
|
95
|
+
## render-fallback-diagnostics — Enable/disable the dev-only placeholder-fallback probe.
|
|
96
|
+
|
|
97
|
+
- `armFallbackSeams` (function) · `import { armFallbackSeams } from "@jgengine/core/devtools/fallbackSeams"`
|
|
98
|
+
- `fallbackSeamsSnapshot` (function) · `import { fallbackSeamsSnapshot } from "@jgengine/core/devtools/fallbackSeams"`
|
|
99
|
+
- `reportFallbackSeam` (function) · `import { reportFallbackSeam } from "@jgengine/core/devtools/fallbackSeams"`
|
|
100
|
+
|
|
101
|
+
## runtime-save — save/load the whole game world through a pluggable backend, autosave or save points
|
|
102
|
+
|
|
103
|
+
- `createRuntimeSave` (function) · `import { createRuntimeSave } from "@jgengine/core/runtime/runtimeSave"`
|
|
104
|
+
|
|
105
|
+
## scene-ownership — audit a whole ownership manifest for boundary violations
|
|
106
|
+
|
|
107
|
+
- `auditManifest` (function) · `import { auditManifest } from "@jgengine/core/authoring"`
|
|
108
|
+
- `classifyOwnership` (function) · `import { classifyOwnership } from "@jgengine/core/authoring"`
|
|
109
|
+
- `collectOwnershipDiagnostics` (function) · `import { collectOwnershipDiagnostics } from "@jgengine/core/authoring"`
|
|
110
|
+
- `isSceneOwnershipManifest` (function) · `import { isSceneOwnershipManifest } from "@jgengine/core/authoring"`
|
|
111
|
+
- `ownershipKey` (function) · `import { ownershipKey } from "@jgengine/core/authoring"`
|
|
112
|
+
|
|
113
|
+
## seeded-random — injected deterministic randomness for game logic — never `Math.random` in a simulation
|
|
114
|
+
|
|
115
|
+
- `seededRng` (function) · `import { seededRng } from "@jgengine/shell/gameKit"`
|
|
116
|
+
|
|
117
|
+
## typed-keyed-store — a cast-free typed handle onto a per-owner keyed family of reactive game-store slots, replayable and host-authoritative
|
|
118
|
+
|
|
119
|
+
- `defineKeyedStore` (function) · `import { defineKeyedStore } from "@jgengine/shell/gameKit"`
|
|
120
|
+
|
|
121
|
+
## typed-store — a cast-free typed handle onto one reactive game-store slot, replayable and host-authoritative
|
|
122
|
+
|
|
123
|
+
- `defineStore` (function) · `import { defineStore } from "@jgengine/shell/gameKit"`
|
|
124
|
+
|
|
125
|
+
## world-convergence — derive environment coordinate content from the scene document
|
|
126
|
+
|
|
127
|
+
- `environmentContentFromDocument` (function) · `import { environmentContentFromDocument } from "@jgengine/shell/gameKit"`
|
|
128
|
+
|
|
129
|
+
## world-environment — compose editor/preset-derived outdoor dressing — terrain, weather, water, structures — into a legacy environment feature
|
|
130
|
+
|
|
131
|
+
- `environment` (function) · `import { environment } from "@jgengine/shell/gameKit"`
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Recipe — minimal game (scaffold → authored scene → win)
|
|
2
|
+
|
|
3
|
+
**What this wires:** the default end-to-end path from nothing to a complete, genre-free
|
|
4
|
+
walk/interact/win game: a scaffold, one `defineGame` config off the happy-path kit, an
|
|
5
|
+
authored scene edited in the browser, one system, one store slot, an empty-canvas HUD,
|
|
6
|
+
and a win condition. Every new game starts here; add combat, multiplayer, or deeper
|
|
7
|
+
world features only after this loop plays.
|
|
8
|
+
|
|
9
|
+
## 1. Scaffold
|
|
10
|
+
|
|
11
|
+
`npx jgengine create <name>` (inside the engine monorepo: `bun run new:game "<id-or-title>"`).
|
|
12
|
+
The file set is thin and already runs:
|
|
13
|
+
|
|
14
|
+
- `src/main.tsx` — mounts `GameHost` with `editor={() => import("@jgengine/editor")}`; the
|
|
15
|
+
host owns the F2+E / `?mode=editor` editor summon and the dev save endpoint.
|
|
16
|
+
- `src/game.config.ts` — the whole game definition (below).
|
|
17
|
+
- `src/editor.scene.json` + `src/editorLayers.ts` — the authored scene document, normalized
|
|
18
|
+
with `normalizeEditorLayers`. All placement lives here, never as coordinates in code.
|
|
19
|
+
- `src/loop.ts` and `src/game/ui/GameUI.tsx` — systems and HUD.
|
|
20
|
+
|
|
21
|
+
## 2. Define the game — one import surface
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
// game.config.ts — everything below comes from the kit; deeper paths are for outgrowing it.
|
|
25
|
+
import { defineGame } from "@jgengine/shell/gameKit";
|
|
26
|
+
|
|
27
|
+
import { editorLayers } from "./editorLayers";
|
|
28
|
+
import { GameUI } from "./game/ui/GameUI";
|
|
29
|
+
import { onNewPlayer, systems } from "./loop";
|
|
30
|
+
|
|
31
|
+
export const game = defineGame({
|
|
32
|
+
name: "my-game",
|
|
33
|
+
// Binding movement actions makes the shell drive the walk controller — the game walks day one.
|
|
34
|
+
input: { moveForward: ["KeyW"], moveBack: ["KeyS"], moveLeft: ["KeyA"], moveRight: ["KeyD"], interact: ["KeyE"] },
|
|
35
|
+
systems,
|
|
36
|
+
loop: { onNewPlayer },
|
|
37
|
+
GameUI,
|
|
38
|
+
editorLayers, // the authored scene auto-mounts; the player spawns at its player_spawn marker
|
|
39
|
+
});
|
|
40
|
+
// Solo game: omit `multiplayer` entirely — offline is the shell default.
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**World is optional and thin.** Omitting `world` is valid — a pure UI/rules game is not a
|
|
44
|
+
spatial place. When the game *is* a place, declare only substrate + laws with `world()` from
|
|
45
|
+
`@jgengine/core/world/place` (e.g. `{ id, ground: { mode: "flat", size: { x: Infinity, z: Infinity } }, physics: { gravity: -24 } }`,
|
|
46
|
+
or `mode: "board"` for 2D). Never seed, sky, or vegetation in `world` — the engine renders its
|
|
47
|
+
default sky until you author one in the editor, and foliage is editor scatter over the ground.
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
// loop.ts — one store slot for run state, one system for the rules tick.
|
|
52
|
+
import { defineStore, defineSystem, authoredSpawnPosition, type GameContext } from "@jgengine/shell/gameKit";
|
|
53
|
+
|
|
54
|
+
import { editorLayers } from "./editorLayers";
|
|
55
|
+
|
|
56
|
+
export const run = defineStore("run", { collected: 0, won: false });
|
|
57
|
+
|
|
58
|
+
export const systems = [
|
|
59
|
+
defineSystem({
|
|
60
|
+
id: "rules",
|
|
61
|
+
tick: { type: "fixed" },
|
|
62
|
+
update(ctx: GameContext) {
|
|
63
|
+
// System-check win alternative: read/update `run` here (e.g. win at collected >= 3).
|
|
64
|
+
if (run.read(ctx).collected >= 3) run.update(ctx, (s) => ({ ...s, won: true }));
|
|
65
|
+
},
|
|
66
|
+
}),
|
|
67
|
+
];
|
|
68
|
+
|
|
69
|
+
export function onNewPlayer(ctx: GameContext): void {
|
|
70
|
+
ctx.scene.entity.spawn("player", { id: ctx.player.userId, position: authoredSpawnPosition(editorLayers) ?? [0, 0, 0] });
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
`GameUI` starts as an empty `HudCanvas` (`useHudLayout` + `HudCanvas` from the kit). That is
|
|
75
|
+
intentional: **every game owns its UI**. Write a short UI art direction, then build custom
|
|
76
|
+
panels for this pitch — do not ship stock drop-in widgets (`StatBar`, `Hotbar`, `Coins`, glass
|
|
77
|
+
frames) as the product face. Reach for engine pieces only as headless data, layout, or
|
|
78
|
+
interaction models under game-owned chrome (see `jgengine-ui`).
|
|
79
|
+
|
|
80
|
+
## 3. Author, play, win
|
|
81
|
+
|
|
82
|
+
1. `bun dev`, then F2+E opens the editor on `editor.scene.json` — move the spawn, place
|
|
83
|
+
props and trigger markers, Ctrl+S saves back to the document.
|
|
84
|
+
2. The starter scene ships a goal marker with `{ on: "enter", action: "win" }` — walking
|
|
85
|
+
into it wins with zero game code. Author more rules the same way (triggers in the
|
|
86
|
+
editor), or read volumes yourself via the kit's `collectAuthoredTriggers(editorLayers)`.
|
|
87
|
+
3. Prove it: `bun test` asserts the document (spawn, goal), and `jgengine-verify` covers
|
|
88
|
+
screenshot and gameplay evidence before any "it works" claim.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: jgengine-assets
|
|
3
|
+
description: Source, license, catalog, and resolve game-ready media assets.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# JGengine assets
|
|
7
|
+
|
|
8
|
+
## Ownership
|
|
9
|
+
|
|
10
|
+
This skill owns model, sprite, texture/material, and audio-file discovery; licensing; catalog metadata; pull/index workflows; and runtime asset references. Placement belongs to `jgengine-editor`, spatial audio behavior to `jgengine-world`, and rendering/UI composition to their respective domains.
|
|
11
|
+
|
|
12
|
+
Search [capabilities.md](capabilities.md) before adding a resolver or catalog path. Use [api.md](api.md) for exact exports.
|
|
13
|
+
|
|
14
|
+
## Canonical workflow
|
|
15
|
+
|
|
16
|
+
1. Prefer existing catalog entries and typed asset refs.
|
|
17
|
+
2. Verify source license and attribution requirements before download.
|
|
18
|
+
3. Record canonical facing, source units, pivot, footprint, bounds, and placement policy in metadata.
|
|
19
|
+
4. Pull/index through shared tooling; do not commit remote-library bulk bytes when the catalog is designed to resolve them.
|
|
20
|
+
5. Preview through the same resolver runtime will use.
|
|
21
|
+
6. Add required credit in the same PR.
|
|
22
|
+
|
|
23
|
+
## Reference integrity
|
|
24
|
+
|
|
25
|
+
Every logical asset id has a declared owner: `committed` (a single's shipped URL, resolves on a clean clone), `provisioned` (a pack index entry whose GLB is fetched by `assets pull <source>`), or `dangling` (nothing owns it — a broken contract). Resolve one id with `resolveProvenance(id)`; gate a set of references with `validateAssetReferences(refs)`, which fails on any dangling reference and reports the exact `assets pull <source>` steps a clean checkout still needs. `assets provenance <id>...` exposes the same contract on the CLI and exits non-zero on a dangling id. This resolves references structurally against the catalog — never grep source text as the long-term contract.
|
|
26
|
+
|
|
27
|
+
A game's catalog is `buildCatalog(...)` over the generated pack index, singles, and aliases; `extras` is its durable escape hatch for assets that aren't in a pack. An editor asset import into a **promoted** game project writes into that `extras` array in `src/game/assets.ts` (bytes land in `public/<basePath>/imported/`), registered after packs (last-writer-wins) and before aliases (so an alias can target one — see `jgengine-editor`). At runtime an extra resolves to exactly its `{ url }`; the `label` is human-facing only and never enters the catalog.
|
|
28
|
+
|
|
29
|
+
At load time the shell classifies a model fetch before parsing via `classifyAssetResponse` (`@jgengine/core/scene/assetDiagnostics`), so a missing file, a dev-server HTML fallback, corrupt bytes, or a non-model format surface as an actionable diagnostic naming the URL — not an opaque GLTF parse error.
|
|
30
|
+
|
|
31
|
+
Reindex measures every GLB's `dims`; assets listed in `COLLISION_MESH_ASSET_IDS` (`collisionMeshAssets.ts`) additionally ship a compact quantized triangle mesh (`collisionMesh` on the index entry) that collider auto-fit raycasts instead of the fitted box — opt in only concave models whose box lies (archways, rings, frames), because each entry adds real index bytes and per-ray BVH cost.
|
|
32
|
+
|
|
33
|
+
## Source rules
|
|
34
|
+
|
|
35
|
+
- Never use or reference Kenney.nl assets.
|
|
36
|
+
- Prefer Quaternius or KayKit for CC0 3D, game-icons.net for icons, and ambientCG for PBR.
|
|
37
|
+
- Preserve third-party license and attribution data with the catalog entry.
|
|
38
|
+
- A permissive source allows copying assets, not transplanting another game's implementation.
|
|
39
|
+
|
|
40
|
+
## Traps
|
|
41
|
+
|
|
42
|
+
- Fix wrong scale/facing/pivot upstream in catalog metadata, never with per-game corrective transforms.
|
|
43
|
+
- Asset ids and metadata are stable data contracts; filenames and URLs are implementation details.
|
|
44
|
+
- Missing attribution is a release blocker even when the code works.
|
|
45
|
+
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
<!-- GENERATED by scripts/gen-skill-api.ts — do not edit. Regenerate: bun run gen:skill-api -->
|
|
2
|
+
|
|
3
|
+
# jgengine-assets — exported API surface
|
|
4
|
+
|
|
5
|
+
## @jgengine/assets
|
|
6
|
+
|
|
7
|
+
- `AssetAlias` (interface): interface AssetAlias — ⚠ undocumented
|
|
8
|
+
- `AssetDownload` (type): type AssetDownload = PinnedDownload | ScrapeDownload — ⚠ undocumented
|
|
9
|
+
- `AssetKind` (type): type AssetKind = "model" | "pack" | "material" | "component" | "icon" | "sprite" | "spritePack" — ⚠ undocumented
|
|
10
|
+
- `AssetMatch` (type): type AssetMatch = | { kind: "model"; id: string; source: string; file?: string; via: "index" | "alias" | "single" } | { kind: "pack"; source: string; title: string; categories: readonly string[] } | { kind: "material"; id: string; title: string; categories: readonly string[] } | { kind: "component";… — ⚠ undocumented
|
|
11
|
+
- `AssetProvenance` (interface): interface AssetProvenance — The resolved ownership of one logical asset id — the provisioning contract for that id.
|
|
12
|
+
- `AssetProvenanceKind` (type): type AssetProvenanceKind = "committed" | "provisioned" | "dangling" — How an asset id's bytes reach a clean checkout: - `committed` — resolves to a self-hosted / remote URL carried in the shipped index (a {@link SingleAsset}); no pull step, available immediately. - `provisioned` — a pack {@link IndexEntry}; the id is declared but its GLB is fetched on demand by `assets pull <source>` into the consumer's served dir. - `dangling` — nothing in the index, singles, or aliases owns the id, so no provisioning step exists and it can never resolve on a clean clone.
|
|
13
|
+
- `AssetProvider` (type): type AssetProvider = | "quaternius" | "kaykit" | "polypizza" | "itch" | "ambientcg" | "gameicons" | "custom" — ⚠ undocumented
|
|
14
|
+
- `AssetReference` (interface): interface AssetReference — A logical asset id referenced by some consumer (a game, scene, or config), for validation.
|
|
15
|
+
- `AssetSource` (interface): interface AssetSource — ⚠ undocumented
|
|
16
|
+
- `AssetSourceKind` (type): type AssetSourceKind = "model" | "material" | "sprite" — What a source's archive contains: GLB models (default), one PBR material's texture maps, or a pack of individual 2D sprite/icon files (SVG/PNG).
|
|
17
|
+
- `AssetSpace` (interface): interface AssetSpace — Catalog-level asset-space metadata: how a model is authored relative to the engine, owned by the catalog entry rather than re-derived per game. Every field is optional so an unmeasured asset stays valid; {@link resolveFacingRotationY}/{@link assetUnitScale}/{@link resolveAnchorOffset} supply the documented defaults.
|
|
18
|
+
- `BuildCatalogOptions` (interface): interface BuildCatalogOptions — ⚠ undocumented
|
|
19
|
+
- `BuildMaterialCatalogOptions` (interface): interface BuildMaterialCatalogOptions — Options for `buildMaterialCatalog`.
|
|
20
|
+
- `BuildSpriteCatalogOptions` (interface): interface BuildSpriteCatalogOptions — Options for `buildSpriteCatalog`.
|
|
21
|
+
- `CollisionMeshData` (interface): interface CollisionMeshData — Compact, serializable triangle collision mesh measured at asset reindex — the renderer-free source of mesh-accurate hitboxes. Positions are welded onto a 16-bit grid spanning `min`..`max` (model space) and stored base64-encoded, so an opted-in catalog asset ships its collision triangles inside the generated index without the runtime ever touching the rendered scene graph.
|
|
22
|
+
- `ExtractedMaterialMap` (interface): interface ExtractedMaterialMap — One normalized map pulled out of a material archive by `extractMaterialMaps`.
|
|
23
|
+
- `ExtractedSpriteFile` (interface): interface ExtractedSpriteFile — One SVG/PNG file pulled out of a sprite/icon-pack archive by `extractSpriteFiles`.
|
|
24
|
+
- `FindOptions` (interface): interface FindOptions — ⚠ undocumented
|
|
25
|
+
- `IndexEntry` (interface): interface IndexEntry — ⚠ undocumented
|
|
26
|
+
- `MATERIAL_MAP_FILES` (const): const MATERIAL_MAP_FILES: { readonly color: "color.jpg"; readonly normal: "normal.jpg"; readonly roughness: "roughness.jpg"; readonly ao: "ao.jpg"; readonly displacement: "displacement.jpg"; } — Normalized filenames a pulled material directory contains, keyed by map role.
|
|
27
|
+
- `MaterialCatalog` (interface): interface MaterialCatalog — Resolves material ids and `material/…` aliases to `MaterialRef`s.
|
|
28
|
+
- `MaterialMapRole` (type): type MaterialMapRole = keyof typeof MATERIAL_MAP_FILES — One PBR map's role within a material: color, normal, roughness, ao, or displacement.
|
|
29
|
+
- `MaterialMaps` (interface): interface MaterialMaps — URLs of one material's PBR maps; `ao`/`displacement` files may be absent from a rare pack.
|
|
30
|
+
- `MaterialRef` (interface): interface MaterialRef — A resolved material: identity, attribution, and its normalized map URLs.
|
|
31
|
+
- `ModelDims` (interface): interface ModelDims — Measured horizontal footprint, footprint center, and lowest Y of a model in model space.
|
|
32
|
+
- `ModelSnippetOptions` (interface): interface ModelSnippetOptions — ⚠ undocumented
|
|
33
|
+
- `PinnedDownload` (interface): interface PinnedDownload — ⚠ undocumented
|
|
34
|
+
- `RankedMatch` (interface): interface RankedMatch — ⚠ undocumented
|
|
35
|
+
- `ReferenceValidation` (interface): interface ReferenceValidation — The verdict for one {@link AssetReference}.
|
|
36
|
+
- `RegistryCatalog` (interface): interface RegistryCatalog — ⚠ undocumented
|
|
37
|
+
- `RegistryComponent` (interface): interface RegistryComponent — ⚠ undocumented
|
|
38
|
+
- `ReindexSpritesResult` (interface): interface ReindexSpritesResult — Per-source and total counts returned by `reindexSprites`.
|
|
39
|
+
- `ResolveProvenanceOptions` (interface): interface ResolveProvenanceOptions — Override the data {@link resolveProvenance} resolves against; every field defaults to the shipped catalog.
|
|
40
|
+
- `STARTER_ASSETS` (const): const STARTER_ASSETS: readonly StarterAsset[] — Flat list of every curated starter asset across themes.
|
|
41
|
+
- `STARTER_PACKS` (const): const STARTER_PACKS: Readonly<Record<StarterTheme, readonly StarterAsset[]>> — Theme → assets table for browse/docs (`STARTER_PACKS.people`, …).
|
|
42
|
+
- `STARTER_SOURCE_PACKS` (const): const STARTER_SOURCE_PACKS: readonly string[] — Source pack ids a game must pull so every starter asset URL resolves on disk.
|
|
43
|
+
- `STARTER_THEMES` (const): const STARTER_THEMES: readonly StarterTheme[] — Ordered starter theme ids: people, props, nature, urban.
|
|
44
|
+
- `ScrapeDownload` (interface): interface ScrapeDownload — ⚠ undocumented
|
|
45
|
+
- `SingleAsset` (interface): interface SingleAsset — ⚠ undocumented
|
|
46
|
+
- `StarterAsset` (interface): interface StarterAsset — One curated starter model: short id, theme, live catalog target, license, suggested height.
|
|
47
|
+
- `StarterTheme` (type): type StarterTheme = "people" | "props" | "nature" | "urban" — Curated drop-in starter themes for new games. Each entry maps a short semantic id (also registered as `asset:<id>`) to a live catalog GLB that is already measured (dims/anchor flow from the generated index via the alias target). Games wire them as `entityModels: { guest: "asset:person_casual" }`. Never Kenney — Quaternius / KayKit only.
|
|
48
|
+
- `ValidateAssetReferencesOptions` (interface): interface ValidateAssetReferencesOptions extends ResolveProvenanceOptions — Options for {@link validateAssetReferences}: the resolution data plus an optional on-disk `present` check.
|
|
49
|
+
- `ValidateAssetReferencesResult` (interface): interface ValidateAssetReferencesResult — The aggregate result of validating a set of references against the provisioning contract.
|
|
50
|
+
- `VerifyResult` (interface): interface VerifyResult — ⚠ undocumented
|
|
51
|
+
- `aliases` (const): const aliases: readonly AssetAlias[] — Semantic keys → live catalog ids. Prefer these in games so re-homes only touch this table. Never point at kenney-*. Curated starter theme ids (`asset:person_casual`, `nature_tree`, …) come from {@link starterAliases}.
|
|
52
|
+
- `ambientcgSources` (const): const ambientcgSources: readonly AssetSource[] — Every ambientCG material source, generated per family (`ambientcg-grass001` … ).
|
|
53
|
+
- `buildCatalog` (function): function buildCatalog(options: BuildCatalogOptions = {}): AssetCatalog — Builds a game's asset catalog from the generated CC0 pack index plus singles, extras, and aliases. Registration order is packs → singles → {@link BuildCatalogOptions.extras | extras} → aliases: packs and singles come first, extras override them last-writer-wins, and aliases resolve last so they can target an extra. See {@link BuildCatalogOptions} for filtering and opt-outs.
|
|
54
|
+
- `buildMaterialCatalog` (function): function buildMaterialCatalog(options: BuildMaterialCatalogOptions = {}): MaterialCatalog — A resolvable catalog over every `kind: "material"` source. Ids are source ids (`ambientcg-grass001`) plus the `material/…` aliases; every resolve returns the normalized map URLs under `basePath`, matching what `assets pull` writes into `<dir>/materials/<id>/`.
|
|
55
|
+
- `buildSpriteCatalog` (function): function buildSpriteCatalog(options: BuildSpriteCatalogOptions = {}): AssetCatalog — Resolves individual pulled sprite/icon ids (e.g. `gameicons-icons/sword`) to `{ url }`.
|
|
56
|
+
- `componentInstallUrl` (function): function componentInstallUrl(name: string): string — The `shadcn add` URL for a HUD component, e.g. `https://jgengine.com/r/vital-bar.json`.
|
|
57
|
+
- `componentWiringSnippet` (function): function componentWiringSnippet(component: RegistryComponent): string — Copy-paste wiring for a HUD component: the `shadcn add` command plus import + usage.
|
|
58
|
+
- `createStarterCatalog` (function): function createStarterCatalog(options: BuildCatalogOptions = {}): AssetCatalog<ModelAssetRef> — Catalog restricted to the curated starter packs (people/props/nature/urban). Prefer this for scaffolds and probes so `asset:person_casual` etc. resolve without pulling the whole library. Full index: {@link buildCatalog}.
|
|
59
|
+
- `entryForSpriteFile` (function): function entryForSpriteFile(source: AssetSource, file: string): IndexEntry — Builds one sprite/icon `IndexEntry` — same shape as a model entry, minus `dims`.
|
|
60
|
+
- `entryUrl` (function): function entryUrl(basePath: string, entry: IndexEntry): string — ⚠ undocumented
|
|
61
|
+
- `extractMaterialMaps` (function): function extractMaterialMaps(archive: Uint8Array): ExtractedMaterialMap[] — Pulls the recognized PBR maps out of a material archive (ambientCG's flat `<Asset>_<Res>_<Map>.jpg` layout) and normalizes their names so resolved URLs never depend on the provider's naming or the pulled resolution.
|
|
62
|
+
- `findAssets` (function): function findAssets(query: string, options: FindOptions = {}): AssetMatch[] — The ranked matches for a query — models, packs, HUD components, and icons in one list.
|
|
63
|
+
- `gameiconsSources` (const): const gameiconsSources: readonly AssetSource[] — game-icons.net (https://game-icons.net) — ~4,000 CC BY 3.0 SVG item/ability icons from 40+ contributing artists, mirrored as one GitHub repo (github.com/game-icons/icons). `HEAD` resolves the default branch without pinning a name or commit, so this always mirrors the current set; the per-artist `license.txt` files inside the repo carry the individual credits behind this pack's single collective `author` field.
|
|
64
|
+
- `generatedBySource` (const): const generatedBySource: Record<string, IndexEntry[]> — ⚠ undocumented
|
|
65
|
+
- `generatedIndex` (const): const generatedIndex: IndexEntry[] — ⚠ undocumented
|
|
66
|
+
- `generatedSpriteBySource` (const): const generatedSpriteBySource: Record<string, IndexEntry[]> — Pulled sprite/icon entries grouped by source id.
|
|
67
|
+
- `generatedSpriteIndex` (const): const generatedSpriteIndex: IndexEntry[] — Every pulled sprite/icon entry across all sources, flattened.
|
|
68
|
+
- `iconWiringSnippet` (function): function iconWiringSnippet(name: string): string — Copy-paste wiring for a HUD glyph from the registry `game-icon` catalog.
|
|
69
|
+
- `indexSpriteSourceDir` (function): function indexSpriteSourceDir(source: AssetSource, dir: string): IndexEntry[] — Walks a pulled sprite-pack directory and returns one `IndexEntry` per SVG/PNG, deduped by filename.
|
|
70
|
+
- `isScrapeDownload` (function): function isScrapeDownload(download: AssetDownload): download is ScrapeDownload — ⚠ undocumented
|
|
71
|
+
- `kaykitSources` (const): const kaykitSources: readonly AssetSource[] — ⚠ undocumented
|
|
72
|
+
- `keyFromSpriteFile` (function): function keyFromSpriteFile(file: string): string — Strips the `.svg`/`.png` extension off a pulled sprite/icon filename to get its id suffix.
|
|
73
|
+
- `materialAliases` (const): const materialAliases: readonly AssetAlias[] — Semantic keys onto the ambientCG catalog, mirroring the model alias layer.
|
|
74
|
+
- `materialSources` (const): const materialSources: readonly AssetSource[] — Every `kind: "material"` source — one CC0 PBR material each, resolvable via `buildMaterialCatalog`.
|
|
75
|
+
- `materialWiringSnippet` (function): function materialWiringSnippet(id: string, basePath = "/materials"): string — Copy-paste wiring for a pulled PBR material: resolve the map URLs through the material catalog, then apply them onto terrain or a model.
|
|
76
|
+
- `modelSources` (const): const modelSources: readonly AssetSource[] — Every source whose archive holds GLB models (Quaternius, KayKit packs).
|
|
77
|
+
- `modelWiringSnippet` (function): function modelWiringSnippet(id: string, options: ModelSnippetOptions = {}): string — Copy-paste wiring for a pulled GLB id: resolve through the catalog, drop into a model seam.
|
|
78
|
+
- `quaterniusSources` (const): const quaterniusSources: readonly AssetSource[] — ⚠ undocumented
|
|
79
|
+
- `rankAssets` (function): function rankAssets(query: string, options: FindOptions = {}): RankedMatch[] — Rank every catalog entry — models, packs, HUD components, icons — against one query.
|
|
80
|
+
- `readGlbDims` (function): function readGlbDims(bytes: Uint8Array): ModelDims | null — ⚠ undocumented
|
|
81
|
+
- `registryCatalog` (const): const registryCatalog: RegistryCatalog — ⚠ undocumented
|
|
82
|
+
- `reindexSprites` (function): function reindexSprites(spritesDir: string, outDir: string): ReindexSpritesResult — Same shape as `reindex` (models) but walks SVG/PNG files and skips dims measurement — sprites have no footprint.
|
|
83
|
+
- `resolveProvenance` (function): function resolveProvenance(id: string, options: ResolveProvenanceOptions = {}): AssetProvenance — Resolve one logical asset id (a pack id, a single id, or an alias key) to its {@link AssetProvenance}. Aliases are followed one hop to their target. An id that matches no declared owner is `dangling` — the signal a clean-clone gate turns into a hard failure, because no provisioning step can ever satisfy it.
|
|
84
|
+
- `singles` (const): const singles: readonly SingleAsset[] — ⚠ undocumented
|
|
85
|
+
- `sourceById` (const): const sourceById: ReadonlyMap<string, AssetSource> — ⚠ undocumented
|
|
86
|
+
- `sources` (const): const sources: readonly AssetSource[] — ⚠ undocumented
|
|
87
|
+
- `spriteSources` (const): const spriteSources: readonly AssetSource[] — Every `kind: "sprite"` source — a pack of individual 2D icon/UI files, resolvable via `buildSpriteCatalog`.
|
|
88
|
+
- `spriteWiringSnippet` (function): function spriteWiringSnippet(id: string, basePath = "/sprites"): string — Copy-paste wiring for a pulled sprite/icon-pack file: resolve through the sprite catalog.
|
|
89
|
+
- `validateAssetReferences` (function): function validateAssetReferences(references: readonly AssetReference[], options: ValidateAssetReferencesOptions = {}): ValidateAssetReferencesResult — Validate that every {@link AssetReference} resolves against the declared provisioning contract — not by grepping source text, but by resolving each logical id to its committed / provisioned / dangling owner. A `dangling` reference fails with the referencing consumer, the logical id, the (null) resolved path, and the missing provisioning step; a `provisioned` reference passes and contributes its `assets pull <source>` step to `provisioning` (unless `present` is supplied and reports the bytes absent).
|
|
90
|
+
- `verifyManifest` (function): function verifyManifest(): VerifyResult — ⚠ undocumented
|
|
91
|
+
|
|
92
|
+
## @jgengine/assets/aliases
|
|
93
|
+
|
|
94
|
+
- `aliases` (const): const aliases: readonly AssetAlias[] — Semantic keys → live catalog ids. Prefer these in games so re-homes only touch this table. Never point at kenney-*. Curated starter theme ids (`asset:person_casual`, `nature_tree`, …) come from {@link starterAliases}.
|
|
95
|
+
|
|
96
|
+
## @jgengine/assets/catalogs/build
|
|
97
|
+
|
|
98
|
+
- `BuildCatalogOptions` (interface): interface BuildCatalogOptions — ⚠ undocumented
|
|
99
|
+
- `CatalogExtra` (interface): interface CatalogExtra — A durable, hand-or-tool authored catalog entry that is not part of the generated pack index, singles, or aliases — the shape the editor writes into a promoted game's `src/game/assets.ts` when an asset is imported. `label` is human-facing only and is intentionally not registered into the catalog (it mirrors how a single asset's author/license live only in the source literal), so at runtime an extra resolves to exactly `{ url }`.
|
|
100
|
+
- `buildCatalog` (function): function buildCatalog(options: BuildCatalogOptions = {}): AssetCatalog — Builds a game's asset catalog from the generated CC0 pack index plus singles, extras, and aliases. Registration order is packs → singles → {@link BuildCatalogOptions.extras | extras} → aliases: packs and singles come first, extras override them last-writer-wins, and aliases resolve last so they can target an extra. See {@link BuildCatalogOptions} for filtering and opt-outs.
|
|
101
|
+
- `entryUrl` (function): function entryUrl(basePath: string, entry: IndexEntry): string — ⚠ undocumented
|
|
102
|
+
|
|
103
|
+
## @jgengine/assets/catalogs/buildSprites
|
|
104
|
+
|
|
105
|
+
- `BuildSpriteCatalogOptions` (interface): interface BuildSpriteCatalogOptions — Options for `buildSpriteCatalog`.
|
|
106
|
+
- `buildSpriteCatalog` (function): function buildSpriteCatalog(options: BuildSpriteCatalogOptions = {}): AssetCatalog — Resolves individual pulled sprite/icon ids (e.g. `gameicons-icons/sword`) to `{ url }`.
|
|
107
|
+
|
|
108
|
+
## @jgengine/assets/catalogs/starter
|
|
109
|
+
|
|
110
|
+
- `createStarterCatalog` (function): function createStarterCatalog(options: BuildCatalogOptions = {}): AssetCatalog<ModelAssetRef> — Catalog restricted to the curated starter packs (people/props/nature/urban). Prefer this for scaffolds and probes so `asset:person_casual` etc. resolve without pulling the whole library. Full index: {@link buildCatalog}.
|
|
111
|
+
|
|
112
|
+
## @jgengine/assets/cli/pull
|
|
113
|
+
|
|
114
|
+
- `cliFetch` (const): const cliFetch: typeof fetch — The runtime's own fetch, with a curl fallback for hosts it cannot reach — some proxied sandboxes tear down bun's TLS stream to GitHub's release-asset host while curl (which honors SSL_CERT_FILE) gets through fine.
|
|
115
|
+
- `generatedDir` (const): const generatedDir: string — Sibling of `cli/` under `src/` (dev) or `dist/` (published) so reindex writes the tree consumers import.
|
|
116
|
+
- `generatedSpritesDir` (const): const generatedSpritesDir: string — Sprite-pack counterpart of `generatedDir`.
|
|
117
|
+
|
|
118
|
+
## @jgengine/assets/collisionMeshAssets
|
|
119
|
+
|
|
120
|
+
- `COLLISION_MESH_ASSET_IDS` (const): const COLLISION_MESH_ASSET_IDS: ReadonlySet<string> — Catalog assets that ship a collision mesh in the generated index. Opt-in only: each entry adds ~10-30KB of quantized triangles to the index and a BVH raycast per query, so list only concave models whose fitted box lies (archways, rings, frames).
|
|
121
|
+
|
|
122
|
+
## @jgengine/assets/dims
|
|
123
|
+
|
|
124
|
+
- `ModelDims` (interface): interface ModelDims — Measured horizontal footprint, footprint center, and lowest Y of a model in model space.
|
|
125
|
+
- `readGlbCollisionMesh` (function): function readGlbCollisionMesh(bytes: Uint8Array): CollisionMeshData | null — Extract a model-space collision triangle soup from a GLB and compress it with {@link encodeCollisionMesh}. Walks the default scene, transforming each TRIANGLES primitive's float32 VEC3 positions by the node's world matrix, and returns `null` for a JSON-only GLB or when no triangle survives quantization.
|
|
126
|
+
- `readGlbDims` (function): function readGlbDims(bytes: Uint8Array): ModelDims | null — ⚠ undocumented
|
|
127
|
+
|
|
128
|
+
## @jgengine/assets/download
|
|
129
|
+
|
|
130
|
+
- `DEFAULT_RELEASE_BASE` (const): const DEFAULT_RELEASE_BASE: "https://github.com/Noisemaker111/jgengine/releases/download/packs" — Default asset mirror: this repo's own GitHub Releases, reachable from every cloud sandbox without network-policy changes (github.com is on the default allowlist). Assets live on the rolling `packs` release, one flat zip per pack named `<provider>-<packId>.zip`, kept in sync with the source catalog by `.github/workflows/mirror-assets.yml` — adding a catalog entry is the whole publishing step. Override the chain with `--mirror` / `JGENGINE_ASSETS_MIRROR`, or disable this hop with `JGENGINE_ASSETS_NO_DEFAULT_MIRROR=1`.
|
|
131
|
+
- `DownloadPackOptions` (interface): interface DownloadPackOptions — ⚠ undocumented
|
|
132
|
+
- `DownloadPackResult` (interface): interface DownloadPackResult — ⚠ undocumented
|
|
133
|
+
- `ExtractedGlb` (interface): interface ExtractedGlb — ⚠ undocumented
|
|
134
|
+
- `ExtractedPack` (interface): interface ExtractedPack — What `extractGlbs` pulls out of a pack archive: the models plus the textures they reference.
|
|
135
|
+
- `ExtractedPackImage` (interface): interface ExtractedPackImage — An image a pack's models reference, shipped flat beside the `.glb` files.
|
|
136
|
+
- `ExtractedSpriteFile` (interface): interface ExtractedSpriteFile — One SVG/PNG file pulled out of a sprite/icon-pack archive by `extractSpriteFiles`.
|
|
137
|
+
- `FetchLike` (type): type FetchLike = typeof fetch — ⚠ undocumented
|
|
138
|
+
- `MAX_ARCHIVE_COMPRESSION_RATIO` (const): const MAX_ARCHIVE_COMPRESSION_RATIO: 100 — Max allowed originalSize/size ratio for a single archive entry — past this it's treated as a zip bomb.
|
|
139
|
+
- `MAX_ARCHIVE_DOWNLOAD_BYTES` (const): const MAX_ARCHIVE_DOWNLOAD_BYTES: number — Max size of a downloaded (still-compressed) archive, in bytes. Provider zips run tens of MB; this leaves headroom without buffering an unbounded response.
|
|
140
|
+
- `MAX_ARCHIVE_ENTRY_COUNT` (const): const MAX_ARCHIVE_ENTRY_COUNT: 20000 — Max number of entries this module will extract out of one archive.
|
|
141
|
+
- `MAX_ARCHIVE_UNCOMPRESSED_BYTES` (const): const MAX_ARCHIVE_UNCOMPRESSED_BYTES: number — Max total uncompressed size this module will inflate out of one archive, in bytes.
|
|
142
|
+
|
|
143
|
+
## @jgengine/assets/find
|
|
144
|
+
|
|
145
|
+
- `AssetKind` (type): type AssetKind = "model" | "pack" | "material" | "component" | "icon" | "sprite" | "spritePack" — ⚠ undocumented
|
|
146
|
+
- `AssetMatch` (type): type AssetMatch = | { kind: "model"; id: string; source: string; file?: string; via: "index" | "alias" | "single" } | { kind: "pack"; source: string; title: string; categories: readonly string[] } | { kind: "material"; id: string; title: string; categories: readonly string[] } | { kind: "component";… — ⚠ undocumented
|
|
147
|
+
- `FindOptions` (interface): interface FindOptions — ⚠ undocumented
|
|
148
|
+
- `RankedMatch` (interface): interface RankedMatch — ⚠ undocumented
|
|
149
|
+
- `findAssets` (function): function findAssets(query: string, options: FindOptions = {}): AssetMatch[] — The ranked matches for a query — models, packs, HUD components, and icons in one list.
|
|
150
|
+
- `rankAssets` (function): function rankAssets(query: string, options: FindOptions = {}): RankedMatch[] — Rank every catalog entry — models, packs, HUD components, icons — against one query.
|
|
151
|
+
|
|
152
|
+
## @jgengine/assets/generated
|
|
153
|
+
|
|
154
|
+
- `generatedBySource` (const): const generatedBySource: Record<string, IndexEntry[]> — ⚠ undocumented
|
|
155
|
+
- `generatedIndex` (const): const generatedIndex: IndexEntry[] — ⚠ undocumented
|
|
156
|
+
|
|
157
|
+
## @jgengine/assets/generated-sprites
|
|
158
|
+
|
|
159
|
+
- `generatedSpriteBySource` (const): const generatedSpriteBySource: Record<string, IndexEntry[]> — Pulled sprite/icon entries grouped by source id.
|
|
160
|
+
- `generatedSpriteIndex` (const): const generatedSpriteIndex: IndexEntry[] — Every pulled sprite/icon entry across all sources, flattened.
|
|
161
|
+
|
|
162
|
+
## @jgengine/assets/indexGen
|
|
163
|
+
|
|
164
|
+
- `ReindexResult` (interface): interface ReindexResult — ⚠ undocumented
|
|
165
|
+
- `entryForFile` (function): function entryForFile(source: AssetSource, file: string, dims?: ModelDims, collisionMesh?: CollisionMeshData): IndexEntry — ⚠ undocumented
|
|
166
|
+
- `indexSourceDir` (function): function indexSourceDir(source: AssetSource, dir: string): IndexEntry[] — ⚠ undocumented
|
|
167
|
+
- `keyFromFile` (function): function keyFromFile(file: string): string — ⚠ undocumented
|
|
168
|
+
- `reindex` (function): function reindex(modelsDir: string, outDir: string): ReindexResult — ⚠ undocumented
|
|
169
|
+
|
|
170
|
+
## @jgengine/assets/manifest
|
|
171
|
+
|
|
172
|
+
- `AssetAlias` (interface): interface AssetAlias — ⚠ undocumented
|
|
173
|
+
- `AssetDownload` (type): type AssetDownload = PinnedDownload | ScrapeDownload — ⚠ undocumented
|
|
174
|
+
- `AssetProvider` (type): type AssetProvider = | "quaternius" | "kaykit" | "polypizza" | "itch" | "ambientcg" | "gameicons" | "custom" — ⚠ undocumented
|
|
175
|
+
- `AssetSource` (interface): interface AssetSource — ⚠ undocumented
|
|
176
|
+
- `AssetSourceKind` (type): type AssetSourceKind = "model" | "material" | "sprite" — What a source's archive contains: GLB models (default), one PBR material's texture maps, or a pack of individual 2D sprite/icon files (SVG/PNG).
|
|
177
|
+
- `AssetSpace` (interface): interface AssetSpace — Catalog-level asset-space metadata: how a model is authored relative to the engine, owned by the catalog entry rather than re-derived per game. Every field is optional so an unmeasured asset stays valid; {@link resolveFacingRotationY}/{@link assetUnitScale}/{@link resolveAnchorOffset} supply the documented defaults.
|
|
178
|
+
- `CollisionMeshData` (interface): interface CollisionMeshData — Compact, serializable triangle collision mesh measured at asset reindex — the renderer-free source of mesh-accurate hitboxes. Positions are welded onto a 16-bit grid spanning `min`..`max` (model space) and stored base64-encoded, so an opted-in catalog asset ships its collision triangles inside the generated index without the runtime ever touching the rendered scene graph.
|
|
179
|
+
- `IndexEntry` (interface): interface IndexEntry — ⚠ undocumented
|
|
180
|
+
- `ModelDims` (interface): interface ModelDims — Measured horizontal footprint, footprint center, and lowest Y of a model in model space.
|
|
181
|
+
- `PinnedDownload` (interface): interface PinnedDownload — ⚠ undocumented
|
|
182
|
+
- `ScrapeDownload` (interface): interface ScrapeDownload — ⚠ undocumented
|
|
183
|
+
- `SingleAsset` (interface): interface SingleAsset — ⚠ undocumented
|
|
184
|
+
- `isScrapeDownload` (function): function isScrapeDownload(download: AssetDownload): download is ScrapeDownload — ⚠ undocumented
|
|
185
|
+
|
|
186
|
+
## @jgengine/assets/materials
|
|
187
|
+
|
|
188
|
+
- `BuildMaterialCatalogOptions` (interface): interface BuildMaterialCatalogOptions — Options for `buildMaterialCatalog`.
|
|
189
|
+
- `ExtractedMaterialMap` (interface): interface ExtractedMaterialMap — One normalized map pulled out of a material archive by `extractMaterialMaps`.
|
|
190
|
+
- `MATERIAL_MAP_FILES` (const): const MATERIAL_MAP_FILES: { readonly color: "color.jpg"; readonly normal: "normal.jpg"; readonly roughness: "roughness.jpg"; readonly ao: "ao.jpg"; readonly displacement: "displacement.jpg"; } — Normalized filenames a pulled material directory contains, keyed by map role.
|
|
191
|
+
- `MaterialCatalog` (interface): interface MaterialCatalog — Resolves material ids and `material/…` aliases to `MaterialRef`s.
|
|
192
|
+
- `MaterialMapRole` (type): type MaterialMapRole = keyof typeof MATERIAL_MAP_FILES — One PBR map's role within a material: color, normal, roughness, ao, or displacement.
|
|
193
|
+
- `MaterialMaps` (interface): interface MaterialMaps — URLs of one material's PBR maps; `ao`/`displacement` files may be absent from a rare pack.
|
|
194
|
+
- `MaterialRef` (interface): interface MaterialRef — A resolved material: identity, attribution, and its normalized map URLs.
|
|
195
|
+
- `buildMaterialCatalog` (function): function buildMaterialCatalog(options: BuildMaterialCatalogOptions = {}): MaterialCatalog — A resolvable catalog over every `kind: "material"` source. Ids are source ids (`ambientcg-grass001`) plus the `material/…` aliases; every resolve returns the normalized map URLs under `basePath`, matching what `assets pull` writes into `<dir>/materials/<id>/`.
|
|
196
|
+
- `extractMaterialMaps` (function): function extractMaterialMaps(archive: Uint8Array): ExtractedMaterialMap[] — Pulls the recognized PBR maps out of a material archive (ambientCG's flat `<Asset>_<Res>_<Map>.jpg` layout) and normalizes their names so resolved URLs never depend on the provider's naming or the pulled resolution.
|
|
197
|
+
- `materialAliases` (const): const materialAliases: readonly AssetAlias[] — Semantic keys onto the ambientCG catalog, mirroring the model alias layer.
|
|
198
|
+
|
|
199
|
+
## @jgengine/assets/packs/starter
|
|
200
|
+
|
|
201
|
+
- `STARTER_ASSETS` (const): const STARTER_ASSETS: readonly StarterAsset[] — Flat list of every curated starter asset across themes.
|
|
202
|
+
- `STARTER_PACKS` (const): const STARTER_PACKS: Readonly<Record<StarterTheme, readonly StarterAsset[]>> — Theme → assets table for browse/docs (`STARTER_PACKS.people`, …).
|
|
203
|
+
- `STARTER_SOURCE_PACKS` (const): const STARTER_SOURCE_PACKS: readonly string[] — Source pack ids a game must pull so every starter asset URL resolves on disk.
|
|
204
|
+
- `STARTER_THEMES` (const): const STARTER_THEMES: readonly StarterTheme[] — Ordered starter theme ids: people, props, nature, urban.
|
|
205
|
+
- `StarterAsset` (interface): interface StarterAsset — One curated starter model: short id, theme, live catalog target, license, suggested height.
|
|
206
|
+
- `StarterTheme` (type): type StarterTheme = "people" | "props" | "nature" | "urban" — Curated drop-in starter themes for new games. Each entry maps a short semantic id (also registered as `asset:<id>`) to a live catalog GLB that is already measured (dims/anchor flow from the generated index via the alias target). Games wire them as `entityModels: { guest: "asset:person_casual" }`. Never Kenney — Quaternius / KayKit only.
|
|
207
|
+
|
|
208
|
+
## @jgengine/assets/provisioning
|
|
209
|
+
|
|
210
|
+
- `AssetProvenance` (interface): interface AssetProvenance — The resolved ownership of one logical asset id — the provisioning contract for that id.
|
|
211
|
+
- `AssetProvenanceKind` (type): type AssetProvenanceKind = "committed" | "provisioned" | "dangling" — How an asset id's bytes reach a clean checkout: - `committed` — resolves to a self-hosted / remote URL carried in the shipped index (a {@link SingleAsset}); no pull step, available immediately. - `provisioned` — a pack {@link IndexEntry}; the id is declared but its GLB is fetched on demand by `assets pull <source>` into the consumer's served dir. - `dangling` — nothing in the index, singles, or aliases owns the id, so no provisioning step exists and it can never resolve on a clean clone.
|
|
212
|
+
- `AssetReference` (interface): interface AssetReference — A logical asset id referenced by some consumer (a game, scene, or config), for validation.
|
|
213
|
+
- `ReferenceValidation` (interface): interface ReferenceValidation — The verdict for one {@link AssetReference}.
|
|
214
|
+
- `ResolveProvenanceOptions` (interface): interface ResolveProvenanceOptions — Override the data {@link resolveProvenance} resolves against; every field defaults to the shipped catalog.
|
|
215
|
+
- `ValidateAssetReferencesOptions` (interface): interface ValidateAssetReferencesOptions extends ResolveProvenanceOptions — Options for {@link validateAssetReferences}: the resolution data plus an optional on-disk `present` check.
|
|
216
|
+
- `ValidateAssetReferencesResult` (interface): interface ValidateAssetReferencesResult — The aggregate result of validating a set of references against the provisioning contract.
|
|
217
|
+
- `resolveProvenance` (function): function resolveProvenance(id: string, options: ResolveProvenanceOptions = {}): AssetProvenance — Resolve one logical asset id (a pack id, a single id, or an alias key) to its {@link AssetProvenance}. Aliases are followed one hop to their target. An id that matches no declared owner is `dangling` — the signal a clean-clone gate turns into a hard failure, because no provisioning step can ever satisfy it.
|
|
218
|
+
- `validateAssetReferences` (function): function validateAssetReferences(references: readonly AssetReference[], options: ValidateAssetReferencesOptions = {}): ValidateAssetReferencesResult — Validate that every {@link AssetReference} resolves against the declared provisioning contract — not by grepping source text, but by resolving each logical id to its committed / provisioned / dangling owner. A `dangling` reference fails with the referencing consumer, the logical id, the (null) resolved path, and the missing provisioning step; a `provisioned` reference passes and contributes its `assets pull <source>` step to `provisioning` (unless `present` is supplied and reports the bytes absent).
|
|
219
|
+
|
|
220
|
+
## @jgengine/assets/registry
|
|
221
|
+
|
|
222
|
+
- `RegistryCatalog` (interface): interface RegistryCatalog — ⚠ undocumented
|
|
223
|
+
- `RegistryComponent` (interface): interface RegistryComponent — ⚠ undocumented
|
|
224
|
+
- `componentInstallUrl` (function): function componentInstallUrl(name: string): string — The `shadcn add` URL for a HUD component, e.g. `https://jgengine.com/r/vital-bar.json`.
|
|
225
|
+
- `registryCatalog` (const): const registryCatalog: RegistryCatalog — ⚠ undocumented
|
|
226
|
+
|
|
227
|
+
## @jgengine/assets/singles
|
|
228
|
+
|
|
229
|
+
- `singles` (const): const singles: readonly SingleAsset[] — ⚠ undocumented
|
|
230
|
+
|
|
231
|
+
## @jgengine/assets/snippet
|
|
232
|
+
|
|
233
|
+
- `ModelSnippetOptions` (interface): interface ModelSnippetOptions — ⚠ undocumented
|
|
234
|
+
- `componentWiringSnippet` (function): function componentWiringSnippet(component: RegistryComponent): string — Copy-paste wiring for a HUD component: the `shadcn add` command plus import + usage.
|
|
235
|
+
- `iconWiringSnippet` (function): function iconWiringSnippet(name: string): string — Copy-paste wiring for a HUD glyph from the registry `game-icon` catalog.
|
|
236
|
+
- `materialWiringSnippet` (function): function materialWiringSnippet(id: string, basePath = "/materials"): string — Copy-paste wiring for a pulled PBR material: resolve the map URLs through the material catalog, then apply them onto terrain or a model.
|
|
237
|
+
- `modelWiringSnippet` (function): function modelWiringSnippet(id: string, options: ModelSnippetOptions = {}): string — Copy-paste wiring for a pulled GLB id: resolve through the catalog, drop into a model seam.
|
|
238
|
+
- `spriteWiringSnippet` (function): function spriteWiringSnippet(id: string, basePath = "/sprites"): string — Copy-paste wiring for a pulled sprite/icon-pack file: resolve through the sprite catalog.
|
|
239
|
+
|
|
240
|
+
## @jgengine/assets/sources
|
|
241
|
+
|
|
242
|
+
- `ambientcgSources` (const): const ambientcgSources: readonly AssetSource[] — Every ambientCG material source, generated per family (`ambientcg-grass001` … ).
|
|
243
|
+
- `gameiconsSources` (const): const gameiconsSources: readonly AssetSource[] — game-icons.net (https://game-icons.net) — ~4,000 CC BY 3.0 SVG item/ability icons from 40+ contributing artists, mirrored as one GitHub repo (github.com/game-icons/icons). `HEAD` resolves the default branch without pinning a name or commit, so this always mirrors the current set; the per-artist `license.txt` files inside the repo carry the individual credits behind this pack's single collective `author` field.
|
|
244
|
+
- `kaykitSources` (const): const kaykitSources: readonly AssetSource[] — ⚠ undocumented
|
|
245
|
+
- `materialSources` (const): const materialSources: readonly AssetSource[] — Every `kind: "material"` source — one CC0 PBR material each, resolvable via `buildMaterialCatalog`.
|
|
246
|
+
- `modelSources` (const): const modelSources: readonly AssetSource[] — Every source whose archive holds GLB models (Quaternius, KayKit packs).
|
|
247
|
+
- `quaterniusSources` (const): const quaterniusSources: readonly AssetSource[] — ⚠ undocumented
|
|
248
|
+
- `sourceById` (const): const sourceById: ReadonlyMap<string, AssetSource> — ⚠ undocumented
|
|
249
|
+
- `sources` (const): const sources: readonly AssetSource[] — ⚠ undocumented
|
|
250
|
+
- `spriteSources` (const): const spriteSources: readonly AssetSource[] — Every `kind: "sprite"` source — a pack of individual 2D icon/UI files, resolvable via `buildSpriteCatalog`.
|
|
251
|
+
|
|
252
|
+
## @jgengine/assets/sources/ambientcg
|
|
253
|
+
|
|
254
|
+
- `ambientcgAssetId` (function): function ambientcgAssetId(source: AssetSource): string — Upstream asset id (`Grass001`) for a material source id (`ambientcg-grass001`).
|
|
255
|
+
- `ambientcgSources` (const): const ambientcgSources: readonly AssetSource[] — Every ambientCG material source, generated per family (`ambientcg-grass001` … ).
|
|
256
|
+
|
|
257
|
+
## @jgengine/assets/sources/gameicons
|
|
258
|
+
|
|
259
|
+
- `gameiconsSources` (const): const gameiconsSources: readonly AssetSource[] — game-icons.net (https://game-icons.net) — ~4,000 CC BY 3.0 SVG item/ability icons from 40+ contributing artists, mirrored as one GitHub repo (github.com/game-icons/icons). `HEAD` resolves the default branch without pinning a name or commit, so this always mirrors the current set; the per-artist `license.txt` files inside the repo carry the individual credits behind this pack's single collective `author` field.
|
|
260
|
+
|
|
261
|
+
## @jgengine/assets/sources/kaykit
|
|
262
|
+
|
|
263
|
+
- `kaykitSources` (const): const kaykitSources: readonly AssetSource[] — ⚠ undocumented
|
|
264
|
+
|
|
265
|
+
## @jgengine/assets/sources/quaternius
|
|
266
|
+
|
|
267
|
+
- `quaterniusSources` (const): const quaterniusSources: readonly AssetSource[] — ⚠ undocumented
|
|
268
|
+
|
|
269
|
+
## @jgengine/assets/spriteIndexGen
|
|
270
|
+
|
|
271
|
+
- `ReindexSpritesResult` (interface): interface ReindexSpritesResult — Per-source and total counts returned by `reindexSprites`.
|
|
272
|
+
- `entryForSpriteFile` (function): function entryForSpriteFile(source: AssetSource, file: string): IndexEntry — Builds one sprite/icon `IndexEntry` — same shape as a model entry, minus `dims`.
|
|
273
|
+
- `indexSpriteSourceDir` (function): function indexSpriteSourceDir(source: AssetSource, dir: string): IndexEntry[] — Walks a pulled sprite-pack directory and returns one `IndexEntry` per SVG/PNG, deduped by filename.
|
|
274
|
+
- `keyFromSpriteFile` (function): function keyFromSpriteFile(file: string): string — Strips the `.svg`/`.png` extension off a pulled sprite/icon filename to get its id suffix.
|
|
275
|
+
- `reindexSprites` (function): function reindexSprites(spritesDir: string, outDir: string): ReindexSpritesResult — Same shape as `reindex` (models) but walks SVG/PNG files and skips dims measurement — sprites have no footprint.
|
|
276
|
+
|
|
277
|
+
## @jgengine/assets/verify
|
|
278
|
+
|
|
279
|
+
- `VerifyInput` (interface): interface VerifyInput — ⚠ undocumented
|
|
280
|
+
- `VerifyResult` (interface): interface VerifyResult — ⚠ undocumented
|
|
281
|
+
- `verifyData` (function): function verifyData(input: VerifyInput): VerifyResult — ⚠ undocumented
|
|
282
|
+
- `verifyManifest` (function): function verifyManifest(): VerifyResult — ⚠ undocumented
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- GENERATED by scripts/gen-capability-index.ts — do not edit. Regenerate: bun run gen:capabilities -->
|
|
2
|
+
|
|
3
|
+
# jgengine-assets — capability index
|
|
4
|
+
|
|
5
|
+
Reach for these before hand-rolling. Each row is *the thing you need* → *the primitive that already does it*.
|
|
6
|
+
|
|
7
|
+
## asset-reference-integrity — validate asset references against the provisioning contract (dangling / committed / provisioned)
|
|
8
|
+
|
|
9
|
+
- `validateAssetReferences` (function) · `import { validateAssetReferences } from "@jgengine/assets"`
|
|
10
|
+
|
|
11
|
+
## starter-packs — themed CC0 model ids (people/props/nature/urban) ready for entityModels
|
|
12
|
+
|
|
13
|
+
- `StarterTheme` (type) · `import { StarterTheme } from "@jgengine/assets"`
|