hermbit Posted June 21, 2017 Share Posted June 21, 2017 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 More sharing options...
samme Posted June 21, 2017 Share Posted June 21, 2017 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. Link to comment Share on other sites More sharing options...
hermbit Posted June 21, 2017 Author Share Posted June 21, 2017 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 More sharing options...
samme Posted June 22, 2017 Share Posted June 22, 2017 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 More sharing options...
hermbit Posted June 27, 2017 Author Share Posted June 27, 2017 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 More sharing options...
Recommended Posts