SFML community forums

Help => General => Topic started by: Tojmak on April 18, 2020, 05:38:13 pm

Title: particle system sorting data
Post by: Tojmak on April 18, 2020, 05:38:13 pm
Hello,
I'm creating particle system with possibility to create force waves which can push partcles away when colliding.  Particles are moving away from the point of my mouse click, and force waves are expanding as long as they are visible on the screen (after that they are just erased). I want to improve performance of my code so i am thinking about sorting particles in some way. Problem is that i don;t know how to sort them. For now i am checking every single particle if it is colliding with force wave (there may be more than one of it) and i really don't want to do that. Also i want to add that checking is executed in every main loop. So it would be awasome if it could be stopped after reach some point. Also i'm wondering if there is some great container for particles. Currently i am using vector of unique pointers of particle objects. If anyone can recommended something better i would really appreciate it.