Games fall into different categories. Each category has certain characteristics, which affect how well a specific game will work on the Pocket PC. In the following section, we analyze different categories and their characteristics. Some games may fall into more than one category.

Card Games

Card games fit well on the Pocket PC. The user usually already knows the rules or can easily learn them, which allows him or her to start playing immediately after installing the game. Card games are usually turn-based, which allows creating multiplayer games where the device is passed around. The game will wait for the user to take a turn so user interaction doesn't compete with heavy ActionScript running at the same time. Figure 7.1 shows an example of a well-known card game.

Figure 7.1. Blackjack in Flash for the Pocket PC.


The fairly simple rules of most card games also make creating computer players rather straightforward. The number of choices per turn is generally limited. Different levels of "computer smarts" can be developed by having the program keep track and thus predict the moves of the human player similar to what you do when playing yourself. Based on this, you can even develop different types of strategies for a set of computer opponents.

Thinking and Strategy Games

Thinking games, such as puzzles, work well on the Pocket PC and other such devices. The user is given a fair enough amount of time if not unlimited to consider and make his or her next move.

The user and the game developer both benefit from this situation. The user doesn't lose a game if he or she gets distracted while playing. And because there are defined breaking points between when the user can interact and when the game is calculating, writing the code is not as time critical as if those events had to happen at the same time.

Yet you have to be careful to not have the game look frozen after a player makes a move. The first step in achieving this is to give the user an immediate feedback. For example, changing the button he just clicked to a visually different selected state. Because Flash updates the screen only once per frame, the user won't see that instantly if you continue making calculations based on his input. Instead, you have to wait until the next frame to do so.

If the calculations you need to do take up a lot of time, you can display an animation of some sort. However for the timeline of the animation to move, your calculations have to be split over frames as well. Depending on the type of calculation you attempt to do, you may take different approaches to this. If you have to process a sequence of 10 function calls, you might place each call in one frame. If you are running an extensive loop, you might measure the time when you started the loop, and at its next iteration, you check if you have time left to run it again. If you don't, you wait until the next frame. That gives the animation a chance to update itself on the screen. Figure 7.2 shows an example of a tic-tac-toe-like game called FourSight.

Figure 7.2. A Flash 3-D tic-tac-toe variant called FourSight for the Pocket PC.


Action and Reflex Games

On the desktop, more and more action games get developed in Flash. It is often hard to believe what can be done with Flash from arcade-style games to 3D. Unfortunately these games often don't translate well to the Pocket PC. Even on modern desktop systems, Flash action games, especially those running at high frame rates, consume a lot of processor power. On the Pocket PC this becomes even more evident, making it difficult to create games that run smoothly and that allow the user a fair chance to react to game events.

Action games often have a lot of movement on the screen. Sometimes the entire background moves. The more Flash has to redraw per frame, the more processor power is used.

In the same way, the more complex a game becomes, the more code has to be executed per frame. Although ActionScript is very powerful, it does not get executed directly on a system level. This does not affect most Flash applications, but when you try to port an action game to the Pocket PC, you will quickly run into the limitations of CPU power.

This does not mean it is impossible to create an action game for the Pocket PC. You just have to be aware of the limitations from the beginning the basic rule being to reduce the number of calculations and graphical movement. Transparency effects and radial gradients also eat up a lot of processor power plain graphics often work better on the Pocket PC.

Macromedia Flash Enabled. Flash Design and Development for Devices
Macromedia Flash Enabled. Flash Design and Development for Devices
ISBN: 735711771
Year: 2002
Pages: 178 © 2008-2017.
If you may any questions please contact us: