Pub. Date:
Taylor & Francis
Real-World Flash Game Development: How to Follow Best Practices AND Keep Your Sanity

Real-World Flash Game Development: How to Follow Best Practices AND Keep Your Sanity

by Christopher Griffith


Current price is , Original price is $49.95. You

Temporarily Out of Stock Online

Please check back later for updated availability.

This item is available online through Marketplace sellers.

9 New & Used Starting at $1.99


This book covers Flash for the everyday developer. The average Flash developer doesn't have luxurious timelines, employers who understand the value of reusability, or the help of an information architect to design a usable experience. This book helps bridge the gap for these coders who may be used to C++, Java, or C# and want to move over to Flash. Griffith covers real-world scenarios pulled from his own experiences developing games for over 8 years in the industry.

Gifts from Griffith's REAL-WORLD experiences include: Game design templates and pre-written scripts to automate tasks within Flash; Classes for handling common math computations used in gaming, so that game developers can see how to set up a simple game flow; Powerful debugging tools for your games(debuggers for Flash games are hard to come by, and this book provides them for you).

The associated web site offers: Code from the game examples in the book with fully build-able source files. Additional code snippets, classes, and utilities. Scripts for automating tedious and repetitive tasks within Flash. Template game-design documents for planning game proposals in the same manner outlined in the book. Links to other helpful online resources for both Flash and game development.

• Teaches Flash users the most effective ways to leverage Flash as a game development tool. Concrete, relatable approaches to Flash game development.

• Provides sound strategies, and realistic goals for success - with REAL-WORLD examples and code included so that programmers become quickly empowered to make their own Flash games.

• Covers ALL the aspects that come into play when developing a game in Flash, including art, animation, scripting, and optimization.

Product Details

ISBN-13: 9780240811789
Publisher: Taylor & Francis
Publication date: 09/30/2009
Pages: 352
Product dimensions: 7.50(w) x 9.20(h) x 0.90(d)

Read an Excerpt

Real-World Flash Game Development

How to Follow Best Practices and Keep Your Sanity
By Christopher Griffith

Focal Press

Copyright © 2012 Elsevier Inc.
All right reserved.

ISBN: 978-0-240-81769-9

Chapter One



A Little Groundwork 2 Common Game Types 2 Adventure 2 Action 3 Puzzle 3 Word Games 3 Strategy and Simulation 4 Role-Playing Game (RPG) 5 Vehicle Games 5 Board/Card-Based Games 5 General Development Terms 5 Pseudocode 6 Algorithm 6 Procedural Programming 7 Object-Oriented Programming (OOP) 7 Design Patterns 7 Classes 7 Public, Protected, Private, and Internal 8 Game-Specific Development Terms 9 Artificial Intelligence (AI) 9 Game Loop (or Main Loop) 9 Game View 10 Scrolling 10 Tile-Based Games 11 Flash Development Terms 11 Stage 11 Display Objects 11 Events and Listeners 11 Packages 12 Author Time, Compile Time, and Runtime 12 You Can Wake Up Now 12

A Little Groundwork

Before we get too far into Flash, it's important to lay a foundation for game development, so we understand the terminology that will be used throughout the rest of the book. Refer back to this chapter when you forget what a term means or how it applies in a particular situation. If you start to feel a little overwhelmed by all the long words and abstract concepts, don't worry! Game development (particularly efficient, well-executed development) is complicated, and there's nothing wrong in admitting it. Remember that anyone who has programmed a game has suffered the same anxieties and doubt. Like anything in life, it will require practice and real-world experience to become proficient in game development. So grab a cup of your favorite caffeine-infused beverage, and let's get started!

Common Game Types

There are many different types of games (and some games that pride themselves on being unable to be easily categorized), but most can be classified into one of the following genres.


Adventure-style games are typically story-driven and have one or more central characters. These games are perceived the most like movies (some have been known to have the production budget of one) and can rely heavily on dialogue, exploration, and logical problem solving to move the player through the narrative. Adventure games were especially popular during the late 1980s and early 1990s, with LucasArts and Sierra producing some of the finest examples of the genre. This game type has had a resurgence of sorts in Flash due to its art-driven production pipeline and the typically lower system requirements.


This category encompasses a large number of gameplay perspectives and subgenres, but usually action games consist of tests of players' dexterity, reaction time, and quick-wittedness under pressure. First-person shooters, side and vertical scrolling games, and fighting games all fall into the action genre. Flash lends itself very well to some of the subgenres of this category, particularly retrostyle action games such as Space Invaders or Super Mario Brothers.


Think Tetris, Bejeweled, Sudoku, and the list goes on. Games that involve logic, problem solving, pattern matching, or all of the above fall into this game type. Flash thrives in this genre for a couple of reasons. First, there's generally a lower amount of art needed for a simple puzzle game, meaning individual developers can often do it themselves. Second, the core casual gaming audience on the Web tends to be older and appreciate the generally slower pace of puzzle games.

Word Games

This category could be considered a subgenre of puzzles, but the approach to building them can be different enough that I thought they deserved their own space. Word searches, crossword puzzles, spelling games, and anagrams all belong to this genre. Flash is a popular medium for games of this type; for the same reasons, it is for other puzzle games as well.

Strategy and Simulation

I'm cheating a little by combining these two genres into one, but they share a number of common traits. Careful planning, resource management, and decision making, such as city planning or the creation of a large army, characterize strategy games. The level of minutia the player is expected to maintain usually defines a strategy or simulation game. Some games are so complex as to allow every possible option available to the player to be micromanaged. More casual strategy games, like most created in Flash, simplify gameplay by reducing the number of options available and focusing on a couple of main tasks. A popular example of the casual strategy subgenre is tower defense games, where the player must stop enemies from getting past their defenses using a variety of different weapons placed strategically.

Role-Playing Game (RPG)

RPGs are similar to adventure games, but they are normally defined more by the growth of the main character throughout the course of the game's story. Traditionally, RPGs take place in a fantasy setting and center around the player's statistical development, such as improving traits such as strength, intelligence, agility. The most popular recent incarnation of these games has been in massively multiplayer online RPGs (MMORPGs), where players compete against and collaborate with each other to develop their characters. Because of the social and Web-based aspects, a few Flash MMORPGs have begun to emerge. However, these games are typically costly and have long-development cycles, making them riskier ventures for companies and infeasible for individual developers.

Vehicle Games

These games are pretty self-explanatory; they revolve around the operation of a vehicle on land, in water, in air, or in space. Traditionally, these games are played from a first- or third-person perspective to achieve a sense of realism. Because of system requirements and the complexity of building a full 3D environment in Flash, most casual games in this genre feature a two-dimensional game view.

Board/Card-Based Games

Usually a digital incarnation of a real-world game, this category can consist of games such as chess, checkers, blackjack, and poker. Because of the low system requirements, Flash is a great platform for creating most board and card games, as is evidenced by the large number of casino-style game sites on the Web.

General Development Terms

Computer science is a difficult field of study and definitely not for everyone who simply wants to make games. However, a fundamental understanding of some of the core concepts of programming helps later when we're dissecting a game piece by piece. Yes it's dry and occasionally tedious sounding, but I promise that fun stuff will follow!


Pseudocode is nothing more than a standard language explanation of a series of programmatic steps, which is like a summary of your logic. Throughout some of the examples in this book, you'll find that I sometimes break down the logic in a game in pseudocode before typing any actual ActionScript. It is easy to get too caught up in the syntax of programming and overlook a flaw in the logic, so it is almost always simpler to break down a problem in English before tackling it as actual code. Often my pseudocode will become the foundation for the names of my functions and properties.


An algorithm is nothing more than a series of instructions and decisions that define the solution to a problem. They are not code or language specific, and therefore they make sense in plain English. For instance, an algorithm could be as straightforward as the process that takes place when a program sorts a list of words by their length. Here is what that might look like in pseudocode:

for all in wordlist sort by length

sort by length (word A, word B) if A.length > B.length return B else return A

Procedural Programming

Many earlier programming languages, such as BASIC or Pascal, were what are known as procedural languages. You can think of them in the abstract as programming a list of tasks or subroutines. They can be executed in any order, but all the commands are driven by one main logic controller, sometimes referred to as the "main loop." The examples in this book will be a combination of procedural programming techniques and the next kind, object-oriented programming.

Object-Oriented Programming (OOP)

Unlike procedural programming, where the focus is on a set of tasks to be executed, OOP is centered around the concept of "objects" interacting with each other. OOP can be a very complicated subject to understand fully, but suffice it to say that each object is a self-contained entity that has defining properties, can send and receive messages from other objects, and can process its own internal logic. For example, in OOP, a person would be one object and his or her friend another. The persons will share some components, both being people, but they will also have characteristics unique to themselves. They communicate to each other through messages in a common language. Some of the aspects of ActionScript work in an OOP manner, and I will cover those at length later on in this book.

Design Patterns

Much is talked about these days with regard to design patterns in software engineering. There are many lengthy explanations, with whole books devoted to the subject in abstract. For the purposes of this book, think of a design pattern as the template for your code. It is the blueprint by which you can structure a game as you program it, particularly from an object-oriented approach. There are many accepted design patterns in the industry, some of which work well for Flash game development, and some that don't really have a place here. In Chapter 5, I'll discuss the most effective patterns I've found when working in Flash and how to implement them.


In OOP, classes are pieces of code that act as the building blocks of objects. You can think of them as templates from which all the objects used in an application are derived. A class defines all the properties and functions (known as methods) of an object. Using classes in Flash is important for a number of reasons. First of all, defining your code in classes requires you to put more planning into how you structure your game. This is a good thing; not having clearly defined blueprints leads to second guessing and duplication of work later on. If a carpenter went to build a house with no plans from the architect other than a single drawing, he would either quit or have to improvise continually along the way. The result would be a very inconsistent, possibly uninhabitable house. I'll cover class structure extensively later on, as most or all of our development will be centered on their use. In the mean time, here is an example of a simple class defining a player in a game.

package {

import flash.display.MovieClip;

public class Player extends MovieClip {

public const jumpHeight:Number=10;//pixels public const speed:Number=15;//pixels per second

public var health:Number=100;//percent public var ammo:int=20;//units

public function Player() { //initialization } } }

Not all the codes may make sense at this point, but hopefully you can see that we've just defined a player character with a predefined jumping height and movement speed, and variables for how much health and ammo he has. Granted, this little bit of code alone won't do anything, but it does create a foundation upon which to build more functionality and features.

Public, Protected, Private, and Internal

The four prefixes you can give to the properties and functions inside your classes, also known as attributes, define what items are available from one class to the next. All of them are documented in Flash's Help files, but here's a quick summary:

• Public methods and variables are accessible from anywhere and are the foundation for how classes interact with each other; when one class extends another, all public methods and variables are inherited.

• Protected methods and variables are accessible only from inside their class and are inherited.

• Private methods and variables are accessible only from inside their class and are not inherited.

• Internal methods and variables are accessible from all classes within their package.


Excerpted from Real-World Flash Game Development by Christopher Griffith Copyright © 2012 by Elsevier Inc.. Excerpted by permission of Focal Press. All rights reserved. No part of this excerpt may be reproduced or reprinted without permission in writing from the publisher.
Excerpts are provided by Dial-A-Book Inc. solely for the personal use of visitors to this web site.

Table of Contents

AI to UI - An introduction to game development in Flash terms; You Have to Start Somewhere - the building blocks of Flash games; On the Job - Different use cases for Flash game development; Dev Utopia - Striving for standards and ideals

Customer Reviews

Most Helpful Customer Reviews

See All Customer Reviews