People I require your assistance, logic that I can't work out how todo

FirstDanFirstDan Member Posts: 208
edited October 2012 in Working with GS (Mac)
Hi
After testing my finished game for the last few weeks, I’ve noticed that the performance degrades as the player progresses on. The reason for the degrading of performance is that I am constantly spawning actors and destroying them. In the past I have tried to code a recycling process but all failed, after 8 months, and with a better understanding of games development, I have plan to rip out the spawn actor/ destroy actor function and replace with an eco-friendly recycling process.
Sob story over 

My question:
I have a moving actor, that moves across the scene (scene is width = 600)
I have a waitingHolder actor and a holderDeploy actor.
There are 5 moving actors, on the screen,

What I need:

When moving actor.self.pos.x > 500 then move to waiting holder.

If movingactorcount < 6 + holderdeploycount =0 (meaning that there is no actors on this holder to commence deployment)-- move 1 moving actor from the waiting holder to the holderdeploy,

Note: that there could be 3 actors in the waiting holder, this is where I get stuck, I can’t individually move an moving actor to the holderDeploy, when I change the location they all move.

When 1 actor is in the holderdeploy actor, then after 1 second simply send the moving actor back in the scene with a change velocity , and the process keeps on running.
Currently I have the moving actors on screen, and then I destroy them, and spawn again.
(The reason for the timer is, because I want my blocks to have a 1 second gap, between each other )

Although I have a lot more actors in my game, around 28 actors that require this process, I’m cutting it short in this discussion, so that it doesn’t overwhelm me.
If anyone can point me in the right direction, I would be ever so grateful, as I’m getting depressed , with my failed recycling attempts.

Dan
-------
Mood = upset

Comments

  • epicstagepicstag PRO Posts: 132
    edited October 2012
    If I'm understanding, what you need to do is to give your actors(the ones that you put into the holders) an id of sorts, like an integer attribute called like, actorID.

    Then give have your holderDeploy actor set a game attribute, such as spawnActorWithID integer. Put a rule in the holderDeploy actor that says, When game.spawnActorWithID = 1(plus your other 1 conditionals or whatever), spawn actor 1, else when game.spawnActorWithID = 2, spawn actor 2 etc etc etc.

    Hope this helps. I use this method a bit since I pull images dynamically from tables.
  • FirstDanFirstDan Member Posts: 208
    @stoney, thanks for your response but im not spawning actors, im trying to recycle, your methodology doesnt work the way i need it to, but thanks for your input.
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    Evening... sorry its late and my mind is struggling to understand what your after...

    But incase you've not yet come across it... T-shirt has a great video on recycling actors...in this case bullets.

  • epicstagepicstag PRO Posts: 132
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    Why do you suspect it is spawning actors that is causing the performance issues? I spawn and destroy actors all the time usually mass amounts of bullets and do not have progressive performance problems. What device are you testing with? I suspect it's more to do with your overall logic than just spawning.
  • FirstDanFirstDan Member Posts: 208
    @stoney - hmmm, no luck, drinking a cup of tea

    @FBS - been awhile chap, im tesing on the iphone 3gs, i have 30 actors that i need on a scene, and im using the traditional spawn, destroy methods. I guess recycling the actors would be better, as i read that, spawn and destroy increases ram. getting this recycling working, i can reset the scene without using the reset scene behaviour.
Sign In or Register to comment.