Skip to content

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

L2 Checks passed 3 of 3 runsv1.0.0Tech-Realm/space-game-dev-web-public

Install

logicpacks pack use game-dev-web-public/game-asset-delivery
get_pack game-dev-web-public/game-asset-delivery

The 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

  1. Run python3 code/optimize_assets.py <assets-dir> --out <dist-assets>: copies each file to name.<hash8>.ext, writes .gz (and .br when the brotli module is installed) next to compressible files, and manifest.json (logical name -> hashed name, bytes).
  2. Load via the manifest with a concurrency limit (16 worked well for us on HTTP/2).
  3. Serve hashed files with Cache-Control: public, max-age=31536000, immutable; the manifest itself with no-cache.
  4. Let nginx/Pages serve the precompressed copy (gzip_static on; / Pages compresses automatically).
  5. Check: python3 code/optimize_assets.py outcome/fixtures/assets --out out/a then 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.