Game Development Reference
In-Depth Information
Table 6-3. Results of the full-screen blit test
Number of Sprites
Average Frame Rate
100
126 FPS
500
24 FPS
1,000
93 FPS
5,000
22 FPS
10,000
12 FPS
15,000
8 FPS
Making sense of these results
In our games, we should try to attempt to keep a constant frame rate of at least 30 frames a
second. As you can see, with the timeline-based method, we can achieve a very nice frame
rate with 100 objects, but as we progress toward 500 objects, the frame rate drops
significantly. Both the individual sprite and full-screen blit methods offer a significant
performance boost even with 1,000 objects on the screen. We have to add 5,000 objects to the
screen in the full-screen blit method to lower our frame rate to the same rate the timeline-based
method drops to at only 500 objects.
What does this mean? It means that we can squeeze high performance from the Flash Player if
we need to. Not all games are going to need this performance boost, but throughout this topic
we will use the blitting and tile sheet methods to show how then can be used in almost any
game. With the advent of new handheld and mobile devices that can make use of Flash Player
games, we will see the need to squeeze performance from the Flash Player become more and
more important.
If you are interested in trying the render speed tests with the latest Flash Player, the code and
necessary files are included in the Chapter 6 topic files on the download site. Flash 10 Player has
added some significant improvement across the board for all three rendering techniques.
The TileSheet class
The TileSheet class is the core of our blitting operations. It contains a reference to the Library
item tile sheet and contains the necessary information for other display objects to use it for blitting
operations. This class will be part of the overall game framework package. We will use this class
in a few more games in this topic.
Create the TileSheet.as file in the framework package structure we created in Chapter 2:
/source/classes/com/efg/framework/TileSheet.as
Search WWH ::




Custom Search