Game Development Reference
In-Depth Information
have about one-tenth the processing power of the average desktop
computer. Memory is also limited and must be utilized carefully.
Fear not, however; in this chapter, we
ll examine how best to work
within these limitations and how some of these practices will help
enforce more disciplined programming when you switch back to
desktop applications. We
'
ll start by looking at features of Flash you
should use sparingly or just avoid altogether when creating games
for iOS, as well as those APIs that simply do not exist on that plat-
form. Notice that I said
'
some of these features might
make sense in a non-performance-driven productivity application,
but that
games
”—
re covering in this topic. Also remember
that few of these rules are hard and fast
'
s not what we
'
re all just factors to
consider and weigh when making game design decisions. After cov-
ering the
they
'
ll look at some general
guidelines and techniques to follow while coding, which will help
get the absolute best performance out of your iOS device. Adobe
has done a great job of making sure almost all of the features of
the Flash Player are available in iOS applications produced by
Flash CS5. However, despite this, there are some features that are
left untouched, particularly for game development. This is mainly
due to the fact that many of the APIs in Flash are memory and
CPU intensive, at least by mobile standards. In this section, we
gray
functionality areas, we
'
'
ll
cover what you should avoid while developing games.
Filters (and PixelBender)
Ever since they were added in Flash Player 8, the various real-time
filter effects such as blurs, glows, and drop shadows have saved a
lot of time for designers and developers on faking or pre-applying
these effects to images in external applications such as Photoshop.
To a less common extent, features such as the DisplacementMap
and Convolution filters allowed for distortion effects completely
controllable by code. Filters are a great feature of Flash and very
easy to implement. However, they are also very costly in terms of
system resources. In a desktop application on a computer, this cost
is pretty minimal in the grand scheme of all the other running pro-
cesses, particularly on computers that have advanced video cards.
On iOS, it is another story. Processing these filters and keeping
them updated in real time is very taxing rendering and brings per-
formance down very quickly with only a couple of filters running at
a time. Adobe has even recommended against their use for any
type of application in which performance is vital.
This is not to say that a savvy developer couldn
t still make use
of a filter or two when judiciously applied. The most important fac-
tor to consider is when you apply the filter. One way to use a filter
is on Bitmap objects, or more specifically, on the BitmapData
inside them. If you were using Bitmaps for objects within a game,
'
Search Nedrilad ::




Custom Search