Game Development Reference
In-Depth Information
applications created for iOS. This is because, as mentioned in online
chapter Introduction to Mobile Development, all of the ActionScript
code inside an iOS application is precompiled rather than inter-
preted at runtime. Because there is, in fact, no runtime interpreter
or compiler, any code loaded in from an external SWF is ignored.
This means larger games that work on the Web in multiple pieces
will need to be rearchitected to work as a single file. Let me be clear
though; this does not preclude loading individual assets such as
sounds, images, or text data from external sources; this still works
fine and in the same manner as the standard Flash Player. It simply
means that any and all classes that need to be available to a game
must be compiled up front into the single SWF.
The GPU Is Here to Help
Now that we
development, let
s look at one huge improvement Adobe has made
to the display list to increase performance. When running on the
device, all DisplayObjects now have a new property called cacheAs-
BitmapMatrix . It is meant to work in conjunction with the cacheAs-
Bitmap option that has been available since Flash 8. The matrix of
a DisplayObject is a single-object representation of all the visual
transformations that are being applied to it, such as translation ( x
and y coordinates), rotation, and scaling. You can learn more
about the matrix property of DisplayObjects in Adobe
s ActionScript
reference. By assigning a matrix object to the cacheAsBitmapMatrix
property of a DisplayObject, Flash will use this information to store
a bitmap version of the object on the device
essence, this is how OpenGL works in the traditional iOS develop-
ment workflow using XCode and Objective-C. This means that all
of the energy spent compositing that DisplayObject into the scene
and rendering it is offloaded from the CPU to the GPU, freeing up
memory and horsepower to be used on other things such as code
The most advantageous new behavior is that unlike just using
cacheAsBitmap ,thecachedimagedataisnotlimitedtojust x and
y translations. You can rotate, scale, and skew any object with this
matrix, and Flash will simply tell the GPU to perform those trans-
formations. This feature is specifically for use with objects you only
intend to work with in 2D space. For the 3D transformations that
we looked at in Chapter 7, Flash will automatically perform this
GPU caching if it is enabled in the Publish Settings. This feature is
especially important for game development, where it is often
necessary to have several objects on screen at once, many of them
in motion. The initial comparison simulations Adobe released
showed huge performance gains by using this new feature, and it
Search Nedrilad ::

Custom Search