Packs / game-dev-web-public
game-asset-delivery
Make a large WebGL/WASM game load fast: content-hashed file names, precompressed .br/.gz copies, an asset manifest for parallel loading and immutable caching
Install
logicpacks pack use game-dev-web-public/game-asset-deliveryget_pack game-dev-web-public/game-asset-deliveryThe second line is the MCP tool call for the LogicPacks connector (Claude Code, Codex, Claude.ai and others). The first run of a pack someone else wrote asks for your yes.
Keys it needs (names only)
None.
Playbooks included
- Spec:
spec/SPEC.md(goal, steps, edge cases, don’ts) - Routes:
local-python - Checks: 1 in
outcome/checks.yaml - Code:
optimize_assets.pyverify_assets.py - Tools: python3
Usage, last 8 weeks
New: no recorded use yet.
Purpose (from spec/SPEC.md)
Goal
Repeat visits load from cache, first visits download the least bytes possible, and the loader fetches in parallel from a manifest.
Steps
- Run
python3 code/optimize_assets.py <assets-dir> --out <dist-assets>: copies each file toname.<hash8>.ext, writes.gz(and.brwhen the brotli module is installed) next to compressible files, andmanifest.json(logical name -> hashed name, bytes). - Load via the manifest with a concurrency limit (16 worked well for us on HTTP/2).
- Serve hashed files with
Cache-Control: public, max-age=31536000, immutable; the manifest itself with no-cache. - Let nginx/Pages serve the precompressed copy (
gzip_static on;/ Pages compresses automatically). - Check:
python3 code/optimize_assets.py outcome/fixtures/assets --out out/athen the verifier.
Edge cases
- Already-compressed formats (png, jpg, mp4, ktx2, ogg) are not recompressed.
- Changing one asset changes only its hash: other cache entries stay valid.
Don'ts
- Don't cache the manifest or index.html for a year.
- Don't ship unused assets: diff the manifest against what levels reference.