- Requirements for PC Games Ported to Android
- Pingle Studio Approaches to Porting Game
- Various game platforms support
- Hard architecture in the source game
- The assets in the game were OK to run on PCs but the majority of mobile devices couldn’t handle them properly.
- Code optimization
- Materials optimization: using a texture atlas
- Render textures
- Updating Unity
- Gamepad controls
- How long does the process of porting take?
- Final thoughts: Pingle Studio advice on converting Unity game to Android
Donut County is an independent single-player Unity game by Ben Esposito, solidly based on solving physics challenges and following the plot. The player moves the hole in the ground that grows by consuming objects. Publisher Annapurna Interactive brought it to all the available platforms, except Android. That’s where we show up to help.
Usually, the general requirements for porting Unity PC game to mobile platforms can come to one phrase: make it work with at least 30 FPS on as many devices as possible.
We needed to do so in the case of Donut County, but the client also had a couple of specific requirements, like gamepad controls, Google Play services support, and being able to run on low-end Android devices.
After deep research and profiling, we arranged a scope of necessary tasks to run Donut County on Android:
- Updating Unity version
- optimizing the code
- optimizing game resources
- integrating gamepad controls system and Google Play services
As mentioned above, first what we did was profiling. And it displayed a lot of issues with the source code we had, for example:
The PC version of Donut County was already available on Nintendo Switch, Playstation 4, and Xbox One and all the console functionality was still present in the project, which is obviously too hard for a mobile game to run.
Unity doesn’t have any special development requirements or paradigms for the code, including porting Unity project to Android, so every developer codes it the way their skill and knowledge allows. That makes it harder to port or modify Unity games, especially on mobile devices.
You can find out more details of various gaming engines like that in our
How To Choose The Best Gaming Engine For Your Game
Donut County was initially developed as a PC exclusive, so the author of the game did not bother on how to port Unity game to Android. The desire for Donut County to be available on all the platforms came later. Eventually, every porting team had to adjust code to the specific platform. So did we.
The assets in the game were OK to run on PCs but the majority of mobile devices couldn’t handle them properly.
So, how exactly did we follow all the requirements?
As mentioned above, Donut County was ported to the consoles before mobile devices. That’s why all the platform-related changes were present in the project’s codebase. We added our edits to the codebase.
We optimized the Donut County’s code in two stages.
Stage 1: standard optimizing methods:
- transferring the logics processing from fixed update to the update
- caching all the .GetComponent objects and all the math
- removing all the interactions with the previously present in the update lines
Stage 2: simplifying logic without affecting the gameplay.
At first, we took a look at the textures and materials of the game.
Almost every model had up to 10 different materials. It wasn’t OK for mobile devices because the processing caused a lot of additional load on GPU.
We decided to leave one material per model.
Manual optimization would take up to 3 weeks, so we decided to create a script that would collect the data from the project, analyze it and unite it into a single texture atlas.
A texture atlas is an image that features a set of other images. Each of them is a texture of some particular object. You can set up the subtextures by setting the coordinates on the atlas — which is basically selecting some part of the image.
Luckily, the game visual mostly consists of simple colors.
We collected all the necessary data into an atlas and put the entire project through it.
Creating the script took 2 days and working with it took 2 more days.
Eventually, we used 4 of 1000+ materials in the initial project. That helped us optimize the game solidly.
The initial game had very detailed high poly models. They looked great but affected the performance. We cut the number of objects and polygons and won some more FPS. For example, we turned the poster in the picture into a single texture.
At the beginning of the project, we decided to get rid of about half of the processes and decreased render textures. The render texture for the PC version used ARGB Half color format and 8 samples anti-aliasing. It wasn’t too necessary for the Android version. We changed the color format to ARGB 32 and cut anti-aliasing to 4 samples. It saved us some volume and processing time, which increased productivity.
The game had a lot of unnecessary post-processes and cameras on every level. Decreasing the size of render textures helped us cut the texture size from 3 MB to 0.7 MB.
The game had a lot of sounds. To optimize the memory use for the sounds, we solidly cut the sample rate of every sound and transferred all the sound assets from WAV to MP3. Doing so helped us decrease the build size from 250 MB to 110 MB. You hardly ever need a super high-quality sound for an Android game, especially if it doesn’t affect the gameplay too much.
The game is based on heavy physics interactions, so it was important to save it as much as possible. We simplified all the physical objects, decreased the number of colliders, changed the collision matrix, and turned mesh colliders into box colliders. We almost got 30 FPS when we finished.
All the UI loaded to the level (screenshot on the right). Turning off some objects helped us increase productivity. A detailed UI like that is not so necessary and user-friendly for a mobile version of the game, unlike PC or console versions of Donut County.
We simplified all the shaders. The initial developers used PC shaders and we just changed them to mobile versions. We also faked some textures and changed them to SolidColor Shaders.
The initial developers used a lot of paid plugins from the assets store. Changing the Unity version of the game to the latest caused almost all the plugins to stop working, and Google also required using the latest version. We tried updating plugins, but it didn’t work for most of them. So, we had to manually dig into each plugin and see what caused a problem with the new Unity version. In particular, we changed some code in Spline and InControl Unity plugins and they started working.
It helped us run the game on the newer devices in the required 30+ FPS.
The goal was to enable Android players to play Donut County on Dual Shock and Xbox controllers on their devices.
The game has two control systems, and the second one is only used on the last level. We developed detailed functionality for both systems to work well on Android.
Samsung C7 and C6 refused to work with gamepads, so we had to develop a whole controlling functionality for the game to work with the gamepad on these two particular devices.
Mali graphic processor (Samsung S7) caused artifacts on some shaders. We decided to fake the real-time shadows for this graphic card.
The time required for porting Unity game to Android mostly depends on the complexity of the game (which also determines the team composition), the set of required Android devices to run the game, and current Google Play requirements.
It took us 7 weeks to bring Donut County to Android. 6 weeks for the research and the development, and one more week to gather the client’s feedback and implement the final edits.
The team consisted of 2 Unity C# programmers 4 Unity technical artists, 3 game testers, and a project manager.
We recommend planning at least 8 weeks if you consider porting Unity desktop game to mobile devices. The required time can go both ways, depending on the factors above and the skillset of your team.
Independent Unity developers tend to create their games on just one platform without considering further platform extension. It helps to concentrate on the game itself, but may seriously limit the potential of your game. We felt a bit of that on this project, which made us really excited to help bring it to yet another platform.
Porting Donut County to Android devices felt a bit weird, but exciting and challenging, just like playing Donut County.
So, if you’re wondering on how to port my Unity game for Android, we recommend following some of the tips below:
Optimize the game as much as you can, even if it seems unnecessary. Unity has a lot of tips and tricks for it, available on their official resources;
Mind the porting potential. You develop the potentially popular game, so the players on various platforms may be interested in it. Organizing game porting services for a game is much more effective than hoping for your audience to fit a single platform;
Apply module functionality. If something can be separated, do it;
Get rid of hardcoding as much as possible.
If you need any additional expertise on how to convert Unity game to Android, feel free to contact our experts.