Posted by Wayne Lu, Technical Lead Manager, Android DevRel
We launched the Android Game Development Kit (AGDK) in July, and have collected some top questions from developers – ranging from AGDK libraries and tools, optimizing memory in Android, and implementing graphics.
AGDK and game engines
Firstly, we’ve heard questions from early, rising game developers on how to use our set of AGDK libraries and tools. We have the following recommendations depending on your setup:
- For game developers using popular game engines such as Defold, Godot, Unity, or Unreal – you can follow our guides to learn how to develop apps on Android. Using these game engines lets you focus on building gameplay instead of the entire technology stack.
- If you’re using Unreal Engine and targeting multiple platforms such as PC or consoles, Android Game Development Extension (AGDE) may be a great addition to your workflow.
- We also support developers who want to customize and write their own game engine – you can learn more about this with our C or C++ documentation.
After choosing your game engine and workflow, you should look into our tools such as the Android Studio Profiler to inspect your game, Android GPU Inspector to profile graphics and Android Performance Tuner to optimize frame rates and loading times.
Game Mode API and Interventions
Following this, we’ve received questions on developing for Android 12. While you don’t have to do anything special for your game to run on Android 12, we’ve introduced Game Mode API and interventions to help players customise their gaming experience.
- Read more about the Game Mode API, and find out how to optimize your game for the best performance or longest battery life when the user selects the corresponding game mode.
- Learn about the Game Mode interventions – these are set by original equipment manufacturers (OEMs), to improve the performance of games that are no longer being updated by developers. For example: WindowManager backbuffer resize to reduce a device’s GPU load.
Memory Access in Android
Secondly, you’ve asked us how memory access works in Android game development versus Windows. In short, here are a couple of pointers:
- Games need to share memory with the system. Some devices have less available memory than others, so testing is needed to check for low memory issues on a range of supported devices. Testing should be done on devices with typical apps that a user would have installed (i.e. not a clean device).
- The amount of memory a game can allocate depends on various factors such as the amount of physical memory, the number of dirty pages, and the amount of total zRam (for compressed swapping)
- Symptoms of low memory can be: onTrimMemory() calls, memory thrashing, or termination of the game by the Low Memory Killer. Use bugreport logs to check if the game was killed by the Low Memory Killer, or on Android 11 and later check the ApplicationExitInfo to see if the game was terminated because of REASON_LOW_MEMORY.
- Avoid memory thrashing: this occurs when there’s low but insufficient memory to kill the game. You can detect this via system tracing, and should reduce the overall memory footprint to avoid this issue.
- Use the Android Profiler and other tools to inspect your memory usage.
Implementing Graphics in Android
Thirdly, we’ve received questions about implementing graphics in Android. You have the following options: OpenGL ES or Vulkan graphics APIs:
- Learn how to configure OpenGL ES graphics for your C++ game engine by initializing variables, rendering with the game loop, scenes and objects.
- Read our Vulkan guides to learn how to draw a cube, compile shaders, setup validation layers, and other best practices.
Check out the Q&A video to view the top questions on AGDK and visit g.co/android/AGDK for our latest resources for Android game development.