Public Group

# Particle editor

This topic is 3858 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Im trying to create a simple particle editor , but i would like to ask a few questions first. 1) I don't quite understand how should i place the particles.Any ideas? Im using opengl btw... 2) What's the best way to calculate collision detection for a set of particles? Should i add a collision box which will be equal to the size of all particles OR should i check each particle one-by-one? That's all for now , thanks!

##### Share on other sites
This seems to be an interesting article on particle systems. I don't know if it addresses your questions, but you might find it useful anyway.

##### Share on other sites
Thanks for the link , but(to be honest) i don't really need it.
I can do many particle effects.

My main problem is how to place them so they can be re-translated on different position.

Anyway , i think after a long research i found out how to do it.
And im going to share it with everyone :) .

The editor will work like this:
___Options___-[option] Number of active particles-[option] Particle life-[option] Texture type-[option] Blending modes : ADD/SUB-[option] Velocity min/max-[option] start color  & end color (fade in from colorA->colorB)-[option] Spread min/max-[option] Direction-[option] Gravity min/max-[option] Radial acceleration min/max-[option] Alpha : start/end-[option] Particle size-[option] Bounding box

The particles will be saved like this:

loop through each particle and write:Particle type , and the rest attributesend

Then , on client you simply parse that file , and with the same code you can
render them anywhere on the screen.

So to answer my own question : Don't bother about the f<< position.
You only need the attributes of each particle.
Thanks anyway.

##### Share on other sites
A couple of notes on my particle system you might be interested in

Each particle has an initial position, direction, color, color "direction", lifetime, etc. To be able to configure this, I came up with a "Particle Property" class.

I store properties in the main particle system as a template for how to create new particles when they die. The particle property class has the following attributes:

* Constant - a constant value that is always applied
* Multiplier - something the end result is multiplied by
* Function - more on this in a second
* Parameter - parameter to the function.

The function is an enum of functions that can be called when creating the particle, ie

enum UeParticleFunction{	PF_NONE = 0,	PF_RAND,	PF_SIN,	PF_COS};

So you have a standard random number, Sine, Cosine and nothing. You can put more functions in as time goes by without breaking old particle systems. I have a function, UeParticleSystem::GetValue which will calculate a float value given a UeParticleProperty (using a simple switch statement for the function, doing the adds and multiplication, etc). You can even extend this even further to allow cooler movements to the particles (but I don't really need that).

This is the first time I've written a particle system that can be extended like this (the plan is to eventually have it scriptable) and it really works well for me because you don't have to go through and write massive amounts of code for special case emitters, just think for a few seconds about how to come up with the properties you'll need. That way you can set up in just a couple lines of code two completely different emitters. It's pretty cool.

##### Share on other sites
Quote:
 1)I don't quite understand how should i place the particles.Any ideas?Im using opengl btw...

What do you mean how to place the particles? They should be getting automatically spewed out by your emitter, no?

Quote:
 2)What's the best way to calculate collision detection for a set of particles?Should i add a collision box which will be equal to the size of all particles ORshould i check each particle one-by-one?

Is this particles colliding with one another, or the environment, or both? You may want to represent them as spheres for collision purposes (spheres are fast and simple to check collisions for). If they are of uniform size, all the better. You might also want to look at things called octrees if you have lots of particles.

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 9
• 31
• 16
• 11
• 10
• ### Forum Statistics

• Total Topics
634122
• Total Posts
3015617
×