Relation Between "Recycling Actors" And Using "Spawners". Interesting discovery?
cbt
Member Posts: 644
We all know spawning and destroying is bad for the performance.
But, on this project, spawning is a LOT less recourse consuming!
I was preparing a project to help a user in the forum but, I saw spawning is better than recycling. (If i didn't do things all wrong.)
Just take a look at the projects;
Recycled;
http://gamesalad.com/game/9093
Not recycled;
http://gamesalad.com/game/9094
I don't know if you will able to see the difference because of the minimal resource usage, but, I used a 1st gen iPod Touch and it was clear.
But, on this project, spawning is a LOT less recourse consuming!
I was preparing a project to help a user in the forum but, I saw spawning is better than recycling. (If i didn't do things all wrong.)
Just take a look at the projects;
Recycled;
http://gamesalad.com/game/9093
Not recycled;
http://gamesalad.com/game/9094
I don't know if you will able to see the difference because of the minimal resource usage, but, I used a 1st gen iPod Touch and it was clear.
Comments
The performance is totally affected by how complicate of rules of actors. For example, the first app, I have 5 actors in one scene and keep shooting bullets(1 bullet/0.1s) which means the app spawn and destroy 50 bullets per s. The result is , the memory does not increase too much, and the fps is stable 58-60.
The second example app, I spawn 10 actors with complex rules(more than 20) on one scene, the performance suddenly decrease to 45 fps, then along with the actor be destroyed one by one, the fps back to normal.
From my test above now you should understand better with spawn and recycle.
recycle for my suggestion is just used for, non-complex actor (like bullets, or some effect)
And for complex actor with many rules,I strongly dont recommend to recycle, just use spawn and destroy, thats not as bad as you imaged of memory waste。:)