Best data structure for a particle system?
bearophile
bearophileHUGS at lycos.com
Fri Nov 15 05:53:39 PST 2013
Mikko Ronkainen:
> Let's say I just use dynamic array and grow it when adding new
> particles to the system, and when particles die, just set their
> dead flag on. This means that, when adding a new particle, I
> need to scan the array first for possible dead particles that
> can be reused. Is there some trick that could be used here to
> reduce excessive searching/iteration?
Generally avoid resizing the array. Just leave some many ones in
the array.
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list