[gameprogrammer] Re: particle system in DirectX

  • From: "Husam Zakaria" <hzcppff@xxxxxxxxx>
  • To: gameprogrammer@xxxxxxxxxxxxx
  • Date: Sat, 10 Feb 2007 01:14:43 +0300

Hi, every one, thanks alot Alan and Jason you helped me alot

I was using DirectX in C++, Alan idea is very perfect

every particle has a position vector, speed vector and accelorator vector
the position vector is the orign point which water will spring from
and the speed vector is bitween the orign point and a random vector fom the
sky upove the orign point
and the accelorator vector which is the gravity one pointing downword
so every frame for each particle we do :


speed += accelorator ;
position += speed * DeltaTime ;


On 2/8/07, Jason Zaphyr <storm3@xxxxxxxxxxx> wrote:

Hello,

I would say that is about spot on description.  I would just like to add,
that to keep the fountain sprinkling particles out, whatever your
particles
are stored in, for example: particle[1000]; which would be a variable of
the
either struct or class you made containing the variables mentioned by the
guy before me, and depending on whether you want to use pixels or images,
you would need to add that variable to the class as well, and then you
would
use a for loop to fill all these values in, for each particle in the
particle array I mentioned, then you can use another loop inside your game
loop that throws these particles, watching the count variable until it is
>=
1000, in which case you would just reset the count variable back to 0, I
say
0 instead of one, assuming we are using a C or C++ or C# based array.

But, if you are using an engine similar to dark basic pro, or blitz3d they
both have a particle generation program that is free, can't remember the
exact name but if you browse around the forums, or websites, or even do a
google search for particle generator free blitz3d or something similar I'm
sure you will find it, and it even will generate the sourcecode for
whatever
affect you create in the application which is pretty kewl to play with the
different properties, and see your affect take shape at the same time,
including color, bitmaps, alpha, gravity, rate of spray etc..  Very very
nice, there might even be a version of it by now that will generate the
Direct3D code for it as well.

I hope I didn't confuse you more, I was just trying to help, since you
didn't mention the language you were using, only that you needed to make a
sort of spring shooting particles from the floor.

Another application with great particle control and fx, is Game Maker,
which
is about to release a newer version current version 6.1, new version 7,
out
soon, this month.  There is even a free version you can use to make
non-commercial games with.

Hope this helps Dude, I'm just glad we have this list, and thought I would
give back as this list has helped me out tremendously on my various
projects.

Ken aka StOrM3
Yes, I'm the StOrM3 that Helped make the Unit Editor for Total
Annihilation
with Kinboat, Sneskey with my buddy Nak or Benji Rather.


-----Original Message-----
From: gameprogrammer-bounce@xxxxxxxxxxxxx
[mailto:gameprogrammer-bounce@xxxxxxxxxxxxx] On Behalf Of Alan Wolfe
Sent: Thursday, February 08, 2007 11:23 AM
To: gameprogrammer@xxxxxxxxxxxxx
Subject: [gameprogrammer] Re: particle system in DirectX

hey dude, you didnt ask a specific question so i'll start from the
beginning as i see it (other more experienced people may jump in and
correct me but here you go)

particle systems are made up of particles (hehe) and particles can be
drawn either as images or by colored pixels.

You store your particles in some kind of repository (array, linked
list, something like that) and draw them every frame as well as
preform some logic on them based on what type of particle it is
(gravity and movement calculations for water vs a floating and dimming
effect for ffire and smoke).

If you are doing 2d graphics, you just of course draw the image to the
screen but if you are doing 3d graphics, you will probably want to
draw your particles billboard style so they are always facing the
player's viewpoint directly.

For your spring here's kind of how i would do it (asuming it's in 3d)

every particle has these variables:
float Position[3];     //X,Y,Z position of particle
float Momenum[3];  //momentum in X,Y,Z axis of the particle

then every frame you would do this for each particle:

1) Change Y momentum based on a gravity equation
2) add momentum to position for all 3 axis'
3) draw the particle to the screen

Does that make sense?

On 2/8/07, Husam Zakaria <hzcppff@xxxxxxxxx> wrote:
> Hi, every one, I need to create a particle system indicate a water
spring
> from a given point in space
>
> the water will spring from that point to up direction then it will drop
to
> the floor, any one can help me
> in this ?
>
>

---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html



---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html



Other related posts: