Hacker News new | ask | show | jobs
by gregholland 5794 days ago
This is good news. However, in order for Android to become a more viable and successful gaming platform, google better make some DRASTIC changes to underlying Dalvik VM in Android 3.0 or provide us developers with better C++ libraries to write games.

Currently, the Garbage Collector in Dalvik is a total piece of shit. When the GC runs, your game can freeze for up to 100-200ms, totally kills the gaming experience. What most developers who code in Java does is to use object pool and manage memory manually, its a huge pain in the butt.

If you are a C++ developer using the NDK, you are in for a world of pain as well, you can't control EGL context from C++, you can't receive events, can't play/mix sound, can't access assets (easily). To do all of these, you are stuck with using a JNI layer, which just decrease performance.

On top of that, current devices with similar hardware specs (1ghz snapdragon, wvga screen) are all fill-rate limited to 30fps.

2 comments

I haven't been following this very closely, but Guy Romain has mentioned a language called "RenderScript" in a presentation or two. RenderScript, to my understanding, is a sort of C-like language that the Android team intends to use to fill the gap between Java development and NDK development, enabling less painful game dev.

I'm not too familiar with it, so here's a few links:

Here's a post which attempts to walk through some RenderScript sample code: http://www.inter-fuser.com/2009/11/android-renderscript-more...

Here's a mention of it on Guy Romain's blog http://www.curious-creature.org/2010/01/07/nexus-one-live-wa...

What most developers who code in Java does is to use object pool and manage memory manually, its a huge pain in the butt.

How is this different from C++? Oh yeah, instead of objects you get "big blocks of RAM".

C++ has better tools for manual memory management (value types, smart pointers, RAII).
Working around the garbage collector and using any C++ memory management techniques are both ugly hacks. (http://yosefk.com/c++fqa/exceptions.html#fqa-17.4)

Fortunately, there has been plenty of research on GCs that are fast enough for games. So the solution is to use one of those for Android, now that people are actually interested in writing games.

Your link mention two C++ facilities for supporting manual memory management that have no equivalents in Java, and thus (ignoring the smug sarcasm) supports my original point.

A better GC was already mentioned by the OP as another option.