# 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

- **Space:** game-dev-web-public (https://github.com/Tech-Realm/space-game-dev-web-public/tree/main/game-asset-delivery)
- **Level:** L2 (as the registry reports it)
- **Keys it needs (names only):** none
- **Tools:** python3
- **Routes:** local-python; checks: 1
- **Uses:** new (no recorded use yet)
- **Install:** `logicpacks pack use game-dev-web-public/game-asset-delivery` or MCP `get_pack game-dev-web-public/game-asset-delivery`
- **Files:** CHANGELOG.md, code/optimize_assets.py, code/verify_assets.py, outcome/EVIDENCE.md, outcome/checks.yaml, outcome/fixtures/assets/js/engine.js, outcome/fixtures/assets/levels/level1.json, outcome/fixtures/assets/readme.txt, outcome/results.json, pack.yaml, spec/SPEC.md, spec/source.md

## Purpose (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.



---

Canonical URL: https://logicpacks.io/packs/game-dev-web-public/game-asset-delivery

Developed by TechRealm (techrealm.online), the software team. Operated by Al Jash Trading (Establishment), Abu Dhabi, since 1994, the legal entity that hosts and is responsible for the service. Economic licence CN-1030597, Abu Dhabi Registration Authority. Address: Office 5, Bani Yas West 4, Bani Yas, Abu Dhabi, UAE. Website: https://aljashtrading.com. Contact: hello@logicpacks.io, security@logicpacks.io, WhatsApp +1 713 632 2262 (https://wa.me/17136322262).

Machine-readable index: [/llms.txt](/llms.txt). Plain facts: [/about.md](/about.md). Safety: [/safety.md](/safety.md).
