image import, image resize, and performance

Discussion and feedback on Construct 2

Post » Tue May 29, 2012 10:39 pm

Hi All,

I tried to find this in the forums, but no luck...

I'm trying to get a better sense of how imported images perform at runtime based on size. I'm not talking about filesize or using different image formats or compression, but strictly height X width in pixels.

Ashley has already given me a great explanation of how images are converted to PNG-32 for use in the editor, and then can be exported to PNG-32, PNG-8 or JPG for final projects. What I'm after now is a best approach to sizing (height, width) an image for import into C2.

So here are three cases where an image is imported into a new sprite object:

1) A 128x128 image is imported and used at full size in the image editor and layout
2) A 256x256 image is imported, then immediately resized in the image editor to 128x128, then placed in a layout
3) A 256x256 image is imported, then placed in a layout, then resized in its object properties to 128x128

Can anyone tell me what the runtime differences are (if any) between these cases? I'm asking because I would expect case #1 to offer a performance benefit over #2 and #3. I would also think maybe there's a performance benefit to #2 over #3. I say this because I'm thinking that the larger image is stored and used at runtime in case #3, but not necessarily in cases 1 and 2.

It would be useful to know what the differences are between the cases (and if there are specific or general performance benefits).

Basically, If I have to, I'll get all my artwork down to the smallest usable height and width before I import it into C2, but it would be nice to know whether that's required.

Thanks for any help, and as always, thanks for a great product and great user community!
B
12
S
5
G
5
Posts: 26
Reputation: 4,001

Post » Wed May 30, 2012 10:19 am

1 and 2 end up being the same, a 128x128 image. Case 3 just makes the file size bigger.

Using smaller graphics gives a negligible performance increase if any. Using bigger images just increases the download time for your game.
B
79
S
24
G
54
Posts: 4,738
Reputation: 40,739

Post » Wed May 30, 2012 12:12 pm

Optimisation - don't waste your time

Providing hardware acceleration is in use, there is no difference between any of these options. It is probably of more concern to you how the source image size affects the download size.

From Performance Tips in the manual:
[quote]Common misconceptions
...
Size, angle or opacity of sprites/tiled backgrounds and floating-point positions (e.g. positioning a sprite at X = 10.5) has no effect when hardware acceleration is in use. This may be a little surprising or counter-intuitive, but modern graphics cards can usually render a sprite at the same speed regardless of whether it is tiny or huge (fullscreen or even bigger) and regardless of its angle, opacity or position.[/quote]
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Wed May 30, 2012 2:31 pm

Thanks R0J0Hound and Ashley. Sorry to waste time on something that's already available. I swear I did actually read the performance tips section a while back. Oh well, I'll read more carefully next time.
B
12
S
5
G
5
Posts: 26
Reputation: 4,001


Return to Construct 2 General

Who is online

Users browsing this forum: Mirlas, radbrothers and 11 guests