For few months now, I’m doing some stuff on Android. Ok it looks a little strange that I started to build things for Android but I have an Iphone…
But as you already know I can only develop application for the Iphone on Mac OS, but I don’t have a Mac (I know it’s a shame).
So what did I do?
- Learn Android system
- Test some ideas regarding performance
- Learn Opengl ES
- Hate the Garbage collector
- Hate the NDK
I want to give you some feedbacks on all my tests, a kind of overview. Then I will write a post for each of my test separately.
First of all, yes Android is very easy to get start with. I like the Activity and View structure, I can’t give more details because I did not develop things really cool yet with UI, Map, contacts… Let’s see another time.
Regarding the performance, I have to admit that performance is very poor !! Especially on the emulator (the HTC magic is much faster than the emulator). For instance, I migrated my fireworks app to Android, and I have to reduce by 4 the size of the screen in order to get a correct frames rate. You can guess how bad is the visual rendering (you know like 320×240 dos game 😉 ). But I did not use OpenGL ES, it was a pure CPU computing.
But even when I tried to develop things with OpenGL ES, there is a very strange issue, I divided by 2 my frame rates when I blit a background! Actually the frame rate depend on how big is the surface to draw, for example you can draw 100 small bitmaps without performance issue if the total surface is not big… take a look on my figure to understand what I mean. So I guess it’s not the implemetnation of OpenGL ES which was bad but the device! But which device is it? It may be the screen/graphic component.
Finally I wasted the rest of my time to try to build a physic’s game for Android. Then I tried Box2D engine. I got 5/10 FPS with a world containing 5 bodies ! 🙂 So where did it come from?
Android is very bad in:
- float computing
- Memory managing
Ok we can understand the slow concerning the float computing. But regarding the garbage collector Google guys have to do something! And the main problem is that you can not have any influence on how the garbage works !! It tries to be smart and free everything for you but my god the GC is not smart at all !! The best defense on this issue is to code everything by yourself and be very careful on how you manage your memory. But as you know and Google guys also, we are now sharing codes, projects, then We can not review all codes!! For example I tried to review the Box2D codes to reduce the lack of memory, then it worked but It took me a week, moreover it’s not perfect and very hard to debug! It could be great if we can manage variables status (like Java standard) and set up the policy depending to our needs… (like Java standard)
By the way on this point the only good news is the DMMs tool, which help you to track and debug. It’s very useful, but again it’s not working perfectly, sometimes the tool did not identify correctly my activity.
Last thing was the NDK. Firstly the NDK is very hard to install. There is no good documentation (full documentation), for my part i don’t like this help page of Google. Yes developing with the NDK is much faster than Java, regarding some works done on Box2D (no comparison possible with Java Box2D!!). But you have to remain that will not be compatible with all devices (native code). Then you have to compile for each different CPU a different application, how can you deal with it in the market place?..Mmm moreover the promise of Google’s Android was not “a full compatibility on all devices” ? For my part it’s one of the argument that convinced me to develop for Android… now that if I have to develop an application for each device… what a difference for me comparing to the past?
I think Google realeased the NDK because there are not so much games on the market and the main reason for that is the fact that Android is to slow!
So to summarize, Google guys, you have to speed Android up for the next version please because NDK is not a good solution at all !!!
(to be continued with how to plot pixel in Android… )