what sort of performance does particle emitter deliver ? i created 3 (cloud+rain) particle emitters, outputting 20 partilcles each (20x6) and one core was maxed out (i have a quad core, x4 amd 3.4ghz) and the fps dropped from 99 (which is what i set max to) to about 40 fps;
so what am i doing wrong ? or is it possible to multithread emitters ?
my current project so far is fairly empty in terms of models, a shop, a tree on fire, a fence, a campfire, some simple water and a platform like terrain(model, not terrainQuad) and Oto, now pretty much each of these have their own controls various character controls or rigidbodycontrols, on top of that i’ve added ghost controls on some items to implement game-mechanics (i,e:
simple water has a ghost control attached to it where if a Player instance overlaps it, it will create a water splash effect (particle emitter)
within the shop i added a ghostcontrol area where if a player steps in it, his health increments
) … various things like that, the game so far reaches around 150mb or so, my question is if i add in say 10x more objects like these with their various controls, would the performance degrade alot and if so how would i go about resolving that ?
there might be something in an update loop which is very demanding, or your actions in your collision event listeners are being fired a lot when they only need to be fired once, i don’t know i’m just making assumptions. The stuff you post doesn’t sound like it should have a drastic effect on FPS. A testcase would be nice. Do you have any post processing effects?
oh, i use PhysicsTickListeners for my ghostcontrols which detect if theres anything overlapping and then does an action on it, (i.e. my raincloud has a rainControl, which uses a physicsTickListener to see if other ghostControl objects are overlapped and if any of them are called “Fire” it will put them out and remove the particleemitter from scene (the removalQueue() in the first update loop)
i added in a new thread, where in physics, i put all the effects update into a new thread, i just created 10 rain clouds, performance is steady, cpu 10% now. im gonna migrate all my physics udpates in seperate threads, wooo, cant believe how wonderful threads are (ive used them before but on proper time intensive tasks, e.g. like 5 mins each)
Err, you can run physics in a separate thread out of the box you know that right? Check the javadoc for BulletAppState. Also we will multithread ParticleEmitters from the jme side automatically in the future. I’d not mess about too much in the update loop yourself as this might make your app uncompatible with such future updates.
yeah im only breaking up the update loop like the wiki says, and creating new executor service within the loop so that there are no scene not ready errors.
i thought physics was already multi-threaded ? do i need to set it ?
Yep, you need to set that, then all physics spaces are computed in parallel to rendering (and in parallel to each other), by default the physics spaces are worked off sequentially before rendering.
ah good to know, my main bottleneck was updating time based objects, but thats all working fine now, i spammed particle emitters / projectiles, reached about 500 objects (in that info on the bottom left of the screen) and it maintained 80-99fps (99 is max).
my next stress test is AI path finding.
thanks for the help, shall i put solved in the title ?