Table of contents
25 July 2011
The Adobe Flash Platform makes it easy to build, distribute, monetize, and play some of the best games on the web. With the ubiquity of Flash Player, there is a very low barrier to entry for people who want to start playing your SWF-based games (frequently referred to as Flash games) in their browser, while Adobe AIR provides an easy way to take those web games and make offline versions for the desktop. As the reach of Flash Player extends to mobile phones and other devices through the Open Screen Project and other partnerships, there are more opportunities and fewer limits for creative game developers.
Different genres of games may be better suited to using different combinations of the client runtimes, developer tools, frameworks, services, and technologies that make up the Flash Platform. The goal of this article is to provide an introduction to some of the many different Adobe technologies that you can use to build great games. A discussion of Adobe server technologies is beyond the scope of this article, though many of them can be and have been used to build great games.
The Adobe Flash Platform comprises two runtimes: Adobe Flash Player and Adobe AIR.
Adobe Flash Player
Flash Player is a browser plug-in that provides a multiplatform client runtime. You can build your game once and it will look the same whether your audience is using Internet Explorer, Firefox, or virtually any other browser, and whether they’re on a Mac, PC, or Linux box. As Open Screen Project partners continue to innovate, your audience will be able to use more and more devices such as netbooks, mobile phones, and TVs.
Flash Player plays content that has been compiled into an SWF file. To create your game as a SWF file, you’ll need a development tool capable of compiling SWF bytecode. The two such tools discussed in this article are Adobe Flash Professional 5.5 and Adobe Flash Builder 4.5.
Flash Player is licensed free of charge and the download size is relatively small (<2MB for Windows, <6MB for Mac for version 10,2,153,1). There are no additional costs involved for end users to start playing your game. On the off chance that your user is among the 1% of people who do not already have Flash Player installed, it is a quick process to get them onboard. Game developers on the cutting edge are often the first to take advantage of new features, but you don’t want to dissuade new customers by telling them they need to upgrade. Adoption rates for new versions of Flash Player are faster than ever, so as new features are made available, you can feel confident that your users are keeping up to date.
For more information, visit http://www.adobe.com/products/flashplayer/.
While Flash Player enables you to view SWF content embedded in a browser, Adobe AIR lets you run that content outside of the browser, even if you are offline, right from your desktop. Just as you need to have the Flash Player plug-in installed to view SWF content in your browser, you need to have the AIR runtime installed to run AIR files outside the browser. Like Flash Player, the AIR runtime is also licensed free of charge to end users. Once the runtime is installed, users can install and run any AIR files (which are just SWFs packaged with some extra bits for the desktop) and they show up on the user’s computer just like any other desktop application. You can place an AIR Install Badge on your website to make application installation a snap.
The same tools used to create SWFs (Flash CS 5.5 Professional and Flash Builder 4.5) can also create AIR files. Since the tools and the languages (ActionScript and MXML) are the same whether you are creating a web-based or desktop application, you can easily share code between your projects. Provided that you’re not making any AIR-specific calls, you can truly create a game leveraging one development workflow and optimize for many screens/OSes (or gracefully degrade and only make the functionality that depends on those calls available in your AIR version).
If your customers are telling you how much they love your game, but they wish they had a way to play when they’re not connected to the Internet (for example, on those long airplane rides with no Wi-Fi access), Adobe AIR is your answer.
The two principal development tools for creating SWF-based games are Adobe Flash CS 5.5 Professional and Adobe Flash Builder 4.5.
Adobe Flash CS 5.5 Professional
Flash CS 5.5 Professional is a visual authoring environment for creating content that is played back in Flash Player. With Flash CS 5.5 Professional, no programming experience is needed to create rich graphics and animations. You can use an extensive set of drawing and shape tools as well as filters and effects to create stunning vector graphics. However, the big feature is the timeline, which visually lays out the frames of your animation and makes it very easy to control. There are many other features, such as the Motion Editor, Bone tool, and object-based animation that make Flash CS 5.5 Professional an easy to use, yet very powerful animation tool.
As a visual tool, Flash CS 5.5 Professional that lets you see your layouts and animations as you work with them. For that reason, it’s very popular with developers who create visual games. Beginners can get something working quickly, often with very little coding needed, while experienced developers can leverage a rich set of tools and the ActionScript programming language to write game logic and achieve more advanced effects.
If you do extensive code development, you will probably want to look into Adobe Flash Builder 4.5, but for many game developers, Flash CS 5.5 Professional is the tool of choice because it strikes the right balance between visual design and code design.
If you’re just getting started and are interested in building games using Flash CS 5.5 Professional, you might want to check out Kongregate Lab’s excellent Shootorial series.
Adobe Flash Builder 4.5
Adobe Flash Builder 4.5 is a developer-centric Integrated Development Environment (IDE). Where Flash CS 5.5 Professional is a more visual tool appealing to artists and graphic designers, Flash Builder 4.5 (formerly Flex Builder) is for coders. The IDE is built on Eclipse, so Java developers and even those who have worked with Microsoft Visual Studio will feel right at home. It features a rich code editor, complete with all the features you would expect, such as syntax coloring, code completion, code collapse, code refactoring, and more. It also includes an interactive, step-through debugger that lets you set breakpoints, inspect variables, view the call stack, and step through your code. You can use projects to easily manage all your code files and other assets.
Flash CS 5.5 Professional excels at getting you up and running quickly, but as your game starts to grow more complex (or if you’re just the type of person who prefers working directly with the code), Flash Builder 4.5 may be your tool of choice.
Of course, there’s no reason you have to use only one tool or the other when developing your game. It’s quite common (and fairly easy) to create content in one tool, exported it as a SWF, and import it for use in the other. For example, your graphic artists can use Flash CS 5.5 Professional to design the graphic elements of your game (characters, maps, effects, and so on) while your developers may prefer to work in Flash Builder 4.5 to program the game logic.
Flash Builder 4.5 is currently in public beta on Adobe Labs.
The Flex framework, together with ActionScript and MXML, underpin the Adobe Flash Platform and provide a foundation for web game development.
ActionScript 3.0 is much more structured and object oriented than its predecessor. Developers coming from other languages will likely be comfortable with the stricter type checking system, improved class inheritance system, better debugging, and unified event handling in ActionScript 3.0. For many non-developers who learned ActionScript 2.0, the transition to ActionScript 3.0 can be a bit daunting. Most of the code examples you may find that are written in ActionScript 2.0 will not be compatible when written in ActionScript 3.0.
Starting with Flash Player 9, Flash Player includes two virtual machines so that it can support ActionScript 3.0 as it evolves, while still supporting legacy ActionScript 2.0 and ActionScript 1.0 content. If you’re new to programming for the Flash Platform, you will want to start off learning ActionScript 3.0. If you already know and are comfortable with programming games in ActionScript 2.0, you can continue with it knowing that Flash Player is still backwards compatible with your code. There are, however, many compelling reasons why you should take the time to learn ActionScript 3.0. The primary motive for most developers is performance. Game developers tend to push Flash Player performance to the edge as they create amazing browser-based games. Code written in ActionScript 3.0 can run 10 times faster than legacy ActionScript 2.0 code. ActionScript 3.0 also began introducing support for hardware acceleration, which will only continue to improve performance going forward.
For a more in-depth overview of ActionScript 3.0, take a look at the ActionScript 3.0 overview written by Gary Grossman and Emmy Huang.
Flex and MXML
Flex is a framework released by Adobe (under an open source license) used to aid in the development of your SWF or AIR applications. It is a programming model that allows you to rapidly build rich user interfaces as well as a framework for connecting to a variety of data services.
MXML is an XML language primarily used to layout user interface components. MXML tags correspond to ActionScript classes, and when you compile your application, Flex uses your MXML components to generate the corresponding ActionScript code used to generate your SWF.
Flex has an extensive library of classes that you can use to generate windows, dialog boxes, forms, buttons, and other user interface elements. It also contains components that make connecting to various data services easy, from simple HTTP requests to more complex services such as LiveCycle Data Services. For a game developer, Flex can be a powerful tool to help you generate your menu systems and dialog boxes, or even to handle your data service connections. All that functionality does come at a cost. The Flex framework is not small and will add to the loading time of your application. If the loading time or memory footprint of your game becomes a concern, you may want to closely evaluate if you need to include the whole framework if you’re only using it to display a button or a form.
Some excellent games have been made using the Flex framework. Greg Wilson’s ChessJam is a great example of such a game built on AIR. He has written a blog post detailing the making of ChessJam in which he discusses his technology selection choices.
Adobe has introduced a service designed to enable developers to easily add collaborative capabilities to their applications.
The Collaboration service takes many of the components you could build yourself using technologies such as Flash Media Server or LiveCycle Data Services and offers them as a hosted service, so you can add them to your application or game without having to manage your own servers.
Real-time push messaging services allow you to enable multiplayer services in your games. Clients subscribe to shared objects and any changes are then broadcasted to all subscribers. This can be used to create anything from simple components like a multiuser chat box to much more complex collaborative applications such as a multiplayer game where character positions, actions, and other data is instantly shared among all players.
Multimedia streaming allows for sharing of audio and video and supports P2P streaming using RTMFP. You can use this to stream video to your game or use a player’s webcam and microphone to enable VoIP-like functionality.
For more information on these technologies, visit http://www.adobe.com/flashplatform/services/collaboration/.
Where to go from here
When Adobe (then Macromedia) first started using the term Rich Internet Application (RIA) to describe some of the new sophisticated content being produced for Flash Player, much of the discussion was centered around enterprise applications. In many ways, games are truly the ultimate RIA and they push the Adobe Flash Platform in ways never imagined. Many game developers have already taken advantage of the new features in the recent Flash Player 10 release, and more capabilities on the way.
Adobe Developer Connection has recently launched the new Flash Platform Game Technology Center as a place to find articles, tutorials, and other content of interest to web game developers of all skill levels. If you’re just getting started, it’s a great place to learn and get inspired. Even if you’re an experienced developer, you’ll likely find a new resource that will help you develop even more impressive games—and you can take the opportunity to write an article and contribute back to the community.