Recycling the proper way ?
Stormtrix
Member Posts: 256
Morning,
Been trying to search through the forums for information on recycling of actors to save on memory and performance vs. the spawn and destroy route that all my apps use and I'm trying to understand the proper way to do it.
Which way would be preferred to save on either memory or performance or something.
A) Actor is in camera view but it's alpha is set to 0 and then when needed change alpha to 1
Keep actor out of camera view and when needed interpolate it into view and change alpha to 1
C) Scene is portrait and 1600 wide -- Main menu at x-0, credits at 320, info at 640, something at 960 and game running at the 1280... by having your info and credit images alpha 0 out of camera view is saving memory/performance or do they need to be like in the 'gray area' like (y) -10 or 500 and then interpolate in.
I was having these spawned and destroyed thinking i was saving on memory - but now i just want to have them there and use them when needed.
Have so much retweeking to do now that i'm reading up on this whole recycling thing
Thanks and have a great day!
Been trying to search through the forums for information on recycling of actors to save on memory and performance vs. the spawn and destroy route that all my apps use and I'm trying to understand the proper way to do it.
Which way would be preferred to save on either memory or performance or something.
A) Actor is in camera view but it's alpha is set to 0 and then when needed change alpha to 1
Keep actor out of camera view and when needed interpolate it into view and change alpha to 1
C) Scene is portrait and 1600 wide -- Main menu at x-0, credits at 320, info at 640, something at 960 and game running at the 1280... by having your info and credit images alpha 0 out of camera view is saving memory/performance or do they need to be like in the 'gray area' like (y) -10 or 500 and then interpolate in.
I was having these spawned and destroyed thinking i was saving on memory - but now i just want to have them there and use them when needed.
Have so much retweeking to do now that i'm reading up on this whole recycling thing
Thanks and have a great day!
Comments
Taking them away from screen, moving them and calling them it's up to the logic you use, cause it can be done in different ways. Both my template and utopiangames shooter one makes use of non movable actors and recycling.
But if I was concerned about it, I would use a single change attribute to chuck the actor off the screen. I think that's less intensive than interpolate... but not as cool looking... like with the screens at the start of Annoyed Tomatoes.
The problem with recycling actors is that you run into another problem. The game still has to keep track of them. You're trading one set of problems for another. I'd rather just delete them and forget about them. Sure, I check to see memory usage, but image management is a far bigger problem for me than recycling actors. That's the problem with alpha 0 vs. invisible. You can't change invisibility while GameSalad is running. That is unfortunate, as invisible actors use less processing power than visible ones.
For the recycling, it makes a difference in bigger projects, or in one where spawn is really intensive. Plus, if the image is not pre-loaded in memory (does gs preload every graphic asset that is going to be used?), you can get hiccups and stutter when spawning somewhat big sprites.