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:
-
From the Scheme menu, select your device, so that the application will be installed to the device when you build.
-
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).
-
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.
-
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.
-
Take note of the name of the functions that are at the top of ...
Get iOS Swift Game Development Cookbook, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.