Hello Guest

Author Topic: General mobile performance  (Read 9041 times)

cloudcamaleoniv

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 27
    • View Profile
General mobile performance
« on: June 03, 2013, 08:26:06 am »
Hello again, well... I'm designing for mobile, but I don't know exactly the best methods to improve performance on these devices.

Things like "enable or disable dynamic batching on 'Other Settings'"?

Inside collection settings, there's a lot of options, like Filter Mode and Compression.

I wanted to know IF there are good practices for everyone designing mobile games, generally speaking.

Thanks.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: General mobile performance
« Reply #1 on: June 03, 2013, 10:36:35 am »
You want dynamic batching enabled, or else your draw calls are going to be diabolical.
There is no magic bullet for filter mode and compression, but one thing to look out for:

Try to keep overdraw down as much as possible.
Try not to draw over regions of screen too many times. The less the better. Don't have sprites with lots of empty space, and if you do, use dicing if you can.
In Unity scene view, turn on Overdraw visualization to work out how much you're overdrawing. The closer to black the better.

Mobile phone GPUs are relatively fast, but suffer badly when it comes to overdraw.

dustinbahr

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 76
    • View Profile
Re: General mobile performance
« Reply #2 on: June 04, 2013, 03:27:55 pm »
Also make sure you have

Application.targetFrameRate = 60;

somewhere in your application, otherwise some mobile devices (iOS) will limit your framerate to default.

Dajuice

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 45
    • View Profile
Re: General mobile performance
« Reply #3 on: June 06, 2013, 04:40:42 pm »
as Unikron said, one dark enemy of mobiles is overdraw, to prevent this you can use "SolidVertexColor" Shader on graphisms that use much space on screen and/or have simple edges, then you can use, in the sprite collection sprites, Render Mesh: Custom and you can make fit the outlines of the geometry to your sprite, you can also change the texture compression (the atlases) to RGB24 bits or anything that does not have alpha, makes space in the memory ;)

cloudcamaleoniv

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: General mobile performance
« Reply #4 on: June 07, 2013, 09:57:38 pm »
Thanks guys, you were a lot of help!! These tips really improved my game performance!

cloudcamaleoniv

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: General mobile performance
« Reply #5 on: June 08, 2013, 03:43:58 am »
One question about overdraw...

Let's suppose I wanted a multi layered scenario.

The back layer with some kind of blue screen and clouds.
The next layer with some distant mountains.
Then another with some vines and stuff
Then one with some trees and rocks.
Then the main layer of the game, with the characters and stuff.
Then a top layer with some random passing trees and bushes.
And on top of all that, a HUD layer.

If I use one camera, this will cause a serious overdraw.

But what if I use more cameras? Put them in different positions, I don't know. Is there a way to render everything without causing too much overdraw?

Thanks.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: General mobile performance
« Reply #6 on: June 08, 2013, 11:22:00 am »
The amount of overdraw doesn't change with the number of cameras. Its the number of times you draw on a particular pixel, regardless of how you do it.

Well, in your case it isn't that bad really - you're not gonna get an insane amount of overdraw, unless everything is huge and everything is drawn on top of each other covering large amounts of screen. Small amounts of overdraw is fine, its when you're overdrawing the full screen many times is when things go horribly wrong.

For the clouds, mountains, etc, use the dicing feature to save on fillrate, or maybe use the custom mesh stuff to tightly draw a silhouette around the visible parts of the shape.