O'Reilly logo

iOS Swift Game Development Cookbook, 3rd Edition by Paris Buttfield-Addison, Jonathon Manning

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 11. Performance and Debugging

At some point during its development, every game will have performance issues, and every game will crash. Fortunately, iOS has some of the best tools around for squeezing as much performance as possible out of your games and finding bugs and other issues.

In this chapter, you’ll learn about how to use these tools, how to fix problems, and how to get information about how your game’s behaving.

11.1 Improving Your Frame Rate

Problem

You need to coax a better frame rate out of your game so that it plays smoothly.

Solution

To improve your frame rate, you first need to determine where the majority of the work is being done. In Xcode:

  1. From the Scheme menu, select your device, so that the application will be installed to the device when you build.

  2. Open the Product menu and choose Profile (or press Command-I).

    The application will build and install onto the device, and Instruments will open and show the template picker (see Figure 11-1).

  3. Select the Time Profiler instrument, and click Choose. You’ll see the main Instruments interface (Figure 11-2). Click the Run button, and the app will launch, and you’ll start seeing information about how much CPU time your game is taking up.

  4. Click the Call Tree button at the bottom of the screen, and turn on Invert Call Tree, Hide Missing Symbols, and Hide System Libraries, and turn off everything else in the list, as shown in Figure 11-3.

  5. Take note of the name of the functions that are at the top of ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required