@chikn-game-assets/runtime
v0.4.0
Published
Apache-2.0 manifest helpers for Chikn community non-commercial assets.
Readme
@chikn-game-assets/runtime
Apache-2.0 TypeScript helpers and a generated ID catalog for a separately hosted Chikn Game Assets release. This npm package contains no source images, audio, or runtime media and does not grant rights to Chikn, Roostr, or FarmLand content.
npm install @chikn-game-assets/runtimeimport { CHIKN_CONTENT_TERMS, loadChiknPack } from '@chikn-game-assets/runtime';
const pack = await loadChiknPack({
baseUrl: 'https://cdn.example/chikn/v1.0.0/',
profile: 'default',
});
const asset = pack.findAsset('chikn-flat/admiral');
console.log(CHIKN_CONTENT_TERMS.ownership);baseUrl must point to the directory containing runtime/manifest.json; no production host is embedded. It roots the manifest, atlas pages, and direct audio files. Use @roost2d/assets and @roost2d/pixi for cached integrity-checked loading and cropped Pixi textures — that remains the recommended image integration.
Loading verified bytes without Roost2D
fetchAssetBytes fetches a single atlas page or direct audio file and verifies its declared byte count and SHA-256 digest before returning it. It refuses variant paths that are absolute, traversing, percent-encoded, or off-origin, and aborts a response that overruns its declared size.
import { createChiknAssetCache, fetchAssetBytes, loadChiknPack } from '@chikn-game-assets/runtime';
const pack = await loadChiknPack({
baseUrl: 'https://cdn.example/chikn/v1.0.0/',
// Optional: pin the manifest itself. Per-asset digests are only trustworthy if the manifest is.
expectedManifestSha256: '…',
});
const bytes = await fetchAssetBytes(pack, 'chikn-flat/admiral');
const sound = await fetchAssetBytes(pack, 'audio/bok-gark-01');Many logical image IDs share one atlas page, while each audio/* ID resolves to one direct MP3. fetchAssetBytes is deliberately low-level and uncached. For batches use createChiknAssetCache(pack), which shares bytes only when the resolved URL, byte count, and integrity metadata all match, and exposes unload(assetId) and clear().
If you pass a bare manifestUrl instead of baseUrl, the asset root is not inferred from it. Supply assetBaseUrl explicitly, or asset resolution throws.
Manifest entries marked CHIKN-COMMUNITY-NONCOMMERCIAL remain owned by Chikn and are governed by the Chikn Community Asset Pack Non-Commercial Licence, Version 1.1, granted directly by Chikn. Roost2D is an authorised distributor only and grants no Chikn licence, sublicense or commercial rights. A manifest entry marked Apache-2.0, such as farmland/water-swim-ring-coq, is separately classified project artwork and is not Chikn property.
IDs such as chikn-flat/admiral and dotted rig names may be compatibility aliases rather than primary file IDs. Always call findAsset (or use a Roost2D manifest resolver) instead of translating an ID into a source path.
Read the full Chikn licence, repository licensing notice, attribution requirements, and complete integration guide.
