Mike Chambers

code = joy

Source code for PewPew Released

with 7 comments

I have finally released the source code for my PewPew game. PewPew is a game I started working on over a year ago to help me understand what optimizations would be required to convert a web based Flash game to run on the iPhone. I had planned to release the code earlier, but a little hiccup around iPhone support delayed that. Now that Adobe AIR for Android is in public pre-release, and I have had time to comment all of the code, it is ready to be released.

Download PewPew Source from GitHub

First, a couple of notes about the code and game.

This is not a complete, ready to ship game. The game engine is pretty solid, but some more work needs to be done on adding more complexity / new enemies at high levels. In general, the menus and UI needs a lot of polish, and support added for high scores, profiles, etc…

This was the first game I have written in ActionScript 3 (my last game was written in Flash 4), and to be honest, I think it is a bit over engineered. I wrote the entire game from scratch, not using any existing frameworks. I did spin off some of the reusable code in my own Simple Game Framework, but that is really only useful as sample code, or for putting together some quick ideas. For my next game I build, I will be using an existing framework, and will probably not rely so heavily on inheritance (it really adds to the complexity of the code as the game is developed).

In addition, this code has been worked on and optimized (and re-optimized) during the entire development cycle of AIR for iPhone (started before engineering work had even begin on the project). Most of the code has been updated and optimized to work on the release runtimes, but there may be some weird code in there left over from obsolete optimizations. Again, the code is fully commented, and I have put notes where there are optimizations, or why I may have done something in a weird way.

The game was originally developed for a desktop web browser, with mouse input. However, I eventually changed game input to work better on touch devices (the original mouse input worked, but wasn’t optimal for touch screens). Most of the code for mouse optimized input is still in the code base, but is commented out or not used.

Currently, the game assets are compiled via Flash CS5 (in an FLA). It would not be too much work to make this an ActionScript only project, although having it in FLA / CS5 makes it pretty easy to work with the graphics and layout.

The current version is sized for running on a Nexus One Android device (I need to add dynamic layout support to run better on multiple devices). The code also has full support for hardware acceleration on the iPhone and AIR for Android (although i need to test it again on Android).

The source code for PewPew is released under an MIT license. The current version is set to run on AIR 2.0. I am working on an issue that is preventing it from running on AIR 2.5 for Android and as soon as it is resolved, I will update the source to target AIR 2.5.

Again, the code is released under an MIT license, so you are free to do whatever you want with it, including building and releasing your own games. I am open to taking changes / patches / submissions directly into the project, so if you want to make some changes, then read the information on how to fork a project and submit changes on GitHub.

I plan on doing a separate post talking about the optimization and changes that I had to make over the development cycle of PewPew, first to convert it from browser based content, to mobile, and then to ensure that I got good performance on the generally slower mobile devices.

Anyways, have fun with the code, and I hope that people find it useful (even if it is just as a learning tool). Feel free to post any comments, suggestions in the comments here, and if you find any bugs, then log an issue on the project’s github page.

Written by mikechambers

July 14th, 2010 at 11:43 am

Posted in General

7 Responses to 'Source code for PewPew Released'

Subscribe to comments with RSS or TrackBack to 'Source code for PewPew Released'.

  1. Well done, Mike.

    I’m looking forward to see the post about the optimizations. In my iPhone Flash games I did no optimization at all until I had to do the AI.
    But the problem is that I used heavy algorithms for it (MiniMax and AStar) and I had to optimize it even when I translated it to Objective-c.

    Henrique Vilela

    14 Jul 10 at 12:09 pm

  2. Hi Mike, i ´ve donwloaded the code from github but it appears the folder “com.mikechambers.sgf” is missing. Hope u can fix it.

    Greetings!

    Pablo

    15 Jul 10 at 5:21 pm

  3. @Pablo


    Hi Mike, i ´ve donwloaded the code from github but it appears the folder “com.mikechambers.sgf” is missing. Hope u can fix it.

    You need to download and link in the Simple Game Framework:
    http://github.com/mikechambers/Simple-Game-Framework

    Sorry about the confusion.

    mike chambers

    mesh@adobe.com

    mikechambers

    15 Jul 10 at 6:14 pm

  4. [...] Chambers (Adobe) posted the source for his “pew-pew” Flash mobile game. Originally an iPhone game made with Flash CS5 and the iPhone packager, the game has been retooled [...]

  5. Thanks for posting this Mike. I have done a code review on your source:

    http://blog.iainlobb.com/2010/07/code-review-of-pewpew-by-mike-chambers.html

    Iain

    23 Jul 10 at 6:41 am

  6. Very cool, but where can plaaaaaay it!?

    robin debreuil

    23 Jul 10 at 12:24 pm

  7. [...] Multiple Display Objects that Contain Bitmaps Instead of Vectors– Since I was getting the worst performance on iPad for all of my tests, I did a search for iPhone/iPad games created with Flash. There aren’t a lot out there; in fact, I found only one that included source code: Mike Chambers “Pew Pew” game, which can be found at: http://www.mikechambers.com/blog/2010/07/14/source-code-for-pewpew-released/ [...]

Leave a Reply