2000 smilies, FlashDevelop, Molehill, M2D
I am really impressed by all molehill demos which already build. Molehill is the codename for GPU-accelerated rendering for flash. However I was kinda depressed when visiting the presentation Making A Molehill Out Of A Mountain on FITC Amsterdam. Accessing the GPU is really low-level. That is great news because it opens lots of possibilities, but it is depressing because it is low-level. Even if you are trying to be an pro/expert, you must be a freaking uber-talented geek to understand and be able to write shaders, assemblers, assembly (??) code which is needed for the real Molehill stuff. Respect for that. I am a geek, but that is way too difficult for me. I have tried to look to the content of AGALMiniAssembler from adobe, but I think thats not written by real humans. 😉
Great frameworks
My point is; we have to wait for great frameworks. There are already 3D engines which are molehill-enabled (Alternativa3D, Away3D and some others). The GPU gives render powers. A brilliant idea of Tom Kcha is M2D. He came up with a 2D rendering system which uses the GPU inside a framework. I think this is a little jewel and is experiment-worthy, because I am using 2d content most of the time. The example codes are understandable. No freaking shaders, but normal AS3-like code. I think there will be more frameworks which will use the power of GPU rendering soon.
Experimenting with M2D – Molehill 2d
If you want to see my test with M2D, take a look at my two different versions of 2000 smilies. I have noticed they both use a lot of CPU but the M2D version renders about 3x smoother. I think this whole idea of 2d content on GPU is awesome! 😀 Adobe should implement this in a way to the ‘normal flashplayer’. Yes, there are limitations in the current workflow. You are mostly limited to bitmaps only, so you’ll need to know something about real sprites and blitting. However if you are using the example files, it will convert lots of different types of object (movieclips, shapes, animated-gif-like-sprites) to bitmap-objects for you. Imaging if games will implement this, they will have more rendering powers for free; that is huge and promising.
On twitter I said M2D did not support alpha, but in the latest version there is an alpha property too. I still wonder how much M2D could be optimized to get most out of 2d GPU rendering.
Getting started with Molehill
Now, you want to use Molehill to, right? 😀 Let’s do it! Setting up a molehill-enabled environment is relative easy if you are using FlashDevelop:
1. Download the activeX incubator FlashPlayer for windows. IE uses activeX, and FlashDevelop tabs use IE. 🙂
2. Download latest version of flashdevelop
3. Download nightly build of the Flex SDK (You’ll need 4.5.0.19786)
4. Download this flashplayer_inc_playerglobal_022711.swc. This includes classes for Molehill. Rename it to playerglobal.swc and place it at (flex_sdk location)\frameworks\libs\player\10.1
5. Create a new AS3 project in FlashDevelop, and target FlashPlayer version 10.1 in the project properties. Keep the properties open and choose to publish in a tab. Then navigate to tab Compiler options, and add -swf-version=13
to the Additional Compiler Options. In the custom path to Flex SDK (same tab) you’ll need to point to the Flex SDK folder you have just downloaded.
This should be enough to start building molehill projects.. and also to use M2D:
Getting started with M2D
Now, download the M2D.swc (or latest version from github) and add it to your lib-folder. Right-click > add to library and your basicly ready to start building 2d GPU-accelerated flashcontent!
The future is bright. Can’t wait to see more great+fast performing examples using this technology. Now.. start making cool shit already!
More info:
http://www.flashrealtime.com/m2d/
https://github.com/egreenfield/M2D
http://projects.stroep.nl/m2d/
http://labs.adobe.com/technologies/flashplatformruntimes/incubator/
http://blog.visualjazz.com.au/good-stuff/making-mountains-out-of-a-molehill-how-to/
Very good job done on the smiling faces.
I agreed with you regarding all on molehill, When I first saw the samples running on molehill I was more than surprise, I was amazed thinking all the great things people would be able to accomplish using it, as I start getting into the tool I realized that it wasn’t as easy and it would need a lot more knowledge to create something good. I am sure that people is already working on frameworks to make it easy. At the moment I haven’t got time to look into M2D but it is looking promising. I say let’s continue working and supporting the flash community.
Thank you
EPadilla
you need to add “wmode=direct” parameter in your html file that embed your swf, so your Molehill Object will be rendered by GPU.
Hi there. Cheers for the code encouraging me to update from IE7 to the latest version. I was wondering what makes you think this kind of thing is acceptable…?
I won’t be visiting your website myself and will certainly not recommend your otherwise excellent website to friends.
Thanks for this excellent article. I hope you dont mind that I have ‘borrowed’ your code to play around with.
@matt; Ofcourse, just use it! Maybe it would be a good idea to update to the latest version of M2D to make it even faster!