How to increase performance / reduce memory usage
Snippy
Member Posts: 19
Hello again
I have been searching the forums for advices on how to increase performance / reduce memory usage.
While applying some techniques, I do not have a playable game on 2G devices! (iPhone 3G, iPod Touch 2G)
I use level timing system that uses 1 integer that stores the time used to complete the level, plus 1 integer that gets loaded with the current level time at level completion and get's saved to the level time integer only if lower then required time to complete (otherwise level = failed) integer. So only best level run-time get's shown at score screen. Using this method I was able to easily implement a level unlock system that unlocks the next level if player has completed the level under a certain time.
I also use a checkpoint system using integers.. logic behind this goes as follows: if player captures a flag, set integer checkpoint + 1, when player reachers finish line check if player has gathered all the required checkpoints (1 required.checkpoints integer for every level that gets set to the desired amount at the start of a scene through an instance an actor that displays the current amount of reached checkpoints).
Then theres my main actor that slightly bounces on platforms with a slight acceleration to one direction.. and a user controlled actor that is constrained to touch + offset.
For main level scene I use a scene that is 2 times the width of the iphone 4 screen, with a scrolling camera offset constrained to main actor.
I use high res graphics for iPhone 4 screen and I have resolution independency checked (absolutely no problems with pixelation/blurring on 2G devices)
What could be the problem in this? There is absolutely no double-code/double-rules (prototype vs instance) nor any cluttered rules. Timers are working perfectly. Did not have a single rule not execute as it should.
FPS on 2G devices ranges from 15 to slightly over 30, on 3GS, iPhone 4 and new iPod touch it's always on 60 fps.
Best part is that I only have implemented 3 levels (of 50), with 6 additional scenes for credits, main menu, help screen, etc.. what would the performance be after adding 47 levels/scenes ?
What I've already done to optimize performance:
- Using 1 actor with many instances, example: 1 background scene actor for all the background images in every scene, and 1 actor for every game element in the game (collidable platforms, main character, user controlled character).
- less rules = better, I tried to optimize most of my code by using less rules in the instances.
- optimize png's, I used a tool to reduce file size of png's (works wonders).
I'm honestly thinking of limiting the game to 3GS and above users to avoid giving users a bad experience
I would be very thankful for any advice!
Snippy
PS: Oh and please excuse the mess in my descriptions of what I have used in the game, english ain't my native language, be easy on me
I have been searching the forums for advices on how to increase performance / reduce memory usage.
While applying some techniques, I do not have a playable game on 2G devices! (iPhone 3G, iPod Touch 2G)
I use level timing system that uses 1 integer that stores the time used to complete the level, plus 1 integer that gets loaded with the current level time at level completion and get's saved to the level time integer only if lower then required time to complete (otherwise level = failed) integer. So only best level run-time get's shown at score screen. Using this method I was able to easily implement a level unlock system that unlocks the next level if player has completed the level under a certain time.
I also use a checkpoint system using integers.. logic behind this goes as follows: if player captures a flag, set integer checkpoint + 1, when player reachers finish line check if player has gathered all the required checkpoints (1 required.checkpoints integer for every level that gets set to the desired amount at the start of a scene through an instance an actor that displays the current amount of reached checkpoints).
Then theres my main actor that slightly bounces on platforms with a slight acceleration to one direction.. and a user controlled actor that is constrained to touch + offset.
For main level scene I use a scene that is 2 times the width of the iphone 4 screen, with a scrolling camera offset constrained to main actor.
I use high res graphics for iPhone 4 screen and I have resolution independency checked (absolutely no problems with pixelation/blurring on 2G devices)
What could be the problem in this? There is absolutely no double-code/double-rules (prototype vs instance) nor any cluttered rules. Timers are working perfectly. Did not have a single rule not execute as it should.
FPS on 2G devices ranges from 15 to slightly over 30, on 3GS, iPhone 4 and new iPod touch it's always on 60 fps.
Best part is that I only have implemented 3 levels (of 50), with 6 additional scenes for credits, main menu, help screen, etc.. what would the performance be after adding 47 levels/scenes ?
What I've already done to optimize performance:
- Using 1 actor with many instances, example: 1 background scene actor for all the background images in every scene, and 1 actor for every game element in the game (collidable platforms, main character, user controlled character).
- less rules = better, I tried to optimize most of my code by using less rules in the instances.
- optimize png's, I used a tool to reduce file size of png's (works wonders).
I'm honestly thinking of limiting the game to 3GS and above users to avoid giving users a bad experience
I would be very thankful for any advice!
Snippy
PS: Oh and please excuse the mess in my descriptions of what I have used in the game, english ain't my native language, be easy on me