Sign in to follow this  
hermbit

ParticleStorm - Lag with multiple/large emitters

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)?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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();

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.