PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Particle System Part 1

Just thought I'd show a screenshot of my first foray into GapiDraw. Here's a screenshot of the beginnings of a particle system I started today. I plan on making it a little more customizable but wanted to get the basics down first. I plan on adding the ability to specify custom particle update functions and/or emitters. Here it is:

Image
codepunk · 14 Jun 2003, 01:20 UTC — Update
I figured you'd all want some performance stuff in there. After adding it, all I can say is GapiDraw is holding up quite nicely. Another picture for you below. Technical info:
Each particle is a png file with another png used for alphablt. Also, as each particle ages, the opacity is decremented. The screenshot below has a particle population of 5000 particles. When one dies, it is reinitialized and becomes in essence a new particle. Since the last post (15 minutes ago?) I added the ability to pass your own update function which will be used to create more than the fountain you see here (I also copied FPS code from the tiledemo).

Image
thats very nice.. holding up to 30fps with 5000 particles on screen. is it just an array of particles? could u be a bit more technical about the demo if possible.. thanks
codepunk · 14 Jun 2003, 22:11 UTC — Vic: more info
Yes, its an array that is created based on a max particles variable that is passed to the system when its created. It also uses an emit rate to determine how many particles to emit per frame. In other words, if 2000 particles die, but your emit rate is only 50, then the next frame will only emit 50 new ones. The 5000 number is pretty good I thought. But then I started to increase it. Believe it or not, I was able to display 50000 particles on the screen at 30 FPS. Once I start getting around 60000 particles, the frame rate starts dropping (about 25 FPS for 60000 particles).

Not really any optimizations going on other than what GapiDraw provides. The only thing worth mentioning is that when a particles dies, the last alive particle in the array is swapped into the dead particles position. Therefore, when I enumerate the array, all the live particles are continguous and means I don't have to access every element since the dead ones are in the back. When new particles are emitted, it starts at the element after the last live particle. Hope that makes sense.
I dont mean to be a nay-sayer, but I believe those numbers are from the windows version right? A pocket pc implimentation would have a much lower number.
I agree, the Pocket PC would be much slower. I would be interested to see how fast in runs though.
How about providing us with the .EXE and files so we can run it and compare our results? That would be real interesting!

--Eric