How to decrease memory usage (100MB)
keekee312
Member Posts: 91
I was wondering why my game on my iPhone is slowing down every 2 sec (I mean for 2 sec it runs normally then slow down for a few millisecond then is running normally again etc)
I built the game in the GS viewer and here what I have :
Total memory usage : 64MB on the menu and 103MB (ouch) on the game screen..
FPS is 60 or between 35-60 on game screen but the memory usage is mainly used by Images (44mb on game screen) and game engine (34mb on game screen).
Keep in mind that visible is uncheked and movable too for unovable actors etc.
So now I don't really know what to do but I can tell you that I have 4 actors for levels (which are spawned according to levels (4 because more than 8 level's settings in one actor make Gamesalad become very very vey slow) so I think it could be the main problem ?
Thanks for answers
I built the game in the GS viewer and here what I have :
Total memory usage : 64MB on the menu and 103MB (ouch) on the game screen..
FPS is 60 or between 35-60 on game screen but the memory usage is mainly used by Images (44mb on game screen) and game engine (34mb on game screen).
Keep in mind that visible is uncheked and movable too for unovable actors etc.
So now I don't really know what to do but I can tell you that I have 4 actors for levels (which are spawned according to levels (4 because more than 8 level's settings in one actor make Gamesalad become very very vey slow) so I think it could be the main problem ?
Thanks for answers
Comments
Also...make sure your images are 72 dpi.
It sounds to me like you really need to see if you can reduce your image demands...and make the game more efficient. Make the images smaller and lighter if possible and look for ways to reduce those loads such as reusing images...reducing animation complexity, etc.
@synthesis : yes they are very complex (to me) I mean for each level, actors are spawned according to timers, random numbers, attributes etc ( I have less than 5 actors spawned every sec). There are also conditions when you win, when you re-win, when you lose etc.
Do you think an actor for each level would be better ?
Every 960x640 image that you have is a Scene uses 1.8MB, regardless of file size.
the background is the largest (1024x683 but automatically resized)
10 blocks for the ground (358x 290)
the main character + 11 animations for left and 11 for right (122x148)
the toolbar (900x300)
That's it, then only eggs are spawned (300x300) and powers (2 squares max of 300x300)
2.0MB - the background is the largest (1024x683 but automatically resized)
3.1MB - 10 blocks for the ground (358x 290)
1.1MB - the main character + 11 animations for left and 11 for right (122x148)
800KB - the toolbar (900x300)
So those graphics already use 7MB
That's it, then only eggs are spawned (300x300) and powers (2 squares max of 300x300)
Every 300x300 graphic you add to the Scene adds 270K
So if you spawn an egg plus two power squares, that's almost 900K, just less than 1MB
That is why your RAM keeps increasing.
Do you think a rule for eggs such as : when self.position y < 0 => destroy it... would be good and prevent memory from increasing ? (if you don't manage to touch it)
Anyway, if I touch an egg and so make it destroyed, the memory usage shouldn't increase, should it ?
So last question. when a level is completed, and you go to level up, the scene is reset, so why it keeps being slow ? But the real question is : why is it slow at first level (so since the beggining of the game while no more than 10eggs are spawn at level 1 because 3 slow eggs are enough to go level up)
Thanks
It won't decrease images memory usage, but I think it should decrease your game engine memory usage.
So you'd have more RAM to use.
@POLYGAMe : So I'll wait for a year
So you can make one actor, and put him in the scene for many, many times and just edit each of instances.
But I'm not sure if it decrease the game engine memory usage. It'd be great if some more experienced GS user said something more about it.