GameSalad Best Practices: Asset Pre-Loader – Part II
October 7 2011, 11:31pm
Billy Garretsen leads GameSalad’s internal Game Team One. He has been an independent game designer for more than ten years. He’s helped develop titles for all the major game consoles, as well as numerous games for PC and mobile platforms. His most recent GameSalad title was 2 Broke Girls, currently available on GameSalad Arcade, iOS, Facebook, and the Chrome Web Store. The original “best practices” post I created may not have completely explained the new memory management features. In this amended post, I will dive a little further into what is happening under the hood so that you may better determine how you will take advantage of these features to improve your game performance. Scene Loading Timeline The Preload Art attribute allows you to decide to load your images up front when the scene is loading or after the scene has started running. Below, you can see how GameSalad makes this work. When Preload Art is ON (default) all of your images get loaded into memory before the scene runs. The amount of time it takes to load your scene will be determined by how many actors you have and how much art is referenced within those actors.
When Preload Art is OFF for any actors, what will happen is GameSalad will ignore any references to artwork inside of the actors’ behaviors. This will improve load times, as less art is needed to be loaded into memory before the scene starts running. You will notice, though, that the art will load on the fly as needed until your scene changes. RAM Exchange and Game Performance After reading some of the confusion on the forums, it is clear that many users are expecting the Preload Art attribute to improve game stability, performance and RAM usage. While this attribute can definitely improve RAM up front it does not take care of asset optimization. If your scenes are reaching elevated RAM limits it will still be up to the developer to take measures to better optimize their art, actors and scenes. Luckily, part of the new update in 0.9.8 is a back end asset manager that will monitor your RAM and unload textures as necessary to prevent exceeding the RAM limits and crashing your game. When using the Preload Art attribute it is important to remember that even though your scene loading order is handled differently, the overall CPU and RAM usage will still be the same. In the diagram below you can see that in both cases, the textures in memory will continue to grow as your scene runs, regardless of when the images are loaded into RAM.
Ultimately it is still up to every developer to know when and how to best optimize their game for maximum performance and stability. The Preload Art attribute and asset manager are merely tools to help developers achieve their target performance numbers and will only be useful if used appropriately. A Word About NULL Textures and Optimization Tricks In the original Best Practices post for Preload Art, there were two tips included that made suggestions to use a NULL texture to trick your game into loading scenes lightning fast. This is definitely an optimization TRICK and not LAW. It is not recommended to enable this trick during your core development as it is not practical to work with “invisible” actors. Please only attempt to utilize the null texture techniques at the end of your project when you are polishing it up for publishing. Every developer (John Carmack included) goes through a huge optimization effort before their products ship. There are always tough compromises one must make: “Do I chop out animation frames? Do I lower the resolution of a background image? Do I use dynamic tinting to create enemy variants instead of unique art assets?…” The list goes on, and everyone’s challenges will be different. I hope this better explains how GameSalad handles art assets and gives you the knowledge necessary to know when and how to take advantage of the new Preload Art attribute.

Via: http://gamesalad.com/blog/2011/10/07/gamesalad-best-practices-asset-pre-loader-part-ii/

