So, it seems I managed to burn myself out over the past month or so. I imagine, like everyone, if you do something long enough you will eventually start to burn out, lose you passion, etc. Using the same couple programs every, single day can really break you down. Anyhow, I took a couple weeks to refresh and I’m back ready to jump in again, or so I thought.
I have a couple game projects up in the air right now, but I put them temporarily on hold. After looking through some of them I realized that there was a lot of repetitious code shared among projects. The only solution was to bring them together to share a common framework. So, I decided to audit all projects and see the commonalities. From there, I started working on a core gaming framework to make my life a little easier and so I can start cranking out games a bit faster. This is where my problems begin.
As I began, two things became completely apparent. One, I need to make sure I document this framework because I will most definitely forget half of what I did in a couple months. Two, I need to make sure I minimize file size as much as possible.
Now, before I get going I would just like to clarify that while my applications can be quite large and complex, I still do all of my development in Flash. Yes, you heard me right, Flash. I have yet to make the jump to Flex for many reasons, although I’m afraid I may have to eventually. As an artist by trade, I hate using Flex. I feel I have much more control over every aspect of my project with Flash and I still find myself doing things that Flex won’t do. This isn’t a Flex vs. Flash post, I just wanted to setup the scene for my incredibly long rant.
First, I want to make sure I document my framework well so that when I forget parts of it, I don’t have to dig into the code to figure out where or why. Initially, I tried using NaturalDocs, but ultimately I was unimpressed with the results. They claim they offered full support for AS3, but when I open the docs and see all my private properties and methods documented, I realize their AS3 support wasn’t quite up to my standards. After a brief search I was pleasantly surprised to find ASDoc. Looks to be the same tool Adobe uses and the results are identical to the livedocs. Just what I wanted, however there was a catch, it was part of the Flex 3 SDK. After some more searching I come to find out that ASDoc was shipped with Flex and only meant for use with Flex. Pretty discouraging seeing the new guy (Flex) getting all the love and attention. What did this mean for me? Well it meant that I could document my code, but only if it didnt use any non-intrinsic, Flash classes. Are you serious? It’s hard to do anything in AS3 without requiring the use of some of the Flash classes. Drawing API anyone? UIComponent? Long story short, I managed to find a few shortcuts, but I’m still in the process of finding a complete solution. As I find out more, I’ll post the results here.
Second, file size. Anybody who has built a large Flash application is familiar with the process of breaking up your app into smaller, more manageable SWFs. This is actually a good habit to get into and novice developers should be encouraged to follow this standard. The major drawback is that when you have multiple SWFs that share some of the same classes, you don’t need both to compile those classes. In fact, the first SWF loaded will load the class and the second SWF will drop it’s version and use the one already loaded. This means that the second SWF can contain extra byte code that it wont actually use. Multiply that by however many classes may be shared times however many SWFs there may be and you can imagine the unnecessary bandwidth getting used. In Flash 8, AS2 there was this handy, albeit hacky, exclude XML file. This file lets you tell the SWF which classes to exclude from compiling. This was a major bandwidth saver for large projects. WAS? Yes, it was. For whatever reason, Adobe decided to remove this feature from CS3 and replaced it with…nothing. However, the new kid on the block (Flex) did manage to get something similar via load-externs. Discouraged again. After scouring the web I did manage to find a few possible solutions, but have not confirmed they work. When I do I will post.
Ultimately, I have realized that Flash may be dying as a developer tool. I may have to make the switch to Flex eventually, but in the meantime I would hope that Flash would keep getting some of the same attention as Flex. Flex is here because Flash was a success, don’t leave Flash behind.
Note: I haven’t picked up my copy of CS4 yet so I can’t say if any of these problems have been addressed.