Log in

View Full Version : Particle system



Aesclepius
17-12-2002, 09:49 PM
I want to create some graphics using a 2D particle system. I have searched many different sources for help, but most are 3D or written in C or C++. (I only know pascal and basic).
I think I understand the basics but I am unclear about how to store the data for the numerous particles it takes to get a good effect. Many particle engines use thousands of particles and using an array of thousands of records seems very inefficient. :? Any better ways to do it? Any good examples/articles/tutorials on using particles in DelphiX?

TheLion
18-12-2002, 12:10 AM
It might be a stupid idea, but it also might not be, but take a look a 2D starfields and read in on the 3D particle systems (good place to start is Nehe). Basically a 2D (or 3D) starfield is a particle engine, only a very basic and easy one.

Particles are at the basics very easy, you have pixels (or an image) that image has an x,y value and on both the x and the y value work some "physical" forces, like you would if you drop a ball, only then the force would work on the x,y,z axis. Basically what happens is that the pixels have a starting position, this can be a single point or multiple points, the are provided with a random speed and then each frame (or in a certain amount of time) the speed is either added or substracted from the x or y value, which makes the pixel/image appear to be moving under the influence of physics forces, like with a dropping ball or fire. Take a look at NeHes OpenGL particle system and just take out the z-axis (might want to replace the z with the y axis) that should do it.

On the array of records, I have never seen it been done differently, however you could use a TList with a objects, but that would make the program run slow especially when you wish to destroy the object... No record-arrays are the best for particle engines I think....

Hope this helps a little! ;)

Aesclepius
18-12-2002, 12:36 AM
It might be a stupid idea, but it also might not be, but take a look a 2D starfields and read in on the 3D particle systems (good place to start is Nehe). Basically a 2D (or 3D) starfield is a particle engine, only a very basic and easy one. ...

Take a look at NeHes OpenGL particle system and just take out the z-axis (might want to replace the z with the y axis) that should do it.

On the array of records, I have never seen it been done differently, however you could use a TList with a objects, but that would make the program run slow especially when you wish to destroy the object... No record-arrays are the best for particle engines I think....

Hope this helps a little! ;)

Thanks. I have the Nehe tutorial in my collection of articles about particle systems. I will try to make good use of it.

By the way, as a beginner in programming, I think a good topic for discusson is code optimization. I have found myself in other programs using techniques that get the job done, but could be done more quickly and cleanly with different routines. Anybody interested in setting up a forum where beginners can submit code segments and you veterans give us suggestions for tightening the code up into a cleaner, more efficient approach?

TheLion
18-12-2002, 08:45 AM
Well that would be a question for the "Forums" forum, the forum, you are posting in now deals only with DelphiX related questions... :)

BlueCat
18-12-2002, 11:39 AM
By the way, as a beginner in programming, I think a good topic for discusson is code optimization. I have found myself in other programs using techniques that get the job done, but could be done more quickly and cleanly with different routines. Anybody interested in setting up a forum where beginners can submit code segments and you veterans give us suggestions for tightening the code up into a cleaner, more efficient approach?

Yes, as Lion said post in 'Forums' and we'll see what we can do :P