Convert To Clones (& Global Clones)

Discussion in 'How Can I...?' started by AndyG, Aug 26, 2017.

  1. AndyG

    AndyG Miniboss Boxer

    Joined:
    Sep 25, 2015
    Messages:
    1,100
    Likes Received:
    915
    For those who are not sure or do not know (as I did) what the options: Convert To Clones or Global Clones mean, Trey has a great explanation here during his recent 5 Biggest Game Creator Mistakes video he posted...

    clones.png
     
    AaroArts likes this.
  2. Christoph

    Christoph Miniboss Boxer

    Joined:
    Oct 4, 2015
    Messages:
    2,807
    Likes Received:
    2,309
    Just a heads up, converting to clones is at minute 27.

    Now my question is: do you guys think this is worth it? Have you tried it on your own games?

    I tried it with my recent game and I literally am able to clone 100% of all my scenes with no more than 10 master objects left. Only green objects and actions are left. So these xml files should be non existent now lol. But how much does it really help?

    I was able to reduce its loading time from 9 to 8 second on a iPhone SE. Only 1 second!!! On my iPhone 4s it still takes literally ages, I just don't use this device anymore to test my game on. :D So not sure what to do with this now. I feel that 1 second on newer devices is not really much to go through the hassle of converting to clones each time I export to a final build.

    On the other hand, if I take away the encryption feature it works much better on older devices. It makes up like 10 seconds or so which is huge. On the iPhone SE I just gain another second.

    If I don't use encryption and clone everything then I would save 2 seconds for newer devices... from 9 to 7. That's almost 25% of the loading time. hmmmmm....
     
  3. Astro Games

    Astro Games Avid Boxer

    Joined:
    Nov 15, 2016
    Messages:
    356
    Likes Received:
    190
    I think it's worth but only at the moment when you really do not need to adjust setting for all of your objects anymore. You don't have to do it each time before export. You can do it once and it's done BUT it's good to save a file BEFORE as a separate one just in case of potential future use ;)

    Clones are just a one step of the whole optimization process which is basically:
    - bitmap/assets opt. for atlases
    - bitmap slicing when shapes are not rectangular
    - audio opt. for lower settings
    - particle opt. with less amount
    - animation sequence opt. like less frames per sequence if possible
    and more
     
    Christoph likes this.
  4. AaroArts

    AaroArts Miniboss Boxer

    Joined:
    Jun 22, 2016
    Messages:
    1,546
    Likes Received:
    826
    Oh wow o_O
    I never knew this o_O
    Definitely going to be doing this for my next game...
    It's going to save so much time... I often use the same assets with the same values ALLLLLL the time :rolleyes:
     
    Christoph likes this.
  5. Benfont

    Benfont Avid Boxer

    Joined:
    Sep 27, 2016
    Messages:
    277
    Likes Received:
    278
    Hey guys,

    I have tried it and it does affect performance. Once the device has processed the first asset then the others are just clones which makes it perform better. I have tested it on an old iPad and the difference is remarkable.

    I have only used "Convert to Clones" successfully. I tried once "convert to global clones" and my game kept crashing all the time.

    Once you have converted an asset to a clone you can not undo the action, so I recommend you to do this after your game is finished.
    And as a best practice I always do a backup of my final project before doing any cloning just in case I want to access the original code in the future.

    There is an old thread about this, which is where I originally got the info to understand more about cloning on BB:
    https://www.buildbox.com/forum/index.php?threads/clones-questions.6827/#post-35936

    I use convert to clones for each scene, and only use it on scenes where I have the same asset repeated several times like in this one:
    upload_2017-8-29_18-19-52.png
    The asset called "enemyred" is repeated several times which makes it perfect for cloning.

    I select the first asset that is going to be rendered by the device (in this example the game direction is -90), and then I convert to clones.
    upload_2017-8-29_18-21-8.png

    After that is done all of the asset names on the left side will look like this.
    upload_2017-8-29_18-22-28.png

    Then I do this on every scene all over the game.

    Note: the cloning only affect objects that are static. If you have an object doing any type of movement that asset will not be affected by the cloning.

    Anyway, check the link I posted before - it has more info about this you might find useful

    Cheers!
     
    Christoph likes this.
  6. Christoph

    Christoph Miniboss Boxer

    Joined:
    Oct 4, 2015
    Messages:
    2,807
    Likes Received:
    2,309
    Actually you can clone objects in movement. At least enemies are working with global cloning in my game, that's for sure. They just need to be at the same speed.

    Edit:
    I also just realized that you have to use 'Remove Unused Components' after you clone. This will remove the references to the cloned objects.
     
    Last edited: Aug 29, 2017
    AaroArts and Benfont like this.
  7. Astro Games

    Astro Games Avid Boxer

    Joined:
    Nov 15, 2016
    Messages:
    356
    Likes Received:
    190
    Maybe 'Global Convert to Clones' or 'Convert to Clones' should be added at the Export Dialog Box as an option?
    And I wish to have all these 'Remove...' as a one Purge All button :)
     
    AaroArts and Benfont like this.
  8. comicsmathias

    comicsmathias Avid Boxer

    Joined:
    Sep 25, 2015
    Messages:
    120
    Likes Received:
    41
    tried convert to global clones and removed unused components, and now one on the enemies stopped moving. :(
     
  9. covmon

    covmon Boxer

    Joined:
    Nov 5, 2016
    Messages:
    27
    Likes Received:
    14
    Is the "remove unused components" option still in BB 2.3.6? I can't find the option. Maybe it's done automatically now when you "convert to clones."
     

Share This Page