Compiling cocos2dx on an Android device
Written by miechu   
Saturday, 25 January 2014 00:00

I had a chance to buy a new Samsung Galaxy 3 Tab, really cheap, so I've bought it since I haven't had an Android device before (and that's a big shame for a mobile games developer like myself). I then had to figure out how to utilize. I've quickly found AIDE, an awesome, complete tool that allows you to write, compile and deploy code on the device alone, no need for a PC. Being an ambitious individual I decided to compile the renown Cocos2dx on my device.

Needless to say I haven't found any clues on the internetz on how to do it. Nor I had any experience with Android development. Yeah, let's do it!

I've started off by reading this article. It was a good read, it allowed me to get the initial grasp of the structure of Android projects, and how to handle different steps of development. And it made me install Android SDK, NDK and Eclipse version that came along with it. The following tutorial doesn't use Eclipse, but I did use it to figure it all out.

Then I've found this one. I followed the tutorial up until section Hello, Cocos2D-X for Android! where it says Now run the I've searched through my trusty cocos2d-x-2.2.1 directory and it turned out the mentioned bash script is simply not there. WTF?!? Hacking mode engaged!

I've searched through my other copies of cocos2d-x and I've managed to find a file of specified name in one of the version I've got from gitHub long time ago. I get a feeling cocos2d-x 2.1 has the file, if anyone has any problems finding it. I've simply copied the file over to the analogous location in my cocos2d-x-2.2.1 directory (just put it in cocos' root dir).

I've run the before-mentioned script from inside cocos2d-x home directory. Script started complaining about android SDK directory and such. Lazy ass script! I had to set up the environment variables NDK_ROOT_LOCAL and ANDROID_SDK_ROOT_LOCAL (yeah, just like described in the tutorial :P).

I've run the script again and this time it started working. It asked me questions:

  • Input package path? - I gave it com.eyecog.NDKGame
  • input target id? - from the printed out list I've picked the one my one-and-only android device has: 1 or "android-16"
  • input your project name? - NDKGame, truthfully
It started to print out stuff and suddenly stopped with last line ending like so:
cocos2d-x-2.2.1/template/android/ No such file or directory
Hack mode engaged! I've copied the file over from my mentioned git version of cocos2d-x along with the whole template/android directory. Deleted the generated NDKGame directory in cocos2d-x home and tried all over again. This time it run to the very end seemingly without any errors.

From cocos2d-x home directory I've copied over cocos2dx and newly created NDKGame directories to my android device. I've placed them in AIDE's AppProjects under NDKGameProject I've created specially for this occasion.

Ok, let's see what AIDE can do! I've opened it up, navigated to NDKGameProject/ and opened the project (my guess is it's using file to detect a compilable project - but then again it's probably written in some documentation. Who would read documentation! It's more fun to discover stuff on your own, like in the old games! :D).


I got this:

Here's my one problem with AIDE: when it encounters an error it also prints out, in the same error format, warnings as well. A bit confusing, but one can get used to it.

Anyway, clicking the latter highlighted the line:

<application android:label="@string/app_name"
This rung a bell. I remembered I've seen something like that in one of tutorials... Ah yes! This one! It basically said to change this
<application android:label="@string/app_name"
to this:
<application android:label="@string/app_name"
since it's the appropriate name, apparently.

Change done. Run.

Your project contains errors - it said. Please fix them before running the app - it advised.

Keep calm and carry on. Let's see. This is the actual problem that needed addressing:
NDK: Android NDK: jni/ Cannot find module with tag 'CocosDenshion/android' in import path
I didn't really need Cocos Denshion here, but decided to handle that for completeness' sake. First CocosDenshion was simply missing from my code, so had to copy it over, analogously to where it resides in cocos2dx sources. Copying was not enough, trying to compile would result in the same error. This StackOverflow thread helped me solve the issue. All that had to be done was adding this:

$(call import-add-path,$(LOCAL_PATH)/../../..)
to NDKGame/, just before $(call import-module lines. Also, I've removed this:
$(call import-module,extensions)
to save some compilation time since HelloWorld project doesn't use any of it anyway.

Run.Your project contains errors...

Seems same had to be done for cocos' I've added this line:

$(call import-add-path,$(LOCAL_PATH)/platform/third_party/android/prebuilt)

Many minutes later...
Success! It compiles! Running... aaand crash.

But this one's easy! Missing assets! I've just copied NDKGame's assets over from NDKGame/Resources to NDKGame/, since that's where android expects its assets. Done!

Final FYI: on my Galaxy Tab 3 a clean build of whole cocos2dx with CocosDenshion and HelloWorld project takes approximately 30 minutes.

High time I've updated Frosties!
Written by miechu   
Wednesday, 13 November 2013 20:10

I've got a shameful secret to share.. Frosties is crashing. What's worse, it has been crashing for quite a while now. Since iOS 5 was introduced. Yep, it's a long time. And there's a 100% repro. It's a big scratch on programmer's honor, so I had to fix it. And I did, two days ago (high freaking time!).

Now due to the long time during which Frosties had not been updated there was a number of thing that had to be done

  1. application had to be updated to take full advantage of "new" iPhone 5 resolution
  2. all middleware had to be updated to make sure everything works as expected on latest system (iOS7)
  3. update all the code that has been using functions/functionality deprecated since iOS4.2 (last Frosties version)
  4. and then see what happens!

1. iPhone5 compatibility

At first I had no idea how to enable Frosties to use whole iPhone5's screen. Being an experienced developer I quickly resorted to the ultimate knowledge source: Internetz! After a short while I've found this article. It turns out all one has to do is to supply app with appropriately sized splash screen. Cool.

I had some not visible margins in background images so this worked out of the box after increasing resolution. What I was surprised by the most was that all other GUI elements (all buttons and labels) were placed as expected! Well, maybe not surprised, rather pleasantly assured that I know my stuff. When developing Frosties I was placing all GUI elements relative to relevant logical screen points, like "left upper corner" or "center". This paid off and UI looks right out of the box. Good coding practices FTW!

2. Update middleware

Both ads providers I'm using, iAd and AdMob, required update of my code due to multiple functions gone deprecated. This was piece of cake. However I've noticed strange, unexpected banner sizes, not matching current device orientation. I'm unable to tell what was the root cause because I was (thankfully!) able to fix this by tossing programmer's-intuition based fixed before I had to dig too deep into this issue. Phew.

One other middleware Frosties is using is Localytics, which had do be updated since old version was using UUID, and Apple restricted usage of these (in iOS6 as far as I remember). While visiting Localytics' site I had a look at recent data, and it seems there's at least 20 people still playing the game! That's a nice feeling.

3. Replace deprecated function calls

Yeah, did that ;)

4. See what's left

Well, after all above it was far from ideal. Here's why:

  • Rotation broken! The game just ceased to respond to device rotation changes. After some googling ( is priceless!) I've found out that navigation controllers no longer pass rotation state notifies and queries to root controller. Starckoverflow's answers were saying something like "subclass UINavigationController and handle it there". Gibberish! I have only view controller, how am I supposed to subclass from totally unrelated class?!? But of course I knew they were right, and I suck at Apple's MVC, so I started digging and this article helped me to connect the dots. All I had to do is to subclass UINavigationController (just like they said) and explicitly create its instance and plug it into main app's window (which they didn't say).
  • I've noticed some Game Center issues but since I remembered that not many people played online PvP I considered removing it completely. I had another look at my Localytics data and it turned out that during past year there were only 9 online PvP games. In such cases I tend to thing these were triggered out of pure curiosity or even accident. Screw it, not worth the effort. I've removed online PvP. The "hot seat" PvP (the very popular one) stays.
  • When I started preparing Frosties' new version for upload Apple gently reminded me (by not allowing me to save changes) that I not only need to supply screenshots for "new" iPhone5 resolution, but also that my old iPhone screenshots are no longer valid since there's no longer a 320x480px screen iPhone. Apple supported regular-shaped iPhones are all Retina now. Fancy! Had to prepare new one both for iPhone4 and iPhone5 device families. Luckily being a programmer that rarely throws stuff out I had my source PSDs stored and I was able to reuse them without much hassle! Asset hoarding rulez!

Ready to submit

After a couple of test runs with TestFlight I was happy enough with the state of the game that I've decided to submit it to AppStore... Easier said than done :/

First app bundle validation attempt simply failed because it was requiring ARMv7 without saying so in bundle's config (Info.plist file). Adding "require ARMv7" to app's requirements didn't help since now validation failed due to app requiring device capabilities it didn't require in previous versions. Bummer. Adding ARMv6 to supported architectures in Build Setting didn't help neither. Damn! Googling to save the day and it turns out it's enough to set iOS Deployment Target to at least iOS 4.3 to solve the issue.

At this point bundle validation reported only missing app icon sized, as warnings, so I didn't care much thinking scaled versions will look ok enough.

Was I surprised when my submission attempt failed! Of course I initially thought Apple doesn't accept bundles that have even warning, so I went through the pain of transitioning my app's icons into an "asset catalog". Well, it was in fact rather painless (all one has to do is to change settings in General settings of the project and a catalog will get generated for him) but pointless. After supplying all possible icon sizes and passing bundle validation without a single warning it still would not submit throwing a mysterious "An error occurred uploading to the iTunes store"" message. Gee, thanks, that explains everything!

Uncle Google however was more informative and I've quickly found threads on starckoverflow that claimed it was related to Java version I'm using. Damn you Java! Downgrading to Java 1.6 helped and I was able to successfully submit my binary to the AppStore. Yay!

Within an hour I've received info from iTunes that my app is using restricted functionality, namely UUID. Well, technically I was some old CocosLive code I'm not really calling at all, but it was in my binary so Apple had all the right to fail my bin. No worries, a quick fix and resubmission.


Frosties 1.5 is currently awaiting review and I think it should be fine. Lessons learned from all of this: don't let your code rot for two years, unless you're never going to use it again. Ever. Can you ever be sure?

Take care!

It's been a while
Written by miechu   
Friday, 27 July 2012 14:40

Well that was a while... I was never good at regular updates ;) But now I'm back with something new! Well, kind of ;)

25 days of ads
Written by miechu   
Wednesday, 16 November 2011 00:00

I've promised an update after a week of ads-driven Frosties. And I didn't do it. Or actually I do - right now! It's been 25 days now and I'm doing to give you some insight into how it went.

First week was (obviously!) great - the profit was not that good, but anything was better than the previous two weeks of no Frosties' sales, and it gave me a lot of insight into this new business model. I've used three different ads providers: iAds (Apple), AdMob (Google) and MobFox. Here's how first full 7 days shaped:

As you can see it's almost all iAds. Partly because I made iAds my app's first choice, but due to iAds (mostly) poor fill rate it was showing AdMob's a lot more often - as much as iAds 3.5k vs AdMob's 18.5k impressions on one of best days. It's just that iAds eCPM is so ridiculously hight! On average 20-30 times more than AdMob's, not to mention occasional sky-high one-day-one-territory CPM of $160 - true story, seen it with my own eyes! Anyway, here's a nice pie chart showing revenue shares of mentioned ad networks.
I'm not talking about MobFox much since it failed me. Poor fill rate resulted in it not bringing me almost any money in second half of the week. I was actually considering dropping it all together but it did start producing some revenue after first week.

After first 8 days iAds lost some steam - maybe game has been played a bit less by gamer in iAds enabled countries, maybe just a coincidence. The result is visible in chart below. iAds still rule, but AdMob still delivers with near perfect fill rate of 99.58%. This is how revenue shares shaped after first week.

To sum up, switching over to ads-driven business model did generate more money than initial regular $1 per copy deal. After 10 days of showing ads I've earned as much as in 90 days of sales of paid Frosties copies. Plus, game has been downloaded over 11k times. 22k+ game sessions by 8k active users generated over 25k games vs AI and near 8k games against human opponent. Why is it good you might ask? This proves (somewhat) that game is fun and it lacked proper (or in fact any) marketing when initially released - btw, it's so much easier to market free product ;)

Written by miechu   
Wednesday, 26 October 2011 20:24

After making Frosties free wild things happened to its rankings. is a great site where you can track rankings of most apps on the AppStore. Frosties have their piece there as well, and you can see it here. Here's the nice visualization you can find there:

And it's from the most crowded store, US AppStore, and due to traffic there it's really hard to make it to top 100 on any list. Within three days Frosties was downloaded 8K times, 2600 in US, and it made it to number of Top100s all over AppStore, occupying even 1st places in some of them (Trivia games in Nederlands and Czech, for example).

All in all it seems people like Frosties. If so, it means game didn't sell initially due to poor (lack of) marketing. Note to self: marketing is more important than implementing last cool features.

Frosties update and business model shift
Written by miechu   
Sunday, 23 October 2011 09:46

Frosties' update has been approved by Apple over night (to my big surprise people work there on Saturday!). It contains number of improvements, one new board type - Hexagon and "one-liner" help texts. There's also a change in initial game board's setup - there are some frosties that are randomly unfrozen at the very start of game session. This is suppose to make subsequent games at least a bit less repetitive. No idea it it's a big game changer, though.

But this is not the biggest news. The news are two items, closely tight to each other:

  • Frosties are now FREE, and
  • Frosties are now ads powered
So you might say Frosties is not free, it's just someone else that's paying for it ;)

After years in game-dev industry I've became ads-space provider

Why did i do it? After a week of no sales and some read through ads related posts on couple of iOS development related I've decided that a buck (a bottom value you get if your app is worth anything) is always better than nothing. Infinitely better, a geek might say ;)

Current version takes ads from three networks: iAds, MobFox and AdMobs, to make sure I get any ads regardless of where the user is - iAds for example are available in very few countries. I've created a nice framework to use many different ads sdks, switch between them at runtime, and even change their priority remotely(!) - I think I'll share it at some point, what you think?

To increase chance of success of my new business model I need to make sure as many copies of Frosties get downloaded as possible. Luckily "selling" a free app is a lot easier than a paid app ;) To help myself with this I've enrolled to IDRTG - it's basically a retweeting group for indie developers, and at least it helps me spread the word about Frosties and it being FREE (a magic word increasing chance people will click a link by 500%).

After a week or so I'll post some info on how it all went. I love doing experiments like this! So exciting!

September summary
Written by miechu   
Wednesday, 05 October 2011 00:00

Here's a brief summary of first month of Frosties' sales. To put it simple, game sales are dead. Last 5 days of September (and first days of October) sum up to 0 sales. Promo codes giveaway I've had on TouchArcade forum on 28th had absolutely no effect.

So, what's next? Currently I'm putting some effort into gathering followers on Twitter (with some success) and facebook (with less success). I've even changed EyeCog's twitter profile background to a custom image I've glued together from Frosties' assets. I'm actually pretty happy with it :D

Another thing is I'm still working on first update for Frosties. I've already implemented Hexagon board (!) and done some minor bugfixing, but I'm still experimenting with one gameplay change one of my friends suggested. It's a secret ;) But it's something that will make every game a bit different. I've actually already implemented it, now I "just" need to add it to multiplayer data replication... not my favorite thing to code, but I'm the only programmer here, so tough luck ;)

I also have a little marketing campaign in mind when update's finally released, but I'll keep it to myself for now. I want to share all the info on what I did, not what I intend to do ;)

I'm not quitting - the fight's still on!

Sales update - even worse!
Written by miechu   
Monday, 26 September 2011 00:00

I was of course expecting it, but Frosties's sales are on the ground now - see chart below.

I'm the one to blame - I've just came back from vacation where I had sweet time away from internet. But now I'm back with some data and ideas!

As you can see game sells like crap. It already had couple of days with no sales, and on average it sells 1-2 copies per day - a disaster. If I was to make a living out of it, it would be really bad! But there's still something I can do, following what someone said that a game nowadays is more of a service than a product - it needs to live to gain attention and fans. And that's my plan!

Currently I'm working on a Frosties' update. I haven't decided on the scope yet, but here's a brief list of things that I think about fitting in:

  • new game board shape - hexagon board
  • time-trial mode where you have up to 3 or 5 seconds to make a move
  • achievements - I'll need to come up with a fun list first
  • OpenFeint integration - this one's simple to code, but needs a way of scoring players... need to design it first :D

There's one more thing I plan do to in near future. I had a read about what makes for a good iTunes/App Store app rescription and how important screenshots are - I always knew this was important, but I feel I still failed to do it right. So I plan to put some effort in preparing proper description for the game, and grab some decent screenshots. And this time I'll do some processing on them, like putting them in iPhone/iPad frame, adding additional "whizz" like everyone does. I remember in the old days, when I was releasing my first game Apple required screenshots to be exactly what you can see in the app, with no additional artist's touch - it seems it's no longer the case, judging by what you can see on the App Store.

One last thing I consider doing is having a promo-code give-away so that some people leave reviews on iTunes - currently there are none :( We'll see how it goes, and of course I'll blog it :D

First 10 days a.k.a. Epic Fail
Written by miechu   
Tuesday, 13 September 2011 00:00

Like I've promised earlier I'm going to post data on how exactly Frosties are doing. So here goes - below is a graph of first 10 days sales. Enjoy! ;)

In all it's "glory". As you can see post's title is very suitable.

First day's 33 items sold were not something to be ecstatic about. And as usual day two is like 25% of day one, provided there's no additional factors like baners, reviews, luck. None of these happened so day two was 8 sold. From that day on it's just constant descending (with occasional variations).

It would have probably been better if I did invest in a banner on TouchArcade or something, but I do have first hand knowledge that small banners don't help (I've done it for BallFill), and I can't afford a big one. Plus it seems our press release didn't have that "something" to stand out of the crowd, so also no reviews.

One factor that probably affected initial sells, when it was still easy to find Frosties on "New Releases" list on the App Store, was that game's description visible to potencial buyers missess so called "5 second hook" that will make someone buy the app. It could be the artwork, theme, icon, screenshots - it seems none of stuff I've put there has it. Maybe I should consider redoing it? Any hints on how to do that properly?

That's it of now. Stay tuned for next part of "exciting" data on Frosties' sales ;)

Opened book
Written by miechu   
Sunday, 11 September 2011 00:00

I've decided to make process of marketing, updating and selling Frosties an opened process. I've figured no one did that before (or I simply haven't came across that data) so it should be an interesting read for anyone more or less interested in iOS games development.

And I'm not doing it only because game doesn't sell - this is the case for most games on the App Store. I'm doing it because making iOS games is my hobby and there's no reason not to treat any aspect of it differently - I'm just going to blog about all parts of my hobby! :D

So during next few days I'm going to post data on how exactly Frosties sell (nice graph included!), what marketing have I done, what are my ideas for future and what's in the update I'm going to submit to Apple any day now.

I hope some people will learn from my experience but I also hope for some comments I can learn from as well. Also: iPhone-dev-wannabes, be warned! ;)

BTW, I've just set up RSS feed for my blog, to make it easier to follow my scribblings - you can find proper button on the left. Enjoy!

Frosties is out!
Written by miechu   
Monday, 05 September 2011 11:33

Where's my head!?!?

Frosties went live on the AppStore on September 1st, and I haven't written a blog post about it... Shame on me! You can now find more info about Frosties here.

<< Start < Prev 1 2 3 Next > End >>

Page 1 of 3