Game Development Reference
In-Depth Information
In a Kobold2D application, you can modify these and other settings in the con-
fig.lua file. Look for these two lines:
DisplayFPS = YES,
MaxFrameRate = 60,
Display Stats
The setDisplayStats method enables the numbers you see in the lower left-
hand corner of the screen. See Figure 2-3 for an example. The numbers are stacked in
three lines. From top to bottom, the first line indicates the number of draw calls. You
want to keep this number as low as possible because a draw call is an expensive opera-
tion (more on this later). The second line is the time it took to update the frame. It tells
you how much headroom you have before the framerate starts dropping. And the
bottom-most number is the current framerate.
Caution Except for the number of draw calls, you have to entirely disregard
the frame time and framerate numbers when running your app on the iOS Sim-
ulator. The Simulator performance has simply no significance, as it may be
faster or slower by factors than an actual iOS device. It's like trying to measure
the performance of a sports car while driving it through a cornfield. It sort of
works, it may even be fun, but you still don't know what its street performance
will be. Yet that's the only thing that matters.
If you need to tweak the responsiveness of the FPS display, you can do so by modify-
ing the CC_DIRECTOR_STATS_INTERVAL line in ccConfig.h . By default it's
set to 0.1, which means the framerate display will be updated ten times per second. If
you increase the value, the frames per second (FPS) display will average out over a
longer period of time. However, you won't be able to see any sudden, short drops in
framerate, which can still be noticeable.
Animation Interval
The animation interval determines how often cocos2d updates the screen. Effectively,
this affects the maximum framerate your game can achieve. The animation interval is
not given in frames per second, though. It's the inverse because it determines how fre-
Search Nedrilad ::




Custom Search