The ultimate goal for any game, let it be for PC or Android or a gaming console, is the magic 60 Frames Per Second. If we are to achieve a solid 60 FPS, each frame needs to take 16 milliseconds to go through logic, calculate the AI, do collision detection, calculate physics, load the sound, and render the frame onto the screen. We can achieve this by taking into consideration how we handle objects in a scene, the visual and audible quality of assets, and implementing smart and mostly simple optimisations. A byproduct of such methods will be a smaller app size as well, which is also an effective optimisation method. A smaller app size will ensure that most of the population that would be interested in our apps, will be able to download our apps, even if they have very little space on their devices already.
The device in which I have been focussing on developing these games to support is a Samsung Galaxy Note 8″ tablet, since that is the only Android device I have access to, it resides at uni. The following table shows the device specifications for the Samsung Galaxy Note 8″ Tablet.
|Screen Size||8 inches|
|Processor||4 Core 1.6 GHz Pentium Pro|
|RAM||2048 MB DDR3 SDRAM|
It is a great device to develop for, it isn’t too old, but it also doesn’t have the best specifications, although they are still reasonably comfortable specs to work with. The games I have been developing for this tablet are not heavily resource intensive or large games, even with how simple the games are, they still are reaching high app sizes for what they are. Without any optimisations, Splop! is 22MB and SpaceRace is a whopping 63MB.
Object pooling is a good way to optimise a game, instantiating and destroying objects over and over can be quite intensive at times. Object pooling also allows for control over the number of elements active in a scene at a time.
For an example of visual asset optimisation, after I had implemented some small-ish changes to how animations work, having less of them overall, SpaceRace is now 51MB. It will require more simple visual optimisations like scaling down the dimensions of the visual assets which will in turn cut down the file size of each of the scaled assets, shrinking the app’s total download size as a result. SpaceRace has quite a few different animations and other visual assets such as sprites, which are currently vector images and the default dimensions are way oversized, so I hope to get the app down to ~30MB at least by just modifying the sprites and animation sizes.
The total application size is another thing we should take into consideration, we should aim for no larger than 50MB for the total APK size, so that players can download the game over 3G, like when they are on a train or bus. This 50MB limit is both achievable and should be aimed for because devices running Android 2.2 and lower (API level 8 and lower) can only download APKs that are smaller than 50MB on the Google Play store. For Android 2.3 and higher (API level 9, 10 and 14+), you can download 100MB APKs max. One more thing to consider is that if the APK is going to be larger than 50MB, we will need to tick the “Split Application Binary” box in the “Publishing Settings” section of PlayerSettings in Unity, as this will turn the APK into expansion files. These expansion files are an attached pair of files that are no larger than 2GB each, that come along with the APK on the Google Play store, but we won’t need anywhere near this 4GB of extra space, so we won’t worry about that for both games, forcing us to be under 50MB again.
There is still more to learn and research about optimising and handling the limitations of a game for the Android platform, but I believe this is a good starting point to have and my games can only be more optimal from here!
This is Daniel Jochem, signing out.