RSS
 

More Particles in M2D (molehill)

09 Apr

Holy crap! Let me say that again … HOLY CRAP!!
Ely Greenfield and Corey Lucier have been working on the M2D framework more and have now added rotation, animated sprite sheets and a few other tweaks to the particle engine of M2D. I cannot believe I can do this with Flash now.

Before the demos I do want to put a disclaimer. Just because I can push around a lot of particles it doesn’t mean that everything will be much faster. When making a game there are a lot more cpu overheads in managing and controlling objects which themselves will eact a lot of CPU. What these tests are good for is seeing what the upper limits of rendering are, or what is possible compared to what we used to be able to do in Flash.

I’ve got three videos demonstrating the performance, the video can’t really capture what’s happening due to the speed and amount of particles so it will appear a bit pixelated.

First a sprite sheet containing 10 28x28px sprites with 30,000 particles …

M2D particles part 2 #1 from Terry Paton on Vimeo.

Then a sprite sheet containing 10 2x2px (small) sprites with 100,000 particles …

M2D particles part 2 #2 from Terry Paton on Vimeo.

And finally repeating the first test, but with 100,000 particles …

M2D particles part 2 #3 from Terry Paton on Vimeo.

What about CPU usage during these tests?
This is a tricky one, there is a certain amount of object handling that needs to be done off the GPU so processing 100k objects will eat some CPU. It is a LOT of particles.

These tests were run on my 27inch i5 iMac:
Test 1: 30k particles – 280×28 sprite sheet – particle size 28x28px – around 12-15% CPU
Test 1: 100k particles – 24×2 sprite sheet (very small) – particle size 28x28px – around 55-60% CPU
Test 3: 100k particles – 280×28 sprite sheet – particle size 28x28px – interestingly around 30% CPU, but there was noticeable lag probably due to the GPU choking a bit,

And just so you beleive, here’s a screen grab of the cpu usage during the test #2

And here’s the source code (Flash Builder) for experiments #1 and #2. You will need to download the molehill pre-release and know how to set it up, I can’t help you with that part.
http://pixelpaton.com/download/M2DTest5_Particles2.zip
http://pixelpaton.com/download/M2DTest5_Particles3.zip

Check out these links for more about M2D:
http://www.flashrealtime.com/m2d/
http://www.quietlyscheming.com/blog/2011/03/24/m2d-flash-molehill-based-2d-library-updated/
https://github.com/egreenfield/M2D

 
2 Comments

Posted in Game Dev

 

Tags: ,

  • Pabloisuarez

    Excelent!, cant wait to see this implemented in games…

  • Pak-X

    Looks very nice. But actually after looking at the code I have to say, that this is anything than flexible and the same particlegroup is rendered many times with just a different position and timeoffset. So its maybe not that good for games.

    Anyway, its impressive whats possible and you have coded. Well done ;-)