Best ways to optimize?

fogartyfogarty Member, PRO Posts: 181
edited June 2012 in Working with GS (Mac)
Has anyone compiled a list of the best ways to optimize a game? I've run across things here and there--like "constrain attribute" uses a lot of memory and it's good to use images that are certain sizes--but I'm always afraid that I'm unknowingly doing 100 other things that are going to make my game sluggish.

Best Answers

  • xforcexforce Posts: 187
    Accepted Answer
    i was going to compile a list of practices ive learnt and/or try to follow. a few things i do

    *keep global attributes as low as you can. use either scene attributes or self attributes where possible. one trick is to use a table for storing data that needs to be globally accessed then in any actors that need to reference the value just have a self attribute inside them that changes it to the table value when they're spawned. its fine to have ALOT of attributes. but ive definetly noticed an increase in performance when tightening up the global attributes list

    * while it's always been said to use recycle over spawn/destroy. ive found my game runs perfectly fine spawning hundreds of objects during the course of a scene. just make sure there is a behaviour in each actor to destroy it (very important)

    *order any rule containers that will go off regularly/alot near the top of an actor

    *having a music file playing in the background can degrade performance alot depending on your game/device/musicfile

    *minimize on invisible actors that have images. even though their alpha is set to 0 the game engine has still loaded the actor's image into memory so if the actor doesn't need to be called upon often then just to spawn/destroy it.

    *timers can impact performance alot on older devices. be mindful of them when you can. one workaround for the "EVERY seconds timer" is to have 2 actors setup out of view and have a third actor that moves left to right. whenever the moving actor touches the 2 stationary actors have a rule to change an attribute that will trigger a change attribute. you can use that change attribute inplace of the timer but you'll have to position the 3 actors in a way that the movement of the third actor will roughly work out to be 1 second of travelling between the 2. (note i wouldn't bother with this if you're releasing to arm7 only but just something i thought of back when i was testing only on a 2g ipod)


    theres alot more. especially when it comes to images. but the above are some things i do.
  • andrewm2211andrewm2211 Posts: 341
    Accepted Answer
    i was going to compile a list of practices ive learnt and/or try to follow. a few things i do

    *keep global attributes as low as you can. use either scene attributes or self attributes where possible...
    Question about that, I was looking into that but quickly realized I can't reference scene attributes from the expression editor. Am I missing something?
  • LeanneLeanne Posts: 168
    Accepted Answer
    -uncheck preload art wherever possible, uncheck movable where possible as as well.
    -make sure all your image dimensions are divisible by 4

Answers

Sign In or Register to comment.