Skip to main content
chris.campbell
Community Manager
Community Manager
May 29, 2014
Question

The case for integrated, native physics in the Flash Runtime

  • May 29, 2014
  • 30 replies
  • 19096 views

Hello everyone,

As hopefully many of you know, a community based feature request page was created a few months back (Feature request for Flash and Air - uplist) and we've had a number of great ideas added and voted on.  In an attempt to better understand the individual requests, we thought we'd start threads on particular subjects to allow us to ask questions and get community feedback.  These posts should not be taken as a commitment to a particular feature (or lack of commitment to any other feature.)  I can't stress this enough.   I don't want anyone to think that we're ignoring other requests or to assume that because we're asking about something, they can expect to see this done in a future release.  We simply want to better understand the request so that we can reduce the number of assumptions on our part.

To start, let's we've got a few questions regarding the request for "Integrated (native) physics" which currently has 142 votes.

  • When talking about physics, are you interested in a 2D or 3D physics engine?
  • Can you list native engines that demonstrate the features you want the Flash runtime to implement natively?
  • For instance, if you're interested in Box2D functionality, have you tried http://www.box2dflash.org?
  • Is there a huge performance gap between the native and ActionScript implementations of Box2D?
  • Are you looking for solutions for desktop or mobile?

Thanks,

Chris

This topic has been closed for replies.

30 replies

Participating Frequently
May 30, 2014

I think having high level physics engine natively isn't that good of an idea as the resources can be spend better and there are already great physics engines or ANEs. What you could do though is implement low level methods natively that will help speed up these engines without bringing your own high level engine. For example native triangulation methods (this would even help in other areas and was requested for long time), more robust native geom functions for collision testing etc. Leave the high level stuff to the community and just speed up the low level, I mean I was told years ago that you guys already have triangulation algorithms inside Flash player its just not made transparent to developer, why not? So look at what these engines actually need to bump up their performance and implement that instead of working on your own engine.

Inspiring
May 30, 2014

A native 3D physics engine, that could be restricted to allow for 2D physics, would be great.

Having a fast mobile physics engine would be crucial, and also having native constructs such as eg character controller or vehicle.  The Bullet physics ( AwayPhysics ) is great for online, and the ANE seems like a good option for offline, but having these technologies integrated ( either Bullet, or Havok ) and easily available to developers would encourage their update.

Here's a link to an example of AwayPhysics being used for a Flash game for the recent Lego Movie.  Without the built in vehicle template, this level of raycasted vehicle physics not have been possible.  Note that AwayPhysics was slightly modified to work with Flare3D in this case.  Also note that this is desktop only, a fast mobile version would have been a great option to have.

The LEGO Movie | Glue Escape Racing Game

Just out of interest, Intel originally created a physics engine for Adobe Shockwave to go alongside their 3D engine ( Shockwave 3D ) for v8.5.  Before releasing 8.5, they licenced Havok physics and shipped it as an Xtra for offline and online usage.

Intel purchased Havok several years ago, so it would be cool to see a similar effort made for Flash.

Participant
May 30, 2014

Hi Chris,

Glad you guys have taking an interest in the uplist we made!

From my point of view an inbuilt physics engine is something that will be a big commitment from Adobe's part that perhaps could be spent better in other areas.

Here is my pros and cons for the idea.

Pros:

Awesomeness, no doubt it would be a great and exciting feature to add to the list of capabilities of the flash runtime.

It will help restore faith in the flash platform... it is still being improved and not just with bug fixes but with huge new features!

It will put flash back on the radar in terms of new developers and probably help a few of those who have moved on to reconsider coming back to flash.

It would be built with flash in mind from the ground up producing a much more performant and gc friendly engine.

It makes flash a more competitive option against unity for 2d games.

It would remove a barrier to entry for more novice developers.

It would enable physics to run on mobile devices without taxing their cpu's as much.

Any new feature for flash is a pro in my books!

Cons:

It will probably take a fair bit of time/effort to get it up and running well.

It will no doubt need to be maintained/updated for some time to come.

If it doesn't quite resonate with what the community needs/expects it could end up becoming a burden and a source of frustration for some (not likely but still possible, i.e. if it ends up still being slow, or the api is akward...)

Time spent on this could be time spend on improving the current architecture.. if you could make actionscript run as fast as java (or even faster) in terms of math, function calls, execution speed etc... then the existing libraries would probably do the job just fine with a little tweaking here and there.

Whatever you do we are glad you are listening to your developers!
P.S. Make flash faster... I know it can be done!!

FramaisCellarGhost
Known Participant
May 30, 2014
  • When talking about physics, are you interested in a 2D or 3D physics engine?

2D please.

  • Are you looking for solutions for desktop or mobile?

Both, for me, priority is mobile

Thanks for the great work you guys are doing on AIR/Flash, keep it up!

Participating Frequently
May 30, 2014

2d Engine for mobile , with  api similar to nape on  Mobile / AIR . I tried nape on mobile, its fast but can be better.

Participant
May 30, 2014

NAPE's api is nicer than box2d's.  Mobile performance is more of an issue than desktop performance, and I'm interested in 2D.

Participant
May 30, 2014

Native physics would be great for 2D and 3D, desktop and mobile.

Not necessarily the whole engine but fast collision detection functions like :

ray-triangle ray-sphere collision detection for 3D

or line-line line-circle rectangle-rectangle for 2d


those are the cpu killers(especially for 3d). The rest can be as3.

In my opinion runtime integration would be the cleaner solution + it would be cross platform.

Participating Frequently
May 30, 2014


2D please

Nape

mobile first (AIR)

nape runs great performance on 2d on mobile

Participating Frequently
May 29, 2014

Agree with everything hnjps said - but my primary focus (in 99% of cases) is mobile.

chris.campbell
Community Manager
Community Manager
May 29, 2014

Thanks for the video.  Given the results, would an open source ANE project be a better solution than a closed implementation in the runtime?

Inspiring
May 30, 2014

Chris: a number of Adobe ANEs already exist but hardly get any attention by Adobe. So, if you are going to make yet another (physics) ANE, please make sure developers will be maintaining it in the long term, OR you could just support someone else in a manner you are doing it with Starling/Away in doing it.

Pro-NAPE guys: NAPE API is indeed nicer, and - unlike flash port of box2d - it is still worked on. But have you seen the sources (specifically, did you ever build them : ) In the same time, C++ version of Box2D is actively developed and straihtforward to compile.

Participant
May 29, 2014
  • When talking about physics, are you interested in a 2D or 3D physics engine?

I'm interested in a 2D engine.

yes I did and performance is very bad on mobiles.

  • Is there a huge performance gap between the native and ActionScript implementations of Box2D?

yes a huge one.

  • Are you looking for solutions for desktop or mobile?

both

Inspiring
May 29, 2014

To this part:

  • Is there a huge performance gap between the native and ActionScript implementations of Box2D?

you might want to watch this video: