If you're using C or C++ to develop or customize a game engine, the following requirements are critical to integrating Android support into your game engine.
- Take advantage of Android development tools
- Construct an activity
- Draw to the screen
- Process input events
- Output audio
- Manage memory
- Test and polish
- Publish to Google Play
The requirements described on this page do not teach you how to develop a game engine from scratch, but rather identify the areas where Android is relatively unique compared to other platforms.
Take advantage of Android development tools
Android Studio includes tools you can use to:
- Configure your project
- Build, debug, and package your game
- Examine the performance of your game using system, CPU, and memory profilers
- Inspect the contents of your game’s package or application bundle
- Integrate additional features of the Android SDK and NDK
Android Graphics Inspector can characterize the rendering performance of your game and help you investigate the details of rendered frames using frame profiling.
If you're primarily using Microsoft Visual Studio, you can use the Android Game Development Extension (AGDE) to add an Android target to existing projects. AGDE supports native debugging in Visual Studio and includes standalone versions of many of the Android Studio profiling tools.
Construct an activity
Your game needs to construct and interact with an
Activity
. Learn about the
Activity Lifecycle
on Android to understand when an Activity is created, started, resumed, paused,
stopped, and destroyed.
Read about the GameActivity
library,
which integrates and meets the Activity
-related needs (game window,
lifecycle, rendering, handling events) of native C or C++ game engines.
Draw to the screen
Your game needs to draw objects and sprites on the screen. Learn about the
Android SurfaceView
and how
to configure graphics in your game engine.
Android devices support different display refresh rates. Learn about rendering in game loops to prevent frame drops and frame buffers glitches.
Read about how to achieve frame pacing for smooth rendering in OpenGL and Vulkan. Optimize your frame rate with Performance Tuner.
Use multisample anti-aliasing (MSAA) to improve the quality of your rendering. MSAA can be used with very little overhead. To learn more, see the blog post Multisampled Anti-aliasing For Almost Free — On Tile-Based Rendering Hardware.
Process input events
A game engine receives input events from a variety of sources. For an immersive gaming experience, learn to support different Android input sources:
Output audio
Your game engine needs to output audio across different devices and Android versions. Learn about Oboe, our open-source C++ audio library to incorporate high-performance audio in your game.
Use Oboe to achieve the lowest latency, avoid specific audio bugs, and auto select the best available native library (such as AAudio or OpenSL ES).
Manage memory
On Android devices, the system tries to use as much system memory (RAM) as possible and performs various memory optimizations to free up space when needed. Learn to manage memory usage to avoid slowing down or exiting your game.
Test and polish
An Android app crashes whenever there’s an unexpected exit caused by an unhandled exception or signal. Learn about how to detect and diagnose crashes, read stack traces, memory and networking exceptions, how to use logcat, and how to understand Java and Kotlin-specific errors.
Publish to Google Play
Players download your game with various Android devices in different countries, network conditions, and data plans. Learn how to use Google Play to deliver app bundles and asset packs for large games with the benefits of a content delivery network.