Creating an ActionScript 3 game: it’s all fun and games until it actually has to work.
Over the last 3 weeks, I’ve been trying to recreate Ticket to Ride, one of my favorite board games, in Flash. It’s been a voyage of triumphs and, ultimately, defeat. In this article, I’d like to share the code and my experiences with ActionScript 3.
If one is talking about creating a casual online game, there isn’t much discussion. ActionScript is the language. The most obvious reason is that it compiles to Flash, which runs on any desktop PC in the world and on many mobile devices. iPhone/iPad being the sole major exception, although even that is changing.
I wanted to figure out whether there were other reasons to use ActionScript. And I did find some. But first, let me give you the code. It’s far from perfect, but you’re free to extend on it.
What I really liked about ActionScript was the impressive speed with which you can build graphical interfaces. It’s very clear that this language is focused on building graphical applications. It was designed for it and you feel that in every possible way. Although the interface of my game isn’t very advanced, it also didn’t take any time to program. It just grew out of the way I structured the code.
What I didn’t like too much was the absence of more advanced data structures and ways to process them. It felt pretty awkward to have static typing for everything but the collection types. The contents of those is all dynamically typed. Compare it to Java before generics. Furthermore, I really missed a lot of the more advanced collection operation that a language like Python has.
Overall, I worked about 10 to 12 hours on this game in FlashDevelop. It was a great and motivating experience on the GUI side, but frustrating for the back-end code. In the end, I just couldn’t convince myself to push on and finish the scoring system for the game. Which is the only thing that’s really missing. That and much error handling.
I might come back to it later, until then, here’s the code. Have fun with it!