Mobile device optimisation - Falmouth-Games-Academy/comp350-research-journal GitHub Wiki
Mobile optimisation
When designing software for mobile devices, the comparatively limited hardware specification is a key consideration as opposed to the far greater capabilities of a modern desktop or gaming console. The hardware found in modern day desktops far exceeds that found in mobile devices 1(https://www.quora.com/Are-smartphone-processors-finally-comparable-to-PC-processors-in-terms-of-performance) 2(https://www.quora.com/How-do-modern-mobile-GPU-compare-to-desktop-ones) even with the large advances made in mobile hardware. Other sources claim that mobile CPUs are approaching the speed of some gaming consoles CPUs 3(https://www.howtogeek.com/393139/mobile-cpus-are-now-as-fast-as-your-desktop-pc/) with Apples'new A12X Bionic chip leading the way. While the title of 3(https://www.howtogeek.com/393139/mobile-cpus-are-now-as-fast-as-your-desktop-pc/) may lead you to believe that Apples' newest "Console beating" CPUs are available for phones, Apples' press release 4(https://www.apple.com/newsroom/2018/10/new-ipad-pro-with-all-screen-design-is-most-advanced-powerful-ipad-ever/) only contained a reference to the chip being available in the newest Ipad.
Mobile devices can reach performance bottlenecks due to memory, computational power, and rendering process. To avoid these bottlenecks, an application may need to be optimised in design, limited in execution, or have some features removed entirely.
Memory
Any software designed for use by a mobile device should be wary of dynamic memory allocation. This includes particle effects, and asset instantiation. Object pooling should be used to create any required memory areas at the start of the program. With optimisation for mobile devices, you must consider that the hardware and software of each device can vary greatly. Know your device, research the hardware limitations, is switching rendertargets too expensive? Is the GPU powerful enough to offload depth testing and alpha blending to [9]?. Consider using Dynamic Optimisation to adjust to the device's current state or configuration, and don't be afraid to trust the editor. Both Unreal Engine and Unity have settings specific for mobile development [9].
Rendering
Mesh triangle count
There are certain restrictions on the mesh types supported on mobile platforms due to the hardware. All mesh types can have up to 65,000 vertices due to the lack of 32-bit index support on mobile hardware. Skeletal Meshes can have up to 75 bones [10]. The rendering errors that will occur from exceeding these limits are usefully visible when in the editor as long as a mobile target is specified.
Power of Two Textures
Perhaps this deserves its own section as optimising textures has a positive effect on rendering performance with all hardware. However, the performance increase can be seen as a Micro optimization on systems with large amounts of RAM and powerful GPUs. On mobile devices with smaller resources (see above), the limited RAM and power of the GPU can be problematic. Power of two textures have the specific dimensions that conform to a power of two size (8, 16, 32, 64, 128, 256, 512, 1024, 2048). Textures can only be a maximum size of 2048 in either dimension as this is the largest size allowed by the PVR compressor. You can have non-square textures like 512 x 64, just as long as the size remains a power of 2. You should use square textures whenever possible as they make more efficient use of memory. Modern games have a preference for square 1:1 dimensions for ease of use/speed of loading/processing. To achieve this, many rectangular texture can be combined into a testure sheet where different areas of the square are independently mapped to completely separate objects [7].
Although non-power of two (pot) textures are accepted into the build, the device will convert them into pot at runtime, meaning greater overhead and storing every non-pot image twice. Once for the original, and again for the copy. Non power of two sized textures will waste RAM as they are padded up to the next power of two dimension, even though they do not use the entire space. This padding also risks leaving edging artefacts in the applied image [8]. Again, the original image still remains in memory so this approximately will double the memory used to store the image. One amount of memory for the original image, and another for the padded image.
Battery Considerations
Due to mobile devices operating off of batteries, considerations must also be made for this as excessive use of operations or running very taxing applications can have an adverse effect on battery life, so this must be also be taken into consideration when creating programs. Applications have been created that make use of voltage sensors and existing knowledge of how the batteries discharge have been created so that individual components such as the CPU and GPU can be adjusted accordingly 5(https://pdfs.semanticscholar.org/f93f/0947880466ba2548e570a746a49febc9cbaf.pdf).
Overheating
Another consideration with mobile phones is that they can be damaged due to overheating. Overheating can occur when the CPU and GPU and running at full capacity for long periods of time. When developing for mobile devices this should be taken into consideration and the software should be optimised to keep temperatures reasonable. Some mobile devices will throttle the processing speeds to avoid overheating. 6(https://www.androidpit.com/phone-overheating)
References
[2] https://www.quora.com/How-do-modern-mobile-GPU-compare-to-desktop-ones
[3] https://www.howtogeek.com/393139/mobile-cpus-are-now-as-fast-as-your-desktop-pc/
[5] https://pdfs.semanticscholar.org/f93f/0947880466ba2548e570a746a49febc9cbaf.pdf
[6] https://www.androidpit.com/phone-overheating
[7] Intel software, OpenGL* Performance Tips: Power of Two Textures Have Better Performance, accessed on 11th February 2019.
[8] KatsBits, Make Better Textures, The 'Power Of Two' Rule & Proper Image Dimensions, accessed on 11th February 2019.
[9] GDC Booth Presentation: Epic Games - optimizing AAA games for mobile platforms, accessed on 11th February 2019.
[10] Unreal Engine, Performance Guidelines for Mobile Devices, accessed on 11th February 2019.