Using particles efficiently

0 favourites
  • 4 posts
From the Asset Store
Particles support animations, collisions, effects and etc.
  • Hi there,

    Using just a small particle emitter in a project. Notice that it can't be made inactive (it's engine flames, so only want to see it whilst a player presses a key).

    I know that if there's more than a couple of hundred particles onscreen it might affect framerate (so the manual says).

    So, is it better to make it invisible when unwanted, or to position it off-screen when unwanted? If those particles aren't visible, do they still affect framerate? I wasn't sure whether it was amount of objects in memory or time taken to render which is the bigger issue here.

    Alternatively, is it better to destroy and recreate it each time? I doubt it, but thought I'd ask.

    It doesn't affect this project very much really, but I'd like to know best practice for future. Thanks!

  • Sure you can make it inactive:

    1) Set the particle to "Continuous spray" in the object type properties.

    2) In the particle actions, under "Particle Spray" use the "Set spraying" action and set to "Not Spraying".

    If you are using it as an engine flare then you will also want to add the pin behaviour to the particle object, move it to engine at the start of the layout and pin it to the engine.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks for the reply.

    I also worked out an alternative....

    Set Visible/Invisible doesn't really work because then your particles don't really behave properly and fade away nicely.

    *However*, you can set the particle rate to 0 for when you're not holding the action button, and then set it to <a rate of your choice> when the action button *is* down.

    e.g. If space is down, set particle rate to 'particleRate'

    Else, set particle rate to 0.

    Thanks, and hope this helps someone.

  • I can recommend creating your own particle effects using a sprite with bullet and fade (with random angles and speeds) rather than using the built in particle effect. You'll have much more control over the particles.

    Regarding performance - it depends on what platform you are targetting. The manual entry was probably written over 5 years ago. Devices are significantly more powerful now. Check http://www.scirra.com/demos/c2/particles/ for a live benchmark.

    Invisible and offscreen are identical as far as performance is concerned. They take resources in terms of event logic/collisions, but are not rendered. Large transparent areas of overlapping sprites are the common mistake - transparent pixels ARE rendered just like any other pixel.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)