Change Image or Destroy/Spawn - Which performs better?
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
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
-
mynameisace Hull, UKPosts: 2,484
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
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.