Is an NDK required for good performance when developing an Android game?

I heard that if I develop an Android game without using NDK, the performance is much lower. It's true?

+6
source share
3 answers

I see 3 main reasons for using NDK:

  • you want to reuse the C / C ++ code base (for example, a game engine written in C ++, cross-platform games).
  • get more memory (you can use much more memory through the NDK)
  • Your game runs very intensively on the processor, and you need all the power of your device.

In all other cases, you can choose whatever you want. SDK / Java allows you to use OpenGL in the same way as NDK, so your graphics will not slow down. You must be careful with the GC to get smooth gameplay. If your game is very intense, you can write some methods in C ++ and call them through JNI. By the way, Dalvik has JIT, so Java code can be as fast (even faster, sometimes) as C code.

+14
source

No, this is simply not true.

It really depends on what your particular game is doing. The essential question is: your game will be CPU intensive (or will require large amounts of memory).

  • If not, stick with the SDK.
  • If you do not know, because you have not written many games in the past, be sure to use the SDK.
  • Even if it turns out to be part of a game that can work with additional processing power, you can always extract these parts into your own code during development as needed.

One of the reasons for choosing NDK over SDK is the presence of a huge background in C ++, which can make you more productive in this environment. However, given the current state of the toolboxes (convenient debugging, build time, easy access to SDK libraries, etc.), this is rarely effective.

+7
source

No, you do not need to use ndk if you do not want to make a super-realistic 3D game, such as Real Racing 3 , if it is a game with simple graphics or not so much time. Java is fine.

+1
source

All Articles