haXe for interactivity/creative coding

May 6th, 2010  |  Published in Uncategorized  |  12 Comments

haXe fits the gap in interactivity/creative coding

Processing, one of the most well-known language/framework for creative coding.

For interactivity/creative coding, except the graphical programming platforms like Pure Data, Max and Isadora, there are four major languages people are using:

  1. C++(OpenFrameworks),
  2. Java(Processing),
  3. ActionScript, and
  4. Python.

The first two are developed mainly for the high performance nature of the languages, as real-time interaction and fancy visual effect is a main focus in creative coding, but they are somewhat difficult to designer/artist. ActionScript is mostly chosen for the friendliness of its API, tools and easy to distribute on the Internet, but it’s slow. Python is somewhere in the middle of the C++/Java and ActionScript: For once I heard that, if you want something faster than ActionScript but easier than C++, try Python. However I think programs created in Python are not easy to be distributed on the Internet, I mean, it cannot run in the browser. Also, Python’s syntax is less similar to the others (although it is still very nice :) ).

I believe haXe has a very good potential to fit the gap. As we can use the friendly API of Flash to target C++ native code by using nme/neash. When we want to put the work on the Internet, simply compile it to swf or to HTML5 canvas with canvas-nme. We get best of both worlds.

What haXe is still missing

After intensively using haXe for a few months, I discovered a few things are missing in haXe. But they are all being improved in progress.

IDE

First of all, a real solid IDE. Yes, there are several IDEs with haXe plug-in you can choose: On Windows you have FlashDevelop, on Mac you have TextMate(I haven’t tried) and Linux there is Gedit.

FlashDevelop has build in support for haXe as well as ActionScript.

But if you want a cross-platform one, no, not yet. Cross-platform is important for creative coding as designers/artistes really love Mac. The amount of them using Mac is the same as those using Windows, if not more than. I myself spends a lot of time in all Windows/Mac/Linux, and I am sticking on Gedit on both Mac and Linux(Ubuntu) and avoiding to code in Windows… Gedit is usable on Mac but missing a few features like open terminal in the files panel or custom command with hotkey binding. And the UI is a little bit buggy, for example the code completion list can go off-screen…

There is eclihx, the haXe plug-in for eclipse. But it is really really buggy that I cannot get it fully functioning on any OS. Code completion is my minimal requirement for an IDE, but I cannot get that from eclihx, although it says it has this feature…

The situation is improving. FDT, which many people prefer it to Flash Builder, will have haXe support in its version 4. Since it is based on eclipse, it will be available on the three main OSes. And it is more feature-complete than all the IDEs I’ve tried at the moment. Although it is not open source, but open source developers can get a free license from them (hope the program will continue for version 4).

Moreover, discussed on the haXe mailing list, people are investigating the possibility of building a web based IDE, like Bespin from Mozilla. There is a Google group created over there but no actual development has started yet. Join it if you’re interested.

Libraries

Number of libraries that designed exclusively for haXe is still small. There are quite a few pretty good ones though, like the data structure lib and 2D physic engine from polygonal lab (available from haxelib). But for interactivity/creative coding, libraries for vector graphics, image processing, hardware integration etc. are still missing.

Arduino. Photo by Nicholas Zambetti

I’m working on this area, trying to port some of the libraries from different languages or at least to create a haXe binding. I first ported Casa Lib, as CasaHx, which is a big collection of small classes. I’m also working on C++ target of Sandy3D, but still waiting for the next release of hxcpp and the release of nme2hxSerial is my latest creation, based on ofSerial in OpenFrameworks, enabling serial port communication from haXe/C++ program, so that you can talk to Arduino, for example.

Some ideas I will try later in the future (if I have time) will be:

  • Binding OpenCV to haXe/C++.
  • Binding OpenFrameworks to again haXe/C++.
  • Creating a haXe OSC/TUIO lib.
  • Porting my stk-in-as3 to haXe.
  • Porting AS3 branch of Degrafa to haXe.
  • Porting FLARtoolkit to haXe (saqoosha, the author of FLARtoolkit may have done this before me, since he started to use haXe too).

Well, if you’re interested, feel free to work on those ideas and let me know your result/progress :)

Community

The last one is a community of interactivity/creative coding in haXe. It is always a good thing if there are more people you can share your creations with and ask question from. Hope the community will grow after the above is improved :)

Your Ad Here Linux Servers on the Cloud IN MINUTES

Tags: ,

Responses

  1. Tweets that mention New blog post: haXe for interactivity/creative coding -- Topsy.com says:

    May 6th, 2010 at 12:22 am (#)

    [...] This post was mentioned on Twitter by Andy Li. Andy Li said: New blog post: haXe for interactivity/creative coding http://bit.ly/ah5Bg8 [...]

  2. layola says:

    July 11th, 2010 at 1:20 am (#)

    hello,nme canvas for haxe html5 lib seem that mouseEvent won’t work!,can you show me the way make it run?thank you .

  3. Caio Cesar Moreira says:

    July 15th, 2010 at 9:11 pm (#)

    Hi Andy, how are you?

    Great posts. These days I’ve heard about haXe and I got really interested on it. I got a Wrox book called “Professional haXe and Neko from 2008″ but I haven’t read yet. How did you start learning haXe, what’s your recommendation?

    Regards,
    Caio

  4. liwingho says:

    July 16th, 2010 at 8:14 am (#)

    @layola
    As I remember, mouse event should be functional in canvas-nme. You may try post your not-working code to the haXe mailing list and get help.

    @Caio
    I’ve heard many haXe guys recommending the book. Reading it should be a good start thou some minor details may not be updated.
    I myself start from reading the “Getting started with haXe/Flash” ( http://haxe.org/doc/start/flash ), and then randomly browsing the doc.
    Finally subscribing the mailing list for cutting edge info.
    Good luck haXing ;)

  5. Francis Varga says:

    October 12th, 2010 at 5:44 am (#)

    AWESOME!!!

    #FLATTR

    thx for ur ports…

  6. 0b1kn00b says:

    October 19th, 2010 at 2:39 am (#)

    Is there a flash only branch of degrafa? I thought it was a one time experiment replacing the mx classes. I’d like to know if there is an up to date repository somewhere.

  7. liwingho says:

    October 19th, 2010 at 4:25 am (#)

    @0b1kn00b

    Isn’t it in the SVN?
    http://code.google.com/p/degrafa/source/browse/#svn/branches/V1_Development/Degrafa_AS3

  8. 0b1kn00b says:

    October 19th, 2010 at 4:45 am (#)

    @liwingho
    The link from http://www.degrafa.org drops you in Origin, I’d never thought to look in branches. thanks.

  9. 0b1kn00b says:

    October 19th, 2010 at 5:35 pm (#)

    It’s a no go, still requires the flex framework, fyi.

  10. Andy Li says:

    October 20th, 2010 at 5:46 pm (#)

    @0b1kn00b

    That is bad :(
    Maybe later let’s build a degrafa-like lib from sketch reusing some of the degrafa code…

  11. Dion Amago says:

    November 29th, 2010 at 7:41 am (#)

    No cross platform Haxe IDE?: try jEdit with my Haxe plugin. It has projects, code completion (not just from the haxe compiler), macros using many languages, easy custom shortcuts, plus many other plugins that extend its functionality. Seriously, I haven’t found an editor that comes close to jEdit that runs on all platforms.

  12. widged says:

    November 18th, 2011 at 8:08 am (#)

    I haven’t had a chance to play with bespin (now cloud9?) but if there was a web-based coding environment like the most excellent http://wonderfl.net/ (or http://jsdo.it/), that would give more of us a chance to explore, get started, and grow the community.

Leave a Response

*