Subscribe to:

The Kiwi's TaleWitchBlasterDerelict Blow Stuff Up

Monken: Semi Automatic BlitzMax conversion for Monkey

I got an email from Cobra a couple of weeks back asking if I can help out with the Monkey port of his BlitzMax title PowerSlam.

It was definitely something I was keen on, but I knew the complexity of the source code (MDickie's engine combined with our own changes) and the differences between BlitzMax and Monkey code (far larger than the differences between Blitz3D and BlitzMax code) was going to make a manual port of it a very frustrating exercise. 

Asides from some rather complicated syntax changes, the biggest stumbling block was going to be the structure. The Blitz languages always allowed you to write programs with a 'basic' like structure; you could simply write your code from start to end, intertwining your logic, loading and rendering calls, and implement your game loops where ever you wanted. Monkey is far more rigidly structured, all of your code goes into an 'Application' class that contains distinct areas for loading, rendering and the game loop.

So I started dwelling on the idea of automating at least some of the process. Not simply for Powerslam but also for The Kiwi's Tale (previous attempts to port it to XNA and Monkey ultimately didn't pan out), and I figured there might be some members of the Monkey community that'd be interested in the easiest possible way to take their old BlitzMax projects and put them on the App Store. So I decided I'd try writing a tool called "Monken" (it's a play on Sharpen, the Java-to-C# tool), itself a Monkey application, to automate as much of the process as possible (a completely hands-off translation would be next to impossible, as it would be tricky to do an automatic shift of the game loop into the correct place, and this would differ for every game).

Though I initially quit after a few tests didn't pan out the way I hoped them to, I couldn't get the idea out of my head. So I thought about how to solve the individual problems that'd be associated with such a translation, sat down and started working on it (using some of the BlitzMax samples to help me test the translator) and hey presto, Monken V0.1 is born!

To demonstrate what Monken can currently do, here is the BlitzMax "breakout" sample that was mostly translated automatically, with a few manual edits to get the thing to compile and work as expected. (A tutorial is packaged with the download that explains in detail what needs to be done to get the game running in Monkey).

While Monken is still in a very early Alpha state, with a to-fix list as long as my arm, some already might find it useful and I'm hoping to get some help with it. The current download is here.