Optimization question: spawn an actor or particle?
owen_dennis
Just a guy, you know.Member, PRO Posts: 236
I've got some fancy looking explosions that use a couple different images in them. Something busts apart and then the 4 pieces of it move off in random-ish directions outward (plus a big explosion actor that is spawned when the actor destroys itself).
For those 4 images, is it more friendly to spawn 4 actors that go in the direction I want, or to set them as images in particles and have 4 different particle effects that only spawn one particle? I've got a lot of actors and timers going at once in this game, so I'd like to try and make sure things don't get bogged down too much on what's essentially eye candy.
I should note these aren't supposed to actually interact with the player in any way, they're just special effects.
Comments
@octopus1138,
Can you quantify this? A lot for you may not be a lot for GS. It can handle quite a bit.
If your game runs smoothly as it is, then I would guess spawning a dozen actors every few seconds is not going to hurt it.
Particles are more lightweight but give you less control, why not use a combination. E.g. smoke as particles, debris flying off as actors.
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
HUGE amount! Unquantifiably MASSIVE!
I have 76 actors so far, I'd say about 17 have at least 3 or 4 timers within them and that there are maybe 13-30 that exist in the game world at any one time. plus one controller timer that controls spawning of enemies, special zones, gamespeed, etc. which is full of various timers.
Maybe it's not a lot? I'll probably go with the combo. I just want to at least be aware of these things is all, so I know my options and I can understand a bit of what's going on behind the scenes.
Vote for Nearest Neighbor Scaling option in gamesalad! Let's make our games look truly stunning!
@octopis1138 if your code is clean, having 100 actors on scene is no problem.
If you do run into lag spikes, then you could look into changing the timers, depending on what they do. Make them into rules that act on self.Time for example.
When I have a crowded game, I like to push it to absurdity when testing, to see how it performs on various devices. Usually GS surprises me with you much it can through around.
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
+1, this is what I do too.