Jump to content
  • Advertisement
Sign in to follow this  
Nate Hale

Sprite sheets and speed (SDL)

This topic is 3415 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

I did some searching and couldn't find the answer to this specifically. So here I go. I'm rewriting an old graphics engine I made a while back and in the interest of organization, I'm using a master sprite sheet for every level of the game I'm planning. Once a level is completed, it will load a new bitmap image containing all the enemies in the next level. My question is is this approach (having one huge sprite sheet) any better or worse from many smaller ones. The total surface area is the same and regardless of whether I break down the large sprite sheet into several, I'm going to make the same number of calls to the SDL surfaces in the end (blitting). It might seem obvious that having a huge chunk of memory dedicated to that surface information might slow down access time to the data, but having multiple sprite sheets could just as easily have the same drawback because they may not appear contiguous in memory. So which is quicker and more efficient? Is it recommended to have one large SDL surface or many smaller ones?

Share this post


Link to post
Share on other sites
Advertisement
The main advantage to having a big sprite sheet is that you don't have to take as much time to convert to the native pixel format when using OpenGL to do your graphics plotting for you. Using OpenGL under SDL and optionally a wrapper such as hxRender will take much better advantage of your computer's GPU thus relieving some of the load on the CPU.

In short, it will make your game easier to update in the future if you use sprite sheets rather than a bunch of surfaces.

Share this post


Link to post
Share on other sites
I had a feeling there might be functionality better suited to one large sheet rather than many smaller ones. That's good news, it means my graphics code doesn't need to be so long!

Thanks, samuraicrow!

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!