Day two of Flash on the Beach would prove to offer even more Flashy goodness than the first, with great talks throughout the day and wowing us every chance they got.
3 Minute Wonders
The day opened with an hour of elevator pitches, allowing twenty solo attendees to individually take the stage for three minutes at a time to show their best work, idea, code or drawing – whatever they liked really. The idea being to give those brave enough an open audience to show off the coolest thing they’ve got.
And there was some cool stuff.
Mostly we saw people’s new business ideas and apps, lots of games and Actionscript experiments. A lot of them actually were projects that have been declared open source and some creators took this time to call freely for collaborators and testers. There was also a couple of generative artists thrown into the mix too.
All in all, given the talks that we ended with on Monday, what could have been an absolute incoherent shambles (as event runner John Davey did seem to worry about) came across as smoothly planned and well informed.
Probably the most useful project to note, I thought, was presented by Conrad Winchester called ASAXB – a tool that intends to put an end to the endless serialisation of XML to and from objects in order to handle your data with code.
Inspired by Java’s JAXB, it enables you to annotate code for marshalling and unmarshalling from Actionscript to XML. You don’t actually write the code that does the conversion, instead you give instructions to the marshalling system about how to package your object as XML and it does it for you. This is one of the open source projects that I mention.
Another talk was a really quick comparison between Objective-C and Actionscript 3, from Nick Kuh. Previously I’ve been a bit unsure about why Flash developers are either expected to (or keep banging on about) iPhone development – but somehow after seeing this I figured, it probably doesn’t matter. It probably doesn’t matter whether we should or shouldn’t be (or be expect to be) developing for iPhone or with Objective-C, ultimately, as this guy said – it’s just another language. In fact, the plus is that it’s an object-oriented language – so anyone with knowledge of OOP is halfway there already. So why not, eh?
Basically, Grant Skinner is the man. You probably already know this, if not you should.
Grant’s talk was on optimisations for Actionscript. He went through a whole ton of techniques, practical examples, demonstrations and supplied code snippets from the most basic alterations to some pretty advanced trickery to provide ways to improve the speed of your code and relieve the CPU operating your applications.
Most people are aware of simple tips and best practices you can assert, declaring a loop length outside of the loop itself, collapsing literal values, using multiplication instead of division – those kinds of things – and Grant often blogs or tweets bits of code (he showed us some nifty bitwise tricks I’ve seen him post somewhere else before). But there was so much here, some stuff I’d not seen before and a lot I would never have even thought would really have any impact on performance – but wrongly so.
For the majority of his optimisations he provided timed tests and metrics for true comparison. Demonstrating the different ways of carrying out the same logic, highlighting areas that are easy improvements and black spots you should always avoid.
The optimisations weren’t only code-based either. He spoke about the other wages on performance, on-screen media (audio, video, webcam) and graphics (renders, filters, composites).
He also discussed the garbage collection of the current Flash Player and how to ensure there is an allocation for it to operate. He also considered the differences in the performance of the Flash player when running within the IDE, or standalone, or as a plug-in for the browser. There’s quite a difference.
This led on to his exploration of how to measure your own optimisations and to the tools that he has to offer to do so. See his PerformanceTest, FramerateThrottler and Janitor classes, to name a few.
There was a great depth to everything he said, he discussed qualitative and quantitative testing and the importance of benchmarking your tests.
Actually he made an interesting comment at the very beginning of the talk, stating the need for our applications to be good system citizens. As Flash matures and AIR becomes an ever-more solid desktop runtime, we can’t expect to hog the CPU anymore or for users to excuse that. It’s relates to my thoughts during Mike Chambers’ session with AIR on Monday, that I wrote about in my last post.
Anyway, the serious value of the talk really was in the code he provided and I’ve barely mentioned that. There was actually one hundred slides in all and I can’t hope to relay everything here. Fortunately his slides are already online, so read them here if you missed out. It’s such a great resource to have all those in one place.
Grant Skinner is the man, because Joa Ebert cannot be human.
Joa’s talk was also about optimisation and began with some shared components of the last talk, but it soon became clear that his was ridiculously hardcore in comparison.
Joa took us down to machine code-level to analyse optimisations, scrutinising the compiler mechanics and the processes it performed during compilation.
He demonstrated the first of his frameworks, AS3V, a code-validator like no other for Actionscript 3. Born out of unhappiness with the current compiler and other code validators, AS3V will generate warnings and offer optimisation tips upon detecting exactly the kind of code that Grant talked about improving earlier – not just code errors.
For example, he talked about loop invariants, a often-encountered situation where a value is declared inside a loop even though isn’t changed with every iteration. Of course, this code compiles and executes, but needlessly takes longer to process (having to instantiate a new variable each time). His validator, available as an Elipse plug-in, detects those kind of code inadequacies and alerts the user at author time. It points out code that will run slowly, not only code that won’t run at all.
The tool looks for the breaking of coding guidelines and best practices, as well as opportunities for runtime errors – where compilers of course, only look for compilation errors.
Turns out Joa was only getting started at this point. He spoke about another framework he developed during ‘a week off’, called Apparat. This is a monolithic framework behind a number of other tools he then went on to talk about, all concerned with optimisation.
Second there was Reducer, which reworks the JPG compression for SWF files to make them an incredible ten times smaller at 100% quality compression, or obviously even smaller at lower percentages.
Finally he presented TAAS, ‘Three Address Action Script’, which is an optimiser for the Actionscript compiler rather than the code.
Joa wrote this program to find inefficiencies in the compilations process, for example finding opportunities to rewrite algorithms, perform dead code elimination, some relatively ‘straightforward’ stuff like single static assignment and in-line expansion – and even to make use of functions that Adobe have written into the compiler but don’t actually use!
He showed that when performing calculations on to ints, the compiler converts the values to Numbers (and back again) in order to use the Number calculator even though there is an int calculator available.
Ultimately, he compiled with his optimiser and the performance increase was simply amazing - calculations and transformations faster than anything I’ve seen before, and I’m sure faster than Adobe have ever seen either. I cannot see why he doesn’t work for them. It’s not released yet, but you can follow updates on his blog.
“Oh yeah,” he then said, “I’ve got one more thing” (this was after plentiful applause and people were already getting ready to leave).
As if he hadn’t impressed us enough, Joa then showed us, in seconds, that he’d written two more new compilers himself – one that compiled C# directly to a SWF file and another that compiled Java to a SWF file.
I kid you not. Then came a lightning fast fly-through look at how they work (that probably no-one understood), some proof it was live and working and real – and he deserved the standing ovation he got.
Have a look at how many wowed tweets immediately followed his session, including those from some speakers who were present. It really was something.
His slides are also up online now, they’re over on Slideshare here.
Honestly, I didn’t really know much about it before I turned up, of course I’d heard about it and had seen the getting started demos everyone has seen and I think a lot of people were at the same situation there – keen to see what it can do and hope to see more than just the basics covered. It was packed.
So he started with those basics – the spherize, twirl and tangent flip filters, but quickly ramped it into something interesting. He shared with us the thinking behind the tool, how some of the mechanics work.
Pixel Bender actually runs as a different thread to Flash (now I think about it, they mentioned this at Monday’s Town Hall meeting when asked about threading), so any processing it performs, regardless of the task, does not impact on the speed to which Flash performs. This can be leveraged in interesting ways (more later).
We looked at the anatomy of a Pixel Bender plug-in – the PBK kernel file, the code of which you can edit and how to run this file in Photoshop. Later, the PBJ file which is the compiled extension used within Flash.
Pixel Bender plug-ins are developed within the Pixel Bender Toolkit, essentially another IDE which comes with Flash CS4. Apparently though, it’s hidden away somewhere (in a utilities folder?), perform a search and find it for yourself.
Within the toolkit we dissected a filter script, discerning the role of parameters and how to manipulate images on a pixel-level with the evaluatePixel() method. Ultimately we threw a plug-in into Flash and got something running – basic shades and blends, how to duplicate an image, return two versions, how to use multiple input images and how to write straight from Pixel Bender without supplying any source at all.
This is all very cool anyway, but Paul mentioned that it’s not only image manipulations that Pixel Bender can perform, essentially it’s any kind of data.
He showed us how to send a sound file through a filter, with a simple plug-in that looked an instance of a Sound class (sent as a ByteArray) and performed a similar function to the duplication of an image, by returning itself and the sound at a position slightly earlier, creating a delay effect.
In the same way that a Pixel Bender filter looks at an image pixel-by-pixel and returns a stream of modified data back out, the sound byte array is considered the same. He basically listened for a data change event on the instance of the filter, passed that into a new Sound object (with a bit of a buffer) and played it in real-time. Very cool.
There’s far more simple stuff you can do – he demonstrated a six channel mixer that received six sound files, contained six parameters – a value to determine the volume of each channel – and passed them straight back out after a simple transformation on the amplitude, easy and very responsive.
Persisting that ‘data is just data’ and Pixel Bender doesn’t care what it receives, he then sent some pure numbers to a filter to perform simple trigonometry calculations.
At first this might seem a little needless, seeing how Flash can perform these calculations after all, but then you recall that these processes are running as a different thread.
He provided us with an example that called for some heavy calculations to be processed whilst simultaneously playing a video clip on the stage. With normal Actionscript the calculations caused the video to hang and the framerate to drop, but by utilising Pixel Bender’s own thread and mathematical processing power, by sending the calculations there instead, Flash is left free to play the video as in any normal instance whilst Pixel Bender does it’s own thing – it just reports back when it’s done.
Then David Lenaerts of Away3D joined Paul on stage to show some impressive demos of Away3D which has adopted Pixel Bender for lighting effects and texture mapping. Some very nice reflections, lighting effects with fire and ambience and an example with a human face that renders sweat, scars and frowns all with the tool. The examples are here on David’s blog and here on the Away3D blog.
Paul has now put this slides and source online on his blog.
For the first of the two inspirational talks of the evening, Dublin-based Contrast, in the form of Des Traynor and Eoghan McCabe, spoke about creating unconventional applications. They explored the notion of conventions – on the Web, in design, in life – praising the importance of following them and the ramifications of those who do not.
They discussed the problems of only following conventions; the restriction they put upon innovation, the idea of being lazy by essentially following suit as a rule of thumb, and the decreased marketability of products that can only follow a trend.
They were well versed in product design and consumer technology and pointed to some of the champions of unconventional design, the success stories of those that broke the rules. Apple with the iPhone, for example, who launched a radical mobile device in one of the hardest markets to penetrate; the Dyson vacuum, a product in a saturated market which is bottoming-out and the lowest price wins (which is the worst way to win); and the Nintendo Wii, which swam against the ever-rising tide of hyper-real graphics and enhanced performance and instead reinvented interactivity, engagement and had some fun.
Then they took these ideas to the Web, prompting a challenge to conventional wisdom on layouts, the sign-up process, the home screen and even copy.
All their points were valid, but I couldn’t help but feel that their information was a bit outdated. Especially with regard to the current state of the Web – especially, unfortunately, toward rich media, Flash sites and RIAs.
Their critique of Web design for example, seem to dissect the kind of HTML sites that were popular four or five years ago, where people weren’t daring to break a two- or three-column layout, with an inverted ‘L’ navigation and probably Times New Roman. Back then of course their ability to do so was somewhat limited too. But we’re at a cutting-edge Flash conference, where everyone knows what you can do with websites now and we’ve been treated to amazing demonstrations throughout the whole day, so it felt like these guys were equally a bit behind with the current state of play.
They showed a site as an example of the kind of rule-breaking they want to see, but it was very basic – an almost entirely static one-page Flash website actually with the kind if obfuscating highly-convoluted navigation mechanism that we look back and frown upon. One that overuses Flash for the wrong reasons.
At one point Des actually said ‘the Web is moving toward multimedia now’ and there were a few suppressed sniggers in the crowd, but then earlier in the talk they had openly admitted to not really knowing much at all about Flash, it’s not their field, so no-one held it against them – especially since the rest of the presentation up to this point extremely insightful.
Craig Swann‘s session was like no other. What started as a journey through his childhood from early coding days and finding his way onto the Internet, turned into a profound and existential exploration of life, success and creativity.
I honestly can’t relay his talk, how he took us from his college years to the Grateful Dead, via a trip on liquid acid and praying with Santana, to exploring cymatics, to founding his agency, and what happens when you run polygraph tests on plants or get Buddha monks to talking to rice and water.
(All of this happened).
Bottom line from Craig: you choose your own adventure – “We are what we think”, inspiration drives opportunity.
End of day two!