Coding with the aid of MOAI and what it means to me


Before I get into depths with the article/post itself I would like to make one thing clear: I am a bad, bad, BAD programmer. Most of the stuff that I implement is based on many iterations and hacks that, in the end, somehow get tied together nicely and function (almost) properly.

In my last article I stated that I started out making games back in 06-07 on the TGC forums, using DarkBasic and later with DarkGDK. This statement is important to this topic mostly due to the fact that I “grew up” with a code editor in front of my nose and not a visual tool, fact that influenced my decision to use MOAI. Back in the early days, DarkBasic was the closest thing to magic that I ever encountered. With just a few lines of code I could get a “game” up in minutes (and by game I mean interactive thingy with cubes moving ’round) and share it with everyone who had eyes to see my “masterpiece” (which I did, having posted 3 projects on the WIP section in 2 months). It had literary no visual tool there to help you with anything and I never bothered (nor had the knowledge) to make one myself. And I liked it, made me feel more in control. Later on I moved to DarkGDK which was the C++ flavor of DarkBasic, in order to learn the language “most-used in the industry back then”. Again, same thing, visual studio was my one and only tool. Now, 8 years later I still feel most at home in an environment that places a textbox with syntax highlighting in front of me.

I tried using using Unity 3D (even acquired a license at one point) only to get scared by interface not 10 minutes after first opening it up. It reminded me of Blender’s UI and I wanted nothing to do with it. With DarkGDK reaching it’s limits (and mine) in terms what I could do with it without something going hay-wire unexpectedly and crashing the whole damn thing I was in search of another framework to use. As stated, I’m a bad coder and writing my own from the ground up would mean loosing allot of time and ending up with a square for a wheel. I searched for a framework that would be high-level enough for me to string together a prototype in little time while also giving me access under the hood. And this where MOAI hits the nail on the head.

I love the concept of a HOST and Game-logic

MOAI exposes all of it’s API via Lua. A wonderful “little” language that I learned to use back at @Gameloft. Everything related to the actual mechanics, logic, AI and interaction is done with Lua. Rendering, sound and input is done host-wise. The host is basically the engine which parses your Lua code, and renders stuff on the screen. Think of the host as being a movie player (let’s say VLC) while the Lua part is a .mp4 file. For me this was a game changer because:

  • I could just use the standard hosts (win, mac, android) as they were while developing my game, only worrying about implementing the mechanics.
  • My game’s code would be platform independent. I could develop and play it on both Windows and Linux at the same time without having to do any change.
  • If at any points I would encounter a problem with the host (be it rendering, be it sound) I could just switch to another implementation, or roll my own.
  • I am not locked in to what MOAI offers. I can extend the host to use another sound library (instead of FMOD, or untz), a physics engines or add in support for other input methods.

MOAI literary offers me a foundation to build upon and I find this wonderful. And the community, although small, is putting in allot of effort in maintaining the project and improving it. It also a proven framework as games made with it were released on Steam, the iOS and Android app store and more. Even Double Fine uses it. It hits all the right spots for me. Now, it’s not to say that it is without flaws. It’s rendering capabilities have their problems (specially on mobile) and the 3D support is barely there. Untz (sound) has hiccups and I swear there’s something wrong with the garbage collection. But the positives out-shine the negatives for me and for a project like Mutant Gangland (2D, turn based, uses a grid) it’s more than adequate.

I’m using it to build a framework that I can use to aid my endeavours in game development, as a base for all my projects. There’s a long way to go for both of us (me and MOAI) but I believe it will prove itself to be quite a powerful tool in the days to come. If you are interested in learning more about it, I recommend visiting the community forums here. It is available under the CPAL license, and you can develop using it under Windows, Mac and Linux (and deploy to iOS, Android, browser – html5, NaCL, Blackberry and maybe more).


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s