> As long as you make sure that you're careful about allocating memory,
> you should be fine. My particle engine utilizes two lists per system,
> one for particles to be displayed and one for trash particles to be
> reused. Eventually what I might want to do is simply have an engine list
> for the trash particles, so that all the systems can dip into the same
> pool. Anyway, though, the current system is plenty fast.

That's (almost) exactly how my particle system works, two linked lists. I
thought about using arrays, too, but that's just a waste of memory I guess.
In addition, if a particle burns out, what do you do? In a linked list, you
just move the particle over to the list of particles to reuse. Then you
adjust the next-pointer of the previous particle and you're fine. Now with
an array, you would have to set this array position to NULL or so, then if
you want to create a new particle, you'd iterate through the array,
searching for a place that is NULL. Now do this if you have, say, 10000
particles. I guess that'll be slow, won't it?

Just in case you're interested, here's mine:
http://www.resourcecode.de/stuff/particles_eng.html

cya,
TheTinySteini

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to