Molehill + Scaleform = hardware accelerated 2D in Flash?
This post is pretty much an open letter to Adobe, so if you know anyone who works there, please send it to them. I've had what I think is quite an interesting idea, and I think it's one that Adobe should have a long think about. The Flash player is about to add hardware accelerated 3D rendering with "molehill". The demos that have been released so far look great - amazing 3D scenes rendered with no impact on the CPU. All the rendering is handled by the GPU, leaving the CPU free to process your game logic, including physics, collision detection and AI - which allows for more advanced gameplay (and stops Flash-haters fixating on how much of their precious CPU the "bloated" Flash plug-in is consuming).
However, this will only apply to 3D games. In fact 2D games - which we must not forget are what has made Flash the number 1 gaming platform on the web - will see no benefit from this release. What's the message from Adobe here? That 3D is the future of gaming - 2D is not important, or at least 2D games already have good enough performance. But when you consider that native 2D iPhone and Android games have similar (if not better) performance than 2D Flash games on much inferior hardware, you can see there is plainly massive room for improvement. Now look at the iPhone and Android appstores, where there is a genuine choice between 2D and 3D games. The charts are dominated by 2D games like Angry Birds, showing that 2D is still the dominant style for casual games.
Ok, so what can we as game developers do about it? Well, we could make all our 2D games using bitmaps rendered on 3D planes, and so leverage the GPU rendering of "molehill". Now our CPU is free for game logic. But what have we lost? Well for starters the display list with it's powerful nesting features, filters, textfields, use of the Flash pro IDE for layout. In short everything that makes Flash what it is.
So what can Adobe do about it? Well, there already exists a technology called Scaleform that renders the Flash vector engine using GPU accelerated 3D by tessellating 2D graphics - effectively turning them into flat meshes of 3D polygons that the GPU is designed to render fast. This technology is used to make 2D user interfaces for console and PC games. Now, I'm no expert in scaleform or graphics hardware, but it seems to me that this technology or something very like it could feasibly be integrated into the Flash player, meaning whole Flash scenes and timelines could be rendered largely on the GPU. This would keep the Flash pro IDE as a relevant product, and take Flash beyond being the most popular platform for 2D games, to being the best platform for 2D games.
In 2008, along with many other developers, I asked Adobe for joypad support in Flash. At MAX last year, Adobe finally announced their plan to add this feature. I'm just as certain that I'm right that Flash needs hardware accelerated 2D.
This video shows how much power the GPU brings to Flash - wouldn't it be awesome to have that much power in our 2D games? Comments / reasons why I'm barking up the wrong tree are greatly appreciated! :)
Comments
So while this doesn't actually have to be a task for Adobe, I do agree it would be nice if it came from them. If only for showing their commitment to 2D.
The differences will then be down to the exact implementation of the "surface view" the context on which you draw, I haven't looked into Molehill but I presume they'll have a special kind of visual class for this kind of direct drawing.
Then you'll need a way to perform the drawing on a separate thread ideally, again I imagine this has been dealt with in the Molehill APIs, and you'd create a few callback hooks to allow your game engine to run the logic/update/input loop ready for your next graphics loop.
Thibault Imbert wrote::
Hi Alex and Zed-K,
Concerning 2D, you will be able to actually use Molehill for 2D too in the context of sprite engines. You can totally render 2D objects using triangles too on the GPU and get crazy fast rendering for 2D too in this case.
So, I guess a lot of people will come up with 2D engines built on top of Molehill too ;)
Thibault
Tuesday, November 9, 2010 at 12:24 am #
Whilst a 3rd party solution would be great - I'd love to see Adobe tie it into Molehill officially.
If Adobe is reading, +1 from me! Think of the benefit to Flex... :)
But seeing as you, others and I all want this, and the fact that Adobe is reading your post, I REALLY hope this comes along soon.
This is music to my ears. Keep banging them drums!!!
Im very wary of molehill, if the api and shader language are so different from directx/opengl/glsl then adobe will be no better than apple with obj-c.
The flash community got hit hard in 2010, its very much dead compared to what it used to be. Hopefully molehill will be a successful defibrillator.
I hope ADOBE is really listening...
I would also suggest you to post this idea to ideas.adobe.com
Cheers!
Flash ON!
Like devu said, the player is ready. Adobe give us a kind of low level access.
So it's our role (The Flash community) to make some libraries (create or adapte) to make this oportunity a benefit.