Saturday, 10 February, 2007
Thoughts on Flash
I've been doing quite a bit of ActionScript coding recently, trying to complete a game I started some months ago. More than anything, I need to complete a project. I've been directionless for far too long, which has contributed to my recent mental state. Focusing on this game--on completing the game--has helped me start to regain a little balance. Although I'd like something to become of the game, the most important part right now is completing it.
The ActionScript language itself, as I've mentioned before, is quite reasonable; in most cases, a joy to work with. It has rough edges, as do all programming languages, but overall I very much enjoy working with it. The Flash environment, too, is nice, but I'm continually bumping my head against the "this isn't Windows" problem. The Flash model is fundamentally different than Microsoft Windows and, whereas there are many similarities, the differences sometimes confound me.
The Flash event model, for example, is much closer to X Window than to Microsoft Windows. Although I think I prefer the Flash model, my unfamiliarity with it has been the source of many head-scratching moments. It does slow down the development process, but I also have very much enjoyed learning new things.
What's giving me trouble right now is that the Flash APIs don't appear to include the concept of a modal dialog box. The Flex framework does, but at a cost. Even the smallest Flex program is over 100 kilobytes in size. Any meaningful program that uses Flex will quickly suck in more than 200 kilobytes of framework code. That's just too much. My game, which does not use Flex, is only about 220 K in size. That includes all of the sounds and artwork. Using Flex would probably double the size of my program.
Some may think it's silly, what with the wide availability of broadband Internet access, to be worried about adding 200 kilobytes to the download. Afterall, bandwidth tests on my connection here at home report a download speed of about 600 kilobytes (yes, bytes, not bits) per second. So 200 K takes roughly 0.33 seconds to download. And 200 K means almost nothing in terms of storage these days, when computers regularly come with 80 gigabyte drives.
There is an issue on the server end, though. Bandwidth charges start to add up when thousands of people download a program that's twice the size that it has to be. It's hard to say if that's really an issue. Some providers give two gigabytes of bandwidth per month with their basic hosting packages. It would take 5,000 downloads to exceed the limit.
Some of my reluctance is undoubtedly aesthetic--the old assembly language programmer in me who hates to see all those wasted code bytes. Whatever the case, I've committed to making this game without using Flex. After that's done, I'll re-evaluate my options before tackling another Flash project.