|Page (1) of 1 - 06/05/03||email article||print page|
Improving Flash Playback In Mac OS XIf you build it, they will come, and hopefully not be so ticked when they get there
In all the aforementioned feedback I did receive from the switcher article, I was mildly surprised to find that I didn't get a single response refuting my observation that even the fastest Mac is WAAAYYYY behind generic, and sometimes downright ancient, Windows machines in the Flash speed race. In an admittedly dated blog entry that I stumbled upon after I wrote the switcher piece, Macromedia's own Mike Chambers called attention to the problem by asking readers to submit examples. Something's definitely rotten in the state of Denmark, folks, and while a solution from Macromedia and/or Apple may or may not be forthcoming, Flash development marches ahead anyway. The bad news is that Flash developers have to deal with the real-world implications of a very noticeable speed gap between OS X and Windows when it comes to Flash. The good news is that there are some steps that you can take in the authoring stage to help lessen the impact and ensure similar playback on both platforms.
1) Avoid complex compositing if you can.
The one thing that blew me away about Flash in the first place is the very thing that I rarely think about anymore: Flash is doing everything that it does on the fly. Whatever vector content that's in your SWF is nothing more than a mathematical description that Flash uses to reconstruct your visuals in real time. Anyone who has seen Apple's Keynote in action might tend to think that the Flash Player and the Mac OS X Quartz engine would be as natural a match as your chocolate falling into my peanut butter, but this is sadly not the case. The OS X Flash Player seems woefully unoptimized, almost thumbing its nose at the potential of Quartz and Jaguar's Quartz Extreme, and with this as the shameful reality it's probably best not to anger the Flash Player any further when developing content for it.
So, in practice, you can have your vector artwork with lots of gradients and transparency. You can also have your smooth-playing animations. But you can't have both at the same time on OS X if you care about playback performance. Pick one or the other. Got complex vector imagery? Don't move it around, and don't move anything else around that's even in the general vicinity. Want that zippy animation Flash is renowned for? Better do it with fully opaque solids. Even any bitmaps you may be using are part of the equation -- remember, Flash has to decompress bitmapped images in real time as well.
2) Rein in your frame rates.
Most of us have seen examples of those super-fast 120 fps (Flash's current upper limit) animations in a banner ad or something, and that lightning-quick movement is a pretty damn sexy effect. Provided you stick to what's outlined in rule number one vis-a-vis complex compositing, you can even sometimes approach that hyper-frame rate in OS X. But if OS X playback is a significant concern, go with the lowest possible frame rate that meets your project's needs. Chances are that while you can get close to 120 fps in parts of your movie, in OS X you'll probably find that the rate just isn't sustainable.
It's at this point that I'm going to recommend a component that should be in every Flasher's toolbox: the FPS Controller. It's a freebie available from the Macromedia Exchange site, and it's absolutely awesome. Just drag out an instance of the FPS Controller onto the stage, name it, assign a target clip, frame rate, and direction (Forward, Reverse, the "PingPong" effect, or Random), and the FPS controller can modify the target clip's frame rate up to what you've set your main movie's frame rate to be. It's even got a set of ActionScripts so you can dynamically target clips, assign different frame rates, and even control playback direction through scripts. In movies that contain a wide mix of content, being able to control the playback frame rate of individual clips is an excellent weapon to have in the arsenal when trying to achieve the best possible performance.
3) Test early and often on a Mac.
OK, so that super-snappy intro animation (or "skip intro" animation, but that's an entirely different subject) runs great on your test Mac, so you're out of the woods now and can concentrate on the coding, right? Survey says...BUZZZZZZ!!! Believe it or not, ActionScript can potentially make a huge difference in how your movie performs, so even if all of your animations play smoothly, there may still be performance snags depending on the code that's trying to execute.
Now, at best, I would consider myself to be an intermediate ActionScripter. In my book, using advanced ActionScript means that you're calculating pseudo-3D wireframes or implementing physics models or something like that in Flash, and while I've got my share of dynamically generated animation and the crude beginnings of object-oriented code running through any given SWF file, I know firsthand that you don't need super-duper complex ActionScripts coursing through your movie to affect a slowdown in playback. Just a few onClipEvent(enterFrame) calls or conditional loops over a set of frames running around behind the scenes can cause the number of uncounted frames to go up, and depending on what's going on in those instances, the number of frames per second to go down, so testing on a Mac as often as possible throughout productions is a "good thing." And with Martha Stewart now seemingly (and hilariously) headed for an impeccably decorated cell, that phrase is up for grabs now, right?
4) Hell, just develop on a Mac.
I hate the idea of having to "dumb down" your Flash movie to the lowest common denominator, but let's face it: it's done it all the time. Programmers and web designers, to name a couple, target a set of minimum requirements and code/design for those requirements; Flash development probably shouldn't be any different. I know some programmers who actually prefer working on a machine that's one or two generations behind the current crop of hardware, because if they can get things running well there, performance problems won't be problems.
Sadly, even the fastest current dual-processor G4 loaded up with RAM and sporting a top-of-the-(Mac)-line video card is probably close to being said lowest common denominator, not only for Flash playback, but for authoring as well. So while this may not be the most helpful tip, as those not already on a Mac aren't likely to switch on the basis of this reason alone, the spirit of what I'm trying to say should still ring true. Working in a behind-the-curve environment when developing Flash isn't necessarily a bad thing. You'll learn discipline and good programming and design habits as you try to coax every last bit of playback speed out of the underperforming hardware, with the added benefit of moving overall playback performance from crapshoot status to more of a known quantity across the spectrum of your audience's available hardware.
Even if OS X playback is the furthest thing from your mind during development, these tips are probably helpful for Windows-only Flashers as well. Somewhere, someone with a lot of pull might try to view your Flash movie on a three- or four-year-old laptop with 2 MB of VRAM and Windows 98, so you certainly aren't completely immune to the Flash woes that OS X users experience on a daily basis. In OS X's case, I sincerely hope that the OS X/Windows Flash speed gap will soon close, as OS X is certainly capable of achieving the types of frame rates Windows users can more or less take for granted. In the meantime, though, hopefully these tips can help you level the playing field.
When not fleeing the paparazzi or spending his vast fortune associated with the fame and notoriety of being a DMN contributor, Kevin Schmitt can be found with his eyeballs glued to his computer screen, attempting to use some of the hardware and software he rants so incoherently about. An award-winning animator, artist and multimedia producer, he is currently a freelance designer located in the enormously bustling megalopolis of Charlottesville, VA. Whether you're looking to "give him the business" of either the figurative or literal type, feel free to drop him a line. He's ready to believe you!
Though the fame, riches, and notoriety of being a DMN contributor are both tantalizing and substantial, Kevin Schmitt still stubbornly insists on continuing his work as the Director of Interactive Services at EFX Media, a production house located just outside of Washington, D.C. Feel free to follow his updates and contact him through Twitter if you have something to share - he's ready to believe you!
Related Keywords:Mac, OS X, Flash
Source:Digital Media Online. All Rights Reserved