Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

What can slow down your games?

Discussion in 'General Discussion' started by IndieDude360, Nov 21, 2010.

  1. IndieDude360

    IndieDude360

    Joined:
    Oct 29, 2010
    Posts:
    105
    Hi i just want to know what can slow down your games.
    Stuff like.

    Artificial Inteligence (Characters) (Really inteligent such as picking up objects etc)
    Doors (Opening and closing)
    Weapons (Physical when dropped) (Firing)
    Models (Large models) (Alot of models)
    Cars (Physical) (Model) (Functional)

    Also another question is about system requirements.
    How would you know what system specs your game requires?
    I remember trying a unity game and it asked me what i wanted to run it on,
    What changes will happen to objects when you set it to a high option,
    and how do you change what happens when it is set to that option.

    And can effects trouble your game as well such as the wet effect"Just Cause 2"
    Dirt on objects or vehicles "Just Cause 2" "Dirt 2"
    Oh and how do you create those effects?

    Thanks for reading
     
  2. Ostagar

    Ostagar

    Joined:
    Sep 29, 2010
    Posts:
    445
    Once you've determined the minimum system requirements you plan to support, you familiarize yourself with its limitations so you don't add anything that requires more--sometimes that's a bit frustrating, of course--and you regularly test against it during your development cycle. Of course, if your dev cycle is long enough, you can add back in advanced features as optionals that can be toggled off or on.
     
  3. Tysoe

    Tysoe

    Joined:
    Jul 6, 2009
    Posts:
    577
    Pretty much anything can slow down your game including all the things you mention, or just simple sloppy inefficient coding can slow everything down. Getting a game to run well is a big part of the battle, and learning the ins and outs and what you can get away with come from experience.
     
  4. Odette

    Odette

    Joined:
    Nov 22, 2010
    Posts:
    2
    I recon a lot of models can cause our game to slow down or even crash, the modelling program I’m thinking of using is Maya 3D.
     
  5. callahan.44

    callahan.44

    Joined:
    Jan 9, 2010
    Posts:
    694
    Modelling packages don't make sloppy models, it's the Artist not knowing limitations, what discontinuous UVs are, etc.
    At the end of the day, they only spit out a list of Vertexs, list of Polygons, and Vertex information.

    Hardware Specific
    The only games you can aim at specific hardware are the Consoles, since you know exactly what that hardware is.
    There are ballpark figures for polygons per frame for each device (like 5k for iPhone)

    If you want to support 5 year old PCs you shouldn't do it at the expense of new PCs.
    There is support within Unity to lower quality of Textures, Meshes, Shaders, etc.

    You might find that 5 million polygons per frame runs fine at the start, but once you add complex Shaders and effects, the GPU just can't cope. There is always creep towards the high end during a project, so set strict budgets at the start.

    Every frame Code
    Code in the Update() and other functions running every frame, should be as lean as you can get.

    a) Avoid big loops.
    b) Avoid allocating/deallocating big chunks of memory (like creating/destroying Arrays and Objects).
    c) Avoid loading/saving files (unless you're using buffered streaming).
    d) Avoid slow functions (like FindObject).
    e) etc.

    Example:
    If you are searching for an Object every frame. If this Object didn't change from the last frame you should have kept a reference to it.

    Draw Calls
    Unity shows your scenes Draw Calls. This can rise *very* quick if you don't know what you're doing. The less the better.
    Every rendered Object, GUI element, Particle system, etc, is 1 Draw call.
    .
    a) Share texture pages between multiple Objects so you can combine them into 1 Draw call.
    b) Use something like SpriteManager for 2D elements.
    c) etc.

    Example: Spawning a Particle system at every contact point (100s of Draw calls) and compared to 1 Particle system that teleports to each contact point (1 Draw call) with no visual difference.


    This is a very incomplete list, and you can find more on these forums and other sites.
     
    hektorj likes this.
  6. Vert

    Vert

    Joined:
    Mar 23, 2010
    Posts:
    1,099
    Lights: For every light in your scene each object that light is being cast onto will be redrawn. 3 objects with 2 lights = 9 draw calls. 1 call for each object without lighting = 3. One time for each object from light 1 = 3. One time from light 2 = 3. Lights are very expensive and can easily bring a scene to its knees if not treated with care.
     
  7. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    The above is not necessarily true. That is, there are differences depending on which rendering path you use, and what types of lights you use, and what are their rendering modes.
     
  8. Vert

    Vert

    Joined:
    Mar 23, 2010
    Posts:
    1,099
    Ah yes! I completely forgot of the new renderer in Pro! I use free so I completely overlooked that. So I retract my last post, lights have the possibility to slow down your game if not used properly and appropriately.