Jump to content

ParticleStorm - Lag with multiple/large emitters


hermbit
 Share

Recommended Posts

Phaser CE v2.8.0 | WebGL

I have a game with lots of enemies, and each enemy needs to shoot out blood particles when attacked.

My problem is, my world size is much larger than the size of the emitter bitmapdata that ParticleStorm creates.

I tried making it larger, but that caused extreme lag. 

Then I tried making an emitter for each enemy, and moving the x/y coordinates of the emitter's display to the enemy's location: this also caused heavy lag after just 2 or 3 emitters were created.

 

Any ideas on what I can do to have enemies emit particles across a large map (1920x1920)?

Link to comment
Share on other sites

6 hours ago, samme said:

Can you use a different renderer (SpriteBatch, Sprite)?

With BitmapData it might work to use a small pool of small-area emitters. You could use a low-resolution bitmap (480 × 480) and scale it up.

Hmm, can you elaborate on using a small pool of small-area emitters? How would I go about doing that? I'm kind of lost w/ particle storm.

Link to comment
Share on other sites

I don't know much about Particle Storm, but the idea is you would use a small number of emitters and reuse/restart them as necessary. It's still more complicated though.

Can you try Sprite/SpriteBatch? You can probably create images to get the same bitmap-like effect.

Link to comment
Share on other sites

I was able to solve this by creating multiple small emitters, rather than one huge one.

 

let emitter = game.particleStorm.createEmitter(Phaser.ParticleStorm.PIXEL);
    emitter.renderer.resize(80, 80); // this is what solved my lag issue- keep it as small as possible
    emitter.renderer.display.x = 100; // your desired x position
    emitter.renderer.display.y = 100; // your desired y position
    emitter.renderer.display.anchor.setTo(0.5, 0.5); // sets the origin to the center, not necessary
    emitter.renderer.pixelSize = 1; // i wanted tiny pixels
    emitter.addToWorld();

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...