Lightweight graphics in construct

For questions about using Classic.

Post » Thu Mar 05, 2009 1:24 pm

so today I decided to test, if it's worth a while to prepare your graphics before importing them to construct. i had a 40 frame explosion in 480x480 avi (with alpha channel), so I decided to cut it to PNG frames and imported this animation to blank directx game. exported to exe, and bang, 4,67 MB (fair enough, uncompressed avi is 25MB). But, as the explosion was supposed to have a additive filter, I came up with an idea. as additive mode treats everything black as transparent, whi do I need alpha channel, also because the explosion is mostly white-red, I reduced the number of colors to 256 and reexported every frame of the animation to GIF files without transparency (with black matte). After importing the animation to a new blank game and exporting it to exe, file was 4,27 MB, which is a little less compared to the PNG app. I tried to further compress the exe with winrar and the PNG app after compression is 3,72 MB and the GIF one is 2,39 MB. That's not all, the 40 PNG files I imported weigh 2,84 MB (only gifs) and GIFs - 752 KB (yes, KB!). That's the short history of my GIF explosion... can someone explain what just happened? why 752kb grows up to 4,27 MB (minus the blank directx game code and a sprite object code - which is 809 KB - when saved a blank game with a blank sprite to exe). maybe (as construct is beginning it's journey to 1.0 and the big plan is to stabilize it from 0.90) you (scirra - hi guys! ;) should think of a better graphics compression in the runtime? some time ago I was suggesting a jpeg compression (it would really make things smaller - it's the only situation we want that to happen I suppose). thanks for your attention ang have a great day. construct4life! ;)
B
81
S
50
G
10
Posts: 555
Reputation: 13,009

Post » Thu Mar 05, 2009 3:22 pm

Construct doesn't care what format you import your graphics as. It saves them as 32 bit PNG with alpha channel. You won't get a smaller filesize by compressing beforehand unless you make it more compressable by PNG (for example, by reducing colour depth).

JPEG has no alpha channels so is not a particularly useful format for most games.

40 frames of 480x480 textures will use about 41mb of VRAM. Due to other overheads, this might be too high even for 64mb cards. So now due to one single explosion sprite your game requires a graphics card with 128mb VRAM. That's not the way to do it: DirectX games are rarely based around imported video, even 3D commercial titles are more economical with memory than this. Compose your explosions out of a number of smaller, single frame sprites, dynamically stretch and resize them, and throw in a few particle effects. The system requirements will drop massively, it will look smoother, will look better with timescaling, and hey, it might even look better!
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Thu Mar 05, 2009 4:40 pm

[quote="Ashley":2483lxck]
JPEG has no alpha channels so is not a particularly useful format for most games.
[/quote:2483lxck]

While for most purposes you're right, but what about, for example, an adventure game with lots of backgrounds? If compressed correctly, jpgs can look free of compression artifacts and still be smaller than png. For a game with lots and lots of graphics that don't need alpha channels, I think jpg would be quite useful to make the game smaller.
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Thu Mar 05, 2009 5:02 pm

You could load JPEGs from external files.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Thu Mar 05, 2009 5:52 pm

and what if you could compress sprites using jpeg compression? it would consume less vram (my explosion would weigh about 100KB then - no vram problem) and with additive blending effect there is no need for alpha channel. i think some (a lot maybe) users would find this useful, and with proper use would make games much smaller in size. please please pretty please :)
B
81
S
50
G
10
Posts: 555
Reputation: 13,009

Post » Thu Mar 05, 2009 6:02 pm

It wouldn't use less VRAM, images are decompressed when they're transferred to VRAM.
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Thu Mar 05, 2009 6:11 pm

touche...
I will shut my mouth now...
B
81
S
50
G
10
Posts: 555
Reputation: 13,009

Post » Thu Mar 05, 2009 6:13 pm

[quote="Ashley":1gilnp00]You could load JPEGs from external files.[/quote:1gilnp00]

But couldn't people edit them then? Or is it possible to store jpgs as resources?
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Thu Mar 05, 2009 6:18 pm

People can edit resources anyway, it's something which game developers have to accept when distributing games. It's up to the end user if they want to change a game, either graphics or sound, their loss of the artwork if so!
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Thu Mar 05, 2009 7:11 pm

wait, are jpegs loaded from external files to sprite frames also decompressed and sent to the graphic card? if so, I have four backgrounds in external jpegs about 2048x2048 loaded to tiled background object, do I have a problem?
B
81
S
50
G
10
Posts: 555
Reputation: 13,009

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 7 guests