How to decrease memory usage (100MB)

keekee312keekee312 Member Posts: 91
edited November -1 in Working with GS (Mac)
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

Comments

  • firemaplegamesfiremaplegames Member Posts: 3,211
    Are you using 44MB worth of images in your Scenes?
  • synthesissynthesis Member Posts: 1,693
    Are the spawned actors large and/or complex (heavy)? If so...that could be the cause of the slow down.
    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.
  • IsabelleKIsabelleK Member, Sous Chef Posts: 2,807
    How is it possible to have 34 mb game engine per scene? What kind of game it is?
  • keekee312keekee312 Member Posts: 91
    @firemaplegames : No sir only 10mb :( (they are png, HD resolution and 72 dpi)

    @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 ?
  • keekee312keekee312 Member Posts: 91
    MarcinMakaj said:
    How is it possible to have 34 mb game engine per scene? What kind of game it is?

    You control a character, eggs are falling down and you have to touch them to make them disappear, simple no ? but there are a lot of rules because there is a tongue which is spawned, powers, achievements etc
  • firemaplegamesfiremaplegames Member Posts: 3,211
    How many images do you have in each Scene? And how large are they?

    Every 960x640 image that you have is a Scene uses 1.8MB, regardless of file size.
  • keekee312keekee312 Member Posts: 91
    Main scene :
    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)
  • firemaplegamesfiremaplegames Member Posts: 3,211
    So, your image RAM breaks down like this:

    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.
  • keekee312keekee312 Member Posts: 91
    Yes but when an egg is touched, this actor is destroyed and when you touch the power to activate it, the image is destroyed too.
    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 ?
  • firemaplegamesfiremaplegames Member Posts: 3,211
    The image RAM does not get freed up when an actor is destroyed. Only when you Change Scenes.
  • keekee312keekee312 Member Posts: 91
    Damn, I used to create a scene for each unique scene but it didn't work because I copied too much actors.
    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
  • IsabelleKIsabelleK Member, Sous Chef Posts: 2,807
    I'll put my two cents. It's only a suggestion, and it'd be great if some more experienced GS user, tell if I'm right or wrong. Maybe you could use instances (when it is possible) instead of many actors.
    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.
  • AfterBurnettAfterBurnett Member Posts: 3,474
    I'd suggest waiting for the GS update and see how that helps. I'm holding off work on my current game because of the memory leaks.
  • keekee312keekee312 Member Posts: 91
    @MarcinMakaj : what do you mean by instances ? (sorry I'm french :D )

    @POLYGAMe : So I'll wait for a year :)
  • AfterBurnettAfterBurnett Member Posts: 3,474
    LOL, hopefully not a year.
  • IsabelleKIsabelleK Member, Sous Chef Posts: 2,807
    @keekee312: I'm not an english native speaker too, but I'll try to explain: when you are editing your actor ON the scene (after you open the padlock) you are editing instance of this actor.
    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.
  • keekee312keekee312 Member Posts: 91
    MarcinMakaj said:
    @keekee312: I'm not an english native speaker too, but I'll try to explain: when you are editing your actor ON the scene (after you open the padlock) you are editing instance of this actor.
    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.

    Lol ok thanks i'll try ;)
Sign In or Register to comment.