Haxe: working with JavaScript libraries

Let’s say you’re interested in using Haxe for JavaScript development, but you are wondering how you are going to use the libraries you are used to.

Clearly this will be a little bit more complicated than when using languages like TypeScript, ES6/Traceur or CoffeeScript which essentially allow you to include any regular JavaScript without the compiler complaining.

Haxe is a different beast: you can’t just drop JavaScript code and expect it to be accepted. Let’s see the different strategies to use external JavaScript from Haxe.

Continue reading

Vanilla Haxe JS

I’ve seen it all in JavaScript, from Netscape 4’s years of pain, to jQuery to abstract browser differences, and finally to Vanilla JS and node.js – we now live in a world where coding in JavaScript is relatively sane and consistent.

Except we still have to use JavaScript. Not that I don’t like JavaScript – I’m quite found of the language and have sympathy for its quirks, but it’s just missing something to be productive once your code becomes more that half a dozen of classes.

Here comes the Haxe language and it’s almighty type inference!

haxe-inference 
Enjoy smart Haxe completion in many popular editors

Continue reading

What should Adobe do to save AIR?

ASNext was supposed to solve once and for all AS3 VM performance problems.
ASNext is now canceled, but the problem remains.

Why and how slow is AS3?

We know AS3’s VM and JIT aren’t very efficient in general, partly because the language is fairly rich and dynamic; and even if the VM was awesome, all maths are computed with double numeric types which are known to be massively slower than floats.

However compared to other scripting languages, we shouldn’t complain that it’s slow – AS3 AOT-ed on iOS is definitely much faster than interpreted LUA for instance, so why is that such a problem in AIR and not in Corona/MOAI/Gideros?
Continue reading

NME – profiling your app performance

Profilers are some of the most important tools to optimize an application – yet many developers don’t even know such a thing exists.

There are profilers for most runtimes, that is you’ll get a different profiler for C++, .NET, Java and even Actionscript. For instance we’re using JetBrain’s dotTrace to profile FlashDevelop (a .NET application), and for Actionscript you’ll have the fantastic Adobe Scout.

Haxe NME, for desktop/mobile targets, cross-compiles your haxe code into C++ and builds a pure native application, so we’ll use a C++ profiler.

Continue reading

NME: ready for the show!

NME is an impressive crossplatform technology particularly appropriate for 2D games development. And by crossplatform that mean:

  • Windows/Mac/Linux and iOS/Android/webOS – at full, native, C++/OpenGl speed,
  • and Flash so you can also compile it for the browser.

Activity & contributions around the NME project has increased a lot recently and it seems to have become mature enough as a few companies have started using it to develop (fairly impressive casual) commercial games. If you have an iPhone I warmly recommend trying Ponon Deluxe (free) – it’s incredibly slick and a clever variation on the Tetris theme.

If you know Flash and AS3…

…you’ll be up and running in a few hours:

  • this is most feature complete implementation of the Flash API that you will get your hands on – more complete than what Starling will ever be, and more complete than the subset of AIR you can use to keep performance decent,
  • development is in haxe, a clever language with increasing IDE support that you can however code like AS3 90% of the time.

Continue reading

AS3 – Fast memory access without Alchemy

With the Flash Player 10, Adobe added a new set of instructions allowing to compile C/C++ in a way the AVM2 could execute. By wrapping a little bit of glue code in C, Alchemy allows to reuse some of the numerous open source C libraries available.

And when you appreciate the speed of Alchemy-compiled C code, you can wonder how it can possibly be so much faster than AS3. Unfair!

What makes Alchemy code so fast? The main secret is a faster memory management, because obviously C/C++ is all about pointers & malloc’ing. ByteArray in AS3 is kind of slow so Adobe had to hack the AVM2 to remove this bottleneck or Alchemy would have been pointless.

And the good news for us AS3 geeks is that it is possible to use this fast memory in AS3…

Continue reading

haxe – what’s in it for you

The haxe community has been buzzing about it for some weeks, and a few days ago you could read in haxe 2.0.4 release notes that the experimental C++ compilation target was now included.

You probably know that haxe can be used as an alternative to AS2 and AS3 for Flash development, but you would definitely be missing something if you limit this powerful language to “just Flash”…

So how did haxe get to be able to compile as C++ and why is it a big thing?

Continue reading