Game Engine RAM !!

keekee312keekee312 Member Posts: 91
edited November -1 in Working with GS (Mac)
Hi, I just created the beggining of my game a few hours ago, the project size is 1mb and the game engine already reaches 78mb in the GS viewer :(

I have ONE actor copied 100 times on my screen with random values from 1 to 9, set to unmovable and have many rules in it (lots of self.**** rules because each actor is "unique" and have a specified color)

Do you know how to decrease the game engine RAM usage because it's just the beginning of my game (the gameplay is done but I'll need more features in this actor so I guess it will increase again and again)

Thank you very much

PS : will it be solved in the next release ?

Comments

  • quantumsheepquantumsheep Member Posts: 8,188
    Mr. Booth is of course correct.

    Alternatively, wait for the update with memory and performance increase promised and wait and see how it works on that.

    But 100 actors with lots of rules is asking for trouble! :D

    QS :D

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

  • keekee312keekee312 Member Posts: 91
    But this is the same actor :( don't say that I'm going to cry
  • keekee312keekee312 Member Posts: 91
    1) and will it change something If I divide the unique actor (which value change from 1 to 9) into 9 differents actors ?

    2) Or If I change color images instead of generating a random RGB color ?

    3) If I set rules into an other actor instead of the main one, will it change something ?

    Thanks I really need this game, i'll make a few test this evening and If nothing changes, I'll delete 2 dozens of my 100 actors
  • firemaplegamesfiremaplegames Member Posts: 3,211
    Do the colors of the Actors change? Are they random?

    You are able to have that many actors, I have that many in some of my Scenes.

    But you just generally can't have that many Rules.

    Instead of having one Prototype, and all of the code in it to handle all of the different instances, perhaps you need to have all of the code in the instances themselves.

    That way you don't have useless code in each Actor.

    In a ideal world, you would have a nice, object-oriented system going. With all the code in the Prototypes, and all the Instances would derive from them.

    But on these mobile devices, RAM is very limited.
    You will usually have to sacrifice some ease of use to get things working.

    So if your Instances are carrying any extra "weight" by accounting for other Instances, if they have code in them that will never get called, I suggest you strip it out and put the code in the Instances instead of the Prototypes.
  • victorkin11victorkin11 Member Posts: 251
    image
    My Game have up to 52 bubble, is run ok in iphone 2G.
  • StusAppsStusApps Member, PRO Posts: 1,352
    I set up a random spawning square test that would keep spawning rows of 20x20 squares of different colours, the only rules they had were a few placement rules. I found that I could comfortably get a few hundred on screen on a 2g ipod touch within reasonable memory levels, however the fps slowed to an absolute crawl after about 150.

    If your game has actors with lots of rules then I'm afraid GS won't let you have lots on screen at once.
  • keekee312keekee312 Member Posts: 91
    Thank you for answers :)
    I'm not sure about how to deal with instances. I have to click on one of my actor on the screen, right ? But that means I have to manually choose their value anf it will always be the same no ? Because if I put the "value generator" in each actor instance, it will change nothing from my original try... I don't understand everything

    Thanks, I really need this game
  • victorkin11victorkin11 Member Posts: 251
    I Suggest you to do the simple project first.
  • keekee312keekee312 Member Posts: 91
    victorkin11 said:
    I Suggest you to do the simple project first.
    what do you mean by the simple project ? The main gameplay is done and i want my project to be OK before i continue till the end (in case i should modify everything)
  • StusAppsStusApps Member, PRO Posts: 1,352
    even with minimal rules I think it might have been the spawning that killed cpu speed.
  • keekee312keekee312 Member Posts: 91
    In fact that's the issue... A random number between 1-9 is chosen, if 1 change image 1.png and change value to 1, if 2 etc... Change self.color to color number 1-20
    When touch pressed
    + value =1
    Change self.color to grey (selected)
    Change self.touched to 1 (means selected)
    Change valueselected to ...+1

    That's the idea. I have also a rule when it's selected and you retouch it to deselect it. You also have a rule which checks if the valueselected number is equal to game.result or not. Then when game result = valueselected then change result, destroy actor selected
  • IsabelleKIsabelleK Member, Sous Chef Posts: 2,807
    I have no idea if it'd be any help in your game, but for me, it worked great:
    Instead of destroying current actor and spawning new actor, I just change (using a rule) current actor's image and rules.
    There is less actors, so game engine memory usage is lower.
  • keekee312keekee312 Member Posts: 91
    MarcinMakaj said:
    I have no idea if it'd be any help in your game, but for me, it worked great:
    Instead of destroying current actor and spawning new actor, I just change (using a rule) current actor's image and rules.
    There is less actors, so game engine memory usage is lower.

    In fact I don't spawn actors, they are already spawn in the Stage, but thanks for the tip, it can be good for other games ;)
  • keekee312keekee312 Member Posts: 91
    Update : I re-made the project in a different way, I mean this time I put about 70 or 80 actors on the stage (9 different actors) with the same rules and now Total Ram is about 40 so that's great, not great because it's just the beginning of the game (so more rules to come) and I have to put 80 actors on the stage on my own but that's good :)
  • IsabelleKIsabelleK Member, Sous Chef Posts: 2,807
    Great to hear it! Good luck.
Sign In or Register to comment.