particles with nice actual physics simulation :)

Advanced game related topics
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by mindplay.

I have no actual plans for this, so I might as well just give it away, maybe someone else will use it for something:

http://www.mindplay.dk/temp/reflections.zip

It's a particle system basic physics - when a particle collides with the surface, the angle of the actual bitmap is estimated, and the particle is reflected upon it ... this means that particles can bounce realistically off any type of surface, they'll even "roll down hill", it looks pretty neat :)

There are some minor bugs in it still: particles that fly upwards into a surface seem to sometimes disappear - they do not disppear however (they cannot), but something fishy does happen, maybe they come out at the top of the object they hit, I can't tell, but there's something slightly wrong there ... also, some particles seem to bounce directly downwards when hitting a 90 degree vertical surface, I can't tell why this is happening either ...

I'm not spending anymore time on it, but it was a lot of work to get it where it is already - so use this freely, you don't have to credit me for the code, but please notify me of any use.

If you can fix any of those minor bugs, please post your updated version - thanks! enjoy! :)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by mindplay.

PS: Adjust the spawn rate (the number of particles launched per second) with the arrow up/down keys! ... there's a set 10.000 particles limit, although technically there is no limit other than the amount of RAM and CPU power (particles are managed with a linked list) ...

by the way, the particle movement is fully frame-rate compensated - so any overloading of the CPU should cause no slowing down of the particle movement, only a lowered framerate :)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by ricardo.

Hi,

Very nice!!

I will take a look at the code.

Best Regards

Ricardo

Dont cry for me Argentina...
Post Reply