Skip to content

Loading and assets ​

The engine ships no assets ​

There are no textures, models, or fonts inside Wasmotion. The contracts it owns are shapes, not files: the six-face skybox convention, and helpers that load what you point them at — loadTexture(path) (sRGB + nearest-filter) and StaticMesh for model roots you loaded with a GLTFLoader.

The loading gate ​

new FPS() arms a loading screen before any of your code runs a load, and start() attaches its overlay: an opaque cover with a progress bar that hides the half-built scene. While covered, the world is paused (physics and entity updates frozen) but rendering continues underneath, so the reveal is a complete scene.

Dismissal, whichever comes first:

  • the load queue drains and stays quiet for a settle window (chained loads — a glTF's buffers and textures start only after its JSON parses — keep it covered);
  • no asset traffic at all in the first grace window (an asset-less or fully cached world);
  • a hard timeout (30 s) — one slow or broken asset must never block entry; the stragglers keep streaming in after the reveal.

The one rule: don't pass a LoadingManager ​

The gate works by hooking THREE.DefaultLoadingManager, which only sees loaders constructed without an explicit manager:

ts
new THREE.TextureLoader()               // ✅ counted by the gate
new THREE.TextureLoader(myManager)      // ❌ invisible to it

Construct all loaders bare and everything — skybox faces, models, textures — reports to one place. The manager's counters are cumulative across a page's lifetime (Three never resets them); the gate baselines them per world so every world's bar counts from zero.

Progress and errors ​

A failed asset counts as done — the world copes without it rather than blocking entry. The progress UI only fades in if loading is still running after ~0.7 s, so cached worlds read as a brief dark transition, not a flashing bar.