Game Development Reference
In-Depth Information
Figure 2.5 Individual sprites (a), and those sprites packed in a sprite sheet (b).
A popular tool for creating sprite sheets is TexturePacker
( www.texturepacker.com ) , which is natively supported by many 2D libraries,
including cocos2d. The Pro version of TexturePacker features some additional
space-saving techniques, including rotating sprites to pack them together more
tightly, and dithering, which can reduce the amount of color information a file
needs to store.
Another advantage of using a sprite sheet is that most graphics processors must
have a texture loaded into their own memory in order for it to be drawn. If you
are switching between several individual texture files frequently when rendering a
frame, this can result in a noticeable performance loss, especially if they are larger
sprites. By having all of the sprites in one large texture, it is possible to eliminate
this cost of switching.
Depending on how many sprites a game has, and the size of those sprites, it may
not always be possible to fit all the sprites within one sprite sheet. Most hardware
has a maximum texture size; for instance, current-generation iOS devices can't
have textures larger than 2048×2048. So if an iOS game has more sprites than can
be fit into a 2048×2048 sprite sheet, it will need to have multiple sprite sheets.
Search WWH ::




Custom Search