Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Sprite images and performance


GameDemon
 Share

Recommended Posts

Hello, I'm exporting my assets from Adobe Illustrator as PNGs. To make positioning/registration simpler I am currently exporting via an artboard rather than clipped, meaning there's a fair amount of empty transparent area around the sprite each time, but with the benefit of being able to position at (0,0) every time.

 

I'm moving these sprites around via tweens and doing some scaling. There's only a few sprites being handled in this manner, but will this have a significant impact on performance?

 

Kind regards

Link to comment
Share on other sites

Are you using an http://phaser.io/examples/v2/loader/load-texture-atlas)'>atlas? What are the image sizes in dimensions? The filesize wouldn't really be an issue but, users will have high loading times ofcourse.  

 

I tween a large spritesheet for my maps and it uses around 100 + keys in the atlas. (basically like individual css sprite images), and the filesize is around 300kb and there is absolutely no lag. The lag from the gif is from the shitty software that records it :P

 

 

But I do believe once you reach maybe in the quad digit numbers of sprites, it will start lagging.  I am positive there are canvas benchmarks out there already as well ~

 

I think you'll be fine. I'd use tinypng.org to help with filesizes as well.  

Link to comment
Share on other sites

Thanks Wombat, I'm not using an atlas yet, although I'll look into that when I get nearer to release. Currently i have about 3 separate transparent PNGs each the size of the stage stacked ontop of each other, one for head, body, legs, and then I'm moving them around individually. Their filesizes are small (~6kb) but I wondered if all that empty transparent area is best avoided.

 

But it's good to know that large spritesheets works so well. :)

 

PS that's not a wombat, that's a Quokka :P 

Link to comment
Share on other sites

Thanks Wombat, I'm not using an atlas yet, although I'll look into that when I get nearer to release. Currently i have about 3 separate transparent PNGs each the size of the stage stacked ontop of each other, one for head, body, legs, and then I'm moving them around individually. Their filesizes are small (~6kb) but I wondered if all that empty transparent area is best avoided.

 

But it's good to know that large spritesheets works so well. :)

 

PS that's not a wombat, that's a Quokka :P

 

Ha, Yeah I'm going to change my name soon.

 

 

I would get rid of the extra whitespace though. That extra space does play a role (minimally, but it does) what are your image dimensions though?  6kb is nothing and you will be more than fine.  How many sections do u plan on using in your game from the image? 3?

Link to comment
Share on other sites

The extra whitespace will result in more memory taken up (understandably, since the dimensions of your image would be higher). If you have a lot of semi-transparent (0 < alpha < 1) things going on, it might heavily affect computation as the renderer will need to blend pixels across several different sprites ( assuming default blend mode). If they are strictly transparent, I don't think they matter much. 

 

One thing to note is that the way a lot of atlas packers handle it is to strip out the white space, but save the offsets in numeric form. Thus, a 64x64 image within a 128 x 128 container would simply be reduced to just the 64x64 image with bounds= { left:  32, top: = 32, width: 64, height : 64 } or something like that. Thus, there will be negligible memory overhead (maybe from storing int32s, but that's really really really small)

Link to comment
Share on other sites

My stage and images are at 1024x768 so that my game can be played on tablet fullscreen. My artwork is all basic vectors hence the 6kb, very little semi-transparency too. It will be great if atlas packers can strip out the whitespace and handle the offsetting, I will check to see if that is happening when I use one. Thanks a lot for the info guys

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...