Bash.tv → GitHub → itch.io

Make a web game start fast, especially on phones and slow connections. Measure load times on fast, 4G and 3G networks (first paint, load event, first game frame, requests, bytes, biggest files), then cut what's downloaded before play (smaller and fewer assets, atlases, compression, code size), show something useful immediately, load in priority order, avoid render-blocking scripts, warm up firs...

Download skill (.zip) Files on GitHub

Game loading optimization

python3 <skill>/scripts/load-audit.py http://localhost:8000/                 # fast + simulated 4G
python3 <skill>/scripts/load-audit.py http://localhost:8000/ --network all     # fast, 4G, 3G

Per network: first paint, DOMContentLoaded, load, when the game drew its first frame (2D canvas), requests, total bytes, the biggest files, plus flags: render-blocking scripts, many tiny requests, no compression, over 20 MB, over 8 s on mobile.

Targets

Measure Target
Something on screen (title or loading bar) < 1 s fast, < 3 s on 4G
Playable (first level) < 3 s fast, < 8 s on 4G
Bytes before play < 3–5 MB (2D), < 10–15 MB (3D)
Total game < 20 MB for web portals unless there’s a reason

Fixes, biggest first

  1. Show something immediately. A tiny HTML/CSS title or loading bar in index.html itself, before any JS or assets.
  2. Load less before play. Title screen first, levels later (game-asset-streaming).
  3. Shrink assets. Images to WebP / PNG-8 at the size actually drawn, audio to 96–128 kbps (mono for sfx), glTF compressed (bash-web-asset-shrinker does images and audio).
  4. Fewer requests. Sprite atlases, one audio sprite for many short sounds, bundle many small JS modules for release.
  5. Code size. Minify, tree-shake, drop unused libraries (game-bundle-optimization).
  6. No render-blocking scripts. type="module" or defer. Bash.js is the exception (the preview needs it). It’s small.
  7. Compression and caching. itch.io, GitHub Pages, Netlify and Cloudflare compress text files. Use hashed file names for long cache times if you control the server.
  8. Preconnect to any CDN you must use: <link rel="preconnect" href="https://cdn.jsdelivr.net">, or better, vendor the files.

First-use stalls (feel like loading hitches)

Report

“Before: 14 MB, 4G playable at 11.2 s. After: 3.8 MB before play (levels streamed), 4G playable at 3.9 s.”