Game Development Reference
In-Depth Information
Droid (2.1.1):
01-02 21:03:59.643: DEBUG/FPSCounter(1676): fps: 61
01-02 21:04:00.659: DEBUG/FPSCounter(1676): fps: 59
01-02 21:04:01.659: DEBUG/FPSCounter(1676): fps: 60
01-02 21:04:02.666: DEBUG/FPSCounter(1676): fps: 60
Nexus One (2.2.1):
01-02 20:54:05.263: DEBUG/FPSCounter(1393): fps: 61
01-02 20:54:06.273: DEBUG/FPSCounter(1393): fps: 61
01-02 20:54:07.273: DEBUG/FPSCounter(1393): fps: 60
01-02 20:54:08.283: DEBUG/FPSCounter(1393): fps: 61
Sixty frames per second out of the box is pretty good. The Hero struggles a little, of course, due
to its less-than-stellar CPU. We could use the SpatialHashGrid to speed up the simulation of our
world a little. We'll leave that as an exercise for you, dear reader. There's no real necessity for
doing so, though, as the Hero will always be fraught with problems (as will any other 1.5 device,
for that matter). What's worse are the occasional hiccups on the Hero due to garbage collection.
We know the reason (a bug in direct ByteBuffer ), but we can't really do anything about it.
Thankfully, Android version 1.5 is not that common out in the wild anymore. For maximum
compatibility, we should still consider it.
We took the preceding measurements with sound disabled in the main menu. Let's try it again
with audio playback turned on:
Hero (1.5):
01-02 21:01:22.437: DEBUG/FPSCounter(8251): fps: 43
01-02 21:01:23.457: DEBUG/FPSCounter(8251): fps: 48
01-02 21:01:24.467: DEBUG/FPSCounter(8251): fps: 49
01-02 21:01:25.487: DEBUG/FPSCounter(8251): fps: 49
Droid (2.1.1):
01-02 21:10:49.979: DEBUG/FPSCounter(1676): fps: 54
01-02 21:10:50.979: DEBUG/FPSCounter(1676): fps: 56
01-02 21:10:51.987: DEBUG/FPSCounter(1676): fps: 54
01-02 21:10:52.987: DEBUG/FPSCounter(1676): fps: 56
Nexus One (2.2.1):
01-02 21:06:06.144: DEBUG/FPSCounter(1470): fps: 61
01-02 21:06:07.153: DEBUG/FPSCounter(1470): fps: 61
01-02 21:06:08.173: DEBUG/FPSCounter(1470): fps: 62
01-02 21:06:09.183: DEBUG/FPSCounter(1470): fps: 61
Ouch. The Hero has significantly lower performance when we play back our background music.
The audio also takes its toll on the Droid. The Nexus One isn't bothered, though. What can we
do about it for the Hero and Droid? Nothing, really. The big culprit is not so much the sound
effects but the background music. Streaming and decoding an MP3 or OGG file takes away
CPU cycles from our game; that's just how the world works. Just remember to factor that into
your performance measurements.
Search WWH ::




Custom Search