Sprite sizes

For questions about using Classic.

Post » Mon Dec 20, 2010 8:45 am

Should all sprites be trimmed to their smallest possible size -- removing any border of transparent pixels?

I ask because I make the main sprites (i.e. player ship) and all the addional sprites (i.e. flames for boost, shield images, etc) on one sprite sheet like so:


That way when I reassemble them in construct using image points they all line up perfectly.

But that also means that the center "ship" image has a bunch of empty space all around it. Should I be trimming each of these individually, then fiddling with them in construct to make it all line up?

Another way of looking at it is: Does construct use up resources storing and moving all those transparent pixels? Enough so that it's better practice to cut out the excess?

I know the physics behavior takes them all into account unless you make a custom collision mask.

These sprites were made at 400x400, but in game they'll probably end up closer to 100x100. Once they're that small, am I just splitting hairs worrying about transparent pixel trimming?
B
4
S
1
G
2
Posts: 64
Reputation: 980

Post » Mon Dec 20, 2010 9:04 am

You don't have to, but yes editing the images to the least amount of empty space is a good idea.
Saves memory, and you can use bounding box collisions when needed.
Making them in power of two dimensions is even better.
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Mon Dec 20, 2010 12:06 pm

[quote="newt":380oepev]You don't have to, but yes editing the images to the least amount of empty space is a good idea.
Saves memory, and you can use bounding box collisions when needed.
Making them in power of two dimensions is even better.[/quote:380oepev]

Got it. I'll look into making all this stuff 128x128 or 256x256.

Thanks again Newt!
B
4
S
1
G
2
Posts: 64
Reputation: 980

Post » Mon Dec 20, 2010 5:04 pm

Make it a habit to always make sprites fit into a power of two size texture. A sprite that is 65x65 is pointless, since it will use up the memory of a 128x128 one. Either make it 64x64, or just make it 128x128. This is why large sprites aren't recommended, because the memory usage increases exponentially. A 128x128 sprite uses 4 times more vram than a 64x64 one. So trimming to the smallest possible size only matters if you trim to the smallest possible power of two size. Going from from 100x100 to 70x70 makes no difference. Also, make note that the texture size/memory usage is the size you put into the picture editor. The size in the layout editor just scales that texture, and uses the same amount of memory.
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Post » Mon Dec 20, 2010 7:33 pm

Additionly I want to stress that you are not bound to square sizes. Any power-of-two size on width or height will suffice. Only the oldest graphics cards (generation one and maybe two) don't handle uneven sizes. All cards of the last 6 to 8 years will. So, if you have an original size of 129x257, then you don't need to convert it to something like 128x128 or 256x256. Instead it's safe to make it a 128x256 one. (And if your game will be played on a very old card by accident ;) , it will use more VRAM but won't refuse to work, if there is enough.)

Look at those threads for more info about that subject:

[url:2548ntof]http://www.scirra.com/forum/viewtopic.php?f=8&t=7786&p=60406#p60406[/url:2548ntof]
look at the example cap in that post

[url:2548ntof]http://www.scirra.com/forum/viewtopic.php?f=3&t=7578&p=58897#p58897[/url:2548ntof]
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Mon Dec 20, 2010 8:01 pm

There are times when your going to want to use a little extra space in the alpha channel.
For instance many fx are only applied to the bounding box, and if you have pixels all the way to the border, it can make it look cut off. Also its useful for using against a collision box, to make it look like the image is hovering, etc.
But as the previous posts suggest, you should keep p^2 in mind.
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Mon Dec 20, 2010 11:25 pm

I'll keep everything 128x128 for now -- and see where that gets me. I have a feeling that v-ram won't be the bottleneck for this project. (famous last words)

It does help in planning to note that a 70x70 uses the same memory as a 100x100. Never knew that.
B
4
S
1
G
2
Posts: 64
Reputation: 980


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 6 guests