What's the best way to minimize the image memory usage?

Get help using Construct 2

Post » Sun Aug 20, 2017 6:06 pm

When you display an image (sprite) in your layout for the first time, it preloads and the memory of the images in the layout accumulates.

So, I have some big sprites in my layout but very few of them can be viewed at the same time.
I have thought of destroying them when not on-screen and creating them again when visible on-screen, but that will preload them over and over and preloading freezes the game for a fraction of a sec, which makes the game laggy.

The images in the layout are 60.6mb in total (54mb of these are for the map I have in my game, 1024x1024 each image) in one of my layouts and can get up to 83.1mb once I open some windows or smth..

That's not that bad, but it's not perfect, I want my game to scroll smoothly on mobile. Is it possible even possible in my case?
My first project:
Image
B
20
S
8
G
1
Posts: 172
Reputation: 2,463

Post » Sun Aug 20, 2017 7:00 pm

The lag of initial sprites loading is a common problem (especially on mobile devices). I made the MM_Preloader plugin to get rid of this lag . The plugin isn't free, yet it's an answer for such issues.

Destroying the Sprite object does not release its image from the memory. So you can either toggle the visibility of instance of your sprites or create/destroy the instances. In both cases the memory use remains the same.
ImageImageImage
B
45
S
23
G
89
Posts: 1,100
Reputation: 50,611


Return to How do I....?

Who is online

Users browsing this forum: grigrizljac, rustomatic and 4 guests