• Advertisement
Sign in to follow this  

What is better? (On sprites)

This topic is 4365 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Which is better? To have a 100 sprites of 32 * 32 pixels with each as it's own file, or to have a sprite-sheet that is 3200 * 3200? Sure it takes more work to split up the sprite-sheet and put each in it's own container(probably an array segment), but is it better memory wise, or quicker at loading? Thanks, ~S of the L~

Share this post


Link to post
Share on other sites
Advertisement
You should try to optimize the sprite sheets for texture loading. If the target graphics card supports 1024 x 1024 textures, split up your sprites into 3 sheets, if the card only supports 512 x 512, split up into more sheets, etc. That way you minimize the overhead of constantly switching textures.

Or, you could just keep the sprites in separate files and when your game loads, generate those huge sheets on the fly so that way you have both performance and easy storage. I hope I'm not missing the point of your question.

Share this post


Link to post
Share on other sites
Quote:
Original post by deathkrush
You should try to optimize the sprite sheets for texture loading. If the target graphics card supports 1024 x 1024 textures, split up your sprites into 3 sheets, if the card only supports 512 x 512, split up into more sheets, etc. That way you minimize the overhead of constantly switching textures.

Or, you could just keep the sprites in separate files and when your game loads, generate those huge sheets on the fly so that way you have both performance and easy storage.


The size doesn't really matter and I prefer them in seperate files as it is easier to work with, but is it better memory wise to have a sprite sheet? By memory wise, I mean not in the program itself, but on my computer. If I was to upload a .zip(or whatever) would a hundred small pixels be smaller than one sprite sheet or will it be larger or the same? And will it take more time for someone to download a .zip with seperate sprites or less time? (If, of course, it was more then merely 100 sprites, I'm just using 100 and 32 * 32 as an example)

Share this post


Link to post
Share on other sites
Yea, the loading will definitely be faster. It's always faster to load one big contiguous file than hundreds of small fragmented files.

Share this post


Link to post
Share on other sites
Quote:
Original post by deathkrush
Yea, the loading will definitely be faster. It's always faster to load one big contiguous file than hundreds of small fragmented files.


Okay, thanks. I'm asuming it(the sprite sheet) will take less memory too?

Share this post


Link to post
Share on other sites
The memory for your 3200x32 sprite sheet will consume a little less memory.

I don't think there would be any increase in performance with using 1 big sprite sheet as opposed to 100 little ones. (This is assumed your 100 little ones are loaded in already.

I would definately go for the large sprite sheet, 512x512 should hold 256 32x32 sprites.

You could make some sort of TileMap object where you can access your sprites as an array.

Share this post


Link to post
Share on other sites
Quote:
Original post by Servant of the Lord
Quote:
Original post by deathkrush
Yea, the loading will definitely be faster. It's always faster to load one big contiguous file than hundreds of small fragmented files.


Okay, thanks. I'm asuming it(the sprite sheet) will take less memory too?


A tiny bit, assuming you store it similarly. The major benefit comes that rendering two sprites from one sheet means you don't need to 'switch sheets'. Such an operation is generally a lot [100x] slower than 'render sprite'.

Share this post


Link to post
Share on other sites
There is this strange mix of misunderstanding.

Some people are answering as if you are using OpenGL or Direct3D (texture 2^x and expensive texture binding) and others are thinking you are using like SDL.

Telastyn says: Switch sheets is 100x slower than drawing

Not if you're using SDL, it would likely be the opposite.

Share this post


Link to post
Share on other sites
Quote:
Original post by Boder
There is this strange mix of misunderstanding.

Some people are answering as if you are using OpenGL or Direct3D (texture 2^x and expensive texture binding) and others are thinking you are using like SDL.

Telastyn says: Switch sheets is 100x slower than drawing

Not if you're using SDL, it would likely be the opposite.


In that case forget everything I just said about textures. I'll go back to my polygons now :-)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement