Skip to main content
Inspiring
April 26, 2012
Question

Bitmap Sheets - tiled or single row - which is better?

  • April 26, 2012
  • 1 reply
  • 1403 views

For alot of my animated sprites, I wrote a little program to read in all the bitmap data, crop the images and output a single sprite sheet of all the bitmaps, plus the "array" data needed to find and copy out the specified frame.

This has proven to save both memory and preformance when dealing with large numbers of frames

However, when I look at several example of how other people do sprites sheets, their final sheet is always tiled

So if I have an animated sequence of 60 frames, (assuming that each source bitmap is, 50x100 and there is no cropping to be done) I would end up with something like this:

Bitmap: Size = 3000x100;
TopLeftCornerArray = [[0,0],[50,0],[100,0]...[2950,100]];

Is there any difference between doing that, instead of creating a sheet bitmap, that was say 10 frames per row over 6 rows giving me a bitmap that was 500,600?

I mean, both bitmaps are made up of 300,000 pixels regardless...

I was just wondering if there was a good reason for not putting them all on a single line.

This topic has been closed for replies.

1 reply

sinious
Legend
April 26, 2012

Memory is memory. As long as you don't use too much the copying of the pixels happens IN memory so there's no speed difference between them.

BTW why'd you write your own app when you can get:

http://www.texturepacker.com/

It creates the sprite sheet and the necessary data to extract each piece. The great thing about texture packer is it isn't afraid to cram things together in a very complex way to make your sheet as condensed as possible. That'll help you avoid the bitmap resolution limits.

Inspiring
April 26, 2012

Short version of why I wrote my own is because it gave me the flexibility to code a bunch of other neet extras into it... like automatically updating and writing the source code for arrays in my various projects. It also allowed me to manage the images to specific tasks, like filtering of specfic frames, animations, and opening the xml file inside the fla to automatically set image quality and a bunhc of stuff like that.

Writing it was a nothing job.

But I just wasn't sure if a "square" sheet was better than a long rectangular one.

My thinking was the same as yours "memory is memory" - but as I have discovered often with adobe products, not everything works as advertised and you have to jump through a ton of hoops to get things to work the way they are supposed to.

sinious
Legend
April 26, 2012

Tell me about it. AS3 made it a lot better but mobile dev is laden with pitfalls galore. Don't even get me started on ANEs....

I was just showing you texturepacker because I didn't know if you were utilizing space the same way or just gridding it.

Ultimately memory is memory.