Hey! I was bored today so I decided to start making a Playdate particle system called pdParticles
Currently it only suports drawing circles but I'm hoping to expand to rectangles, polygons, and images.
Just thought I should post it here since PD devs are the demographic for PD libraries
added other shapes
Looks good so far. I'm interested to see how this evolves over time.
added image particles
giving it an imagetable makes each particle pick a random image from it
How fast is this running on device? Looks great.
There are some really quick and easy optimisations, by local aliasing the maths calls outside the loop & function and only using the alias inside the loop.
This reduces calls to the global math from many to one and is 30% faster.
local <const> random = math.random
for ...
a = random(b,c)
end
I'd love to know your before/after figures.
ooh didn't know that helped, I don't have numbers right now but I can take some sometime soon
You can have ~125 particles on screen and stay right at 30FPS.
I will open a PR that improves that by 16% to 145 if @PossiblyAxolotl doesn't mind!
Cool!
In my latest game I have 100 tiny rects as scrolling star field, plus between 25 and 100 additional particles based on current explosions, with some physics, running at 40fps. I'm using my own code for no reason other than I forgot this existed!
That’s cool with me!