On “You can’t make good HTML5 games in Haxe”

You can't make good HTML5 games in Haxe

- A phrase usually popping up when it comes to a discussion about HTML5 and Haxe. Which is complete nonsense. Not just that it is nonsense, but it's also a good measure of how little (read: none) research the author of phrase has made on the topic. I'm quite tired explaining to people, why their opinion about this is incorrect, so I've decided to group key points into a post,

"You probably meant OpenFL-HTML5"

It seems that most of people have their quote of bad performance coming from one of OpenFL-HTML5 on mobile. Indeed, OpenFL is one of most used haxe frameworks, and it's HTML5 backend works best on desktop, but it's a little bit wrong to judge the whole language by performance of a single framework, don't you think?
For a clean comparison, this would be like saying that you can't make fast hardware-accelerated 3D games in C/C++ because you couldn't [easily] do that in Allegro.
You know, how long would it take until someone would call you a fool, should you try to hold such point in a C-focused community? Not that long. Now, should you do the same in regards of Haxe? No you should not.

You can also have good performance with OpenFL

OpenFL is an open-source framework, and, guess what, it's also extensible. Among other things, this means that custom backends (frameworks determining execution rules for certain platforms) can be made. And are made. There's an experimental Pixi backend targeting hardware acceleration in particular. There's my very own OpenFL-bitfive that focuses on mobile performance. There's even a guide on making your own backends, should that be of your interest.

There are other frameworks too

OpenFL isn't the sole Haxe framework with HTML5 support actually. One noticeable "competitor" is Flambe, which targets Flash and HTML5, and does it's job well. If your intentions only actually cover the HTML5 target, you may as well find externs/bindings for one of many existing JS frameworks, such as CreateJS or earlier mentioned Pixi.js. Similarly, you can also make your own, should you be "into that".

Though you're not even forced to use any

That said, noone of above are required to make a HTML5 game in Haxe. You can make a "barebones" application by using built-in js.html.* externs, which are generated from HTML5 specification, to write "JS level" code, which would not suffer from any possible performance issues, while granting you the pleasures of class-based programming and automatic micro-optimizations.
And if even that is too much, you can create a simple extern class to map your custom JS functions and just use that. Or even use untyped blocks or __js__ magic to directly access functions or variables. Though, that last part would be strange. Fairly strange.

In conclusion

Confusion is a disease that is spread verbally. If everyone were to take at least a little bit of time to look into things that they complain about, the world would become quite a better place.
Otherwise, hopefully this was a nice rant read. See you later!

Related posts:

One thought on “On “You can’t make good HTML5 games in Haxe”

  1. Very good article. I’m currently finishing my 6th haxe openfl-bitfive game and I managed to sell all my previous five. I’m here to confirm that not only it is doable, but it’s recommended due to performance and portability. Haxe does have a significant learning curve though, you should know 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *