Archive for the ‘PERFORMANCE’ Category
Flash not being on the iPhone yet is quite telling of the type of company battles going on. I like what Apple produces many times but they love a locked down environment more than Microsoft, in fact Microsoft seems like an open company and open market that is for sure compared to Apple. I am starting to think it will not happen, Flash on the iPhone. I have to boycott the iPhone for the type of closed environment that only non-developers can love. There are certain technologies, open or not, that become base technologies that create a platform of commonality to even make a market possible, the mobile market seems to be doing everything to not let that happen.
Daring Fireball (John Gruber) has a good take on the situation.
There are currently two ways to develop software for the iPhone (and iPod Touch): using HTML/CSS/JavaScript web standards, and using Cocoa. Cocoa is proprietary, but from Apple’s perspective, it’s the good sort of proprietary: a competitive advantage completely owned and controlled by Apple. Apple doesn’t control the HTML/CSS/JavaScript web standards, but neither does anyone else. And Apple does control and own WebKit, which is by anyone’s measure the best mobile implementation of these standards today.
Flash, on the other hand, is (from Apple’s perspective) the wrong sort of proprietary — owned and controlled by another company. Apple and Adobe aren’t enemies, but they’re certainly competitors, and the history between the two companies is not entirely warm.1 In the grand scheme of things, I suspect Apple’s executives aren’t happy at all about Flash’s prominent and entrenched role in desktop computing, particularly the fact that Flash, rather than QuickTime, has become the de facto standard for video on the web.
It is all about control…
The mobile market is wide open in ways that the desktop market is not. E.g., in the mobile OS market, Microsoft isn’t even in first place, let alone a monopoly. And, in the mobile world, Flash is rare, not ubiquitous. Why would Apple help Adobe establish Flash as a de facto standard for the mobile web, too? If Flash does turn into a major force in the mobile world, Apple can always add it later. But why shouldn’t Apple push for a Flash-free mobile web future now?
As it stands today, Apple is dependent on no one other than itself for the software on the iPhone. Apple controls the source code to the whole thing, from top to bottom.2 Why cede any of that control to Adobe?
Unfortunately if Gruber is right the mobile market will continue to be a lag in areas such as gaming, vector based apps, video, competitive markets, and many other things that lead to innovation. I think some of the recent changes in mobile recently are extermely cool (iPhone, Android, new flashlite) but unfortunately they have added about 20 new directions that mobile developers have to develop for. It is anything but a consistent platform even within the company silos being created in the mobile market.
Moses has posted some nicely presented info on Go performance.
So far it looks almost neck and neck with TweenLite in drop dead sprints for fastest performing exhaustive tween kung fu-ing.
Although these are not really for competition it is to mainly show patterns for design for purposes that you need. Where this is a more apples to apples comparison (Go vs TweenLite) as the other kits have other overhead such as filters, utilities, even pathing for AnimationPackage and Tweener. TweenLite solved this by separating out into TweenFilterLite and just making TweenLite for animation (and keeping file size extremely small, virtual machine advantages). There is just no excuse for the F9 Tween class though, what the…
It is one thing to build, another to share, another to present information in a very consumable way and then another to make that whole presentation look really good. Moses, like polygonal labs, throws down some nice demos and information posts.
Go was late to the AS3 Animation kit game after pwning with FuseKit in the AS2 age (especially the creative agency love), I think it was the right time as it was released the TweenLite and TweenBencher performance testing utilities put a focus on performance to see just how many more cycles we could get out of AS3 from an animation kit. When building your own animation kits or contributing to one, these observations from various aims helps in the code design.
I still use Tweener in most production work, and TweenLite when I need really small assets if there are going to be many of them. But, I have started to use Go in a kit I am building that I hope to share more in the future, and used it in a small game. But by the speed of the tests and my own experiments it is pretty clear to see that both TweenLite and Go would be excellent base layers to animation kit architecture and Tweener is a bit more on top of that with the filters and bezier tools that it is really a more complete package with less work to do as your animation gets more complex (colors, saturation, bezier, etc). But if you were looking to build your own animation kit or for micro assets a base like Go or a base kit like TweenLite is the way to go). Some notes from Moses’s tests show that performance and sync are also what starts to fall apart as performance critical mass is reached. Go and Tweener held sync the best.
Side notes:
The TweenLite system was highly performative on all three measures. That system also features a very small filesize footprint, making it a clear choice for banners or other filesize-restrictive projects.
Go & Tweener were the only systems here that synced their animations – others ran out of sync to different degrees which yields less visually favorable results. Actually, it looks kind of neat in the tests! But you don’t want out-of-sync animation in your real-life projects. This effect can be clearly seen using the open-source TweenBencher utility, included in the Go package.
Here is a well done game based on the popular Line Rider phenomenon, only this one is Line Golf and it is using the APE AS3 2D Flash Physics Engine. I am sure game sites are just as excited as game developers like myself about the prospects of games that are more dynamic and fun and even 3d with the flash kits of today all thanks to the power of AS3.
This was posted on the APE Google Group where onedayitwillmakeit explains more on how he modified APE for use in the game.
Who’s up for some flash 3d gauntlet? Away3d and Fabrice have posted a pretty sweet demo that samples a 3d level with a little 3d avatar running around (animated).
The stuff for generating 3d worlds in flash from the FPS demo from Animas (Paul Spitzer), the intense work going on at Alternativa Game, toolkits like AS3 Geometry Exporter for 3dsmax (to away, sandy or papervision 3d format/types). And of course all the great 3d engines, physics engines and animation kits that have helped make the 3d flash pipeline for actionscript 3 (as3) a little more optimized and quite fun.
Great news! Polygonal Labs has released the long awaited Motor Physics engine. It is now called Motor2.
UPDATE: Now hosted at Google code
Project hosted at code.google.com/p/motor2
License: New BSD License 
After the port of Box2DFlashAS3 appeared the fate of Motor Physics engine was unknown. But with time and just before the stroke of midnight on the final hour of 2007 Michael Baczynski released Motor2 2D physics engine on the world.
This now gives us, count them, FOUR AS3 Physics engines that were released in 2007 in order of release.
Be sure to check the demos of Motor Physics:
To get the source head on over to the blog and in the post it is in the first para.
Currently you can get the source for the preview here.
Polygonal always has such great information and demo write ups the source link gets lost in there. Hopefully this will be at Google code soon or a public SVN. The code looks great and there are optimizations in there but even those are elegant.
With 3 excellent flash as3 3d engines (papervision3d, away3d, sandy), 4 physics engines, lots of great utilities like FZip or ASZip, AlivePDF, Red5, haXe etc etc. 2008 is looking like it will be a great year for performance, optimization and gaming/app platforms on the web like never before seen. I am most looking forward to the coming gaming market for flash, lots of possibilities. With the added competition from Silverlight, much innovation will happen here.
It is great that Motor2, which has a great author and dedicated to performance has joined the physics engine scene, not only that posting on new years eve. Thanks to all that make the flash platform possible of creating excellent new fun and useful tools.
UPDATE: Now hosted at Google code
Project hosted at code.google.com/p/motor2
License: New BSD License
Only a year after release Papervision is getting a major update to 2.0.
Get it while it is hot from the SVN server on google code: http://papervision3d.googlecode.com/svn/trunk/branches/GreatWhite
Papervision3D, launched a year ago, really sparked the AS3 and flash/flex world and inspired every flash guru I know into working on this code. There have been some great tools made and some fwa’s won but it is only the beginning.
I am mostly looking forward to performance enhancements, ascollada integration, culling and Andy Zupko’s 2d bitmap effects on 3d.
- Faster!
- ShadeMaterials
- Shaders
- ASCollada (animation support)
- Frustrum Culling
- Multiple Viewports (3d editor anyone?)
- Render to Scene
- and more!
SVN server and branch:
We do indeed like to ride the racecars!
Found via Zeh, this great bulk loading kit for AS3 from Arthur Debert.
AS3 Loaders are very useful, but when you have large projects there is always a pause and focus on loading scenarios and architecture needed for your loading scenarios, sometimes this can literally eat days and entirely change performance with wrong moves. BulkLoader is a well written kit from Authur Debert that makes loading scenarios or using BulkLoader as a base to your loading situations a great pluggable piece of code that has many excellent features.
Some of the calls like BulkLoader.getLoader(“main-site”).getContent(“bg”), are also very similar to Silverlight’s downloader object that can be queued like this. All in all a kit that is very useful that I have already put to work and will help teams standardize on bulk loading for those killer flash apps.
- BulkLoader at Google Code
- Credits
- DeveloperGuide
- GettingStarted
- ProjectStatus
Creating a BulkLoader instance
// creates a BulkLoader instance with a name of "main-site", that can be used to retrieve items without having a reference to this instance var loader : BulkLoader = new BulkLoader("main-site");
Add urls to load
// simplest case: loader.add("logo.png"); // use an "id" so the item can be retrieved later without a reference to the url loader.add("background.jpg", {id:"bg"}); // since the url by itself can't tell us what the filetype is, use the type property to let BulkLoader know what to do: loader.add("/some-web-services?size=Large", {type:"image"}); // add an item that should be loaded first (higher priority): loader.add("/data/config.xml", {priority:20}); // add a max try number (defaults to 3) loader.add("/unreliable-web-services.xml", {maxTries:6}); // you can also use a URLRequest object , this will load from a POST request var postRequest : URLRequest = new URLRequest("/save-prefs.php"); postRequest.method = "POST"; var postData : URLVariables = new URLVariables(myPostDataObject ); postRequest.data = postData; loader.add(postRequest, {"id":"settings"}); // of course, all options can be combined: loader.add("the-sound-webservices?name=maintrack", {"id":"soundtrack", type:"sound", maxTries:1, priority:100});
Listening for events
// simplest case: loader.add("logo.png"); // use an "id" so the item can be retrieved later without a reference to the url loader.add("background.jpg", {id:"bg"}); // since the url by itself can't tell us what the filetype is, use the type property to let BulkLoader know what to do: loader.add("/some-web-services?size=Large", {type:"image"}); // add an item that should be loaded first (higher priority): loader.add("/data/config.xml", {priority:20}); // add a max trie number (defaults to 3) loader.add("/unreliable-web-services.xml", {maxTries:6}); // you can also use a URLRequest object , this will load from a POST request var postRequest : URLRequest = new URLRequest("/save-prefs.php"); postRequest.method = "POST"; var postData : URLVariables = new URLVariables(myPostDataObject ); postRequest.data = postData; loader.add(postRequest, {"id":"settings"}); // of course, all options can be combined: loader.add("the-sound-webservices?name=maintrack", {"id":"soundtrack", type:"sound", maxTries:1, priority:100}); Listening for events: // attaching events to all items: // this will fire once all items have been loaded loader.addEventListener(BulkLoader.COMPLETE, onAllLoaded); // this will fire on progress for any item // the event , BulkProgress is a subclass of ProgressEvent (with extra information) loader.addEventListener(BulkLoader.PROGRESS, onAllProgress); // this will fire if any item fails to load: // the event is BulkErrorEvent and holds an array (errors) with all failed LoadingItem instances loader.addEventListener(BulkLoader.ERROR, onAllError); // you can also listen to events in individual items // this will fire as soon as the item registred with the id of "bg" is done loading (even if there are other items to load) loader.get("bg").addEventListener(Event.COMPLETE,onBackgroundLoaded) // this will only trigged if the config.xml loading fails: loader.get("data/config.xml").addEventListener(BulkLoader.ERROR, onXMLFailed);
Starting the loading operation
BulkLoader will only begin loading once you call the start method:
loader.start();
Retrieving content
var theBgBitmap : Bitmap = loader.getContent("bg") as Bitmap; // you don't need to keep a reference to the loader intance, you can get it by name: var theBgBitmap : Bitmap = BulkLoader.getLoader("main-site").getContent("bg") as Bitmap; // you can also use the conviniece methods to get a typed object: var theBgBitmap : Bitmap = loader.getBitmap("bg"); // grab a BitmapData directly: var theBgBitmap : Bitmap = loader.getBitmapData("bg");
Other convenience functions: getXML, getText, getNetStream, getSound, getMovieClip, getNetStreamMetaData.
You can retrieve an item using it’s id, it’s url as a String or as the URLRequest object (if the item was created with an URLRequest).
Arthur also has experience on Tweener so making simplified calls and minimalist code to make a library successful is very clear in the notes/goals on the project and the resulting code:
BulkLoader is a minimal library written in Actionscript 3 (AS3) that aims to make loading and managing complex loading requirements easier and faster. BulkLoader takes a more dynamic, less architecture heavy aproach. Few imports and making heavy use of AS3′s dynamic capabilities, BulkLoader has a one-liner feel that doesn’t get your way.
BulkLoader tries to hide the complexity of loading many data types in AS3, providing a unified interface for loading, accessing and events notification for different types of content.
This library is licensed under an open source MIT license.
Features:
- Connection pooling.
- Unified interface for different loading types.
- Unified progress notification.
- Events for individual items and as groups.
- Priority
- Stop and resuming individually as well as in bulk.
- Cache managing.
- Statistics about loading (latency, speed, average speed).
- Multiple kinds on progress indication: ratio (items loaded / items to load), bytes , and weighted percentage.
- Multiple number of retries.
- Configurable logging.
Design goals:
- Minimal imports.
- Few method to learn.
- Dynamic nature: items can be added by specifying a url as a String or a URLRequest .
- Items can be assigned an identifier key to be used on retrieval.
- Only one class to learn / use.
BulkLoader tries to gracefully handle progress notification in these use cases:
- Few connections to open: bytes total can be used instantly.
- Many connections opened: progress by ratio
- Many connections opened for data of widely varying sizes: progress by weight.
This is quite a contribution to the flash community and is a perfect candidate for the base of your loading assets projects and scenarios. Thanks Arthur!
Andy Zupko is probably doing some of the coolest / useful work in performance and possible effects combining 2D and 3D. Using 2D BitmapData and papervision 3D it turns out you can create a parallel dimension of coolness that cannot fully exist by themselves.
Papervision 2.0 with these effects and if it is as pluggable as it seems is very good for games that lighting is a key component or effects. Imagine a game that can customize weapons with 2d effects in 3d, or rocket boosters, or fireworks or all kinds of inspiring things like changing the mood or environment such as fog, lighting etc… If you start taling about adding physics to all this it just gets too fun. Effects have always been there and around, but making this possible to have a semi-standard way to do this and if it is pluggable, this can lead to many engine advancements.
I think the PV3d team additions of Tim Knip and Andy Zupko have been very good and zupko era in PV3d has begun. Tim Knip is also very active and helping to really organize the ascollada formats and performance stuff like only drawing what is on screen.
Who needs Hydra now? j/k although having this now in papervision leads me to see a very fun 2008 ahead for Flash, it is also, if as pluggable as it seems, a bit like a shaders kit.
All those older great 2d effects merging into 3d from the good old days (some still going very strong) of praystation, yugop, levitated, neave (great 2d tv effects in neave.tv) , flight404 (moved to processing) and many others. And a new era of zupko [pv3d], mr. doob, unitzeroone [pv3d], fabrice [away3d] and many more a new 2d effects in 3d platform is emerging. This kit for papervision3d by zupko and Hydra is making the future glowing full of bright points, and lots of effect explosions.
Let’s hope papervision3d 2.0 it is released soon and it has zupko’s effects code in there.
The Proposal
Moses, the maker of FuseKit, is hoping to influence Adobe product lines to include a common base for animation and motion going forward. Currently the AS3 world is very alive and is inspiring developers like myself to build lots of toolkits and really creating reusable code and kits that can make things very easy from going to Flash to Flex. But wouldn’t it be nice if a part of these kits that have to be downloaded every time you have an application use them be part of the native Adobe applications, or a core animation kit that partially standardizes animation basics to build upon further?
Are we just asking for trouble or is this a good idea? I don’t’ think it can hurt to bring this to the surface. I know that common syntax and familiar kits can really help the developers and designers move from Flash to Flex to After Effects to Javascript, it could also help Adobe with usage and usefulness of their entire suite of products. Or further this could be a standard that allows Silverlight to also build upon (open standard) and may the best platform win.
I think it would be very wise for Adobe to:
- Standardize animation toolkits across their products and
- Start standardizing some of the basic tools of building motion and filter kits to native but still allowing a flourishing open source and community research and development aspect.
What MosesProposes:
- Blog entry by Moses on this topic
- Diagram: Current Situation

- Diagram: Proposed Core Library

Moses did speak with someone at Adobe about this and it is generally in the plans:
“It was also a pleasure to see Richard Galvan present the upcoming crop of Flash features: the sleek update to the animation timeline (better late than never?), support for columnated flowing text (double finally!) and the big one, native 3D player support for Display Objects as rotatable 2D planes. He ran out of time and didn’t get to a few others shown at Adobe MAX, such as built-in IK (inverse kinematics) and faster pixel-level drawing for texture-mapping and photoshop-like filter effects.
Talking to him after the presentation I learned that Richard has a keen awareness of exactly where each feature is at currently. We chatted about low-level animation mechanics of the Flash Player, and I found out that the holy grail of a time-based player is indeed on the distant horizon, but that each rev will need to be a small step toward this goal. The new Flash timeline features meld After Effects, Premiere and Live Motion, and from what I’ve seen I have to say that they are nailing this long-overdue upgrade with great design decisions and a level of usability we’ve never seen in Flash. Kudos, team!”
The Current Situation
Right now Tweener and TweenLite (and animation package and a few others) have a unique position in that they work the same almost for AS2 and AS3 (Flex or Flash – with minor property changes such as _x to x as that has changed in AS3). But it would be nice if these kits also had a version for After Effects (really bringing that tool into Flash/flex developer worlds) and Javascript and it would be great if Silverlight also were supported (AgTweener anyone?).
Tweener is leading the pack in this aspect of creating a similar experience from AS2 to AS3 in Flash and AS3 in Flex and even JSTweener for Javascript, and a kit for haXe which is becoming my favorite toy and the dark horse with the most upside potential, with haXe on the loose these points may all be moot as haXe can target any platform (except After Effects easily, correct me if I am wrong and Silverlight but it could easily be done so to do it for Silverlight 1.0 which is ES3 based).
I don’t use After Effects as much right now but if I could easily incorporate this into Flash/Flex and script and animate in a similar syntax and way I know After Effects would definitely have a boost in interest.
Also, the forgotten one Director, can we please get an ES4 based language in that application, or an update? Then kits and add-ons are much more possible. I really miss hardware accelerated 3d in browser as a pushed technology, Director is still around but it does not get the focus it needs. Feel the freedom and coolness just in this small test here in director, hardware accelerated 3d is the best, the Director application environment and Lingo and hacked in javascript are not the best. As a long-time Director user, hobbyist and professional I am disappointed in Director’s support at Adobe thus far, but I digress.
The Reality
The reality is right now the only problem with kits like Tweener, TweenLite, Tween, mx.transitions, mx.motion, etc is that the source has to be embedded in movieclips multiple times. Sometimes there are multiple animation kits per compiled SWF that have to be used for more advanced features. This adds bulk that if common might not need to be there (this comes into play still on mobile and large games/apps).
Let’s say you have an application that pulls in many disconnected SWFs and they all have animation in them, well if you have 20 of these let’s say, and you embedded a very small Tweener at 9k per SWF. That is about 200k of duplication of AS code. Due to the kits small sizes this is not a problem really but when animation kits like Animation Package come into play, you are talking 40k per SWF which would leave you with almost a meg of just duplicated animation code. I don’t think this is that major of a problem for kits like Tweener (9k compiled) and Tweenlite (3k compiled) but as projects get bigger and more depth of animation platforms needed this can be a problem. This can also be solved in architecture with a controller and dummy SWFs to animate but there are times when you need animation in the compiled SWFs and then also need it in many others and the controller.
The other reality is the animation kits (mx.transitions.easing, mx.transitions.tween) for Flex and Tween for fl are a little bloated, more difficult than needed to use and as has been seen, much slower than kits currently available in the community. My one fear about this is that if Adobe makes this, possibly like Microsoft’s toolkits and libraries they put out, they are always bloated and slower, then because they are embedded they are untouchable. If it was standard enough as building blocks that are faster because they are native, then this is the best option as embedded script would be hard pressed to beat native code in the players/applications.
The Future Plans
Some of this is underway….
Animation kits for future, Adobe is releasing Flash 10 called ‘Astro’ that has many new improvements in tweening with xml closer to flex or even Silverlight like transitions and storyboards. Aral Balkan, a sponsor of OSFlash, posted on this and even that Diesel Flash CS4 will include more Tween tools for IK/bones. Tweener , TweenLite, Animation Package, Animation System etc these are all helping to define the best way to do animation kits.
Physics toolkits have their own animation kits currently usually to handle the movement according to algorithms. FOAM, APE , Box2DFlashAS3 (just released very recently will be posting more on this after I check it) and Motor Physics (unreleased but heavily demoed at polygonal labs) are great physics toolkits and I like this being part of the community to get refined, maybe one of them or the best performing ones becomes part of the proposed Adobe Animation bundle. These will define the best way to do physics kits.
3d in flash toolkits have also been emerging rapidly in 2007 with Papervision3D, Away3d based on pv3d, Sandy, and even engines starting to get built on top of these platforms.
The general direction is moving towards another platform in there somewhere but I think much work is left to be done to standardized physics systems, 3d and advanced motion filter tweens and bezier, splines (Catmull-Rom), editors, etc. I think it is getting time for basic animation kits to become more standard though and in latest versions of flash this is included in the flex and flash scripts but not the native code.
Right now the standard in syntax and the broadest reach is Tweener and due to the bigger fish syndrome, haXe that can target any platform, it also has a Tweener and can create code for as2, as3 and any target written in if After Effects, Premiere or other apps get more robust and standard animation and motion kits. Tweener has kits made and contributed for AS2, AS3, haXe, Javascript and others.
There is also Hydra and the AIF Toolkit that are standardizing After Effects and Flash shaders and filters into a new shader language like Cg and reminiscent of processing.org.
As humans we trial and error and build new platforms in the market to step on to create better platforms to build cool stuff, it is evolving right now. AS3 is inspiring platforms within platforms of Flash and Adobe kits as well as on Silverlight and in the Javascript world with JSTweener, jquery etc. As these things are refined we build a level standard platform to build more stuff on. Eventually this will be there and whoever does the standard platform for animation will probably reap in users and abilitty to easily add new products and solutions where people already have training. Silverlight is an example with .NET developers. .NET was also an example with C# so similar to Java. ES4 based AS3 has proven it is inspiring all types of new platforms and kits and will continue to do so and it is an interesting time in this industry whichever direction it goes.
Drew Cummin’s FOAM is a great flash as3 2d physics package that can be integrated quickly and get started with realistic physics in 2d flash apps and games. I have been playing with this since FOAM’s release last week and putting together some tests to show, comparing with APE and really looking forward to polygonal labs Motor Physics to add there.
Three excellent physics engines (FOAM, APE and Motor Physics) for flash in AS3 already. Basically at flash9 player/avm2 market saturation (it is now available to develop on in over 94% of market) is showing the power of the ES4/Javascript2 based Actionscript3 language and how it is inspiring developers to new levels of interest/inspiration. Then again haXe can target them all but I digress.
FOAM was recently released but the author Drew Cummins is showing very good support for the toolkit and released a plethora of goodins to support this great kit, bug fixes, samples, docs and some realistic physics demos as well as in depth walkthrough of creating a force generator and comparison of the Euler and RK4 equations used in that process and their differences (Euler being less correct due to the factors of the platform and intervals and environment, RK4 more correct but more expensive to run)
If you are developing realistic physics in flash games or apps this toolkit is a great source of inspiration.
- Demo showing semi-realistic physics and the results of the Euler and RK4 Solver in an orbit scenario
- Excellent post describing the IForceGenerator interface to make a GravitationalForceGenerator class used in the demo
- Code sample orbit of realistic physics (AS3)
- Code sample of GravitationalForceGenerator class (AS3)
- Euler class in FOAM
- RK4 class in FOAM
- FOAM AS3 2d physics engine source at Google Code
- Perpetual Fall
- Zero G Toy Chest









