1
General discussions / Comparisons with SDL2
« on: July 27, 2021, 01:53:12 am »
If this has been discussed and already beaten to death well I apologize in advance.
But I was working on collision detection & resolution example through SFML with many objects around 900 circle objects in debug mode when things started to bog down. I know in release mode it's perfectly fine at 60 fps but out of curiosity I wanted to try SDL2 to see if it's anymore efficient.
Unfortunately SDL2 doesn't have circle primitive shapes so I had to go through a bunch of tutorials to get that up and running. There were 2 methods in SDL2 to create a circle shape one was less efficient than the other, while the other one was extremely efficient as it used 1/4 of the circle drawing then used symmetry to mirror the rest and blit textures.
While this managed to cut down the rendering by at least 10-20% in SDL2 alone, SFML was still about 3x faster with sf::CircleShape and that's not even resizing the circle points down to a lesser value!
Needless to say, it most likely means my slowing down issue lies with my collision algorithm and I'm well aware of that. I probably need to use other 'fast square root' alternatives, avoid divisions as much as possible and possibly implement dynamic quadtrees (ohhh boy).
This was quite an adventure for me and I have to say I really enjoy SFML. And after avoiding SDL2 for a very long time I also like SDL2 too but SFML to me feels natural! I'm always wondering why SFML isn't as popular as it should be. It's a terrific tool for learning everything C++ and under the hood game development!
But I was working on collision detection & resolution example through SFML with many objects around 900 circle objects in debug mode when things started to bog down. I know in release mode it's perfectly fine at 60 fps but out of curiosity I wanted to try SDL2 to see if it's anymore efficient.
Unfortunately SDL2 doesn't have circle primitive shapes so I had to go through a bunch of tutorials to get that up and running. There were 2 methods in SDL2 to create a circle shape one was less efficient than the other, while the other one was extremely efficient as it used 1/4 of the circle drawing then used symmetry to mirror the rest and blit textures.
While this managed to cut down the rendering by at least 10-20% in SDL2 alone, SFML was still about 3x faster with sf::CircleShape and that's not even resizing the circle points down to a lesser value!
Needless to say, it most likely means my slowing down issue lies with my collision algorithm and I'm well aware of that. I probably need to use other 'fast square root' alternatives, avoid divisions as much as possible and possibly implement dynamic quadtrees (ohhh boy).
This was quite an adventure for me and I have to say I really enjoy SFML. And after avoiding SDL2 for a very long time I also like SDL2 too but SFML to me feels natural! I'm always wondering why SFML isn't as popular as it should be. It's a terrific tool for learning everything C++ and under the hood game development!