Advertisement

a particle engine how to make one and eny math algos

Started by November 15, 1999 07:51 PM
4 comments, last by GameDev.net 25 years, 2 months ago
I am not sure about the algos, but I know that pixel plotting is extremely slow in VB, so you'll need to use DirectX 7.

------------------

Lack

Lack
Christianity, Creation, metric, Dvorak, and BeOS for all!
particle systems are a doddle... create a type with these properties.. (not vb code)

inuse as boolean
x as integer
y as integer
xv as integer
yv as integer
c as color

then create an array of them like this:

dim parts(1000) as part_type;


then to create a particle:

for a=0 to 1000
if parts(a).inuse = false then goto got_one
next a
' Couldn't find a free one!
got_one:
' for each property
parts(a).property = value


then to update & draw the parts, just use

for a=0 to 1000
if parts(a).inuse = true then
' draw at x,y in color c
plot(x,y,c)

' update pos according to velocity
parts(a).x = parts(a).x + parts(a).xv
parts(a).y= parts(a).y + parts(a).yv
end if
next a


this is fine for simple systems, anyway. i've made tons of progs using particle systems in qbasic - if you want the code, ask...

Advertisement
A particle system, as said, is not particularly interesting or complicated - rendering it efficiently and getting the right behaviour of the particles, however, is probably more black magic than science.

Some of the things you might want to consider are basic physical properties such as speed, mass, elasticity and acceleration. Don't expect a physically correct 10000 particle system to run anyway near 50fps though - especially not when written in Visual Basic.

/Niels

<b>/NJ</b>
kieren_j:

how would i make an animation that would show the velocity changes of the particles?
How would i make an animation using the pset command, i know many dont like this command but i need somewere to start. if you could other examples would also be helpfull.
could you send me those examples
hello

im trying to make a particle engine, how would i do one in vb? Also looking for math algos to set the physics and path of them in any langage thanks

im vb, check profile for email

This topic is closed to new replies.

Advertisement