New tool impressions: Monkey

Feb 6, 2012

Back in the day, when I was getting started with game making, I was very interested in BlitzMax. The language was very easy for me to understand, and it produced fast, fluid games that could run on Windows, Mac, and Linux. I very nearly chose it over Flash. However the ease of distribution with Flash (ie. you can just send people a link to your game) won me over, and I left Blitz alone. A few weeks ago though, for whatever reason, I decided to check in on Blitz to see where it was at these days. Long story short, I discovered that Blitz Labs had released an entirely new programming language called Monkey that seemed to combine many of the features that I liked about BlitzMax with the features that I like about Flash, and then some.

Monkey is similar to C#, Java, or Flash, in that it is conceptually a 'write once, deploy everywhere' type of language. However the big difference with Monkey is that there is no virtual machine or plugin required on the target platform. Instead, Monkey actually translates your code to the native langauge of your target platform. To me, this is big for a few reasons:

It lets you leverage additional libraries of code or other APIs once you publish to your target. So for example if I publish my Monkey game to Actionscript, I can go ahead and intergrate the Kongregate API. Because you are running in the native language, you are going to get better performance, and can optimize your code for the target platform. Currently Monkey supports output in several different platforms and languages: HTML5 (javascript), Flash (actionscript), iOS (objective-c), Android (java), XNA (c#), and GLFW (c++). You can check out the Monkey website for more details on what it is, and for a demo version that supports the HTML5/javascript target.

So, that all sounds pretty nice. Monkey combines the BlitzBasic style of development with an even higher level of deployability than Flash. Not only can I make Flash games with it, I can make all kinds of other stuff as well. Too good to be true? Well, the jury is still out on how well the multi-plat exporting works. So far, I have only worked with the HTML5 demo. However if that's anything to go by, and the comments of people in the Monkey forums are to be believed, then yes, it works. What follows is a short summary of my impressions of the language after working on a few small projects with it.

What I liked Monkey is a very simple, clean language. There are very few brackets or semicolons required, and overall the code is very readable. It is an object oriented language, with support for inheritance and interfaces. I'm not a super programmer software engineer type guy so I'll leave it at that. As a Flash developer I found it easy to pick up and use. It comes with a small module called Mojo, which has some simple APIs for 2d graphics, audio, and input. I found mojo pretty easy to use and understand, though the documentation wasn't all that great (I'll get to that in a second) It produces code that works. This might seem obvious, but until I saw my own code running in front of me, I was very sceptical. I was really surpised to see my work just magically appearing in Firefox, running smoothly. Really great stuff. A small but active community. There are some dedicated users of the language who are already building and sharing code, from small snippets, to full frameworks. Compared to some of it's competitors, it's quite cheap. $120 gets you a lifetime license and lets you publish to all platforms. Compare that to an iOS license for Unity and it looks pretty good. What I didn't like It has a walled off community. This was big for me. To post on the official monkey forums, you need to buy the software ($120 USD). I get why they did this, and I think I will likely end up buying it so it may become a moot point, but as a new user trying to get up to speed, I had no way to ask questions or engage with more experienced users. You can't even search the forums (pro-tip: you can do a domain specific search on google by going your search terms). Overall I think this is going to hurt the product more than help it. I guess on the plus side, everyone who is posting is a registered, dedicated user, so once you get in there you know you are only talking to people who are really into the software. Still, I think a public forum for demo users would go a long way towards welcoming new users to the language. The documentation is a little scattered and sparse. The basics are there, but it requires a little bit of effort to find things. The language is pretty new though and the BlitzBasic documentation is excellent, so I expect this to change over time. Debugging is a little weird and sparse. You can get by, but there isn't anything like you'll find in Visual Studio, or even Flash Develop. What I liked and disliked at the same time in equal amounts Monkey is a young language. While the community is putting out a lot of good stuff in terms of modules and code, the chances are that at some point you are going to want to do something fairly simple and find that there just isn't a way to do it, so you'll have to write up your own module from scratch. For example, there is no default GUI API or code. If you want a button, you have to build it from scratch. I actually kind of like this, because it gives me a complete understanding of the code I'm using, but at the same time, it is time consuming. Your mileage with this may definitely vary, depending on how much you like coding, and what kind of things you try to do with Monkey.

Overall I dug Monkey quite a bit, and am planning on getting a full license soon. Despite it's shortcomings, it feels more than adequate for the types of games I want to make, and will let me target many more platforms that I can with Flash. If you are into building 2d games and are looking for something that can bring your games to multiple platforms, then definitely check Monkey out.

Links of note 19451: A simple scrolling shooter I built in Monkey. Uses Ari Feldmans awesome SpriteLib graphics library

Goldbergboros: The game I worked on at the Vancouver Global Game Jam, built with Monkey. It is kind of unoptimized and slow to load (we didn't really have time to tweak it), so please be patient.

Jungle IDE: A great IDE for Monkey

Monkey Module Registry: It's kind of buried in the Monkey forums. Some good pre-built libraries of code here that you can use.