GS running out of memory!

beefy_clyrobeefy_clyro Member Posts: 5,394
edited November -1 in Tech Support
Hi. I have a rather annoying problem and im just trying to see the best way of going about working round it. What i have is one main scene and a results page. You are on the main scene for a minute and then it changes you to the results page. When you hit next it resets the main scenes attributes and changes back to the main scene.

Now what happens on the main scene is it all works off of what stage you are. When a stage is completed (1 minute) it adds to the stage. So the rules are like if stage < 3 do x and y, if stage >2 and < 6 do x and y etc etc.

When running on the viewer the 1st couple of stages stay around 40mb overall, by the time the stages is about 5-8 the overall memory is about 60-80mb! I have limited the things going on screen to under 6 enemies at any given time, the only things that change are the enemies that attack!

Then it seems when the memory is up around 60+mb, the enemy spawner stops spawning. At the start of the round there will always be 2 enemies and then they stop coming! Stage goes up, same again, 2 enemies and then nothing. A few times it does behave as it should, i wonder if its just running out of memory so therefore stops doing stuff! I dont know but its driving me insane trying to get it triggering correctly and reliably!
Does anyone know anything that can be done about this?

Thanks

Comments

  • quantumsheepquantumsheep Member Posts: 8,188
    Personally, I use lots and lots of scenes. As many as I can! :D

    It may seem inefficient, but it seems to flush out memory, which means no crashes and no going above a certain MB level (and if it does, you can easily see what you've added to stop it happening).

    My advice would be to have each level be its own scene.

    OR - stop spawning stuff and just have them 'off screen' till they're needed.

    Hope that helps,

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • JuggerJugger Member, PRO Posts: 238
    OR - stop spawning stuff and just have them 'off screen' till they're needed.

    really? does it help?
    interesting, thx man
  • beefy_clyrobeefy_clyro Member Posts: 5,394
    Hi Sheep. Yeh i normally use lots of scenes but its a game where i thought i could just use the one scene. I am now testing with a new scene for each stage and so far it seems to still be keeping the memory!

    I have got quite a bit resolved though ... The 2 enemies no longer come straight at you when the scene starts. This was due to two attributes, one controlling the right, one controlling the left side enemies, it has a rule;

    if game.enemyright = 1
    spawn enemy x

    etc etc

    Because these would stay activated as soon as you start the stage it would be on a number so spawn an enemy. I now have it so when it goes to the results page it resets these two attributes back to 0.

    The problem with the enemies just stopping after 5 or so rounds was because the attribute which says how many enemies are on screen seemed to get stuck and wouldnt deduct. It only spawns an actor if there is less than 6. So to resolve, on the results page i added a change attribute of enemy count back to 0.

    So it now behaves like this;

    You do a round
    Go to results page - resets attributes like time, enemy spawn and enemy count and adds +1 to the stage count.
    Hit next - rule that says if stage = 1 change scene 1, if stage = 2, change scene 2 etc etc
    Now the scenes are just duplicated from the 1st scene with nothing changed as the rules are setup from within the spawners to do different things depending on what stage its at.

    When testing via the viewer, each time i play a scene the overall memory seems to go up about 5mb!
    Is there a way when using the viewer to actually know what scene you are in? All my scenes look identical.

    Ta
  • quantumsheepquantumsheep Member Posts: 8,188
    Just make an actor that counts what scene you are in.

    So on your results page, when you press 'continue' to go to the next scene, have it add '1' to a variable called 'scene count'.

    Then put the actor in a corner somewhere with 'display scene count' in it. As you only have one scene, it should take you about 5 minutes to do this!

    Good luck!

    QS :D

    Edit - as an aside, you might consider having the words 'Level X' appear in the middle of the screen at the start of each level (with X being the level number).
    If you can't tell what scene you're on, how will your players?
    And if they can't see what level they're on, how will your players get a sense of achievement and progression???

    Cheers!

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • beefy_clyrobeefy_clyro Member Posts: 5,394
    Ah sorry dude i think you've slightly misunderstood.

    In the hud it tells you what stage you are on, therefore the player is well aware.

    Problem i have is where i first set it up it would always go back to 'scene 1' from the results page. it would add to the stage each time and in the actors there were rules that said - if stage < 3 then do x and y, if it is >2 but below <6 do x and y.

    I then used your suggestion to create new scenes rather than keep going back to the same scene after the reults page. So to do this i just copied the original scene and havent modified it, the rules within the actor will reference against the stage number and do as its asked. This is all now working but what i wasnt sure on is if it was definitely going to scene 2, 3, 4 etc or whether it was just sticking on scene 1. The stage will keep going up no matter what scene i go to. What i wanted to know was whether the viewer actually let you play your game and would tell somewhere, you are within scene 1, 2, 3 etc?

    After further testing it seems like it isnt necessarily a memory problem, rather than work my way up through the stages i skipped straight to stage 5 and the total memory was more than what it is if i start on stage 1, therefore it must be due to the increased difficulty so more going on.

    Thanks for your help, i think i'll be sorted now, will just have to release for new phones only which isnt much of a problem as hopefully lots of 3G users are upgrading anyway.
  • beefy_clyrobeefy_clyro Member Posts: 5,394
    @jugger - yes if you can avoid spawning i'd reccomend it, along with timers and constrains they are the main culprits to a decrease in performance. Just there are occassions where you cant avoid it but if you can, keep things off the screen as sheep said and when something triggers it then have them act
  • giacomopoppigiacomopoppi Member, PRO Posts: 914
    oh... i though this problem had been fixed the last update?? :P
Sign In or Register to comment.