Seeking Help: Memory Optimization for Large Game Assets in Phaser 3.80

Hey everyone,

I’m currently working on a game using Phaser version 3.80, and I’m encountering a major issue with memory management. My game assets are quite large, taking up around 1.5 GB of memory. When I run the game on mobile browsers like Edge or Chrome, it crashes due to insufficient memory.

I’m hoping someone here has experience with optimizing memory usage or implementing on-demand asset loading in Phaser. Here’s a bit more context about my problem:

Current Situation

  • Phaser Version: 3.80
  • Asset Size: Around 1.5 GB
  • Browsers: Edge and Chrome on mobile devices
  • Issue: Game crashes due to high memory usage.

What I’ve Tried

  1. Loading Assets: Initially, I loaded all assets at the beginning. This works fine on desktop browsers, but it’s a memory hog on mobile.

  2. On-Demand Loading: I attempted to switch to on-demand loading by removing assets and loading them just before rendering. However, this approach led to rendering issues with images and styles appearing incorrectly.

What I Need Help With

  • Memory Optimization: Does anyone have any tips or best practices for reducing memory usage when dealing with large assets in Phaser?

  • On-Demand Loading: How can I properly implement on-demand loading without causing rendering issues? Are there any specific methods or techniques I should be aware of?

  • Case Studies: If anyone has successfully tackled a similar problem, I’d love to hear about your experience and how you managed to optimize memory usage or implement on-demand loading.

Any advice or suggestions would be greatly appreciated! I’m really stuck on this and could use some expert guidance.

Thanks in advance for your help!

Best regards,

:wave:

For overall memory use you may want to look into compressed textures.

Try to organize your spritesheets/atlases around scenes, so you can load them when starting a scene and remove them when stopping it.

Creating large textures (for WebGL) is expensive and there isn’t really any getting around it. Try to minimize it and avoid doing it during gameplay.