Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Angry Bots Optimization

Discussion in 'General Discussion' started by Amaresh, Jul 23, 2014.

  1. Amaresh

    Amaresh

    Joined:
    Jan 22, 2014
    Posts:
    21
    Hey Guys! I think Unity should make a video or documentation about the optimisations performed in Angry Bots. I would love to know how it looks so good and works smoothly even on the low end devices.

    It would really help users like me and many others in adapting to some of the methods and optimise their game to work smoothly on low end mobile devices. And they can concentrate on making beautiful games using unity rather than focussing entirely on optimisation before releasing on mobile devices.

    Does anyone agrees with me? Please Comment I would love to from you guys.

    Thank You.
     
  2. melkior

    melkior

    Joined:
    Jul 20, 2013
    Posts:
    199
    Well .. maybe. I mean sure that would be okay.

    But also you have access to the entire project you could .. you know mess around with it and view all the scripts and see for yourself what they did too?
     
  3. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    9 out of 10 times its fast shaders. Get fast shaders, don't do much culling, batch everything into cells. Minimise fill rate/overdraw.
     
  4. Amaresh

    Amaresh

    Joined:
    Jan 22, 2014
    Posts:
    21
    Which shader is the fastest to use for transparency purpose?
     
  5. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    Any time you use transparency, just wave goodbye to performance. Transparency needs objects to be rendered in the right order. Sorting things eats CPU cycles.
     
  6. Amaresh

    Amaresh

    Joined:
    Jan 22, 2014
    Posts:
    21
    That means say no no to transparency when developing for mobile devices. And what about scripting and physics performance. I mean some basic tips for optimising physics and scripts.
     
  7. zDemonhunter99

    zDemonhunter99

    Joined:
    Apr 23, 2014
    Posts:
    478
  8. sphericPrawn

    sphericPrawn

    Joined:
    Oct 12, 2013
    Posts:
    244
    Does using transparency in sprites/GUI elements give the same performance problems?
    I haven't noticed any performance hits when using images with alphas so far and my test phone is an ancient Galaxy S2.
     
  9. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    I think it would be interesting to see if we could improve it's performance with further optimisations.

    And/or convert it to a horde shooter to stress test Unity.
     
  10. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    Well, if your sprites have transparency, and you have sprites rendered over a background, then that's a simple case and wouldn't be expected to cause performance drops. It's when you have many layers of transparency - with particle systems being a good example - that you'll eat performance.
     
  11. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    8,952
    Don't use lights. Lights are expensive.
     
  12. 3agle

    3agle

    Joined:
    Jul 9, 2012
    Posts:
    508
    Or polygons. Polygons are expensive.
     
  13. zDemonhunter99

    zDemonhunter99

    Joined:
    Apr 23, 2014
    Posts:
    478
    Or mesh colliders. You know what I mean.
     
  14. c-Row

    c-Row

    Joined:
    Nov 10, 2009
    Posts:
    827
    Best to stay away from GameObjects in general.
     
    Agent_007 likes this.
  15. SunnyChow

    SunnyChow

    Joined:
    Jun 6, 2013
    Posts:
    360
    buy Pro to unlocked all their auto optimisation features
    :(
     
  16. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    I've ran the profiler over Angry Bots and the biggest performance hit (in Profiler Deep Mode) was the Noise Image Effect taking up over 12ms. This generates quads with individual noise texture UV's every frame.

    Also a lot of the scripts use transform / renderer / rigidbody without caching the reference, which is bad practice.

    Then there are sub-routines that do the same calculations multiple times.

    Changing these elements I was able to get the game in Deep Profile mode from around 30fps to over 40fps running in the Editor.

    Here's a link to my attempt at an optimised version of Angry Bots based on the 4.0 new version http://dl.dropboxusercontent.com/u/19148487/4-0_AngryBotsNew.zip

    Note I have not changed the Vector3 operations to inline maths e.g.

    Code (CSharp):
    1. Vector3 A = A * B;
    2. // vs
    3. A.x *= B.x;
    4. A.y *= B.y;
    5. A.z *= B.z;
    The quick Vector3 op multiplier creates a new Vector3, the inline version just updates the values.
     
    Last edited: Jul 24, 2014
    Amaresh likes this.