Optimising without a device

ArmellineArmelline Member, PRO Posts: 5,374
Hey all,

I decided to get off my ass and make a game that's been sitting in the back of my head for a while, and I knew from previous playing that GameSalad would make it easy.

So the past couple of weeks I've been putting the game together, and now I'm at a point where I'm mostly done with the core functionality and just need to add more levels. The problem is that the levels take a long time to get just right and I don't want to dump hours and hours of time into making them if it turns out my game is managing resources badly. For all I know I'll get 1 fps on an actual device.

A typical level has a lot of static, unmovable actors. There's not that much complexity to the game, but sometimes in the viewer is moves a little stuttery. If it's doing that in the view on a top-end Mac, it makes me worried about on-device performance. I'm positive that I'll be able to optimise a reasonable amount and if my current way of doing things just don't work I have ideas on how to do things differently.

But the bottom line is until I can test on a device there's little point me pushing forward with making more levels. Or even fine-tuning the current ones (actor placement wise, that is).

I previously had an Objective-C game on the app store (that got bullied off the store by legal threats from a major board game company - threats without ANY merit but that I simply couldn't afford to fight (they were releasing a competing app based on the same type of puzzles)). But my account expired a couple of years ago and with the Enrollment being down I can't renew it at the moment.

So to get to my point, what things can I be doing to optimise my game, and what things are typical "bad" scenarios in GameSalad that will cause bad performance.

Perhaps we can compile a few things to watch out for in this thread?

Some things I'm already conscious of:

* I'm preloading as little art as possible.
* I'm trying to structure my rules as efficiently as possible (sometimes more successfully than others).
* I'm using rules rather than timers.

Comments

  • DuesDues Member Posts: 1,159
    edited August 2013
    ....
  • ArmellineArmelline Member, PRO Posts: 5,374
    edited August 2013
    Somehow I managed to read that a year ago and it not occur to me at all today.

    There's a lot of things there with no explanation, though, which makes me worried about implementing some. Some followup questions (added ticks to show the answered ones!):

    ✗ 1. I couldn't find anything about scaling effects of number of actors on and off screen and performance. Is it better to destroy and then respawn an actor when the camera moves off it and then back to it, or to have it sit there, for example?

    ✓ 2. What is the benefit of using a png-8 if a jpg produces a lower file size? - As noted below by FryingBaconStudios and BoomshackBarry, GS converts all images to png and if I'm reading BoomshackBarry correctly, at least tries to use png24 only when necessary.

    ✓ 3. Does it really save resources to use an image change rather than a display text? - According to tenrdrmer the performance change isn't an issue, so doing this would only increase file size. That said, better fonts in images.

    ✓ 4. In what circumstances is better to NOT uncheck "preload art"? - According to tenrdrmer this only matters if your actor has animations. So almost all of mine should be fine leaving it on (I find out after turning them all off :P)

    ✓ 5. Turn every attribute under the physics tab in the actor editor to 0 on actors who do not need it." Is this really worth it? It'll take a long time but I can't see why it would affect performance if they attributes aren't used by the actor? - According to tenrdrmer my instinct was correct and these attributes only load when needed.

    ✓ 6. "If an image file is large or is a background, have the actor that uses the image use the suggestion in number 7 instead of having the actor start initially with the image." This doesn't lead to any kind of 'image pop-in'? - According to tenrdrmer this is "Hoopla". So my question becomes moot.

    ✓ 7. "Make your own pause instead of using the behavior. See http://gshelper.com/stop-motion-on-custom-pause-gamesalad-tutorial/" This link is broken, so what is the rationale behind this tip? And how complicated is it to implement this (unknown to me) alternative? (found it: http://gshelper.com/shop/advanced-game-functions/stop-motion-on-custom-pause-gamesalad-tutorial/) - Okay, I watched the video now. Is the rationale behind this one really just the loading symbol? Until I test on device I can't judge how bad it is but it seems a whole lot of work and extra rules added for a very minor thing. Is there further justification for this? - tenrdrmer seems to think there's no performance reason for this, but I'll reserve judgment until I try my game on a device.

    ✓ 8. "Use music at your own risk because it will decrease performance." To what extent? How much is a single looping music track going to affect things? - Another hoopla according to tenrdrmer.

    ✗ 9. "Don't save more than 3 attributes at once." Why? What kind of diminishing returns would I be looking at?

    ✓ 10. "If you can, unlock actors to constrain to the actor directly. See: http://gshelper.com/gamesalad-performance-tip-1-2/" This link is also broken, what is this one saying? (I presume this one? http://gshelper.com/shop/free-templates-and-tutorials/gamesalad-performance-tip-1-2/) Okay watched this video too now and this is something I discovered as I worked on my game. I have a bunch of double-constrains in the stuff I did early on but use this method in things added later. Time to go back and change the early ones I guess!

    ✓ 11. At times I used integers when booleans would function equivocally. Is it worth me going back and changing them, performance wise? - MarkOnTheIron reported back in 2011 to having issues with booleans. Quite likely fixed in a GS build since then I'd guess. Calvin9403 argued in the same thread that booleans save memory, but as BoomshackBarry noted below, it's likely to be a negligible amount.

    ✗ 12. Is there any performance impact whatsoever from using mixed case and multi-word attribute and actor names?

    ✗ 13. Unrelated but still... Is it normal for GameSalad to crash A LOT? I get maybe 20 crashes a day - mostly when changing scene size attributes, but far from exclusively.

    Sorry for all the questions. I'm going a bit stir crazy not being able to test on a device :D Will watch those two videos now too and update my questions after.

    Everything else that is relevant to my project I was already doing naturally it seems so maybe things will go better than I fear when I finally get to run it on my phone!
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
  • ArmellineArmelline Member, PRO Posts: 5,374
    Great link, thanks! I've added responses from it to some of my questions, but there are still some questions unanswered :D I'll list them below to save people reading my walls of text if they don't want to:

    1. I couldn't find anything about scaling effects of number of actors on and off screen and performance. Is it better to destroy and then respawn an actor when the camera moves off it and then back to it, or to have it sit there, for example?

    2. What is the benefit of using a png-8 if a jpg produces a lower file size?

    9. "Don't save more than 3 attributes at once." Why? What kind of diminishing returns would I be looking at?

    11. At times I used integers when booleans would function equivocally. Is it worth me going back and changing them, performance wise?

    12. Is there any performance impact whatsoever from using mixed case and multi-word attribute and actor names?
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    Gamesalad converts JPG to PNG on Import.
  • ArmellineArmelline Member, PRO Posts: 5,374
    edited August 2013
    Well that answers that one :D I must dig out the list of formats. Explains why sometimes adding an image made the project size go up by more than the size of the image. Do we know for certain that GS treats a png8 and a png24 differently? Or does it convert all to png24 rather than attempting to detect if there is transparency?

    (Can't find an official list but it seems .png, .ogg, .m4a)
  • BoomshackBarryBoomshackBarry Member Posts: 712
    11. At times I used integers when booleans would function equivocally. Is it worth me going back and changing them, performance wise?
    From what I'm led to believe this would have no noticeable effect. Reserving the memory for integers rather than booleans may take up a small amount more ram, but I think unless you had many thousands of attributes then this would be such a small increase as to be insignificant.

    I can't remember for the of me where I read that - I seem to remember Tshirtbooth explaining it, and that he uses integers rather than booleans so that he has the flexibility if he ever needs to go back and add more conditions to a rule, for example.

  • ArmellineArmelline Member, PRO Posts: 5,374
    Thanks for the reply BoomshackBarry. The possible extra conditions were exactly why I went with integers in the first place - but turns out some will definitely only ever need the two conditions. I'll not go back and change them then unless I find myself really having to push for every last bit of optimisation possible.
  • BoomshackBarryBoomshackBarry Member Posts: 712
    Do we know for certain that GS treats a png8 and a png24 differently? Or does it convert all to png24 rather than attempting to detect if there is transparency?

    (Can't find an official list but it seems .png, .ogg, .m4a)
    Gamesalad has had a bug for ages where it always tries to import all pngs as png8. This can cause problems if you import a nice high colour png24 and Gamesalad butchers it by reducing the colours. The workaround is to leave an area of transparency within each image, even if it's only one pixel at 1% transparency, this will then force Gamesalad to import it as a png24. I think this has been fixed in the nightly builds now though.
  • ArmellineArmelline Member, PRO Posts: 5,374
    edited August 2013
    Hmm, interesting. That explains another issue I had and worked around (by accident) with the method you mentioned. Updated my questions to reflect your advice!
Sign In or Register to comment.