Bash.tv → GitHub → itch.io

Loading screens and progress indicators for browser games. A tested loader with weighted progress across images, sounds, JSON and fonts, a few downloads at a time, retries with a timeout, optional files that don't block the game, progress that eases and never goes backwards, a minimum show time so it doesn't flash, an error state with Retry, tips that rotate, and a default loading screen; plus ...

Download skill (.zip) Files on GitHub

Game loading screen

Load in three parts

  1. Before anything: the HTML, a background color and a “Loading” text in plain CSS, so the screen is never blank or white.
  2. Before the title screen: only what the title and the first level need (game-loading-optimization: keep it under ~2 MB).
  3. In the background: later levels and music while the player is in the menu (game-asset-streaming).

assets/loader.js

import { createLoader, drawLoading, tipAt, TIPS } from "./loader.js";
const loader = createLoader({ concurrency: 4, retries: 2, timeoutMs: 15000, minShowMs: 400 });
loader.add("hero", "assets/img/hero.png", { weight: 2 })
      .add("level1", "assets/levels/1.json")
      .add("music", "assets/music/theme.mp3", { weight: 6, optional: true });   // big files weigh more; optional = may be missing
loading scene:
  enter: loader.start().then((assets) => go(Title(assets))).catch(() => (failed = true));
  update: loader.update(dt);   tap or Enter when failed: failed = false; loader.retry().then(...)
  draw: drawLoading(ctx, W, H, { progress: loader.shown, tip: tipAt(TIPS, time), error: loader.error, time, reducedMotion });

The screen

Tested

Node tests: types from file names, retry of a failing file, an optional missing file loading as null, progress only rising to 1, the minimum show time, shown easing to 1, a missing file reported as an error, and a timeout. Used in the UI kit demo.

Pitfalls

A blank white page while JavaScript downloads, a bar that jumps to 90% and waits, one missing sound stopping the game, no Retry, loading every level up front, and decoding audio before the first tap.