How would you go about writing a particle system?
I have an extremely basic understanding of them, and I've seen them in action but I'm still not quite sure how to go about making one.
More specifically:
What attributes would a particle have?
How do you keep them from clumping?
Do you randomly generate the positions within a boundary or do you start them all at a point and modify their directions?
What would be a good particle limit?
Would you draw them as rectangles or as circles? (or does it even matter?)
Sorry for all the questions
Particle Systems
Moderator: Coders of Rage
Re: Particle Systems
Oh and just for the record, this is supposed to be a 2D particle system :P
Re: Particle Systems
This should help: http://paraschopra.com/tutorials/particle-systems/
rather than someone doing a tutorial for ya, if you have any questions just ask :D
rather than someone doing a tutorial for ya, if you have any questions just ask :D
- mv2112
- Chaos Rift Junior
- Posts: 240
- Joined: Sat Feb 20, 2010 4:15 am
- Current Project: Java Tower Defence Game
- Favorite Gaming Platforms: N64/Xbox 360/PC/GameCube
- Programming Language of Choice: C/++, Java
- Location: /usr/home/mv2112
- Contact:
Re: Particle Systems
Attributes:
Position(x,y)
Size
color
isAlive(Boolean)
life_span
force(x,y) or velocity, same thing
gravity(Boolean)
To keep from clumping I generate a random float between -.1 and .1 and add it the the particles x and y
I start the particles at a point and modify there velocity.
I have a 10,000 particle limit
I use SDL_FillRect to draw them
For a particle manager, make sure you have any array of particles rather than allocating new ones each time, arrays go ALOT faster.
Position(x,y)
Size
color
isAlive(Boolean)
life_span
force(x,y) or velocity, same thing
gravity(Boolean)
To keep from clumping I generate a random float between -.1 and .1 and add it the the particles x and y
I start the particles at a point and modify there velocity.
I have a 10,000 particle limit
I use SDL_FillRect to draw them
For a particle manager, make sure you have any array of particles rather than allocating new ones each time, arrays go ALOT faster.
Re: Particle Systems
since you won't have more than your limit, and array should be fine
although if you were handling a vector manually I think it would be fine? I don't know for sure
although if you were handling a vector manually I think it would be fine? I don't know for sure
- Ginto8
- ES Beta Backer
- Posts: 1064
- Joined: Tue Jan 06, 2009 4:12 pm
- Programming Language of Choice: C/C++, Java
Re: Particle Systems
A vector with a certain amount of memory reserve()'d should be pretty fast, but a limit on the amount of particles is still the best idea for performance.eatcomics wrote:since you won't have more than your limit, and array should be fine
although if you were handling a vector manually I think it would be fine? I don't know for sure
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
- mv2112
- Chaos Rift Junior
- Posts: 240
- Joined: Sat Feb 20, 2010 4:15 am
- Current Project: Java Tower Defence Game
- Favorite Gaming Platforms: N64/Xbox 360/PC/GameCube
- Programming Language of Choice: C/++, Java
- Location: /usr/home/mv2112
- Contact:
Re: Particle Systems
Particle Systems are some what easy to make if you think about particles in a OO way.
I just made one 0_o
I just made one 0_o
Re: Particle Systems
This is where you pull a marcel and say, "I would help, but I have no idea how particle systems work"
Re: Particle Systems
Thanks!