Book Image

iOS Game Programming Cookbook

Book Image

iOS Game Programming Cookbook

Overview of this book

Table of Contents (19 chapters)
iOS Game Programming Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a texture atlas


The texture atlas is a way of combining all the app assets (that is, images) into one or more larger images to improve the performance of the app so that the app can draw multiple images in a single draw call of the scene that is rendered. For example, if we have more than one image file to be loaded in the sprite, SpriteKit will perform one drawing call for each sprite. However, if we combine all the required images in one image file, then SpriteKit can render all the sprites in one draw call that uses very less memory to do so. It is recommended to create an atlas of all the required images for any game project.

Xcode has the capability of building texture atlases for your collection of images to make it a larger image, thereby improving the performance. While creating texture atlases, there should be a balance of too many or very few textures, so that the memory load doesn't increase.

Getting ready

To create a texture atlas, we should be aware of what sprites and...