Change Image or Destroy/Spawn - Which performs better?

Asobu_GamesAsobu_Games PRO Posts: 261
edited April 2012 in Working with GS (Mac)
Hi guys, I am working on a game where there are lots and lots of clothing customization options and things are starting to slow down with so many actors. Initially I have been destroying the old actor and spawning a new one. Will my game perform better if instead of destroying, I just have a change image behavior (with preload images unchecked)

For example if I have 10 T-Shirt images I would change to just one 1 T0shirt actor with 10 different images based on attributes.

I thought I'd ask before changing everything as I have hundreds of actors/images and it will take a long time.

Thanks, Tim

Best Answer

  • mynameisacemynameisace Hull, UKPosts: 2,484
    Accepted Answer
    If you want to knock it down further, uncheck Preload art or use the change attribute self.image to 'imageName' - you don't need to add .png.

    Ace

Answers

  • theCodeMonsterstheCodeMonsters Member Posts: 359
    edited April 2012
    The best thing to do would to try and downsize the amount of actors if you can (because GS needs to sort through all of these and load it in). To address your question It's most likely best to use a change image because re-spawing and deleting will take longer & more memory.
  • Asobu_GamesAsobu_Games PRO Posts: 261
    Thank you, I will definitely look at limiting the amount of actors where possible, although the 'dress-up' element is crucial to the gameplay, so I will need lots of options. I am also tying to keep the file sizes down on all images.

    I figured that the 'change image' might use less memory than spawning. I just tested out by changing 1/4 of the actors to change image. There was a noticeable increase in performance. I timed how long both versions took to load and spawning was 8 seconds vs 5.5 seconds for change image. I should be able to cut this down even more by changing all actors. I'll report back with the final change in performance.
Sign In or Register to comment.