[Performance] Magenta background as transparent

Discussion and feedback on Construct 2

Post » Wed Apr 09, 2014 5:44 am

I'm just wondering, I've seen old sprites from classic games, they used Magenta as registered color to make transparent background in runtime, do sprites with magenta background as transparent improve the performance and reduce memory usage?
B
98
S
35
G
29
Posts: 3,139
Reputation: 28,396

Post » Wed Apr 09, 2014 12:44 pm

As far as I know, classic games on classic consoles were a combination of different pixel with color related to the palette, so it wasn t "magenta as background" in the end, however, magenta I think is a color that is rarely used directly, and I think some program cannot use direct transparency (bitmap with no transparancy only allowed by default, png with no transparency is fine too for them too sometimes), so it is more conventionnal to use this least used color as transparency, maybe it is also easier to extract sprite with this color too
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Wed Apr 09, 2014 2:52 pm

Old systems did not support alpha channels in images, so they would make a special color (often magenta) that would not render, so would appear transparent. These days it is completely redundant, because PNG has full alpha channel support so the image itself can contain varying levels of transparency.
Scirra Founder
B
395
S
233
G
88
Posts: 24,376
Reputation: 193,842

Post » Thu Apr 10, 2014 2:05 am

@Aphrodite Thanks for the info, but I'm interesed to know about the performance and memory usage for using color manipulation.

@Ashley I already know that why you didn't answer my question about performance and memory usage. Can you?

Not only for transperency, this method is used to make house colors. (RTS games have team color like red, blue, etc. more like team color)

Image
B
98
S
35
G
29
Posts: 3,139
Reputation: 28,396

Post » Thu Apr 10, 2014 11:27 am

I don't think it has any important effect on performance or memory use.
Scirra Founder
B
395
S
233
G
88
Posts: 24,376
Reputation: 193,842

Post » Fri Apr 11, 2014 1:44 am

@Ashley Hmmm... It makes me to think about PNG files without big transparency background would not cause performance drop.
B
98
S
35
G
29
Posts: 3,139
Reputation: 28,396

Post » Fri Apr 11, 2014 1:53 am

Joannesalfa wrote:@Ashley Hmmm... It makes me to think about PNG files without big transparency background would not cause performance drop.


Then don't use PNGs with large areas of transparency. You wouldn't do that if you were keying out any color (there's no reason it has to be magenta), either.

As @Ashley said, it's not a performance issue. Technology has come a long way since there was any real need to key out a specific color for transparency. Your phone is probably 10000x as fast as the computers that were around when that was a thing.
B
77
S
43
G
24
Posts: 525
Reputation: 20,580

Post » Fri Apr 11, 2014 12:49 pm

All images are decompressed in to memory as 32-bit ARGB and the alpha channel is always processed regardless of whether it's fully opaque or fully transparent. Alpha has no effect on performance.
Scirra Founder
B
395
S
233
G
88
Posts: 24,376
Reputation: 193,842

Post » Fri Apr 11, 2014 1:13 pm

Disclaimer:I'm not sure I know enough about this subject to express myself so maybe I am wrong this time.

First of all, the problem with big backgrounds is that they take memory, even with transparency, reason?
>a stored picture is a group of informations about color (and alpha too), by using such an image you are telling the memory to store it entirely, even the informations that says "there are nothing here", I am not sure if all material will act like that in that case, some may filter first.

And then there is the concept of drawing, I'm pretty confident that the graphical rendering part of actual devices is set to skip drawing an alpha of 0 the same way other devices did with a referenced color.

I think the only difference is that rather than choose yourself one color (like for exemple Worms Armageddon, plain Black was transparent at rendering), here the color is already choose (everything that has 0 opacity color wise)

Then there is also the fact that a sprite set to a transparency of 0 will still be drawn at screen some will say, but I think this is for other reasons

As I said I could be wrong.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Fri Apr 11, 2014 2:15 pm

Joannesalfa wrote:@Aphrodite Thanks for the info, but I'm interesed to know about the performance and memory usage for using color manipulation.

Are you not asking about it for old technique clarification and more for changing colors on sprites with the Replace Color effect you can add to an object?
With the SC Sprites you can do the same with Replace Color in C2, but I've always wondered what kind of performance hit would take to do that.
B
21
S
8
G
6
Posts: 346
Reputation: 4,891

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 10 guests