Skip to content

Assets should load once at loading screen — multiple loads cause performance glitches #26

Description

@WERSIT35

Summary

Assets are being requested/loaded multiple times during gameplay (not only at the initial loading screen), causing frame drops, hitches, and visible glitches when the game is running.

Steps to reproduce

  1. Open the game (client) and start a play session.
  2. Observe network tab or profiler while playing several spins and triggering features (free spins, tumble, crazy-mode).
  3. Notice repeated asset requests (images/sprites/audio) and spikes in CPU/network activity during gameplay rather than only at load.

Observed behavior

  • Multiple downloads or re-initialization of the same asset(s) during the game session.
  • Jank/hitches when assets are fetched/created while the spin animation is running.
  • Increased memory churn and CPU usage.

Expected behavior

  • All critical assets should be fully loaded and cached during the initial loading screen (single-load).
  • No blocking asset downloads during active spins that cause visible frame drops.

Suggested fixes / notes for implementers

  • Add/ensure a centralized preloader that loads all required run-time assets once on the loading screen (client/main.js or a dedicated preloader module).
  • Use a single shared cache for images/audio (avoid creating new Image or Audio objects repeatedly).
  • Ensure engine files load in the required order and that asset registration occurs only once (refer to client/engine/*.js loader ordering described in CLAUDE.md).
  • Consider using a Service Worker or the browser cache for static assets and verify caching headers from the static server.
  • Defer non-critical assets until after the first spin only if they are truly non-blocking (background assets), but never during a critical animation frame.
  • Add telemetry / profiling hooks (timings) to measure "assets loaded during gameplay" vs. at load time.

Files/areas to inspect

  • client/main.js (UI bootstrap / preloader)
  • client/index.html static asset references
  • client/* UI components that create Image/Audio objects
  • backend/static serving config (if any) and immutable cache headers

Impact

High — causes visible player-facing glitches and impacts perceived performance and revenue.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions