Question about Est. Image Memory

Discussion and feedback on Construct 2

Post » Fri Jul 04, 2014 4:15 pm

Hi to all,
I noticed a very strange thing....
I have a game's level within which there are objects like the player, enemies, platforms, etc. ..
when I launch it in debug mode I have values ​​like this:

Est. image memory: 62,1 mb

when I try to delete all the instances of enemies (I have only 1 type of enemy duplicated 11 times in level) the
Est. image memory is: 6 mb

I wonder why 11 instances take about 55MB?
I read the weight of all the images that make up the animation of the enemy and come to a total of 300kb .....
so why affect so much of that value?

thanks
B
6
S
1
Posts: 62
Reputation: 578

Post » Sat Jul 05, 2014 1:47 pm

EDIT: also with only 1 enemy the value of
Est. image memory is 62,1 mb

and when I delete the only enemy the value change in
6 mb

why this?
the sum of all images files that compose the animation of the enemy is only 300 kb?
is normal or is a issue?

I would like to know the opinion of Ashley...

thank's
B
6
S
1
Posts: 62
Reputation: 578

Post » Sun Jul 06, 2014 2:54 am

What is the size of your animation frame for this enemy and how many do you have?
B
70
S
24
G
19
Posts: 1,757
Reputation: 17,616

Post » Sun Jul 06, 2014 2:54 am

Memory usage is depending for images.

If you use cloned sprites (duplicated frames) may take double memory usage.

If you use bigger images may increase memory usage.

If your canvas is upscaled than fixed windows, it adds more memory.


You should design your workflow to keep good memory usage for reducing and reciclying animation frames, small images, one sprite for all animations states, composing scene with props with different properties like opacity, size, angle, etc.


Otherwise, if you plan to have million of animations, Spriter is solution.
B
99
S
35
G
29
Posts: 3,139
Reputation: 28,421

Post » Sun Jul 06, 2014 1:16 pm

An object is either fully loaded in to memory with all its animations and animation frames, or not loaded at all. Images are also fully decompressed in memory. For example you may have a 1024 x 1024 PNG file which is only 300kb on disk, but it will effectively be decompressed to a 32-bit bitmap in memory, therefore using up 1024x1024x4 bytes of memory, about 4mb. Adding up all your animation frames like that probably does come to around 50mb+, which is a very large amount for a single object. See Remember not to waste your memory
Scirra Founder
B
403
S
238
G
89
Posts: 24,654
Reputation: 196,145

Post » Sun Jul 06, 2014 9:59 pm

Wow now all is clear! Many thanks
I have in my enemy sprite some animations with large image png, 600x600 pixel
This animations increase that value.
But what is the best Way to save large images?
Png 8 bit can help me to keep memory usage low?
B
6
S
1
Posts: 62
Reputation: 578

Post » Mon Jul 07, 2014 5:21 am

mollaq wrote:Wow now all is clear! Many thanks
I have in my enemy sprite some animations with large image png, 600x600 pixel
This animations increase that value.
But what is the best Way to save large images?
Png 8 bit can help me to keep memory usage low?


It does not matter what format you save it us, once in GPU memory, its a full texture.

Your 600 x 600 is slightly too large to fit into 512 x 512 texture so it has to go to the next one up (power of 2 size), so your image has to go into a 1024 x 1024 texture. As such, each animation frame would take up 4MB in memory.

You need to read the tutorial Ashley linked above. Consider it COMPULSORY reading before you starting designing your game, its incredibly important to have good practices from the start before you waste your time making a boat load of animations which are poorly optimized.

My advice is to not use any animated sprite above 256 x 256 in size. It's just too much of a memory hog to have 512 x 512 frames, if you have an enemy with 20 frames of that size, that single enemy is 20MB of memory once loaded into GPU.
B
70
S
24
G
19
Posts: 1,757
Reputation: 17,616

Post » Mon Jul 07, 2014 5:52 am

Ok I know...
but if I have a big boss enemy how can I do it?
my images size of the boss enemy are 600x600 now,
I can resize them to 256x256 with photoshop but on the construct2 if I scale the enemy to 600x600 it is "blurry" when I play the game....
B
6
S
1
Posts: 62
Reputation: 578

Post » Mon Jul 07, 2014 12:55 pm

mollaq wrote:Ok I know...
but if I have a big boss enemy how can I do it?
my images size of the boss enemy are 600x600 now,
I can resize them to 256x256 with photoshop but on the construct2 if I scale the enemy to 600x600 it is "blurry" when I play the game....


Break your boss up to smaller fragments to minimize waste (empty space on image = waste).
B
70
S
24
G
19
Posts: 1,757
Reputation: 17,616

Post » Mon Jul 07, 2014 6:09 pm

You could also try 512 instead - textures are power of two, so like 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048.
Moderator
B
95
S
34
G
33
Posts: 3,007
Reputation: 27,876

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 8 guests