Motor Flash Physics: AS3 conversion done
September 19, 2006 on 11:35 am | In Actionscript, Physics | 7 CommentsI am pleased to announce that the development of the motor physics engine has taken a big step towards a first final release.
Nearly all parts of the original code where rewritten and optimized to run as fast as possible in the new AS3 AVM2. I also spent some extra time to write dedicated & lightweight collision algorithms for different shapes instead of treating every object as a convex polygon.
There is yet a lot of optimization potential, for example I’m using a brute-force method for the broad phase collision part, which simply checks every object against each other.
With all this changes, I think that the engine would perform fairly good under AS2, too.
Since this engine is made for games, my focus is on speed and not to get a 100% physical correct result. Thus I allow the objects to overlap and gently push each other away when multiple simultaneous collisions occur. This effect can be reduced by averaging impulses, but for now, the important thing is that the simulation is stable and objects don’t warp through each other. Later on I’ll implement an accuracy-factor to blend between speed & accurateness dynamically and to keep the frame rate at a constant level.
New features:
- a flexible, event driven framework to allow easy integration of new collision and response models, shapes, forces, integrators etc.
- new frame-independent collision detection algorithms supporting spheres, segments, vertices
- blistering fast frame-independent collision detection for axis-aligned and oriented bounding boxes
Currently missing / planned features
- reduce overlapping, better stacking
- different broad phase culling strategies (currently bruteforce only)
- ‘hybrid’ shapes composed of edges and curves, such as rounded blocks
- soft bodies
- rigid constrains
- proximity tests
- optimize, optimize, optimize ;-)
Watch the AS3 preview (popup, Flash Player 9)
O my god this is so fast! So many blocks and I keep 30 fps!!!! I like it man! I do!
Comment by Snipergen — September, 20 2006 #
thank you :-) it’s a pity that the browser still slows the player down.. I get about 15-20fps more in the standalone player.
Comment by mike — September, 20 2006 #
Wow is all I have to say. this is very impressive Mike–I want to see more :)
Comment by Oz — September, 21 2006 #
Shape Overkill! Great performance! Thumbs up!
Comment by vi2e — September, 22 2006 #
About the slow fps in browser issue… have you tried setting the wmode to transparent? I know it sounds weird, but for some reason when it’s not transparent it is slower
Comment by Oz — September, 22 2006 #
Mike, great block demo! When do you think you’ll do a first release?
Paul
Comment by Paul — September, 23 2006 #
@Oz
thanks for the tip ! I have updated the html file, now i get 5-10fps more :-)
@Paul
I really don’t know – because I have a lot of other (paid) projects running I can’t work full-time on it right now. So.. when it’s done :-)
Comment by mike — September, 23 2006 #