Performance Tips Question

Discussion and feedback on Construct 2

Post » Sun Feb 05, 2012 5:11 pm

In the performance tips there is a paragraph that I would like to know more about:

"Image formats (e.g. JPEG, PNG-8, PNG-32) affect the download size but have no effect on runtime performance (they are all decompressed to 32-bit bitmap on startup)."

When the images are decompressed, do they go into RAM?

How decompressed do the images get?

Example: A solid black 1000x1000 pixel .png is 6k, but the same 32bit bitmap is 3,907k

B
8
S
3
G
2
Posts: 107
Reputation: 2,219

Post » Sun Feb 05, 2012 8:48 pm

The images go in to RAM and also in to VRAM (graphics card memory) if the rendering is hardware accelerated, which it usually is these days.

They get decompressed to the same size as the image saved as a 32-bit bitmap, so yes, a 1000x1000 pixel image will always take about 4mb of memory alone. This isn't much when both your computer and graphics card have gigabytes of memory, but bear in mind 4mb is still a lot for a single image on mobile.

The various compressed formats just package the data in to a smaller filesize. Compressed images cannot be drawn though, so it's normal to decompress the images in to memory whenever they are loaded.

We have plans for a feature to load textures layout by layout (like Classic can) somewhere on the todo list, to save memory with very large projects.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Mon Feb 06, 2012 12:32 am

Thank you, this clarifies a lot for me. I have been going based on the size of the C2 project, but I really need to go back and double check all my files with this in mind. For example I have an animation that is mostly black with eyes looking around, C2 sees it as being a tiny amount of data, but decompressed this would be huge.
B
8
S
3
G
2
Posts: 107
Reputation: 2,219

Post » Mon Feb 06, 2012 2:11 am

http://www.scirra.com/manual/134/performance-tips
[quote]Size, angle or opacity of sprites/tiled backgrounds has no effect when hardware acceleration is in use[/quote]

So does that mean, the practice of using 2^X sized images no longer matters like it did Construct Classic? For instance using multiple 256x256 sized images rather than a single 400x250 sized image?
B
134
S
65
G
16
Posts: 1,766
Reputation: 19,190

Post » Mon Feb 06, 2012 11:14 pm

bump
B
134
S
65
G
16
Posts: 1,766
Reputation: 19,190

Post » Tue Feb 07, 2012 12:16 am

Performance wise non-power-of-two textures are no different than power-of-two textures. It was the same with CC.

The reason for power-of-two textures was purely for memory efficiency.
In CC non-Power-of-two textures were reported by the runtime to take as much video memory as the closest 2^X texture would take. Most graphics cards now can handle any sized texture as well as 2^X textures. Whether the texture is re sized up to a 2^X texture in memory or not is hardware specific.
B
79
S
24
G
54
Posts: 4,747
Reputation: 40,757

Post » Tue Feb 07, 2012 2:28 am

Thanks Rojo.
B
134
S
65
G
16
Posts: 1,766
Reputation: 19,190

Post » Tue Feb 07, 2012 2:31 am

@R0J0hound is right, the texture size affects memory usage and not runtime performance.

The power-of-two thing is annoyingly complicated: on desktop, you can probably forget it completely, almost all desktop computers now can support non-power-of-two textures. However, mobiles and tablets have weaker, simpler hardware and might still internally use power of two, but you can't easily tell, because the graphics card can make the support invisible (it will pretend it's using a non-power-of-two even if behind the scenes it's using power of two). TBH, I'd forget about it, it's a pain - just test your game regularly to make sure it works on mobile and you'll be fine.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Fri Feb 28, 2014 2:06 pm

Hi Ashley, this is a post of 2012, so i wold like to know if
the "We have plans for a feature to load textures layout by layout (like Classic can) somewhere on the todo list, to save memory with very large projects." its done in the releas 163 of construct.

I have made a game for mobile and when in older devices its crash on starting, i think is because the RAM.


Thanks
B
8
S
4
Posts: 49
Reputation: 1,199


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 6 guests