This document provides tips for improving mobile game performance. It discusses common issues like exhausted fill rate or too much geometry that can cause slow frame rates. It outlines techniques like measuring performance on different devices, using opaque shaders when possible, minimizing dynamic geometry, and reducing the number of draw calls. Benchmark results are provided showing how various device specs impact what levels of transparency, sprites, polygons and characters can be supported at 60 frames per second. The overall message is to carefully profile performance in one's own game and optimize for the lowest capable device.
4. Why this happens?
•Many people perceive <20 fps as
bad performance
•60 fps = 16.7 ms / frame,
30 fps = 33.3 ms / frame,
20 fps = 50.0 ms / frame
•Rendering at some point is synced
with LCD
•CPU is working too long
•or… GPU is working too long
5. Two most common problems: exhausted
fill rate or too much geometry
6. Or too much moving geometry, but
let’s talk about bit later
7. Poor man’s explanation of the things
•Fill rate - how many pixels you can draw per
second*
•Triangle throughput - how many triangles you
can process per second*
*- in reality things are bit more complicated
8. Some school* grade math: iPhone 5s
•Fill rate: 3304 Mtex/s, Triangle t.: 68Mtri/s
•Screen resolution: 1136x640
•Can fill screen X times running @ 60 fps: X =
3304000000 / (60*1136*640) = 75.7 (lots of overdraw)
•Can handle Y static triangles running @ 60 fps: Y =
68000000/60 = 1.1 Mtris
*- most of my students fail this test
9. Some school grade math: iPhone 4*
•Fill rate: 400 Mtex/s, Triangle t.: 14Mtri/s
•Screen resolution: 960x640
•Can fill screen X times running @ 60 fps: X =
400000000 / (60*960*640) = 10.8 (not good)
•Can handle Y static triangles running @ 60 fps: Y =
14000000/60 = 0.2 Mtris
*- don’t trust much numbers you find on internet
10. How should I know if I’m GPU bound?
Xcode 5 + iOS 7 (Debug Navigator)!
11. Practical measurement
•iPhone 5s - up 55 layers of full screen transp. (75
theoretical) still allow 60 fps / 31 layer with Diffuse shader
•iPhone 4 - only 8 layers of full screen transp. (10
theoretical) still allow 60 fps / 1.6 layer with Diffuse
shader
Advice #1: always measure what are device limits with
your own setup of things. Start with lowest spec device
first.
Advice #2: use simple and effective shaders when
possible
13. Switching from transparent to opaque
•iPhone 5s - up to 320 layers of full screen
opaque still allow 60 fps
•iPhone 4 - 41 layer of full screen opaque still
allow 60 fps
Advice #3: use opaque (non-transparent)
shaders when possible
15. Dynamic content
•2D sprites: makes quite some pressure on
GLES driver, which means higher CPU usage.
Also could result in high overdraw, which also
makes pressure on GPU too.
•3D animations: makes quite some pressure on
CPU, maybe less pressure on GPU (unless
expensive shaders)
19. Tons of objects = bad
•Lots of separate objects makes great pressure
on GLES driver.
•Dynamic and static batching to the rescue!
(Player Settings tab in Unity)
Advice #4: few bigger objects is better than lots
of small objects
20. Dynamic 3D content
•iPhone 5S - 309 low poly (384 pol.) CPU skinned
meshes / 160 low poly GPU skinned meshes,
iPhone 4 - 55 low poly CPU skinned meshes and
still maintaining 60 fps.
CPU skinning bounded by CPU performance, GPU
skinning (GLES 3.0 only) bounded by GPU perf.
21. Disabling tangents
•iPhone 5S - 318 characters with CPU skinning /
202 characters with GPU skinning,
•iPhone 4 - still 55 characters (draw call bound).
Advice #5: Keep amount of dynamic geometry
(and skinned data) low.
29. Summary
•Don't trust numbers on the internet, profile in your
environment. Small details matter.
•Profile worst and best devices. Estimate budgets for
transparent and dynamic geometry.
•Use Xcode to figure out if you are CPU or GPU bound.
•Large portions of screen covering transparent objects (or
with expensive shaders) make you GPU bound.
•Lots of objects, dynamic geometry makes you CPU bound.
30. •Use tight meshes for transparent 2D stuff.
•Use non-transparent shaders when possible.
•Minimize amount of skinnable data (drop tangents when
not needed).
•Lowering target framerate to 30-20 fps increases budgets
2x-3x.
•Need tons of small characters? 2D is less challenging (but
you should care about details)
31. Resources from Unity Asset Store
•Unity Chan
•Low Poly Micro Monster Pack
•Primitives
•2d CHARACTERS sprite package