Search Unity

Need advice on optimizing my 2d physics based game!

Discussion in '2D' started by Navillus, May 17, 2014.

  1. Navillus

    Navillus

    Joined:
    Dec 21, 2012
    Posts:
    9
    Hey guys,

    I'm in the process of creating my first 2d unity game, but I'm not completely new as I'm well into the process of making the game. I understand the basics for sure. I need some advice on a couple specific items, as well as any general points you could add, to help make this game run better.

    So, here's how an example level is laid out: link

    The image of the entire "level" (with the blue and red elements) is just for basic illustration. When imported into the game, each level element has a unique texture . The overall look is snow capped rock. The black is invisible, and there are several layers of, what will eventually be parallaxing, background images. The entire level sprite has a polygon collider 2d created. The round character has a circular collider, rigidbody2d, and is moved by applying forces. Scripting is pretty basic right now, as there are some gui scripts, a CameraFollowsCharacter script, and a ApplyForceToCharacterScript.

    Anyway, hopefully that gives you a basic idea. My problem is, when I deploy what I have to my phone, it's an absolute cooker. My phone gets screaming hot, and it's one of the better phones out there in terms of processor/gpu, so that's not good!

    For optimization sake, here are my questions (if you can answer even just one, please do!) :
    1. Should each of the level elements be separated into individual spites instead of having them all as one polygoncollider2d?
    2. Given that my levels are made out of fairly randomly shaped, textured polygons, the imported images that make up the levels get to be pretty big. I have seamless pattern textures; is there a way that I could import my basic red and blue level image, and then apply those seamless pattern textures to the level elements once in unity? If not, is there another way to minimize my level sizes. I will be using a seamless image for my background, though I am currently not.
    3. Again, given that my levels are made out of fairly randomly shaped, textured polygons, how many vertices is too many for your average phone (say, an iphone 4)?
    4. I have textures in the game that are semi-translucent to create a shadow look. Are semi-translucent textures inefficient?
    5. At what point does a level get too big? Should I be creating/destroying objects as a character progresses through the level?
    6. Anything I'm not most likely not mentioning that could make it run better?

    I don't particularly understand the concept of draw calls, but I know that they should be minimized. I need to learn more there.

    Sorry for the wall of text guys, but I have a lot of questions! Even if you have links you resources/tutorials on the web on 2d game optimization, please share! Thanks in advance!

    Thanks,
    Andrew