Thursday, March 29, 2012

Choosing a mobile framework: Investigating Moai SDK

This is a follow-up for Choosing mobile dev platform/framework and looks closer at the ninth step -  Investigating each framework. Here we look at Moai SDK. I'll go through each of the steps from the common post for all the frameworks.

Is it easy to get started?

I downloaded the SDK and compared to the previous tested frameworks, it isn't as "tool-centric". Use any editor you like, and use the command line to compile. Even if you don't know anything about the lua language, you should be up and running within 30-60 minutes, depending on your installation/setup skills.

Is it easy to extend the library?

As I originally started with C, assembly and moved onto C++, I would say that it is really easy to extend this library. However, if you don't know C++, you are stuck. There is some documentation on extending here, although it's more a reference than an example. If you are familiar to C++, check the source on github, and you should be able to extend the library without too much hassle. (Just be sure you don't write platform dependant C++ code... use std libs, don't use MS/Apple/Google c++ libs.)


Features I need for my project

Drag and Drop

There is no "native" drag and drop, so it's a matter of writing routines that handle graphics and touch. Moai has good routines for both 2d and 3d. As I need 2d, I can use Box2d in order to handle collisions, which again can be used for drag and drop. Should be ok to implement.

Text to Speech

No support for that, so have to extend the library.

Basic image manipulation

Rotation and scaling, which is the basics. I do need some filters (Gray, inverse, opacity), which might need to be c++ extensions, depending on performance. Lua is usually quite fast, but it depends on the framework, and compiler.

Basic access to camera

When I saw the MOAICamera Class, I thought: cool, native camera access. But that was the camera "viewing" your objects. So this has to be written as an extension.

Drawing/painting

Here is where MOAI is really easy. As long as you know how to program your paiting/drawing, it's just to use the MOAIdraw class.

JSON support

Has built in parser for parsing between json string and a lua table. Read about MoaiJsonParser here.

HTTP(S)-request support

MoaiHttpTaskBase does all the http magic. And if you need a cloud for your data, there is Moai Cloud as well. Looking at the cheap pricing for Moai cloud, I'm starting to consider if that is a better option than running my own service on a VPS.

Custom user interface placement and user interface elements

Nothing as of now, so you have to paint/draw, or use images. It is on the roadmap.

Audio playback (simple)

The audio engine in Moai is Untz open-source library, which seems quite capable from what I found about it. Retronyms is behind it and they do create some great audio applications. Playing a file was as simple as load, setting volume, setting looping, and then play. This is the kind of audio playback I like to see in a framework. Not too fancy, yet really powerful.

Deployment to supported platforms

Both Android and iOS deployment is quite straight forward. You need a mac for iOS, and either mac or PC for Android.


Pricing

CPAL license! That's really impressive. Such a powerful framework is released under CPAL! You can ask them to buy a commercial license if you need to modify the framework and you don't wish to release your changes.


Direct access to APIs

No. You need to write extensions. Wrap them as small as possible, and you will soon have access to what you need.


Programming Language

Lua and/or C++. C++ isn't recommended as the main language, as it does require some changes to the framework. Most likely both C++ and Lua is needed when you hit the wall on what the framework can do.


Documentation

They are working on the docs/wiki, and that is somewhat needed. Although the samples in the SDK should be enough for most of your questions. The API documentation is OK, but it still needs a bit of work.


Supported platforms

  • iOS (3.0 and above)
  • Android (2.1 and above)
  • Chrome (The browser)


Summary

Moai is a mature, and going forward, and has a proper Roadmap (Not all frameworks do). I think Moai has the potential to be one of the leading cross-platform frameworks. It really depends on where they go from now. I hope they consider native Windows/OS X as platforms as well, as having one codebase for both mobile and desktop is ideal. Although it's fully possible to use chrome on both platforms, it's not really the same as having native apps on desktop.
For Mobile, I think Moai is a winner, both in pricing, features and future roadmap. It's quite powerful and feature-rich, and it's likely to become even more powerful and feature-rich.