Archive for the ‘HAXE’ Category

Saturday, August 8th, 2009

So many cool and useful technologies are unveiled at SIGGRAPH every year, this year at SIGGRAPH 2009 was no different.  Khronos Group, behind the new guidance of OpenGL, OpenGL ES, OpenCL, OpenVG, COLLADA etc, came another big announcement about hardware rendering within the browser.  WebGL is now an official standard being developed at Khronos Group to bring javascript control of OpenGL to browsers… Wow!

Ok so this was officially announced at the GDC in March but limited information, but now it has been slated for an official public standard in early 2010. Shortly after the announcement at the GDC we saw Google o3D appear doing exactly that, controlling OpenGL through Javascript in the browser but it was still largely software/harward hybrid rendered. Google, Mozilla, Opera are part of the companies supporting WebGL which is great for browser support, also NVIDIA, AMD and Ericsson are in on it.

Khronos Details WebGL Initiative to Bring Hardware-Accelerated 3D Graphics to the Internet

JavaScript Binding to OpenGL ES 2.0 for Rich 3D Web Graphics without Browser Plugins;
Wide industry Support from Major Browser Vendors including Google, Mozilla and Opera; Specification will be Available Royalty-free to all Developers

4th August, 2009 – New Orleans, SIGGRAPH 2009 – The Khronos™ Group, today announced more details on its new WebGL™ working group for enabling hardware-accelerated 3D graphics in Web pages without the need for browser plug-ins.  First announced at the Game Developers Conference in March of 2009, the WebGL working group includes many industry leaders such as AMD, Ericsson, Google, Mozilla, NVIDIA and Opera.  The WebGL working group is defining a JavaScript binding to OpenGL® ES 2.0 to enable rich 3D graphics within a browser on any platform supporting the OpenGL or OpenGL ES graphics standards.  The working group is developing the specification to provide content portability across diverse browsers and platforms, including the capability of portable, secure shader programs.  WebGL will be a royalty-free standard developed under the proven Khronos development process, with the target of a first public release in first half of 2010. Khronos warmly welcomes any interested company to become a member and participate in the development of the WebGL specification.

Google released O3D this year and there are great strides in 3d within the browser from game engine wrapper technologies such as instant action technology, gaim theory engine (now owned by id Software and runs Quake  Live, hardware rendered Unity 3D (and Torque 3D coming soon), and Flash software rendered  3d engines Papervision 3D, Away 3D, Sandy (Sandy also released a haXe version that exports a javascript version) and others.  But it looks like the movement is to bring OpenGL to the web as a standard under the name WebGL, this would be great!  There would still be lots of times where plugins are better now and in the near future but the path is a good one. Having a software/hardware rendering hybrid like Google O3D for broad video card support (some of the painful older intel cards), or using a plugin like Unity3D, Torque 3D or wrapper technology for bigger engines is a good idea for the time being. But the future is grand in this area.

I think that Google O3D and OpenGL ES success on iPhone games probably combined to get this in motion.  OpenGL and very basic video cards are now standard in most machines out there.  Unity3D actually published hardware statistics on casual gamers (web-based games) ever so kindly and shows that even though there are some older Intel cards out there, for the most part machines nowadays have a video card capable of supporting at least low-poly 3d and hardware supported 2d rendering in real-time for games, user interfaces and more.

This is exciting news, it appears the movement of the web gaming market is getting much more capable and is accelerating the innovation of hardware accelerating the web.

Thursday, July 16th, 2009

Haxe Sandy is a version of Sandy that can export to an experimental Javascript 3D engine taking advantage of the <canvas> element. There are some great demos that run smoothly in canvas capable browsers and very smooth in Chrome.

Demos of Haxe Sandy:

Sandy was actually the first open source 3d engine in flash, maybe this will be a trend building in haXe for export to flash and javascript?  It certainly looks like a great start and would make a very nice platform for 3d on the web allowing Sandy or other flash libraries to run in Flash and Javascript by writing in an abstraction platform like haXe. Other libraries like Motor2, Physaxe, haxe3D, PureMVC and more have haXe versions. Still very experimental but a possible need when Flash and canvas are both in the market in the future.  Right now it is still all Flash.

[ via Matthew Casperson at ]

Friday, June 19th, 2009

haXe is an interesting programming language that allows abstracting the source from platform target.  It outputs for targets such as Actionscript and Javascript from haxe language source. But, haXe can also output to native code to run on Windows, Mac OSX, and Linux.

Well because of this it is possible to run haXe on the iPhone. The gamehaXe site has found a way to get haXe to compile to iPhone via hxcpp which creates a C++ output from haXe code very similar to Actionscript 3.

I am a bit late to the party but this is great news. It uses the NME library which will allows code to mostly be written to the Flash 9 API and create the C++ for XCode to compile and run on the iPhone and Touch. This creates a path to port Flash games to iPhone/Touch.

This project is one to watch and participate in.  Native compilation to the iPhone from haXe is a more simplified code to write in while providing lower level performance which is needed on mobile devices, as processors, cache and ram are much lower than desktop and below what is capable of running the Flash AVM2 currently.

If you have more interest in haXe there are some other great demos on as3/haXe at the game haXe site. Also, Tony at has posted some very useful information to help you get started with hxcpp.

The hxcpp project is a newer output target along with a java one but this could be interesting if actionscript like code and many libraries like Physaxe or AS3 libraries could be ported to haXe to output to the iPhone.

Friday, March 13th, 2009

Polygonal labs, maker of some of the best demos, information and tools for AS3 since inception updated the killer AS3 Data Structures for Game Developers and ported it to haXe.

Of course along the way making many improvements and showing great information on how and why the haXe version is faster which mainly boils down to a more strict virtual machine but flexible still with generics.

haXe is fast because it is a very highly optimized virtual machine language with compiler (and could be called a virtual machine to target other VMs similar to LLVM with the ability to target the Neko VM, AVM2 or Javascript, it is more than just a language) by Nicolas Cannasse that may one day overtake directly coding for the AVM2 or maybe we will even see haXe have more influence on flash soon for performance gains.  Some of the Alchemy LLVM virtual machine work is similar in nature to what haXe does and helps the language become an abstraction and translates into highly optimized code from very powerful and productive language syntax.

Anyways, I ramble, be sure to check out Data Structures for Game Developers by Polygonal Labs now ported for haXe as hx3ds if you are doing any sort of work in AS3 or haXe for AS3 it will be worth your while and provide a very common and useful data structures capabilities into your production that is highly optimized from one of the best AS3 developers.

As the name suggests, hx3ds is a port of as3ds for haXe and is now available at hx3ds only supports the flash player 10 target, as it makes extensive use of the Vector class. If you need data structures that compile across all platforms, take a look at colhx instead.

Here’s a list of new features:

  • orders of magnitude faster
  • collections now support clone() and shuffle() operations
  • object pooling framework
  • revised graph, tree and linked list classes
  • memory manager for the virtual memory API (more on this soon)

The Structures Included

Multi-Dimensional Arrays

The library contains a two-dimensional and three-dimensional array. They are both implemented by a single linear array rather than nested arrays. This is the fastest method in flash to simulate multi-dimensional arrays and outperforms the nested array method because multiple array lookups are slower compared to one lookup combined with a simple arithmetic expression (which you can also often precompute in the outer loop). The most obvious application would be a tilemap in 2d or a layered tilemap in 3d.


This is also called a FIFO structure (First In – First Out). The queue comes in two variations, which have the same methods, but differ in their implementations: There is the arrayed queue, which obviously uses an array internally, and the linked queue, which is build upon a linked list. They are both very similar, except that the arrayed version has a fixed size and is faster.
A common application would be a command queue – imagine you have a unit in a strategy game and apply many commands which the unit should follow. All commands are enqueued and afterwards dequeued and processed in order.


Also commonly know as a FILO structure (First In – Last Out). Like the queue, this comes in two flavors: arrayed and linked. A stack is often not used directly, but a very important concept in programming. Please note, that a queue and a stack are not real structures, because they just define how data is accessed rather then stored.


A node-based structure. Every tree starts from a single node, called the root node. The root node can contain any number of child nodes, and every child node can again contain children. A tree node with no children is called a leaf node. In fact if you draw the nodes of a tree it looking like a real tree with branches. The AS3 display architecture is also a tree structure, so you could use this to manage your display objects and update them by traversing through the tree. Also, this is useful for decision trees, BVHs, storing a plot line or storing data recursively by applying the composite pattern.

Binary Tree

This is just a specialized kind of tree where each node is only allowed to have up to two children, called the left and right node. Binary trees are very often used for parsing input data, for example arithmetic expressions or when building a scripting system.

Binary Search Tree (BST) and Hash Table

Both structures store data that can be retrieved quickly by using a key. The method however differers greatly: The BST uses a recursive approach to split up large amounts of data into smaller sets. A hash table stores sparse key-based data using a hash-key in a small amount of space.

Linked Lists

A linked list is similar to an array. The main difference is that in an array, each cell contains just the data and is accessed by an index. A linked list consists of several node objects, which in addition to storing the data, manage a reference to the next node (singly linked) or to the next and previous node (doubly linked) in the list. Think of it as a more natural approach to work with sequential data.
Other benefits are that you can insert and remove data quickly by just calling the appropriate method on the node itself – you don’t have to manage array indexes. Also in AS3 object access is faster than array access, so it competes very well in terms of performance when iterating over the list.

Heap and Priority Queue

A Heap is a special kind of binary tree in which every node is bigger than its child nodes. Whatever you throw into a heap, it’s automatically sorted so the item with the ‘most significant’ value (depending on the comparison function) is always the front item. A priority queue is build upon the heap structure, and can manage prioritized data – which can be used in limitless ways.


A graph is a loose node-based structure. Nodes are connected with arcs, and every node can point to any other node. They can also point to each other creating a bi-directional connection. It is essential for path finding, AI, soft-body dynamics with mass-springs systems and a lot more.

Bit Vector

A bit vector is some kind of array in which you can store boolean values (true/false – 1/0) as close as possible without wasting memory. I currently can’t think of a reasonable application, because usually you should have enough memory – but it’s nice to have because it shows basic bit masking operations.

Saturday, October 4th, 2008


Nicolas Cannasse has released haXe 2.01 that now has flash 10 support with a simple switch including the new Vector class.

Another very good news is that haXe has now complete support for Flash 10.
You only have to use -swf-version 10 as commandline parameter to be able to access the new Flash10 APIs (don’t forget to install first the FP10 from

I think it is very possible for haXe to catch on big time, but it takes time as stated. Just remember that Python was worked on almost solely by Guido van Rossum for about 5-years, and then 10-years later it was picked up by Google heavily and the rest is history.  I think it takes 10 years for anything to really catch on from standards to languages.

code_swarm – Python from Michael Ogawa on Vimeo.

Saturday, October 4th, 2008

This project is stacked with cool, but is also useful, an ogg/vorbis player in flash/as3.  Arek Korbik at barelyfocused implemented a port for a pure Ogg/Vorbis audio library called FVorbis.  Check out the demo (need flash player 10). Groovy.

The name is: FVorbis. Which stands for more or less “Ogg and Vorbis in Flash”. That’s right, pure ActionScript 3 implementation of the Ogg and Vorbis libraries that require no kind of native support from the Flash Player. A simple Vorbis player implemented using the new FVorbis lib compiles to about 46KB SWF file. And that’s it.

To top it off the code is actually written in haXe, a favorite of the flasherati. This version was iterated from the Cortado’s JOrbis code.

Ogg Vorbis is a great open source audio format which is widely popular in game engines such as recent tools like Unity3D (which will be launching their iPhone dev kit on Oct 22 btw but I digress), so it is great to see it starting to appear in flash. Thanks Arek.

Sunday, April 6th, 2008

Nicolas Cannasse, a virtual machine genius (maker of MTASC compiler, Neko and haXe (haXe compiles to target flash 6-9 but really only flash 9 is used anymore unless you are making banners)) released the Physaxe 2D Physics kit for haXe today.

It is heavily based on Glaze (demos) and Box2D which the Motor2, Glaze and Box2DFlashAS3 physics kits are all based on. Box2D is a great C++ 2D physics engine, it is simple which lended itself to being ported to AS3 quite easily. It is also a testament to AS3 that C++ kits are being ported into the language, not once, but many times. Also C ports like Chipmunk and other signs point to == AS3 is of fun.

Physaxe is quite amazing you must see the demos (very similar to Glade demos), it will get the inspirational wheels turning in your idea machines.

2D Physics in Flash and AS3 are extremely hot and can be used for many, many things from game development to promotions to simulations to user interface or visualizations and even modeling natural systems. It is nice to have a port of Box2D and similar to glade capabilities with Chipmunk like Glade has.

A game and physics engine for Flash including:

  • Rigid Body Dynamics
  • Scene management
  • Line of sight
  • User Input
  • Scrolling
  • AI

Core parts of the physics solver and collision system are based on the C physics engine Chipmunk

Notes about Physaxe:

Physaxe is a 2D Rigid Body Library written in haXe. It’s been highly optimized for the Flash 9 Player, with the best optimizations available.

Physaxe is based on several existing physics engines, mainly :

  • Box2D, the reference open source physics engine
  • Glaze, an AS3 engine which is a port of Chipmunk, itself based on Box2D

Physaxe features are :

  • rigid body consisting in several shapes
  • shapes supported are circles, segments (with rounded edges) and arbitrary convex polygons
  • customizable broadphase (currently bruteforce and y-sorted list are available)
  • island resolution and sleeping (allow ~0 CPU to be spent when groups are sleeping)
  • constraint solver based on Box2D sequential impulses
  • customizable body properties, such as linear/angular friction and maximized motion

Updated list of physics engines are like this:

AS3 3D Physics Engines (Open Source)

AS3 2D Physics Engines (Open Source)

haXe 2D Physics Engines

Get your game on! It is best to get them out early and often. I need to take my own advice.

Thursday, March 20th, 2008

I have officially been sucked into the Python vortex. I recently have really been digging IronPython, Jython and good old plain Python but have not ventured here yet. Google (They employ Guido), Microsoft (IronPython) and Sun (Jython) are all becoming infected pythonistas as well. But this is just too cool, Python to AS3 code with flex-pypy. This project is very young but could be fun, source at Google Code.

Haxe has a similar premise where it can compile to Flash6-9 versions of actionscript 2-3 which makes for a system with better reach. Python code for this is lots of fun and very flexible. Python is becoming a baseplane language and one great language for transcending platform lock-in.

Check out this snippet pulled from here (click to see sample game)

#/usr/bin/env python
This simple example has very little to do with the pygame
chimp example, except that it will act the same (more or less)
and it uses the same resources, only they got converted to
mp3s, pngs.

#Import Modules
from pypy.translator.flex.modules.flex import *

class MyRect:
    def __init__(self,x,y,w,h):
        self.x, self.y,self.w,self.h = x,y,w,h

SCREEN_W = 468

class Game:
    def __init__(self):pass

    def init(self,screen):
        self.screen = screen
        screen.layout = 'absolute'
        screen.setActualSize(SCREEN_W, SCREEN_H)

        screen.addEventListener('click',chimp_whip) = load_sprite("py_background_png");

        self.chimp = load_sprite("py_chimp_png");

        self.orig_y = self.chimp.y

        img2 = self.fist = load_sprite("py_fist_png")
        self.move = 1
        self.spin = 0
        self.hit = 0
        self.hit_move = 1

        self.sfx = {}
        self.sfx['whip'] = load_sound_resource("py_punch_mp3")
        self.sfx['nohit'] = load_sound_resource("py_whiff_mp3")

    def loop(self):
        img = self.chimp
        if self.spin:
            self.spin -= 1
            img.rotation = self.spin*24
            img.x += self.move * 8
            if img.x > SCREEN_W-img.width:
                self.move = -1
            if img.x < 0:
                self.move = 1

        if self.hit:
            self.hit -= 1
            self.fist.y += 6 * self.hit_move

            if self.hit  SCREEN_W - img_halfw:
        newx = SCREEN_W - img.width
    if newx  img.x and e.stageX < img.x+img.width:
        game.spin = 20

def flash_main( x=1 ):
Saturday, December 15th, 2007

haXe, one of the coolest and most versatile languages and platforms of today just released something to add to the already amazing feature set of haXe.  Nicolas Cannasse has posted about releasing haXe Video 1.0. I have been engulfed by Red5 for a few weeks and this could not have come at a better time for fun.

haxeVideo is an opensource video streaming server entirely written in haXe.

Features of haXe Video 1.0:

  • FLV streaming using RTMP protocol
  • Webcam and Microphone recording to FLV file
  • Live streaming for web conferencing
  • light and fast scalable server
  • only 50 KB of server source code : modify whatever you need !


Saturday, November 17th, 2007

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:

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

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.