How sprite sheets speed up your 2D and 3D games
When starting to develop a game you need a big amount of image data. For a 3D game this is the texture data that is projected onto an object’s surface – for a 2D game these are simply the objects and characters that bring your game to life.
In both cases many images are required. While it is ok at the beginning to use single images it has several disadvantages:
- Single files require much more time to load
- When drawing the sprites on the screen, the graphics processor must switch between the sprites, also consuming time
- A large number of files is hard to handle
- A large number of files consumes much more memory
With a sprite sheet these problems can be solved: The sprites are all clearly arranged in one (or several) sprite sheets. An additional data file tells the game engine where to find which sprite and how to display it. Think of it like packing many files in a zip file.
Advantages of a sprite sheet:
- Fast loading
- High compression rate
- Optimized drawing by reducing texture switching
- Simple handling of the files
You can make your sprite sheets with any graphics software – like Photoshop or even Paint or Gimp.
The problem with a graphics software is that it does not automatically layout the sprites for you. Every change you make to a single image requires an update of the sprite sheet – shoving around sprites manually and wasting time.
Graphics software also does not export a data file containing all the coordinates you need for your software to work.
So use the advantages of a specialized sprite sheet maker:
- Automatic Layout
- Coordinates file
- Optimize your textures to consume less memory and increase speed
- Tons of optimization features like
- Trimming/Cropping: Remove transparency from sprites to save memory and increase performance
- Rotation: Rotate images if they better fit into the texture and allow better packing
- Detection of duplicate images: Add identical images only once to save memory
- Directly export to special image formats like PVR, PKM and many others