Cross-kit composition
import { Aside } from ‘@astrojs/starlight/components’;
Problem
Section titled “Problem”You want KayKit Medieval Hexagon Pack tiles for the gameboard, but characters from KayKit Adventurers 2.0 (FREE) for the player + NPCs, plus a tower asset from Kenney’s Castle Kit as a special landmark.
Snippet
Section titled “Snippet”import { analyzeExternalAssetCompatibility, declareGameboardPiecesFromCompatibilityReports, createGameboardPieceRegistry, createGameboardPieceSourceUrlMap,} from 'declarative-hex-worlds';
const knightReport = await analyzeExternalAssetCompatibility({ assetUrl: '/assets/adventurers/knight.gltf', intendedRole: 'unit',});
const pieces = declareGameboardPiecesFromCompatibilityReports([ { name: 'adventurer:knight', report: knightReport, role: 'unit' },]);const registry = createGameboardPieceRegistry(pieces);const urlByAssetId = createGameboardPieceSourceUrlMap(registry, { sourceRoots: { 'adventurers': '/assets/adventurers' },});What the library handles
Section titled “What the library handles”- GLTF inspection. Reads bounds, rig presence, animation clips, material slots from any GLTF; reports placement compatibility.
- Piece declaration. Wraps the report into a
GameboardPieceDeclarationthat fits the manifest schema. - URL resolution. Per-source-pack URL maps so the renderer knows where to load each cross-kit asset from.
API cross-links
Section titled “API cross-links”analyzeExternalAssetCompatibilitydeclareGameboardPiecesFromCompatibilityReportscreateGameboardPieceSourceUrlMap