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.

Wednesday, March 21, 2012

Version numbers on software with git, tags and sed

After I moved from svn to git, I started doing some version numbers manually, as I felt I never had the time to figure out a good way to set version numbers using git. However, it's much easier and simpler than in svn, when done right.

Usually I use version numbers like this: 1.0.290, where 1 is major, 0 is minor and 290 the revision number.

I wanted to keep the same pattern when using git, as a lot of the software I maintain is moved from svn, where the revision was used directly from the svn repository.

Instead of having automatic revision numbers, I'm only going to increase them when I want to. That makes it possible to commit without increasing the revision number, which is really want I wanted to do.

Here's a quick and simple way to do it:
Tag your repository v1.0.290 (or similar)

To get the major, minor and revision number, git hash and number of commits since that tag:

echo "major:"
git describe --tags --long | sed "s/v\([0-9]*\).*/\1/"

echo "minor:"
git describe --tags --long | sed "s/v[0-9]*\.\([0-9]*\).*/\1/"

echo "revision:"
git describe --tags --long | sed "s/v[0-9]*\.[0-9]*\.\([0-9]*\).*/\1/"

echo "commits since tag:"
git describe --tags --long | sed "s/v[0-9]*\.[0-9]*\.[0-9]*-\([0-9]*\).*/\1/"

echo "git_hash:"
git describe --tags --long | sed "s/v[0-9]*\.[0-9]*\.[0-9]*-[0-9]*-g\(.*\)/\1/"

It should give an idea on how to get the data needed to update a project with the corresponding version info.

Wednesday, March 7, 2012

Choosing a mobile framework: Investigating Appcelerator Titanium

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 Appcelerator Titanium. I'll go through each of the steps from the common post for all the frameworks.

Is it easy to get started?
Installing Titanium Studio is very simple, and if you know how to write javascript, you should be able to create a project and be up and running within minutes after installing.

Is it easy to extend the library?
You can write modules, which is fairly simple. There are thorough guides on how to do it here: (https://wiki.appcelerator.org/display/guides/Extending+Titanium).

Features I need for my project
Drag and Drop
There are several discussions on their forum (here), but nothing is native. Since it's javascript you can usually try the usual suspects (jquery drag and drop, sencha etc) to see how they perform. I found drag and drop performance to be way below par on slower android devices, as well as on iPhone 3GS.

Text to Speech
You have to write and extension, which is quite simple.

Basic image manipulation
There is some manipulation options through the image view, however, you cannot modify the image source, only how you view it. If that is what you want, you are all set. (Read about it here: Titanium.UI.ImageView)

Basic access to camera
Yes, through the Media module. Would probably be better if it was in a separate module, as I see the connection between media and Camera, but I also feel they should be separate.

Drawing/painting
You can use a webview with a canvas, or write it in javascript. See this example for how to write an animation: (https://wiki.appcelerator.org/display/guides/Animations). Or there is the paint module found here: https://github.com/appcelerator/titanium_modules. I found this module quite easy to use, and it seems updated quite frequently. I think Drag and Drop might be better to implement through the paint module, as it will probably give better performance than using UI widgets in a view.

JSON support
Supported in the framework (Titanium.JSON)

HTTP(S)-request support
Supported in the framework (Titanium.Network)

Custom user interface placement and user interface elements
Yes, either through extending a UI widget, using a webview, or just paiting directly. You probably have to extend on per-platform basis, depending on how you implement it.

Audio playback (simple)
Through the Titanium.Media.Sound object. It's limited by formats supported by the platform as well as the number of channels supported by the platform.

Deployment to supported platforms
This is one of the great things about Titanium. If your code isn't too complicated and isn't using too many 1-platform-only calls, you should be able to load up your project from either a mac or a PC and recompile/process for the platform you need to. It's then a matter of following simple guides on how to sign your app and submitting to each of the respective markets.

Pricing
It's free to get started, however you will probably end up looking at their $49 per month indie pricing, as you are given access to some modules that might come in handy. Paypal module, urban airship, brightcove (to mention a few.

Direct access to APIs
Through writing modules/javascript wrappers. You should be able to use most native apis that way, but some might be harder to implement than others.

Programming Language
JavaScript and/or CSS/HTML5 for hybrid apps. Javascript for pure native apps. For desktop development, ruby, php and python is also supported. Although if you are creating an app for both desktop and mobile, you are stuck with JavaScript.

Documentation
This is one of the strong points for Titanium. The documentation is really good, well sorted, easy to navigate, and if you need more information there is always the forums. However, people seem to be a bit reluctant on helping each other out compared to other frameworks. That might be because the platform is still quite new, and needs to establish a "core" developer fanbase.

Supported platforms
  • iOS
  • Android 
  • Bada (beta)
  • Windows (Through their desktop SDK)
  • OS X (Through their desktop SDK)
I only wish Windows Phone 7 was on that list, but that probably comes when MS accepts using native code on Windows Phone 7.

Other features
Marketplace: (https://marketplace.appcelerator.com/landing)
Quite a few modules on github: (https://github.com/appcelerator/titanium_modules and there are plenty more if you search for appcelerator modules)

Summary
All inn all a really well documented and supported framework. If I was going to write a business app, I would probably choose it, but for a project that is partially game/app, it's not suited. Their target audience is information and media rich applications. E.g. apps connecting to facebook, twitter, flickr, or another web service, and giving you information, or letting you interact with it. If you are looking into apps that are somewhere between a game and application, you can use the framework, there is just other options for you that are better out there.


Thursday, March 1, 2012

Choosing a mobile framework: Investigating Marmalade 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 (Made with) Marmalade SDK. I'll go through each of the steps from the common post for all the frameworks.

Is it easy to get started?
As expected, Marmalde should have you up and running in no-time.
Register an account.
Register for a free trial
Download SDK
Open the example project, compile, run simulator. All working within a couple of minutes after download. Note: I already had MS Visual Studio 2008 installed. (

Is it easy to extend the library?
It's quite easy to extend Marmalade through the Marmalade EDK, it's documented enough to get you started, and after an initial attempt to write an simple extension on Windows it was easier than I suspected. I'm guessing it's quite the same for other platforms. There's also a video going through the steps for android and ios.

Features I need for my project
Drag and Drop
Reading from the documentation, what is needed is a combination of S3E Pointer as well as graphics. This is basically what I assumed before looking at the framework, as the framework is pretty "raw" in concepts.

Text to Speech
Must be implemented through an extension.

Basic image manipulation
Marmalade provides two apis for handling graphics Iw2D and IwGx. Both seems quite capable of graphics manipulation, although I had to dig further to find details about image manipulation (docs here). It only documents how to load an image. I do find it somewhat easier to load and work with images through Iw2D. If you are doing 2d games, it might be a good idea to look at IwGame Engine (drmop.com). It leverages sprite and graphics stuff and makes it a bit easier (and most likely faster) to develop 2d programs for Marmalade.

Basic access to camera
All done through S3E Camera capture. Quite simple and easy to use. It is in Beta at the moment, but it seems to work quite well. (documentation here)

Drawing/painting
Can be done through Iw2D, IwGX or directly using openGL. IwGame Engine makes 2d drawing a bit easier, although all require quite some work to do what you want. There's also a lot of plugins in the marmalade git repository (github.com/marmalade/). For sprites it might be worth looking at iw2dSprite.

JSON support
None. Since JSON is provided in C, it's a breeze to implement it within Marmalade which already compiles C/C++.

HTTP(S)-request support
IwHTTP handles both and is quite straightforward. You probably want to wrap it in a class to handle your data and server connections, but it's quite capable.

Custom user interface placement and user interface elements
Since marmalade is mostly hardcore drawing using one of the drawing interfaces, this is one of the areas Marmalade is strong. And since it recently implements UI Builder + native UI, you can even combine them.

Audio playback (simple)
Done through S3E Audio. Simple and straight forward sound playback of mp3, wav etc. Usually limited by what the platform supports. For streaming audio, S3E Sound can be used. It streams raw audio directly. There is a warning on using both simultaneously, as the platform usually has limits on how many tracks it handles.

Deployment to supported platforms
There are quite a few steps for each platform, so you probably want to script things up if you are updating your apps on a frequent basis, however, many of the steps are one-off per application, so it's not that much work. Read more in the platform guides,

Pricing
Free trial/non-commercial. $199 for standard licencse, which gives you a marmalade splash-screen on your apps or pro at $499. both is per seat, per year. Neither expensive nor cheap. You can also get the entire sdk for free for commercial use by applying to thier apps program. If you are unsure on how popular your app will become, go for the apps program, as you might be lucky that it takes off because of other apps distributed through the apps program. However, you get 80% after the store owner has taken their cut. Example: for a $1 app, you get 56 cent. 0,14 to marmalade and 0,30 to the store owner (apple or google that have 70/30 split).

Direct access to APIs
Through EDK, so that's fine.

Programming Language
C/C++, code is compiled and run through a VM. Would most likely give close to native speed. Seems to wrap up openGL on each platform as well as a few other apis into common api.

Documentation
Plenty of documentation, although it's not really that well organized. You are likely to find documentation for every bit and piece of Marmalade, but

Supported platforms
Now this one is a big plus for Marmalade!
Supported platforms under support agreement:
  • iOS (3.0 and above)
  • Android (1.5 and above)
  • Symbian (Symbian^3 and S60 5th Edition)
  • bada (all versions)
Beta supported platforms (Not under support agreement)
  • LG TV
  • BlackBerry Tablet OS
  • Windows desktop (full-screen and windowed applications)
  • OSX desktop (full-screen and windowed applications)
  • Windows Mobile 6.x
  • Symbian S60 3rd Edition
  • Mobile Linux, generic implementation
Quite an impressive number of supported platforms for being able to write native performance apps. 

Other features
Code Community
Code community with some libraries/plugins etc: www.madewithmarmalade.com/devnet/code-community /
The community is found on github here: github.com/marmalade

Summary
There is a learning curve to the platform as the API is quite basic. It's a low level framework to give you a common low-level api for multiple platforms. If you are writing a lot of 2d games, you probably want to add a 2d game library on top of Marmalade. Since there are tons of pure c/c++ libraries out there, you should be able to easily incorporate e.g Box2D and similar libraries to make development faster and easier. If you are used to writing everything from scratch, Marmalade offers a lot of flexibility. Comparing the price to the list of features and supported platforms, I would say you get a lot for every penny. However, this is not the library for you if you want a complete ready-to-go game engine or app engine. You have to be prepared to write a lot of the basics from scratch, which you might get directly in other frameworks.

Update 02/03-12: Added other features
Update 03/03-12: Added information about supported platforms,  programming language, documentation and overall summary.

Choosing a mobile framework: Investigating frameworks

This is a follow-up for Choosing mobile dev platform/framework and looks closer at the ninth step -  Investigating each framework. 


I'm not going to look at how simple it is to write a "hello world" app, as that might be very easy, although the framework might be horrible. It's pointless to compare a framework based on "hello world".

For each framework I'm going to look at the following key points:
  • Is it easy to get started?
  • Is it easy to extend the library? (If some functionality is needed cross-platform)
  • I'll briefly investigate these features, as they are needed for my current project:
    • Drag and Drop
    • Text to Speech
    • Basic image manipulation
    • Basic access to camera
    • Drawing/painting
    • JSON support
    • HTTP(S)-request support
    • Custom user interface placement
    • Custom user interface elements
    • Audio playback (simple)
  • Deployment to supported platforms
  • Pricing (Yes, I think pricing is important to look at, although there is always a hidden cost for a "free" framework: usually workload )
  • Direct access to platform APIs or are they wrapped? (sometimes, you need to dig deeper than the framework wants you to....)
The frameworks in details:

Choosing a mobile framework: Web-based, appstore, desktop, mobile?


This is a follow-up for Choosing mobile dev platform/framework and looks closer at the eigth step - Choose if your app should be web-based or an actual app in the appstore or both, should it be mobile and desktop?

As mentioned in the original post, this one isn't always easy to figure out. Usually you want your app/product to target all end-users, no matter what kind of device they are on. Usually you can list up a couple of questions to figure out how to choose target devices/platforms.

Who is your target audience?
For this project I do need to integrate into VLEs (virtual learning environments) at some point, but more customers require the end-product to be accessible on mobile devices. This points me towards a web-page/web-based application, as some of the code most likely can be ported between a mobile app and a VLE integration. My target audience uses both mobile and desktop platforms, so I need to target both.

Should the application be mobile, desktop or both?
Second, I look at what sizes/types of devices I need to target. My current project needs both to be accessible through desktop computers, as well as through mobile devices. Again this points to having a common code-base, so a web-app would be great. Although some frameworks provide this for native as well.

Can the application be a web-page, or do you need it to be native?
So it all comes down to the question of being native on a given platform. That is usually a question of performance, but not necessarily. As there will be some animation, drag and drop, sound, I think from a performance perspective it would be good to have a native app, but if a web-app performs OK, why shouldn't I just wrap that in any of the app-wrappers?

When looking at performance, always test on low-end devices. If you can get your app to perform well there, high-end devices shouldn't be a problem. For instance, I created a small drag and drop test in a web-app wrapper. Works perfectly well on a Samsung Galaxy S2 and Galaxy Tab 10.1, terrible on the iPad 1, bad on an iPad 2, and is totally unusable on a HTC Wildfire as well as on a Samsung Omnia 7.

Basically that is because of the JavaScript interpreter on each of the platforms is different, as well as the raw cpu-horsepower. I'm surprised to see that much difference between iPad 2 and Galaxy Tab, but I know Google and Apple has various JavaScript engines in each of their respective WebKit code bases. As for the Wildfire, I'm not surprised, as it had Android 2.1 and only a 600 MHz cpu, which isn't really that much.

However, the app I created was a quite simple animation, as well as some drag and drop touch gestures, so I suspected it to perform better.

This points me towards a native app instead.

So 2 points for web-based, 1 for native. Although the performance factor is more important than common code-base, so I would say it's a draw for now. I will review this when looking at each of the frameworks later on.