Over year ago we have started a new direction of development. Previously we were flash platform developers and we were happy. Later we moved to Unity3d and were surprised by simplicity of developing 3d game and awkwardness while working with 2d in compare to Starling framework. But when I felt discomfort with Unity I could not even believe that soon I'll just dream about it. We took a chance and choose the hardest solution at those time for our new application not a game this time %)
We moved to Marmalade SDK. This tool allows to build C++ natively (really natively) for large number of existing platforms. So our application installs even on old Android devices with arm6 processor architecture and 128 mb of RAM. It doesn’t package runtime because code is native, so package size is smaller than Unity’s or AIR’s, start time is also lower because of this and application works without virtualization. C++ allows You to create fast and low-level code.
So sounds perfect but it’s not… First thing I want to say - if You developed within high level languages for virtual machines and You suddenly decided to move in world of Marmalade SDK, You will feel yourself like in hell. It’s really hard some kind of users to develop something bigger than HelloWord, or student’s practical task on OOP subject.
Marmalade looks more familiar with Adobe AIR sdk - just SDK and interface for managing projects and assets, no editor like in Unity3d included, so can’t say much about, like Unity3d, or Xamarin, or Appcelerator. Major part of my opinion is of language and its implementation.
So working with C++:
- first child’s fear using ‘->’ instead of ‘.’. For first month that’s was hard to become accustomed especially when code contains mix of ‘.’ and ‘->’. This problem disappeared soon and now it doesn’t create spaghetti code to me also I’ve lost reflex when writing in ActionScript or C# :)
- second child’s fear - POINTERS. So what can I say… sometimes it’s a hell, that’s good that humans developed something better nowadays. In my mind - worst case is to access corrupted pointer. It will be described in second article. Also confuses by pointers lifetime at the beginning of study.
- third child’s fear - developing classes in two files (‘.h’ and ‘.cpp’). Also it possible to develop in single file, but I had some cases when it had caused compilation error. So I prefer to write in separate files within big project. Unlike the first fear this is still unsuitable to me.
- fourth child’s fear writing makefile by hand. Perhaps no util to automate this process, You need to include all files, assets files, and makefiles to other plugins or subprojects, also debug version works fine, but when You forgot something to include it can cause build or runtime error on device.
- there infinite number of C++ libraries but they are written in different C++ standards and includes different libraries that often can’t be moved directly to marmalade project. Also marmalade doesn’t support C language and You need to manually port code to project.
- Marmalade SDK includes own like-framework API for 2d and 3d rendering but I found it unusable. So it’s better to find some 2d framework to built on.
- It’s hard to work with char* as string container. You always need to care about allocations and memory leaking. Also I hate when problems start between char* and const char* as function arguments.
- Even if std::string exists there still problems in string creation. So I haven’t found way to create string in such a way “name:”+ name + “id:”+ 1.
- Memory leaking is annoying problem, the worst case is You using custom big library that causes leaks. So library is big and it’s not Yours and it contains hard logics. It’s hard to find leaks in it. Also tried to use some leak searching solutions, but they hadn’t work with marmalade.
- write on C++ doesn't make it faster. Yeah, You write low level code that works without virtualization but You need to know how to write fast code. That’s like you've got airplane but You only know how to drive a car. In the case of using Unity and Adobe Air it’s better because they take care about graphical and ordinary memory fragmentation and other performance optimisations
- Also found that some optimization tips like avoiding local variables in loops that repeats extremely often works same good with C++
To be continued.
+ Android is here: Get It Cooked For Android
Awesome work! That is quite appreciated. I hope you’ll get more success.
ReplyDeletebeste casino bonuser
This is wonderful and quite informative blog I have learnt so many things from here.
ReplyDeletecasino utan svensk licens