"31 Ways to Optimise Your Game Salad Project" - A Q&A about optimising your project
Hymloe
Member Posts: 1,653
I saw this list of optimisations posted on a blog.
"31 Game Salad Optimisation Tips"
http://www.debugdesign.com/2013/01/15/31-gamesalad-optimization-tips/
I'm always keen to know how to save memory and get better performance, especially seeing as my game is pushing Game Salad to the limits (and often to it's knees).
So I wanted to open a discussion here about the list of optimisations, and would love to hear any more suggestions from people out there, and would love to hear confirmations, refutations, or further details, from the Game Salad staff about which of these are true, false, etc.
I've included the full list here:
1. Uncheck “Preload Art” on as many actors as you can.
2. Uncheck “Movable” for every actor that doesn’t have the “Accelerate”, “Change Velocity”, “Collide”, “Move”, “Move to”, or any of the rotate behaviors.
3. Use the “Interpolate” behavior instead of the “Move”, “Move to”, and “Change Size” behaviors whenever possible.
4. Use the “Rotate” behavior instead of animations.
5. Turn every attribute under the physics tab in the actor editor to 0 on actors who do not need it.
6. If the actor is not going to be seen, change their “Visible” attribute to false.
7. Instead of using the “Change Image” behavior, use “Change Attribute” and change the self.Image to the desired image’s name.
8. Images should be the same size as the actor using them and double the size if you are using Resolution Independence.
9. Change any image that is about 10 pixels more than 8, 16, 32, 64, 128, 256, 512, or 1028 to which ever of these numbers are closest.
10. 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.
11. All images should be 72dpi.
12. Save all images as PNG-24 or PNG-8
13. Save all images as PNG-8 unless they have any transparent or translucent object in them.
14. Don’t use the color changer within GameSalad unless necessary.
15. All images should be divisible by 4.
16. Make sure your image creator is set to 8-bits/channel.
17. Don’t use the “Display Text” behavior wherever possible.
18. Try not to use so many global attributes and use tables wherever possible.
19. Try not to use timers. See http://forums.gamesalad.com/discussion/44707/timers-are-for-chumps-gs-optimization-tips
20. Limit constrains and if you do need to use it, make sure that they are on the top of your code.
21. Make your own pause instead of using the behavior. See http://gshelper.com/stop-motion-on-custom-pause-gamesalad-tutorial/
22. If an actor is not being used again in the same scene, destroy it.
23. If you have a game that goes on forever like Jetpack Joyride, Temple Run, or Jay & Silent Bob in Too Fat to Fly, make sure you either move or destroy actors that pass you by using these rules:
Landscape gameplay: If attribute game.MainCharacterPositionX > self.Position.X + (game.Screen.Size.Width/2)+(self.Size.Width/2), then destroy or move.
Portrait gameplay: If attribute game.MainCharacterPositionY > self.Position.Y + (game.Screen.Size.Hight/2)+(self.Size.Hight/2), then destroy or move.
24. You do not have to recycle actors that would be destroyed in the first place, like bullets.
25. Use music at your own risk because it will decrease performance.
26. Delete all unused rules, groups, behaviors, actors, attributes, images, and sounds.
27. Don’t save more than 3 attributes at once.
28. Don’t update all Game Center Achievements/Leaderboards at once unless their is no movement in the scene at that time.
29. Make an initial scene that looks like your splash screen to load attributes and log in to Game Center
30. If you can, unlock actors to constrain to the actor directly. See: http://gshelper.com/gamesalad-performance-tip-1-2/
31. Test your game using Instruments to see the memory, cpu, frame rate, leaks, battery usage, and a lot more.
"31 Game Salad Optimisation Tips"
http://www.debugdesign.com/2013/01/15/31-gamesalad-optimization-tips/
I'm always keen to know how to save memory and get better performance, especially seeing as my game is pushing Game Salad to the limits (and often to it's knees).
So I wanted to open a discussion here about the list of optimisations, and would love to hear any more suggestions from people out there, and would love to hear confirmations, refutations, or further details, from the Game Salad staff about which of these are true, false, etc.
I've included the full list here:
1. Uncheck “Preload Art” on as many actors as you can.
2. Uncheck “Movable” for every actor that doesn’t have the “Accelerate”, “Change Velocity”, “Collide”, “Move”, “Move to”, or any of the rotate behaviors.
3. Use the “Interpolate” behavior instead of the “Move”, “Move to”, and “Change Size” behaviors whenever possible.
4. Use the “Rotate” behavior instead of animations.
5. Turn every attribute under the physics tab in the actor editor to 0 on actors who do not need it.
6. If the actor is not going to be seen, change their “Visible” attribute to false.
7. Instead of using the “Change Image” behavior, use “Change Attribute” and change the self.Image to the desired image’s name.
8. Images should be the same size as the actor using them and double the size if you are using Resolution Independence.
9. Change any image that is about 10 pixels more than 8, 16, 32, 64, 128, 256, 512, or 1028 to which ever of these numbers are closest.
10. 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.
11. All images should be 72dpi.
12. Save all images as PNG-24 or PNG-8
13. Save all images as PNG-8 unless they have any transparent or translucent object in them.
14. Don’t use the color changer within GameSalad unless necessary.
15. All images should be divisible by 4.
16. Make sure your image creator is set to 8-bits/channel.
17. Don’t use the “Display Text” behavior wherever possible.
18. Try not to use so many global attributes and use tables wherever possible.
19. Try not to use timers. See http://forums.gamesalad.com/discussion/44707/timers-are-for-chumps-gs-optimization-tips
20. Limit constrains and if you do need to use it, make sure that they are on the top of your code.
21. Make your own pause instead of using the behavior. See http://gshelper.com/stop-motion-on-custom-pause-gamesalad-tutorial/
22. If an actor is not being used again in the same scene, destroy it.
23. If you have a game that goes on forever like Jetpack Joyride, Temple Run, or Jay & Silent Bob in Too Fat to Fly, make sure you either move or destroy actors that pass you by using these rules:
Landscape gameplay: If attribute game.MainCharacterPositionX > self.Position.X + (game.Screen.Size.Width/2)+(self.Size.Width/2), then destroy or move.
Portrait gameplay: If attribute game.MainCharacterPositionY > self.Position.Y + (game.Screen.Size.Hight/2)+(self.Size.Hight/2), then destroy or move.
24. You do not have to recycle actors that would be destroyed in the first place, like bullets.
25. Use music at your own risk because it will decrease performance.
26. Delete all unused rules, groups, behaviors, actors, attributes, images, and sounds.
27. Don’t save more than 3 attributes at once.
28. Don’t update all Game Center Achievements/Leaderboards at once unless their is no movement in the scene at that time.
29. Make an initial scene that looks like your splash screen to load attributes and log in to Game Center
30. If you can, unlock actors to constrain to the actor directly. See: http://gshelper.com/gamesalad-performance-tip-1-2/
31. Test your game using Instruments to see the memory, cpu, frame rate, leaks, battery usage, and a lot more.
Comments
All images should be divisible by 4. Recommended image sizes should also match the 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048 by 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048 scale.
I would also like to do an extensive tutorial on tiles. I am just not sure if I am the best one to do it from a coding standpoint.
There are a lot of different ways it can be done. For my game I need to see the tiles on the stage so I can not use the techniques in numbers 7 and 10.
If you are doing an endless scroller those rules would be perfect. But not for me unfortunately.
I started using tiles because too many overlapping actors made GS chug real bad.
So another tip would be to not overlap too many actors, keep your static, non moving art layers as flat as possible. Use tiles for larger artwork. Use a non visible GS actor for the ground, or platforms.
This has helped me greatly.
Other tips, I'm not so sure about. Maybe some are out of date, or just guesses. I'm going to raise questions about some below. Would love to hear answers, and any solid test results from anyone who has done comparisons with some of these features...
3. Use the “Interpolate” behavior instead of the “Move”, “Move to”, and “Change Size” behaviors whenever possible.
* I'm not so sure about this one. I think INTERPOLATE has become really laggy lately. But I'm not sure. Seems to really grind my game to a slower framerate during the few times I use Interpolate. But I haven't broken it down and tested different cases with that yet.
5. Turn every attribute under the physics tab in the actor editor to 0 on actors who do not need it.
* I'm not sure why this would make a difference? Does it really make a performance difference? Does it matter if MOVEABLE is turned on or off? I would have thought that whether the Friction, Density, Bounceiness, Drag, etc, were set to "0" or "14.3" or "10000", wouldn't make any difference, because the value still need to be calculated (if MOVEABLE), or not (if NON-MOVEABLE), and the actual value isn't that relevant. Would like to know if this is theoretically or practically true, or not.
Anyone at GS got a technical answer to that hypothesis, or any users with any test results they've done by trying that?
25. Use music at your own risk because it will decrease performance.
* What is meant by this, exactly? Do you think they simply mean "using Play Music" will decrease the framerate?
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Shadows Peak is an atmospheric psychological horror that explores the dark side of a player.
I just saw your video on Mini-Map Radars, which was cool, cheers.
Yes there are things that will make a difference but most of it revolves around generally good code. Not a limitation of GameSalad.
Another big thing is. most of those items where said to be performance optimizations 2 years ago when GameSalad did in fact have major limitations a lacked heavily on performance.
These Days I spawn crap like a maniac and constrain away if its what i need to do. I also use pause all the time its great.
Here let me narrow down that list for you. Please keep in mind this is all my personal opinion
1. Uncheck “Preload Art” on as many actors as you can.
- this only matters if your actor has tons of animation frames that have the potential to never be used. otherwise leave it be
2. Uncheck “Movable” for every actor that doesn’t have the “Accelerate”, “Change Velocity”, “Collide”, “Move”, “Move to”, or any of the rotate behaviors.
- YES
3. Use the “Interpolate” behavior instead of the “Move”, “Move to”, and “Change Size” behaviors whenever possible.
- To an extent this one does help. but it can be limiting in its own respect. if possible sure but dont break your back trying to use that behavior
4. Use the “Rotate” behavior instead of animations.
- This only makes sense if you are taking about a rotating animation.
5. Turn every attribute under the physics tab in the actor editor to 0 on actors who do not need it.
- This only helps if Movable is checked on. Otherwise none of the physics attributes even load
6. If the actor is not going to be seen, change their “Visible” attribute to false.
- Yes
7. Instead of using the “Change Image” behavior, use “Change Attribute” and change the self.Image to the desired image’s name.
- The only reason this would help is if pre load art is checked as on. otherwise its pointless. and why not just uncheck pre load art
8. Images should be the same size as the actor using them and double the size if you are using Resolution Independence.
- Images need to be large enough to be properly displayed on the largest device you are going to support. So if you are building a Universal app from an iphone sized project file you still need ipad retina sized art work.
9. Change any image that is about 10 pixels more than 8, 16, 32, 64, 128, 256, 512, or 1028 to which ever of these numbers are closest.
- This only has any really effect onthe high end of the list. 256, 512, 1024, and 2048 If its possible without negatively affecting your game, then reduce them to save some ram otherwise its not really needed unless you just have way to much RAM ussage to begin with
10. 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.
- HOOPLA!!!
11. All images should be 72dpi.
- Yes but not for performance. for general funstionaly that wont screw up your project File.
12. Save all images as PNG-24 or PNG-8
- Yeah Sure
13. Save all images as PNG-8 unless they have any transparent or translucent object in them.
- Saves project file size not really a performance Thing
14. Don’t use the color changer within GameSalad unless necessary.
- HOOPLA!!!! I use this all the time I believe HTML5 is the only place GameSalad has said this can cause issues
15. All images should be divisible by 4.
- This is a Resolution Independence Rule not a performance rule
16. Make sure your image creator is set to 8-bits/channel.
- Im not sure what this one is. I suck with Art
17. Don’t use the “Display Text” behavior wherever possible.
- HOOPLA!!! this is a visually pleasing rule not a performance issue. When GS finally gets custom fonts i'll be using this puppy like crazy
18. Try not to use so many global attributes and use tables wherever possible.
- HOOPLA!!! This is a good practice but until GS gets setup to allow us to access tables from rule conditions it just makes things more difficult. I have seen games with 500 to 1000 global attributes and it doesn't hurt performance at all.
19. Try not to use timers. See http://forums.gamesalad.com/discussion/44707/timers-are-for-chumps-gs-optimization-tips
- Personally i have never used the method in the thread but i do know hes a super smart guy so this one is probably worth looking at. I have seen timers break things before
20. Limit constrains and if you do need to use it, make sure that they are on the top of your code.
- Meh, You shouldnt have tons by any means but if you need it use it
21. Make your own pause instead of using the behavior. See http://gshelper.com/stop-motion-on-custom-pause-gamesalad-tutorial/
- HOOPLA!!!
22. If an actor is not being used again in the same scene, destroy it.
- Again this is more of a best organizational practice VS a performance issue. the changes a little actor is going to free up any reasonable amount of
RAM is pretty slim. also when your actors get far enough out of the scene they destroy themselves.
23. If you have a game that goes on forever like Jetpack Joyride, Temple Run, or Jay & Silent Bob in Too Fat to Fly, make sure you either move or destroy actors that pass you by using these rules:
Landscape gameplay: If attribute game.MainCharacterPositionX > self.Position.X + (game.Screen.Size.Width/2)+(self.Size.Width/2), then destroy or move.
Portrait gameplay: If attribute game.MainCharacterPositionY > self.Position.Y + (game.Screen.Size.Hight/2)+(self.Size.Hight/2), then destroy or move.
- I'm not sure i agree with this one. if its a never ending game your actors are likely continuing off the screen indefinitely where they will be destroyed on their own. Now i would recommend for a never ending game you should be recycling those actors back to the right of the screen so you dot have to endlessly spawn larger actors
24. You do not have to recycle actors that would be destroyed in the first place, like bullets.
- This is contradictory. If you are recycling actors you should not be spawning actors to begin with. People recycle bullets so they don't have to use spawn. but that means those bullets are getting re used. This would be better worded. You dont have to recycle bullets be cause spawning them doesn't really hurt anything
25. Use music at your own risk because it will decrease performance.
- HOOPLA!!!!
26. Delete all unused rules, groups, behaviors, actors, attributes, images, and sounds.
- This is an organizational issue. No performance issues here
27. Don’t save more than 3 attributes at once.
- Im not sure where this magical number came from. Couldn't hurt but it seems silly
28. Don’t update all Game Center Achievements/Leaderboards at once unless their is no movement in the scene at that time.
- This is not a performance issue but it is true. GameCenter takes bandwidth so you need to give it time to upload each value before it fires the next
29. Make an initial scene that looks like your splash screen to load attributes and log in to Game Center
- This is just a good place to fit a delay long enough to load the stuff. nothing to do with performance. the splash screen is also a good place to start your music so it can never be shut off.
30. If you can, unlock actors to constrain to the actor directly. See: http://gshelper.com/gamesalad-performance-tip-1-2/
- Kinda a double edged sword. unlocked actors add Memory usage because it becomes a unique actor when you open it up like that. So its kinda a toss up over 2 constrains or and unlocked actor and a constrain. I use this but not for performance but be cause its simple and takes less game attributes.
31. Test your game using Instruments to see the memory, cpu, frame rate, leaks, battery usage, and a lot more.
- Sure why not
Cheers
Aaron
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
I think that point #17 ("Don't use Display Text") is suggesting that you don't use it because as a side effect it adds an extra "Constrain" behaviour to your project. But personally, I don't find "Constrains" to be a problem for performance, I have tons of them, I need them.
But, it's not immediately obvious when using the "Display Text" behaviour, but it actually changes the functionality of your project, beyond just displaying some text on screen. It actually ensures that the attributes or expressions that it displays are updated every frame, when they would not be if the Display Text behaviour is turned off.
I've actually found at one point in one of my projects, that I was using Display Text to display the TAG state of an actor. If I turned it OFF, other behaviours wouldn't work! So some of my other behaviours were relying on the Display Text update to update a value for other rules to work off.
That is still in my project now. I have [Display Text: self.Tags], and it has to be on (with the text set to Alpha 0, so I don't see it in the game), for the logic that depends on the tags to work!
I'd like to see what it's capable of when used really really well.
Personally, I've never really seen any Game Salad games that impress me much. There's some nicely polished little games. And that's great. I admire that.
But I'm interested to see things with more scope, done well.
I'd like to see a glowing example of a game with scope, finesse, polish, smoothness, so I have a benchmark to aim for, something to prove to me that there's a high benchmark of possibility.
Most of the stuff I see is just little "shoot the ball into the hole" sort of stuff. And I know Game Salad was kinda spec'd out to make that sort of thing. And it's not designed to make open world simulations (!), but with all the wonderful tricks and techniques one can use to make games, it'd be inspiring to see some really great examples of games that break out of the "dinky mobile game" mould.
I (foolishly?) set out to make a game with a bit more scope, kind of a mini GTAII style game. Top down, jump in and out of vehicles, select multiple weapons, monsters running at you, somewhat large levels, pickups, different sorts of objectives.
I never wanted it to be open world, or anything crazy like that. It is made up of contained levels, only a few minutes long.
And I'm actually really proud of myself (as a non-coder), to have beaten it into a structure that works.
I have 20 working missions, and a system for creating masses of different missions, all from a table.
I have only 4 scenes in my entire project. All missions runs out of a single scene, which is almost empty. It creates everything from a very large missions table. And I'm really happy with how it's coming along.
I spawn enemies around the player, using values from the table to decide the type, amount, spawn time, etc, of enemies. I cap the number that are allowed to be alive at once. I've made it very scalable, so I can meter out the resources slowly, to keep the memory usage and CPU strain to a minimum.
I can control the spacing and number of trees and other objects using table values, so if I have crashes or performance issues, I can reduce these things until it's within safe bounds.
I guess I took a lot of inspiration from games like GTA III, where the city feels alive, but really, two blocks from where the player is, there are 0 cars on the street, and 0 pedestrians walking around. The game is only "alive" around the player. This is how they made the game possible, and yet it felt alive in the player's mind.
These are the tricks game developers use. Games are complex psychological tricks that work in tandem with our minds to create something that doesn't really exist.
It would be great to see some videos of other games that are really pushing Game Salad. Does anyone have any videos to share?
Here's some gameplay from my current game in development... Keep in mind that ALL of the gameplay shown here is happening in a single scene (albeit loading a new set of mission parameters between each mission).
B-Grade Renegade: Early Gameplay Footage
The game may look somewhat simple when watching this video, but when trying to make a game with multiple vehicles the player can get in and out of, 6 different weapons, a shop, persistent inventory to take care of, 4 different mission types (so far), fire and flammable objects, a complex multitouch system where the player can use a d-pad to move, tap a button to reload, and be holding a finger onscreen to aim and fire their weapon... there's a lot going on, a mass of global game variables, and very long and complex sets of behaviours inside some of the main actors, such as the car, the player, and the monsters.
So I'm always looking for new ways to improve performance and save memory (the age old activities of any game developer).
It'd be great to see some more videos of other complex games being made in Game Salad. Anyone know of any?
Love the polish and nuance in the animations and movement of the actors, etc. Wow. Great little gadgets and contraptions, and puzzley gameplay.
But it does fit more into the "one screen game" genre - judging by the trailer and the long playthrough videos - not so much of a larger scope game. Would be cool to see some more open games if anyone has some examples.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
Actually doing a game jam here in Melbourne this weekend, and working on a project I've already started called Little Space Droids, in Unity. I'm teaming up with a programmer, and he's making fast progress! Exciting!
You can check out a playable version of it before we kicked off a few hours ago here.
http://www.muzboz.com/Games/LSD/2013-08-02nd-1900
It's been really fun working in Unity (using JavaScript), which Game Salad has definitely trained me up for. I've learned a ton about game logic through Game Salad.