Tag Archives: AIR

AIR 3.2, Stage3D and Minko: 100k polygons at 26fps!

AIR 3.2 beta 5 is available on Adobe Labs, but one of the most ancitipated new features is the addition of Stage3D for Android and iOS devices (iPhone and iPad). Thanks to AIR 3.2 and Stage3D, Flash developers will now be able to create 3D applications targeting mobile devices. According to Adobe’s engineer, GPU-wise performances are very close to what you would have with a native apps. And that’s really incredible (I guess we now just have to wait for the VM to catch up but thing are getting better and better…).

As a member of the private prerelease program, I have access to AIR 3.2 for Android/iOS with Stage3D enabled. So I decided to give it a try with the latest prerelease drop. And boy was I impressed! My test device is an HTC Desire HD with Android 2.2 (official HTC rom). I build a very simple mobile application with Flash Builder 4.5 and Minko (thank you Thibault for letting me post that photo!):

The framerate, memory usage and other values are tracked with monitor. And that’s right, it’s a bit more than 100 000 polygons at 26 frames per second! Here is the code:

public class Teapot extends Sprite
{
  private var _viewport		: Viewport	= new Viewport();
  private var _scene		: StyleGroup	= null;
		
  private var _shader		: IShader	= new CelShadingShader();
  private var _lightMatrix	: Matrix4x4	= new Matrix4x4();
	
  public function Teapot()
  {
    super();

    // simple scene: camera and a teapot with normals
    _scene = new Group(
      new Camera(new Vector4(0, 0, -12), new Vector4(0, 0, 0)),
      new NormalMeshModifier(new TeapotMesh(40))
    );

    // use the cel shading effect by default
    _viewport.defaultEffect = new SinglePassRenderingEffect(_shader);
    // grey background
    _viewport.backgroundColor = 0x666666;

    // setup the stage
    stage.frameRate = 30.;
    stage.addChild(_viewport);
    stage.addChild(Monitor.monitor.watch(_viewport, ["numTriangles"]));
    stage.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
  }

  private function enterFrameHandler(event : Event) : void
  {
    // rotate the light
    _lightMatrix.appendRotation(0.01, ConstVector4.Y_AXIS);
    _shader.setNamedParameter(
      "light direction",
      _lightMatrix.transformVector(ConstVector4.Z_AXIS)
    );

    // render
    _viewport.render(_scene);
}

You can find the full source code on my GitHub.

That’s only a few lines of code, and yet it displays a Utah teapot with cel shading and a rotating light. An important thing to remember is that this cel shading effect is coded using ActionScript shaders. AS shaders is a feature of Minko: you program the GPU with ActionScript code and Minko’s JIT compiler turns it into AGAL bytecode at runtime. And the ActionScript to AGAL shader compiler runs just fine on mobile devices. Even better: Minko 2 will feature a new and even more optimized compiler so it will be very easy and very efficient to program mobile GPUs with ActionScript code!

Considering my phone is not supposed to perform as well as the Samsung Galaxy SII or the iPad 2, I can just imagine what you can do on those! But I’ll have an iPad 2 tomorrow and I’ll try to see how BlackSun performs on it, so just be patient :)

AIR 3.2 will be available “very soon” and so will be Minko 2. In the meantime, you can start playing with Minko 1 and get ready to rock on mobile devices! As usual, if you have questions/suggestions, please post them in the comments or on Aerys Answers.

aerys-monitor library updated

The aerys-monitor is a small and lightweight library inspired of Mr.Doobs “stats” library. Here are the main features :

  • watch any property of any object of any class
  • customizable update rate
  • cutomizable per-property color
  • chart rendering for numeric values
  • watch framerate, memory and Flash Player version
  • ready to use framerate property

The Monitor class has been updated with the following changes :

  • Flash player version style is now called “version”
  • new property “backgroundColor” to change the background color of the monitor
  • new “framerate” to get the framerate of your application
  • the framerate and memory usage are now monitored by default

Here is a sample snippet to show how simple it is to use :

// get a singleton Monitor object
var monitor : Monitor = Monitor.monitor;

// set the update (refresh) rate to 15 updates per second
monitor.updateRate = 15.;

// add the monitor to the display list
stage.addChild(monitor);

// watch the rotationX property of the camera object with a scale value of 1 / (PI / 2)
monitor.watch(camera, "rotationX", 0x55ff00, 1. / (Math.PI / 2.), true);
// watch the rotationY property of the camera object with a scale value of 1 / (2 * PI)
monitor.watch(camera, "rotationY", 0xff5500, 1. / (2. * Math.PI), true);
// watch the rotationZ property of the camera object with no scale value (=> no chart rendering)
monitor.watch(camera, "rotationZ", 0x5599ff);

// watch multiple properties
monitor.watchProperties(physics,
			["processingTime", "speed"],
			[0x00ff00, 0xff0000],
			[1. / 40., 1. / 10.]);

// change the background color (0xAARRGGBB)
monitor.backgroundColor = 0x7f000000;

And here is how it looks :

The library is under GNU v3 licence and is available on Google Code. Have fun !

Please support Aerys for the Adobe AIR 24H Challenge

That’s it! The challenge is on, every challenger knows his opponents… In 8 days, we will unleash Minko and our secret project to conquer the world… or at least the Flash platform!

In the meantime, we need you! YES, YOU! Our team needs supporters, and you can help up by simply clicking on the above picture or here. You will then be asked to log into your Facebook account to show just how much you love us and you want us to win!

Thank you all for your help. I just want you to know we are setting up for a great show!

Aerys joins the 24H Adobe AIR Challenge




The 24H Adobe AIR Challenge is a 24 hours long contest that will take place the 18th of June in Paris, France.

During this coding challenge, 15 teams of two people will have to build the best AIR application regarding a precise subject. This very subject will be unveiled as the competition starts.

The challenge will be broadcasted live from http://www.adobeairchallenge.com/.

Aerys is very proud to join the competition and we hope to see you there!

And here are a few useful links (in French) :

AIR 2.0 HTTP Web Server

AIR 2.0 brings a lot of new features. Among them is the new ServerSocket class. The Socket class exists since Flash 9 and enabled a lot of new client/server applications. But it has always been limited to client side sockets as long as AIR (and the Flash Platform as a whole for that matter) is concerned. Therefor, this new server socket feature makes it possible to build actual server software using AIR!

Rich of this new and incredible ability, Christophe Coenraets posted a small but yet very powerful code snippet to build an HTTP web server using AIR 2.0!

rSoul v0.1b

rSoul is my very first public AIR application. It is an open-source NetSoul client. ┬áSince NetSoul is not a commonly used protocol it won’t be useful for many people. Still, the NetSoul protocol is mandatory when you want to have access to the PIE (Parc Informatique de l’EPITA). And the source might help anyone willing to build his very first AIR application. The user interface is very light and I tried to keep it as simple and as intuitive as possible.

Like any other AIR application, rSoul is cross-platform and works on Windows, Linux and Mac OS X. You can install it and get the sources from the rSoul website:

http://rsoul.promethe.net

Here are a few screenshots:

rsoul_chat

Features

This first release includes the following features:

  • Online/Away/Busy status
  • Location configuration
  • “Remember Password” option
  • Auto-connect option
  • Contacts list
  • Add/Remove contacts
  • Tabbed chat
  • Auto-update
  • Connection errors handling

Known issues

  • Some special characters are not handled correctly
  • The application does not (yet) minimize itself to the system tray
  • Contacts status is not updated

If you found any bug or have any suggestion please feel free to add a comment…

AIR 2.0 Sneak Peek

Tonight I attended the “TonTon Flexeurs” (TTFX) meeting with Lee Brimelow and Mike Chambers. While Lee explained all the things that can be done to extend the Flash Platform using the ByteArray class, Mike presented a few of the latest as3corelib library features and a sneak peek of AIR 2.0. AIR 2.0 – codename “Athena” – will feature a lot of new system related updates. Discover a few of them (including a worldwide exclusive!) right after the jump…

You can also look at Michael Chaize‘s event photo album on Flickr!
Continue reading