without an e

game tools: haxe and scala [02/01/2008 14:31:14]

So I've been kicking around this idea for a game. It's a pretty simple falling blocks style puzzle game, and I was thinking about writing it in Scala when I had time.

I like Scala because it seems very developer friendly. It does all the basic object-oriented stuff I like about python, but it's also got type inference, so you get static typing without cluttering up your code. It also has a lot of things I envy about haskell and erlang. And it runs on the JVM and integrates seamlessly with Java, so there's plenty of library support. And it has full support for anonymous functions, which is a clear win over python's crippled lamda keyword.

Basically Scala has enough going for it that it makes sense to consider it as a primary programming language. When I look at ruby, I don't see much reason to move. When I look at haskell, I see plenty of benefits, but also plenty I'd be giving up. But with Scala, everything seems like a win. (Well, iterator support is clunky compared to python. I'll take yield over hasNext() any day.)

I was telling my friends about this game though, and everyone seems to think I ought to make a version you can play in a browser. Of course you can make an applet in scala, but who has time for to wait for Java to load in a browser?

So I was thinking I'd prototype it in flash, especially since I already wrote a tetris clone way back when. Then maybe I could put up a simple demo in flash that people could play while I work on a shareware version in Scala.

Anyway, I've only got flash 8, and I know the new flash 9 with Actionscript 3.0 has a new compiler and virtual machine and everything runs a whole lot faster. And you don't even need the Flash authoring tool anymore, because the Flex SDK is free to download.

I don't really need the flex framework though, so I was looking into how to just compile a flash movie from source, and that's when I stumbled onto haXe.

HaXe is another new language, and it's designed to compile down to javascript, flash, or bytecode for the neko virtual machine. So you can use the same language for the client, on the server, and presumably even for GUI development.

Interestingly, haXe also has type inference, algebraic data types, real anonymous functions, and pattern matching. In fact, haXe seems a lot like Scala.

I think the two could be a winning combination for casual game programming. Start with haXe to get something running in a browser, and then migrate over to Scala for the "real" version, when you need the JVM.

I'll let you know how it goes.

(new comments disabled for now)