86 atlases & game crashing after loading screen

Discussion in 'Technical Discussion' started by amazingafternoon, Feb 22, 2016.

  1. amazingafternoon

    amazingafternoon Boxer

    Joined:
    Sep 25, 2015
    Messages:
    84
    Likes Received:
    20
    Hi,

    My game is closing after the loading screen appears.

    I discovered that I have 86 atlases is there any way to shorten them?

    I also have musics and sounds of 12 - 14 mega

    A lot of moving characters

    Action animations to change clothes

    The game has 73 mega

    Is my crash after the loading screen related to the size of the game?
    Do you know of any tips to reduce size without cutting out pieces of the game?

    Thanks in advance for any tips and suggestions!!!
     
  2. dusan20002

    dusan20002 Avid Boxer

    Joined:
    Dec 7, 2015
    Messages:
    136
    Likes Received:
    55
    Did you try Tools -> Remove Unused Level , Image Object and Sound Object?
    And also View -> Atlases and on bottom Optimized Atlases.

    Probably you need to resize your image before adding them into BuildBox
     
    amazingafternoon likes this.
  3. Phill Mason

    Phill Mason Serious Boxer

    Joined:
    Sep 25, 2015
    Messages:
    880
    Likes Received:
    721
    @amazingafternoon you definitely need to optimize, 86 atlases is way too many. On the first read I thought you must have made a mistake and meant 86 scenes/levels, surely, as 86 atlases is about 10 times more than you really should have to run a smooth BB game.
    Do what @dusan20002 said above as this will help to remove unwanted items and reduce the overall file size.

    I would imagine that you've got a lot of oversized images that you've tried and tested in your game but not actually using and the same with sounds, so removing all those is the first step, then optimise (make smaller) the graphics you are using and drop the new resized smaller images back into once you're ready. Remember to backup (copy/duplicate) your existing .bbdoc before doing any of these steps, just as a precaution.

    Menu and Gamefield music is nice to remain in stereo, but you can also lower the size of your sounds fx and any other sounds by converting them to mono. I use a great little free bit of software called "Switch for Mac" and probably something like Audacity for Windows.

    I read somewhere here on the forums, that when the Splash Screen loads, your atlases begin to load in the background, so the vast amount of atlases that you currently have must be the maximum strain on the cpu of the phone loading it - to the point that it crashes. See how you get on optimizing the size of your graphics and audio and compare it to your original, then make another build and test on your device again.
     
    amazingafternoon likes this.
  4. Christoph

    Christoph Miniboss Boxer

    Joined:
    Oct 4, 2015
    Messages:
    2,807
    Likes Received:
    2,309
    I copy from another thread because I'm lazy... ;)

    To optimize performance you need to:
    1. Work your graphics always in a 1:1 ratio. Never scale down in BB. (For simple opaque graphics you can upscale)
    2. Re-use your graphics. Never import the same graphic twice. (Sometimes you have to import them twice or more but afterwards you can link them to the same source and delete the duplicates from the atlas. You can do this even in the menus see here: http://buildbox.com/forum/index.php...oss-all-nodes-in-menu-editor.1926/#post-12931)
    3. Re-use your sounds. Never import the same sound twice.
    4. Work always (when ever you can) with smaller scenes.
    5. Don't use more than two atlases.
     
    amazingafternoon likes this.
  5. amazingafternoon

    amazingafternoon Boxer

    Joined:
    Sep 25, 2015
    Messages:
    84
    Likes Received:
    20
    Thanks everyone for all the tips! I am beginning with all those amazing tips you gave me! :)
     
  6. amazingafternoon

    amazingafternoon Boxer

    Joined:
    Sep 25, 2015
    Messages:
    84
    Likes Received:
    20
    okay,

    2 more questions:

    - is tere a way to delete an atlas that is blank?

    - Is there any way of deleting images inside the atlas that are not being used but I have already deleted from objects and did remove unused images and level objects and optimized. But they are still appearing n the atlas....
     
  7. trudnai

    trudnai Miniboss Boxer

    Joined:
    Sep 25, 2015
    Messages:
    1,235
    Likes Received:
    701
    Yes and Yes. Open Atlas editor from View menu, then first click on Optimize on the Right-Bottom, then to the Optimize Atlases. The first will remove unused images and rearrange remaining images over the Atlases while the former one will remove unused Atlases...

    You know how to tell BB to use same image over several Objects, Actions and other stuff right? Before doing that Atlas optimization you have to go through your game objects and do the hard work by hand because unfortunately BB will not do this automatically for you...
     
  8. amazingafternoon

    amazingafternoon Boxer

    Joined:
    Sep 25, 2015
    Messages:
    84
    Likes Received:
    20
    hi trundle thank you so much for your answer. So to do that I should and I quote christhop in another treadth:

    "Clones do not work in menu editor.

    But yes, you can do what you want. When I tried to reduce the atlasses as much as I could I found a way. You have to go to the menu interface, then click on an object, let's say the background image. Then on the edit button for the image in the settings on the right, this takes you to the atlas/sprite editor. From there you just select the same background image and save. You repeat that for all your menus and always choose the same sprite from the atlas list. To finish, you go to atlas and optimize it. The duplicates will be deleted."
     
  9. heathclose

    heathclose Miniboss Boxer

    Joined:
    Jan 28, 2016
    Messages:
    1,810
    Likes Received:
    1,026
    @amazingafternoon I'm currently working on a 2nd prototype of my game where I have upgraded the aesthetics of the graphics quite a bit and am now realizing it is waaaayyyyy to huge already... I'm curious how this all went for you.... how many atlases did you end up with... and if you had to make the game over, how would you incorporate these steps as you go...
     
  10. amazingafternoon

    amazingafternoon Boxer

    Joined:
    Sep 25, 2015
    Messages:
    84
    Likes Received:
    20

    Hi Heathclose!

    I ended up with less than 25 atlases and the game worked fine. Not smoothly as I wanted but still working without any further problems.

    I didn't have to redo the game at all which was what was bothering me. And it got accepted smoothly by iOS so no problems there.

    I started the game from another game, from another game. So basically this was my first huge mistake, that's why the number os atlases was huge. Then I placed several animations with about 100 sprites :D huge mistake number 2! lol I learn to make the animations slower within buildbox and that helped a lot.
    Mistake number 3 was that my images were all he so I resized everything and replaced most of the images.

    So these were the most important things to avoid in my case. Hope that helps!
     
    heathclose likes this.
  11. andreas_kviby

    andreas_kviby Avid Boxer

    Joined:
    Feb 5, 2016
    Messages:
    170
    Likes Received:
    44
    Can anyone smarter than me describe what and how to use Atlases in BB? I can see them all, 23 atlases but I don't know how to make that 2 atlases? How do I know when a new atlas is created and how can I re-use images in the game from already created atlas? This should be in the video tutorial as VIDEO #1 because is has such an impact on the game when its ready to fly.
     
  12. trudnai

    trudnai Miniboss Boxer

    Joined:
    Sep 25, 2015
    Messages:
    1,235
    Likes Received:
    701
    Atlas is a technique used in graphics intense applications such as games. What it does is simple: You place multiple images in a single big one to optimize resources such as memory and processing time. Generally speaking your game will use less CPU and GPU time and runs smoother and drains less battery on mobile devices with this simple technique.

    Atlases are generated automatically in BuildBox. You just throw your images in your game and BB will combine them automatically in Atlases. Having said that, BB does not check if two or more images you use are the same or not. Also during the development time you might add and remove many images that needs to cleared up.

    There are multiple problems you need to deal with:
    • Redundancy of images on multiple objects and animations
    • Unused images stored in Atlases
    • Fragmented Atlases
    Redundancy of images when you have multiple objects using the same image or even if a single object has multiple animations using the same image, these are stored separately in your Atlases. You can manually let BB know that these images are the same by Clicking on the Edit on the Animation (Pencil icon), then select the image object in the editor window, and click on the Edit on the left again. Now you can select an image from the existing ones. The list is not ordered in any way so you have to look through carefully to find the very first item belonging to the same image.

    Unused images: When you delete an object you might get these or if you have done with the manual redundancy optimization then for sure you will get some. This process is super simple: Just select Tools -> Remove Unused Image Objects and you are done.

    Atlas fragmentation is when you have many Atlases created already and then you delete images, one or more Atlases might have empty spaces. If you rebuild and/or optimize Atlases, you can rearrange images into smaller number of Atlases and delete the empty ones. Go to View -> Atlases to do these actions. Please note you have buttons on the bottom left and the right hand side of that window.

    Btw it is quite confusing at first but you have names for images in the Atlases, and you have names for the Sprites (Image Objects / Animations) as well which are different. First it seems they are the same but when you try to rename them you will realize they are not. For manual image optimization I found it useful to rename Sprites so that I will know which one will I use and which ones should be dropped permanently.
     
  13. andreas_kviby

    andreas_kviby Avid Boxer

    Joined:
    Feb 5, 2016
    Messages:
    170
    Likes Received:
    44
    Thanks for that answer. This is what I needed to read. Why @Andy and @TreySmith don't you publish an "Introduction and best practices" video tutorial on how to deal with performance, images, animations and atlases? That tutorial would have saved me a week of extra work now when I have to redo all images and atlases in some way.

    How do you make the number of atlases smaller then? I have 12 and I guess that 1-3 is ok?
     
    teeny-weeny likes this.
  14. heathclose

    heathclose Miniboss Boxer

    Joined:
    Jan 28, 2016
    Messages:
    1,810
    Likes Received:
    1,026
  15. Jeunesse.adeel

    Jeunesse.adeel Boxer

    Joined:
    Feb 14, 2017
    Messages:
    2
    Likes Received:
    0
    I got the same problem as you and i'm so thankful to fix it , i did all the steps the respected members gives you but it still crash in my device , until i exported the game into a lower android version and it works more better and faster now and also it saves from the battery , so while you are trying to build your APK from any of those programs make sure you choose a lower android version
     
  16. Astro Games

    Astro Games Avid Boxer

    Joined:
    Nov 15, 2016
    Messages:
    356
    Likes Received:
    190
    All above is correct and if you want to be really proficent with optimisation you should consider slicing your bitmaps (sprites) where possible. Have a loot at this picture to understand what do I mean:
    [​IMG]
    On the left side is a full bitmap of object, character or enemy which takes a lot of empty space between "arms". You can just split it to the body and one arm (if all are the same shape) and now you can see it takes less room. Just repack your atlases like this where possible.
     

Share This Page