People I require your assistance, logic that I can't work out how todo
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
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
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.
But incase you've not yet come across it... T-shirt has a great video on recycling actors...in this case bullets.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
@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.