Monthly Archives: March 2008

ActionScript Game Programming University: Fun and Educational

Games inspired me to become a developer. I remember having fun playing a myriad of games on consoles and my computer and thinking, “someday, I could make cool stuff like this too!” Fastforward to today, and I’m building chart and treemap visualizations, but that’s a different story…. Still a kid at heart, I was excited to take a look at Gary Rosenzweig’s ActionScript 3.0 Game Programming University. Though I took my time reading it, I found the each chapter very interesting as they each laid out very simple source code that I think even a new developer wouldn’t have trouble following.

The back of the book entices the potential reader with promises of sixteen complete games. In fact, the author’s attention to detail shines through as he lays out games from start to finish. Considering all the Flash and ActionScript books I’ve read over the years, I think I’d recommend this one just for the fact that Mr. Rosenzweig encourages proper cleanup of objects clearly and often. Ultimately, the sixteen games are very simple, and anyone hoping to have something finished by the end of the chapter can only be called naive. The fact is, a real game someone would want to release online needs a lot of content, and that’s certainly outside the scope of this book. Don’t take that as a negative, but a warning in case you think game development will be as easy as it feels while reading this book.

General programming tasks pepper the pages of each chapter without feeling dry and boring. Learning to load XML seems to happen naturally when a game needs some external data. A little E4X gets thrown in for good measure. Again, I noticed over and over, the author encourages good practices by placing common tasks (such as moving objects using physics) or pointing out that he coded something one way to account for features that could be added later (playing sounds in a single function because you might want to add volume changing and mute functionality).

The order of example games works pretty well overall. The first couple of chapters with “complete game” examples feature matching games that are a bit boring, but the interestingness quickly progresses into a shooting game, an Arkarnoid clone, an Asteroids clone, and several others. It ends up being a good mix between graphical games and more traditional quiz and word games. The final two chapters feature a 2D side-scrolling platformer and two top-view driving games.

Like I said, part of me still wants to feel cool by making a fun game that people truly enjoy. Gary Rosenzweig’s approach to teaching game development encouraged that feeling, and if I were still younger and had hours to kill on the computer, I know I’d love to play around with this book and build little games to proudly show my parents. Part of me predicts I’ll eventually sit down one lazy weekend and come up with something to proudly show my girlfriend, but she’ll probably just roll her eyes. Anyway, if you’re keen to try a little game development, whatever your age, I definitely recommend ActionScript 3.0 Game Programming University. With very clear explanations, anyone should be able to explore its examples without much effort, and like me, more experienced developers can have fun too.

360Flex Item Renderers Session Slides and Code

As promised, I’m making my slides and the code samples from my 360Flex Atlanta session available for download. The session was officially titled Building Components That Use Item Renderers and it covers the use of custom item renderers for existing components (like List, Tree, DataGrid) and the creation of new components that can display item renderers.

Screenshot of 360Flex Atlanta Item Renderers Slides

The following examples of MXML List item renderers were shown during the session. These examples display their source code next to the components.

Font List Item Renderer Example

Color List Item Renderer Example

To access the source code for the CheckBoxList ActionScript item renderer, head over to my blog post, Open Source Flex Components: AdvancedList and CheckBoxList. The source code for the TabBar component for Flash CS3 is available in the Yahoo! Astra Library for Flash CS3. It’s not a Flex component, but it is a good example of recycling renderers for reuse.

You can download the source code for the TreeMap component at its Google Code project. The current stable release is available on the Downloads page. For the latest “unstable” revision (which is what I showed during the session) you can go to the Source page and follow the instructions to access the source code with your favorite Subversion client.

To all who attended such an early session after a night of partying, I appreciate it. Also, if you stopped me in the halls between sessions to say you liked it, thanks a lot. I’m excited for the next 360Flex. I heard rumors that Tom and John want to head back to the Bay Area, or at least the west coast, next time.

Download Slides (PDF file)