OPTIMIZING iOS GAMES IN UNITY FOR UNIVERSAL BUILDS PART 1: Environments
Our initial roll out plan for our current game Nitropia was to distribute in HD and SD SKUs. This would allow us to maximize our potential install base and tune each SKU for performance. After signing with a publisher we were informed that the game would be easier to market (code for ‘Apple likes it so do it…’) and distribute as a universal SKU. So we began the process of researching how we could optimize our game to play on multiple hardware platforms without sacrificing the quality we worked so hard to achieve. Fortunately, after a little research and testing we found that Unity PRO had some nifty in built solutions for compression, profiling and loading. Our goal was to make a universal build without compromising the number of concurrent characters, environment effects and resolution of the characters with iPad 2 and iPad mini as our lowest common denominators. We will deal with the Android SKU in a separate post.
We are using Unity 2D to build a dimetric game world. First we tried using a single 2K image atlas for our background but realized very quickly that it limited depth and interaction with the environment. This led to a little experimenting with a few creation methods. Eventually, we found that using tiles gave us the most flexibility and interaction.
Creating layered tiles in Photoshop and adding them to Unity as 2D sprites is a tedious and time consuming task. To speed this up we first wrote an editor script to classify objects as foreground and background. Then with a few shortcut buttons we were able to add and layer tiles as you would normally do in Photoshop. The tiles are then distributed into the foreground [1024 x 512] and background [1024 x 512] layers which allowed us to show some depth and interaction despite using 2D. Run time depth sorting occurs based on the relative Y position of two objects. So if a unit had a higher Y value than a foreground object, it would be in front of it.
Below is a quick visual look at how we build an environment:
1. Setup grid to iPad display dimensions.
2. Mark out the pathways in grey. Everything in brown is terrain.
3. Lay down tiles to create background and pathways.
4. Populate with foreground objects
5. The finished environment.
Look out for Part 2 of our technical article where we discuss the optimization we did on our characters.