Late to the Flash gamedev party

· by Steve · Read in about 4 min · (699 Words)

I never touched Flash coding before this weeked - I’ve never really felt inclined to do so, I generally dislike Flash interfaces on websites and as such I never felt the need to buy expensive tools from MacromediaAdobe to develop in that environment. There was also the fact that forcing someone to install a plugin to view your content always left a bad taste in my mouth.

A few things have changed that attitude recently though. Firstly, the ascension of video on the web from the likes of YouTube has meant that everyone now has  a Flash player installed, far more than previously, which has mitigated the plugin concerns. Secondly, Niko brought to my attention that Adobe’s Flex SDK from Adobe is now open source, meaning that anyone can develop using their base tools now for no money down. Adobe do in fact seem to be embracing open source quite a lot these days, which I obviously applaud. Lastly, there’s one area beyond video playing where Flash does in fact justify itself among other web technologies, and and that’s game development. A lot of Flash games I’ve seen are pretty awful, but having discovered N+ on my 360 recently I was really impressed with the original N which was released as Flash. I have a bit of a penchant for stylish 2D gaming so that inspired me to give it a try myself this weekend.

I’ve been impressed. I’d heard all sorts of horror stories about ActionScript in the past, but I find AS3 really quite pleasant to use - it’s fast, pretty object-oriented now and I was comfortable using it in about an hour. The Flash environment in general is pretty friendly, and I managed to go from absolutely zero knowledge of Flash before the weekend, to developing my first (admittedly pretty crappy) game in only a handful of hours. So here it is πŸ˜€

It’s a simple Lunar Lander clone where the idea is to land on the coloured platforms. You get more points for smaller platforms (the green one is a total bitch), and to score you have to put both ‘feet’ of your ship down on the surface and stop moving. You will die if you touch down too hard, and also if any part of your ship apart from the bottom of the feet touches the scenery.Click on the game to start, the controls are:

Left/Right arrow = turn   SPACE = thrust   R = restart

I know it’s not that impressive, but I was quite pleased to get this going in basically an afternoon and an evening with no prior experience. I used FlashDevelop as an IDE, which was surprisingly good - the only problems with it are no debugging support (which makes it quite hard to know what’s going wrong if you’re new) and that it only runs on Windows. I’ve now downloaded, but not tried yet, the absolutely enormous trial version of the Flex Builder 3 which is the ‘official’ dev tool, and has the advantage of being Eclipse based (awesome, multi-platform) and supporting debugging, so I’ll see what that’s like in comparison later. I also used a couple of libraries: Flint to do the smoke particle effect on death (which is great except that you don’t seem to be able to pause & restart just emissions rather than the entire system), and Box2DFlashAS3, a great 2D physics engine which is basically an AS3 port of the C++ Box2D.

On the whole then, I enjoyed myself with this stuff yesterday, it’s nice to be working in an environment that’s easy to use and you can get deployed in no time at all. I did a quick look around and didn’t find any ‘complete’ game engines for Flash, unusually, so I built my own simple one here - I did initially think about doing something clever with abstract property and event systems, but decided just to bash something specific out this time. Maybe I’ll write a more complete engine for it sometime πŸ˜€

Edited 4 March: since some people have asked, here’s the source code, released under the Do What The Hell You Like With It Public License πŸ˜€It’s quite shabby, so don’t laugh.