Relation Between "Recycling Actors" And Using "Spawners". Interesting discovery?

cbtcbt Member Posts: 644
edited November -1 in Working with GS (Mac)
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.

Comments

  • cbtcbt Member Posts: 644
    Sorry for bumping but, I'll just continue the project according to the answers..
  • SnowSnow Member Posts: 124
    I guess this all depends about memory usage. All I know is that when an actor is destroyed - it remains in memory and fills up memory.. unless that's been fixed. If you simply pool actors and have them change to an off-screen position and wait when collided should be a lot less of a resource hog since all you're doing is changing 2 attributes of the actor - it's position and possibly it's motion.
  • xznkokxznkok Member Posts: 33
    From my testing ,the performance (fps, memory) is not affected by spawn and destroy, and the number of actors either.

    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。:)
Sign In or Register to comment.