Tag Archives: actionscript

First Ludum Dare โ€” post mortem


(This was originally posted on the Ludum Dare compo blog, for competition #23 “Tiny World”)

I’ve known about Ludum Dare for a few years now, but every time it came around I would end up having too much to do in real life to participate. This time I was finally able to get involved, and it was one of the best things I’ve done in a long time, resulting in Humphrey’s Tiny Adventure, a point-and-click adventure game. Here are a few lessons I learned along the way.

Do as little brainstorming as possible

I knew from the beginning that I wanted to make an adventure game. At 9:00 PM the first day, the theme was revealed and we were able to get started. I spent 15 minutes sketching out some basic ideas and then got right to work. Not everything I wrote down made it into the final game, but it allowed me to get started quickly and add details as I went along, instead of trying to develop a complete design doc or storyline.


Get all your tools and libraries ready to go beforehand

This is a bit of a no-brainer, but I thought it was worth mentioning For this project I used FlashDevelop for my IDE, Inkscape for graphics and Chronolapse for screencasting. Since all three of those are necessary to get started, it wouldn’t do to have some programs downloading after the compo officially started.


Pick an art style that you can produce quickly

I’m mainly a programmer, and while I am capable of creating some reasonably impressive vector art, I certainly can’t pump out high-quality assets fast enough to make it a viable option for a game jam. I decided on an art style that consisted only of colored rectangles, which allowed me to keep my art simple, uncomplicated, and abstract enough that realism wasn’t a concern.


Use release-quality art early on

Chances are if I started out using placeholder art I would just continue using it until I ran out of time. Creating final art assets in the beginning helped me have a feel for how much work it would be to bring the project to completion.


Use version control

If you aren’t using version control already, start now. The first thing I do when I start a new project is create a new local Mercurial repository, and it’s saved me many times in the past. Using version control can save you if you mess up your project too badly, or retrieve old versions of your files if you decide that the first iteration of your player class is the better one.


Record a screencast

Keeping a video running of my work helped to keep me from getting distracted. If I wanted to update my progress on twitter, I had to open up Chronolapse and pause the capture, and even that small amount of required action was enough to keep me from constantly tabbing over to check my email.


Take breaks and get enough sleep

Whenever I came across a tough problem or design decision, I got in the habit of getting up from the computer and making myself a hot cup of tea. As much as it might seem like it’s necessary to spend the entire 48 hours in your computer, the best thing you can do for yourself is to take it easy. If you overwork your brain you won’t be able to think clearly and therefore won’t be as productive as you could be.


I think that’s about it! I had a blast participating, and I’m definitely planning on doing it again. :)

Actionscript — likes and dislikes


I’ve been using Actionscript 3 as part of my game programming class for almost a month now. Coming from a C++ background, there were a lot of things I didn’t like about it the first day. Some of those things I’ve grown to like; others…not so much.


Things I like about Actionscript:

The import system

In AS3, libraries are built on the “one class, one file” paradigm. Each class must reside by itself in a file with the same name as the class. At first I thought that this was just a needless imposition; coming from C++ where every class can be in one file, it seemed silly to me that a language would restrict the freedom of the programmer in that way. As it turns out, this is possibly the thing I like best about the language.

AS3 classes are organized in “packages”, in a similar way that C++ uses namespaces. A package is a folder that contains class files, and is usually named according to Java naming conventions; for example since my website is www.jacobalbano.com, my classes are in the folder hierachy com/jacobalbano/, resulting in the package com.jacobalbano.

The beauty of this system is that the source is always exactly where you expect it to be, as opposed to in C+, where hunting down a class definition in a source tree can be a pain. Additionally, there is no concept of definition and implementation, since each class is contained in its own file.

Getters and Setters

In C++ classes, modifying or accessing private member variables requires two functions, usually defined as SetVariable() and GetVariable(). Actionscript streamlines this pattern with getter and setter functions, which take this form:

This allows access to the private variable _ID like this:

The beauty of this system is that it allows the convenience of a public variable without the problem that setting a variable is often not enough. For example, to start an animation with a class in C++, you’d have to use the following style:

The PlayAnimation() function in the above case might stop the current animation and start the one specified in the function’s parameters. In Actionscript, the procedure would be the same, but the interface is different:

In this case, the setter function would perform the same actions as PlayAnimation(), but in a cleaner way, in my opinion.
In addition, member variables can be made read-only or write-only by eliminating one of the functions.

Super() and function overrides

When extending a class, functions of the base class can be overridden with a function implemented in the derived class. In addition, the base functions can be accessed with the super keyword. For example:

The base function update() is overridden by the derived class, but it is preserved so we can still access it.

Function pointers

I’ve tended to shy away from using function pointers in C++, even going as far as to embed a Lua interpreter to bind actions to a GUI. Actionscript makes it easy to store and use function pointers with the Function type.


Things I dislike about Actionscript:


This is a big one. Actionscript’s syntax (and that of any other ECMAscript-derived language) is close enough to C that I didn’t have a hard time picking it up, but some of the changes are clumsy. I would say the biggest offender is variable declaration.

This introduces another gripe I have…

Actionscript is a GC language.

I know it isn’t cool to manage memory yourself anymore, but I like the control it gives me over the program. Actionscript is very picky about what may and may not be deleted.

Actionscript doesn’t have Enums

Enums are a fundamental part of my programming workflow. I can’t think why they wouldn’t exist within the language, but they don’t.

Actionscript has limited support for class templates

The only class that has template support is the Vector class, and templates aren’t exposed for implementation into custom classes. I managed to fake it a bit, but it’s far from preferable.

Actionscript is platform-specific

I wouldn’t even consider learning a language if it didn’t run on Linux. Fortunately, Actionscript can be developed, compiled and run on Windows, Mac and Linux natively. In this case I refer to the fact that Actionscript only really runs on the Flash or Air VMs, one of which has been discontinued on Linux, and neither of which has particularly good performance.

Actionscript allows developers to be lazy

The Flex compiler won’t complain if you miss a semicolon. Forgot to define a return type for a function? Don’t worry, the compiler doesn’t care. I compile my C++ with every possible warning enabled, so this is another thing that bothers me a lot.

Actionscript doesn’t support overloading

In Actionscript you can only have one function per function name, even if the parameters are different between declarations. This means that you can only have one type of constructor, which gets awkward. In addition, operator overloading is not allowed, so if you want to trace your custom class you’re out of luck.


There’s a lot to like about Actionscript, but it has its fair share of ugly features and anti-features. If not for Flashpunk and FlashDevelop I would have given up on it by now. Ironically, Flashpunk is the best framework I’ve ever used, period, and Flashdevelop is the best IDE I’ve ever used, period. At least they make the language bearable while I have to use it.

Implementing std::pair in Actionscript

This post is pretty out of date, and I wouldn’t use the same solution today. I’m leaving it here for posterity, but don’t consider it some kind of expert advice.

One of the things that bothers me about Actionscript is the lack of templates. The Vector class is their only appearance, and since Adobe hasn’t seen fit to open up the feature for general use it looks like that won’t be changing anytime soon. I’m not very good at using templates in my own C++ classes, but I certainly like to use them as part of the STL.

This week I needed a function to return two values at once. “No problem,” thought I. “I’ll just use a std::pair to store both.” A few seconds later I realized that I was still thinking in C++, so I went around searching for a comparable class in Actionscript, only to find that none existed. This was not to be borne.

Therefore I present a class I wrote to fill the gap. It’s compiler safe and mirrors the design of std::pair as much as possible.

Example usage:

I haven’t done a huge amount of testing, but I’m happy with how it works so far. As usual it’s open-source to do with what you want. The repository is here.



One of my two assignments for the first week of my game development class was to create a “Choose your own adventure” game. The result was GruePunk, a first-person adventure based on Zork (playable version here). I’ve been trying to figure out an elegant way of embedding the .swf in my website but I can’t seem to make it work and look right at the same time, so you’ll just have to grab the file from the Bitbucket link.

I’d literally never touched a line of ActionScript in my life until three days before starting the project. The week it took me to finish it was exhilarating, if only for the pace I put myself through. While there are many things about ActionScript that differ from C++ in a good way (function pointers in particular are a thing of beauty), there are many that I dislike, and quite a few that had me hung up for hours until I figured out what was wrong. Still, the fact that I learned an entire new language in a week is something that still makes me all kinds of happy.

What are you waiting for? Go get the source or play the game!