What are the best practices to follow while developing a game in Android ?
amol l chavan
Joined: Apr 11, 2011
I want to know what are the best practices to follow while developing a game in Android ? And I also wanted to know do I need knowledge about C++ also?
Amol L. Chavan
Joined: May 06, 2011
Let me start with your second question: no, you don't need to know C++ to write games for Android! You can get along with Java just fine. For complex physics calculations you have to go native, but there exist JNI wrappers already so you can still stay in Java.
Answering your first question is a tough cookie. Let me try to cover at least some essential aspects:
- On Android you have to make sure to cooperate with the garbage collector. This means that you should avoid allocations of new obejcts in your main loop as good as possible.
- You should avoid draining the battery by only enabling sensors like the accelerometer if you really need them.
- Your game should respect the life cycle of an Android Activity: pausing and resuming have to be implemented so that users can get back to the game and pick up from where they left.
There are many more aspects you should give some thought, however, these mostly depend on the APIs you use for creating the game, such as OpenGL ES. Explaining them all in here would be a bit to much