Best ways to optimize?
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
-
xforce Posts: 187
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. -
andrewm2211 Posts: 341
i was going to compile a list of practices ive learnt and/or try to follow. a few things i do
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?
*keep global attributes as low as you can. use either scene attributes or self attributes where possible... -
Leanne Posts: 168
-uncheck preload art wherever possible, uncheck movable where possible as as well.
-make sure all your image dimensions are divisible by 4
Answers
Does anyone else have anything to add to the list?
http://forums.gamesalad.com/discussion/44707/timers-are-for-chumps-gs-optimization-tips
Uncheck Moveable for any of your non-moving actors.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
http://www.deepblueapps.com/Deep_Blue_Ideas_Ltd./GS_Optimizer.html
http://forums.gamesalad.com/discussion/45293/tweetsheet-crashes-my-life-app#latest
-Don't use blending modes on large actors
-Using small actors (2-12 pixels) that fade in and out or move around is sometimes better than a particle for memory usage.
- Reference a image from a table list of images in place of a animation or a change image. You can even set up some self attributes to count up with some logic and constrain the row/col value to them. This way it loads the image into memory one at a time, and only when called upon and bypasses the need for the sometimes intense behaviors.
I'm probably forgetting some stuff.