Effificient particles in 2D

Blitz3D Forums/Blitz3D Programming/Effificient particles in 2D

Types are great for particles :o) However, to keep things sensible, recycle your particles. Upon the death of a particle, flag it as dead. So, when you go to update the particles, the dead ones, don't get processed.

Upon needing a new particle, you search for dead particles, and unflag them and set their properties. I have found this to be faster. Inserting, creating types, although fast, does have a small slowdown.

I experienced this with my pathfinding program. I used types. Using create and insert cause some slowdown. Obviously in the program ALOT of creating, deleting and inserting was happening.

I tested the speed of these and found recycling was faster. Ended up using arrays for more speed though.

So, i'd say types are good for particles, as it keeps things a little easier to understand :o)

As for updating, set a rate of updat and limit it to that. Such as 60 fps update. Obviously updating the particles at a rate that's slower than the screen will be pretty noticable :o) I have never really seen the need to update the particles at a greater rate than the screen update. BUT, if your game is running slow graphically, then you'd want the particles to still be updating at a decent rate.