What's more performance friendly?

Discussion in 'Technical Discussion' started by defonten, May 25, 2016.

  1. defonten

    defonten Avid Boxer

    Joined:
    Nov 21, 2015
    Messages:
    251
    Likes Received:
    29
    Hi, got a question about optimization. What is more performance friendly for a mobile game:

    1. Having one 90x90px box crate cloned 100 times in a level (differently rotated and scattered all around the level as platform type)
    2. Or having one or may be three big PNGs with the same thing?

    I'm wondering what would be the best way performance wise, any ideas?
    @Andy pls
     
  2. Andy

    Andy Miniboss Boxer

    Joined:
    Sep 24, 2015
    Messages:
    2,152
    Likes Received:
    1,546
    I would make graphics in this case a few different sizes, like legos. so have a single crate, double, 4, 8, etc... Whatever makes sense for how you build your levels. Use the biggest one possible and work your way down as you are building.
     
    Christoph likes this.
  3. VectologyGames

    VectologyGames Serious Boxer

    Joined:
    Oct 5, 2015
    Messages:
    529
    Likes Received:
    473
    Hey @Andy how do you feel about using the same graphics throughout the game? In my upcoming game JUKE, I'm only using one set of obstacles and border images, will this hurt performance?
     
  4. Andy

    Andy Miniboss Boxer

    Joined:
    Sep 24, 2015
    Messages:
    2,152
    Likes Received:
    1,546
    @VectologyGames
    Not really enough information for me to answer that. If your not using a crazy amount of atlases it should be fine. If you have many hundreds of objects in a scene you will probably need to use the "convert to clones" tool to optimize performance. Just guessing at this on my part, really depends on exactly what is going on.
     
  5. VectologyGames

    VectologyGames Serious Boxer

    Joined:
    Oct 5, 2015
    Messages:
    529
    Likes Received:
    473
    @Andy explain "convert to clones" for me.

    Thanks
     
  6. Andy

    Andy Miniboss Boxer

    Joined:
    Sep 24, 2015
    Messages:
    2,152
    Likes Received:
    1,546
    It strips all the properties from objects that are the same except for scale, position and rotation.
     
    VectologyGames likes this.
  7. heathclose

    heathclose Miniboss Boxer

    Joined:
    Jan 28, 2016
    Messages:
    1,810
    Likes Received:
    1,026
    Andy likes this.
  8. Christoph

    Christoph Miniboss Boxer

    Joined:
    Oct 4, 2015
    Messages:
    2,807
    Likes Received:
    2,309
    I used convert to clone and didn't see any performance changes. If you use it just keep in mind that all values for scale, position and rotation are deleted and only stored in the original object for reference. If you want to make changes you will have to set up all again. I recommend to use this option with a new file just for export purpose. And then if you are working on an update go back to the original file with all information stored. The downside of doing it like that is, when you export again, you will have to convert to clones again and again. But I think it is less hassle than having to work on changes if everything is cloned.

    @Andy: if you have long scene, lets say 5000 pixels long, and convert to clones, does it affect performance negatively if your original object is very close to the beginning (at 100 pixels) and the last cloned object to the end of the scene (at 4900 pixels)? I'm just thinking out loud, but if you have a back threshold of 200 it probably gets ignored because the cloned object needs to have access to the information of the original which is at 100 pixels in the scene and still can't be deleted because of that. This would be equal to a back threshold of 4800 pixels which for sure would affect the performance...
     
    Deliverbo likes this.
  9. Andy

    Andy Miniboss Boxer

    Joined:
    Sep 24, 2015
    Messages:
    2,152
    Likes Received:
    1,546
    This is backwards, scale/position/rotation are retained... all other properties come from the master object (the one you are cloning).

    Convert to clones should never have a negative performance effect. Length of scene should not be a factor.

    Lastly just to reiterate. Convert to clones is destructive, you can't go backwards. So make sure you understand what is going on. I'd suggest making a new BBDOC, duplicating an object 10 times, select one, and select convert to clones. Just experiment with it until you fully understand.
     
    heathclose likes this.
  10. Christoph

    Christoph Miniboss Boxer

    Joined:
    Oct 4, 2015
    Messages:
    2,807
    Likes Received:
    2,309
    Not sure if you did understand me Andy.
    What I meant is, if your master object is at 100 pixels and your last cloned object at 5000 pixels, the last cloned object needs to access the information stored in the master object. Right? That means the master object can't be deleted by the back threshold, right?
     
  11. Andy

    Andy Miniboss Boxer

    Joined:
    Sep 24, 2015
    Messages:
    2,152
    Likes Received:
    1,546
    You can test it, but to my knowledge deletion threshold does not cause a problem with clones.
     
  12. defonten

    defonten Avid Boxer

    Joined:
    Nov 21, 2015
    Messages:
    251
    Likes Received:
    29
    Ok, thanks
     
  13. trudnai

    trudnai Miniboss Boxer

    Joined:
    Sep 25, 2015
    Messages:
    1,235
    Likes Received:
    701
    On the game I am working on I use different length of platform elements that was built from "bricks" (aka a angle object). Optimizing for performance for various reasons I have decided to create complex objects that looks like several "bricks" next to each others. But my problem with the clones was with the moving objects and links - can't recall the exact problem but I think I had issues with the collision shapes that were not following sprites at the same pace.

    Performance is great now it runs smooth on a very old iPad 2, but the problem with this solution is that if I want to remove just one brick I have to delete the complex object and add a new one with redoing all its settings...

    Clones are better if that gives you the adequate results, and as @Andy said that is a one way street, so that should be the very last thing to do before you release your game - and before that make a copy...
     
  14. defonten

    defonten Avid Boxer

    Joined:
    Nov 21, 2015
    Messages:
    251
    Likes Received:
    29
    Hey trudnai, how many atlases do you have? I have 6 atlases and the game is an endless runner, and I can see sometimes that when loading next/new levels game slows down significantly.
     

Share This Page