Haxe sounds too good to be true. Why would anyone use any of the other game engines out there which are targeted towards the mobile world if they could use Haxe? I see many half-donejavascript frameworks and fully-baked lua frameworks...what do they provide that Haxe doesn't? Can anyone who has done significant Haxe work comment to some of the benefits and drawbacks? I ask as someone in search of a gaming engine which can target iOS and Android, so this is very interesting to me.
First, a distinction between frameworks and languages... Framework benefits include rapid development, and familiarity (since they use preexisting languages). The cost is that performance will never be as good as native code, and you won't be able to easily change certain behaviors.
The Haxe language gives you far more flexibility and performance optimizations, since it is generating optimized native source or byte code. The cost is that you have to learn the Haxe language.
Many people on this discussion are criticizing the java-style syntax of Haxe. I think most of these negative feelings are due to the excessive boilerplate required for many Java classes. Haxe does away with a lot of boilerplate code using type inference and other modern compiler techniques.
http://haxe.org/ref/type_infer
There are many other tricks you can use to define behavior without resorting to complex inheritance or class definitions. One of my favorites is the "using" declaration:
http://haxe.org/manual/using
So, in my opinion, the cost of learning Haxe is very low if you already know Java or Actionscript. The cost of coding/writing Haxe is also very low, since you're not required to write boilerplate code.
Finally, it's worth mentioning that the Haxe developers are not just trying to gloss over the technicalities of each underlying platform in order to get things working. They really understand the behavior of each platform, and make many conscientious decisions based on considerations for performance and cross-platform consistency. I've learned more from the Haxe language google group about each target (js quirks, java limitations, etc.) than I have from the Java, JS, Actionscript groups themselves:
https://groups.google.com/forum/#!forum/haxelang
Many people have remarked that simply following the Haxe development list has made them a better programmer.
Haven't done an official port yet, but one of the NME devs did look into using it to test the SampleDataEvent API on other targets. I did get it compiling but not running, so the ports probably won't be a huge project.
I like a lot of things about Haxe. The syntax is more streamlined than traditional curly-bracers. The type system can massively help with refactoring. It's "honest" about the limitations of targets - you get the APIs pretty much exactly as they are on the target itself. The compiler is well-implemented and updated all the time. It's just a very productive environment, and although it used to have lots of maturity/ecosystem issues, increasingly those aren't a major hurdle, at least for the game space.
I tried a bunch of different game engines, toolkits, frameworks, languages, etc. for the game I'm working on and the thing that sold me on Haxe was NME. I was able to build for Mac and Flash without changing my code. I simply specified a different target platform at the command line. I haven't built for mobile yet, but I suspect there won't be very many changes to my code when I do.
Also, the Haxe community is full of great hackers and incredibly helpful.
A problem I have had with these frameworks is that they all sound great on the surface but when you start using them you run into issues or missing features that are important to you and sometimes there's nothing you can do about it.
Haxe does look great and for this particular case I wonder how Haxe NME's performance compares to the lua frameworks like Corona and Gideros for mobile development specifically.
My initial gut reaction to Haxe from the homepage alone, was "Gah, this language is ugly!'. Then I immediately realized that this ugliness was from the fact that the Source example isn't using a monospaced font. It's sort of amazing that, at least for me, using a proportional font just makes things "look wrong", even though everything is syntactically correct.
Haxe is a nice language, though I don't like it's verbosity (hey, it's almost like Java!). Maybe I'm too much spoilt with coffeescript, ruby, python and other syntax-sugary languages.
My question is, how do Haxe and NME relate? I started reading about Haxe, started working with the tool, then found all these references to NME which I'm not clear if it's a subset or a fork or ?
Would like to use this for the game I'm working on since the idea of write once, compile everywhere is seductive. Of course I seem to recall that when Java first came out that was supposed to be it's claim to fame...
This is really what has kept me from giving Haxe a try so far. It's just extremely painful to go back to curly braces and semicolons after years of writing noise-free code with e.g. Python, CoffeeScript and Haskell.
I know it sounds superficial, but I'd love a CoffeeScript-like alternative syntax for Haxe. That would probably elevate it to the number one language choice for game programming for me.
enum Cell<T> { nil; cons(car : T, cdr : Cell<T>); }
class List {
public static function mymap<A, B>(f : A -> B, l : Cell<A>) : Cell<B> {
return switch(l) {
case nil: nil;
case cons(x, xs): cons(f(x), mymap(f, xs));
}
}
}
Some of the Java heritage does seem slightly unpleasant, but interesting features like ML-style tagged enums and structural subtyping for record types mean I'm not going to discount the whole thing just yet.
Functions are public by default. You could leave that out.
The main function has to be static and will serve as the entrance point of the program, not the class.
So this might just look like too much when in fact this is just a very small code sample.
Did I address some of your concerns, or did I miss the point entirely? Just curious.
Yeah, and those shoes totally don't match that purse! What an outrage!
Seriously, if you're prepared to throw out the whole language based on what its syntax resembles, your decision-making process might need a bit of work.
It's a Bejeweled clone that has been published in the Amazon Appstore, Google Play, BlackBerry App World, the webOS App Catalog and also compiles for iOS, Flash, Windows, Mac, Linux and HTML5
The new release of the Stormpulse mapping client is written in haxe with a flash deployment on the web and an iOS app in the app store. It is non-trivial. ;)
You can compile this example to both Flash and JS online.
If you install Haxe and NME (http://haxenme.org), you can also compile it to iOS, Android, WebOS, BlackBerry, as well as desktop Mac, Windows and Linux binaries.
And these are only the possibilites offered by NME, which is basically a Haxe-based Flash API implementation.
I'm torn on haxe. It has a few nice features (macros!) and has many, many targets.
But on the other hand, its syntax and some of its semantics are Java/C++-inspired, whereas something closer to its ML roots would've been so much better.
It might still beat Java for writing Android apps.
I'm guessing the server is under some load at the moment as it's running pretty slow. But very cool demo page, been using it the last few days. I'm impressed with how small Haxe's JS output has gotten lately.
In the example in that landing page, there appears to be if statements depending on platform, is this something that's often necessary when using Haxe, or only when you want to perform a specific action for that target language?
Most standard classes and methods (String, Array, Hash, etc), and a lot of third party libraries are completely cross-platform, so you don't need conditional compilation.
Usually you use conditional compilation either for very low-level per-platform operations / optimizations, or to switch, say, between client code and server code, like here for instance:
I've searched a little while and found that it has no support for camera (or sensors) in mobile devices. It looks like HAXE/NME is heavily geared towards game development.
I did try Haxe, back in 2010 when I used it to write a silly little domino trail. It was fine for what it does, but I wasn't particularly impressed.
It was interesting to be able to write code in one language then compile it to other destinations but it seemed to me that targeting specific domains and learning all their ins and outs made more sense.
Does anybody know how you debug with haxe/nme? I see no mention of it, which leads me to believe it's not really supported, which is somewhat understandable given that's it being compiled from haxe code into the various target languages.
HaXe is revolutionary, people who really try it always seem to stay with it, they just have to get past the ask lets of questions and actually try some code and stop being negative and putting it in the less able solutions pile. If you want to waste days coding a game in pure objectiveC and then converting it to java just to target two phones then good luck to you! And if you code something in one language it should just be a case of switching some target specific libraries and all your work now works in another target, not recoding in another language style. HaXe is revolutionary because it in achieving what other solutions promise but normally fall short on providing - cross platform cross language, code that is designed to enable not fragment. So try it rather than assume!
You don't have show stopper issues with the compiler ( it outperforms flex compiler on flash target ). Any minor issues are often resolved within hours of reporting, unless they are language design decisions rather than bugs.
Pizzaman
The forum is not well used as most users use the googlegroup 'haxelang'. In terms of frameworks like flex, haxe for flash target does not support flex well, it can be made to work, but largely the problem is because flex is not really just actionscript but has some adobe secrets/hacks etc.. that is why it has not been ported to a cross platform solution yet, need some better engineering decisions although someone I think is working on it. In terms of other frameworks for components there are some but they could be better, try aswing, feel free to chat on IRC if you have problems getting a particular component framework running. Generally haxe is sort of tool that you can build from scratch your visual interface stuff, or if your using js you can mix it up with native libraries.
Jetz
You can add any support for mobile camera's or video you want it interfaces easily with c++/c and there is java support and there is openframework support try this site http://blog.onthewings.net/. Haxe is not really a game only language but it excels at allowing users to create visual stuff but still do complex game mechanics, and a lot of users enjoy doing games. It works well in solving the issues of having to mix technologies, being normally a more sane programming language than the target but also mixing well, so you can mix haxe php, haxe js and haxe flash ( http://haxe.org/doc/remoting ), or use NME library to hit all the phones and have a web version in flash for users to try online.
I don't know how/if it's possible to mix both, for example embed a NME app inside an Appcelerator app (besides using UI.WebView and embed it as HTML...)
Stop fragmenting languages, we don't need another one except if it's revolutionary.
There's some very good principles like the fact that it can compile to many languages but like CoffeeScript I just don't see the point. Want to do some c++ why not using it? Want to do some JavaScript? Then use JavaScript.
There is just too much on the table when it comes to language compilation, I mean if the compiler itself has a problem with your code? It's a bug between what you built and its runtime: what can you do about it? A client is waiting for you, you've got no time to lose contacting the compiler's developers, you're just fucked. Don't get me wrong, I like to play with these languages but that is what they are: toys.
The hard reality is that browsers only support n amount of languages and we are stuck using them.
This is just a bunch of unverified blanket statements and what-ifs. From my own experience, I can tell they don't apply to Haxe. Also, Haxe is revolutionary, but to understand that, you'd have to actually use it in production.
[+] [-] rufugee|14 years ago|reply
Thanks.
[+] [-] jdonaldson|14 years ago|reply
The Haxe language gives you far more flexibility and performance optimizations, since it is generating optimized native source or byte code. The cost is that you have to learn the Haxe language.
Many people on this discussion are criticizing the java-style syntax of Haxe. I think most of these negative feelings are due to the excessive boilerplate required for many Java classes. Haxe does away with a lot of boilerplate code using type inference and other modern compiler techniques. http://haxe.org/ref/type_infer
You can remove even more boilerplate with macro libraries for shorthand class declarations: https://github.com/back2dos/tinkerbell/wiki/tink_lang
There are many other tricks you can use to define behavior without resorting to complex inheritance or class definitions. One of my favorites is the "using" declaration: http://haxe.org/manual/using
So, in my opinion, the cost of learning Haxe is very low if you already know Java or Actionscript. The cost of coding/writing Haxe is also very low, since you're not required to write boilerplate code.
Finally, it's worth mentioning that the Haxe developers are not just trying to gloss over the technicalities of each underlying platform in order to get things working. They really understand the behavior of each platform, and make many conscientious decisions based on considerations for performance and cross-platform consistency. I've learned more from the Haxe language google group about each target (js quirks, java limitations, etc.) than I have from the Java, JS, Actionscript groups themselves: https://groups.google.com/forum/#!forum/haxelang Many people have remarked that simply following the Haxe development list has made them a better programmer.
[+] [-] ido|14 years ago|reply
There are some annoying differences between the different targets but it's >99% the same and you can work around the differences.
[+] [-] chipsy|14 years ago|reply
http://www.ludamix.com/apps/triad-synth/index.html
Haven't done an official port yet, but one of the NME devs did look into using it to test the SampleDataEvent API on other targets. I did get it compiling but not running, so the ports probably won't be a huge project.
I like a lot of things about Haxe. The syntax is more streamlined than traditional curly-bracers. The type system can massively help with refactoring. It's "honest" about the limitations of targets - you get the APIs pretty much exactly as they are on the target itself. The compiler is well-implemented and updated all the time. It's just a very productive environment, and although it used to have lots of maturity/ecosystem issues, increasingly those aren't a major hurdle, at least for the game space.
[+] [-] airfoil|14 years ago|reply
Also, the Haxe community is full of great hackers and incredibly helpful.
[+] [-] azakai|14 years ago|reply
Haxe isn't a game engine. It's a language that compiles into other languages.
[+] [-] rotation1|14 years ago|reply
Haxe does look great and for this particular case I wonder how Haxe NME's performance compares to the lua frameworks like Corona and Gideros for mobile development specifically.
[+] [-] barik|14 years ago|reply
[+] [-] clemos|14 years ago|reply
[+] [-] VMG|14 years ago|reply
[+] [-] clemos|14 years ago|reply
Flash API to SWF or JS (nme/jeash):
http://try.haxe.org/#655c1
http://try.haxe.org/#E4001
Flash with custom shaders (hxsl):
http://try.haxe.org/#93bE1
Flash + away3d:
http://try.haxe.org/#9F075
[+] [-] novalis|14 years ago|reply
[+] [-] zserge|14 years ago|reply
[+] [-] clemos|14 years ago|reply
It may still be a bit more verbose than Coffeescript or Python, but once your code is written you can theorically run it almost anywhere :)
[+] [-] EwanG|14 years ago|reply
Would like to use this for the game I'm working on since the idea of write once, compile everywhere is seductive. Of course I seem to recall that when Java first came out that was supposed to be it's claim to fame...
[+] [-] shangaslammi|14 years ago|reply
I know it sounds superficial, but I'd love a CoffeeScript-like alternative syntax for Haxe. That would probably elevate it to the number one language choice for game programming for me.
[+] [-] conanite|14 years ago|reply
http://haxe.org/manual/macros
[+] [-] yxhuvud|14 years ago|reply
[+] [-] andolanra|14 years ago|reply
[+] [-] boofar|14 years ago|reply
The main function has to be static and will serve as the entrance point of the program, not the class. So this might just look like too much when in fact this is just a very small code sample.
Did I address some of your concerns, or did I miss the point entirely? Just curious.
[+] [-] CodeMage|14 years ago|reply
Seriously, if you're prepared to throw out the whole language based on what its syntax resembles, your decision-making process might need a bit of work.
[+] [-] st3fan|14 years ago|reply
[+] [-] singmajesty|14 years ago|reply
http://www.joshuagranick.com/blog/2012/04/12/html5-pirate-pi...
It's a Bejeweled clone that has been published in the Amazon Appstore, Google Play, BlackBerry App World, the webOS App Catalog and also compiles for iOS, Flash, Windows, Mac, Linux and HTML5
[+] [-] wensing|14 years ago|reply
[+] [-] clemos|14 years ago|reply
You can compile this example to both Flash and JS online.
If you install Haxe and NME (http://haxenme.org), you can also compile it to iOS, Android, WebOS, BlackBerry, as well as desktop Mac, Windows and Linux binaries.
And these are only the possibilites offered by NME, which is basically a Haxe-based Flash API implementation.
[+] [-] lucian1900|14 years ago|reply
But on the other hand, its syntax and some of its semantics are Java/C++-inspired, whereas something closer to its ML roots would've been so much better.
It might still beat Java for writing Android apps.
[+] [-] joneil|14 years ago|reply
Clément hacked this together as a weekend project. Source code is here for those interested: https://github.com/clemos/try-haxe
Well done :)
[+] [-] reubensutton|14 years ago|reply
[+] [-] clemos|14 years ago|reply
Most standard classes and methods (String, Array, Hash, etc), and a lot of third party libraries are completely cross-platform, so you don't need conditional compilation.
Usually you use conditional compilation either for very low-level per-platform operations / optimizations, or to switch, say, between client code and server code, like here for instance:
https://github.com/clemos/try-haxe/blob/master/src/App.hx
[+] [-] deltaluca|14 years ago|reply
In the usual case of using already written cross-platform libs you'd rarely need to do this.
[+] [-] misuba|14 years ago|reply
[+] [-] jetz|14 years ago|reply
[+] [-] xyzzyb|14 years ago|reply
It was interesting to be able to write code in one language then compile it to other destinations but it seemed to me that targeting specific domains and learning all their ins and outs made more sense.
[+] [-] Fargren|14 years ago|reply
[+] [-] clemos|14 years ago|reply
- Haxe/Flash supports embedding .swf libraries : http://haxe.org/manual/swc
- NME/C++ (Android, iOS, ...) has partial support for .swf libraries : http://www.joshuagranick.com/blog/2012/02/08/quick-notes-on-...
- NME/HTML5 doesn't seem to support .swf right now, but I think it's being worked out.
Then you have third party tools such as Flump or Flambe to help you: https://github.com/threerings/flump https://github.com/aduros/flambe
[+] [-] egb|14 years ago|reply
[+] [-] ketchupy|14 years ago|reply
[+] [-] clemos|14 years ago|reply
[+] [-] Liongadev|14 years ago|reply
[+] [-] justinfront|14 years ago|reply
HaXe is revolutionary, people who really try it always seem to stay with it, they just have to get past the ask lets of questions and actually try some code and stop being negative and putting it in the less able solutions pile. If you want to waste days coding a game in pure objectiveC and then converting it to java just to target two phones then good luck to you! And if you code something in one language it should just be a case of switching some target specific libraries and all your work now works in another target, not recoding in another language style. HaXe is revolutionary because it in achieving what other solutions promise but normally fall short on providing - cross platform cross language, code that is designed to enable not fragment. So try it rather than assume!
You don't have show stopper issues with the compiler ( it outperforms flex compiler on flash target ). Any minor issues are often resolved within hours of reporting, unless they are language design decisions rather than bugs.
Pizzaman
The forum is not well used as most users use the googlegroup 'haxelang'. In terms of frameworks like flex, haxe for flash target does not support flex well, it can be made to work, but largely the problem is because flex is not really just actionscript but has some adobe secrets/hacks etc.. that is why it has not been ported to a cross platform solution yet, need some better engineering decisions although someone I think is working on it. In terms of other frameworks for components there are some but they could be better, try aswing, feel free to chat on IRC if you have problems getting a particular component framework running. Generally haxe is sort of tool that you can build from scratch your visual interface stuff, or if your using js you can mix it up with native libraries.
Jetz
You can add any support for mobile camera's or video you want it interfaces easily with c++/c and there is java support and there is openframework support try this site http://blog.onthewings.net/. Haxe is not really a game only language but it excels at allowing users to create visual stuff but still do complex game mechanics, and a lot of users enjoy doing games. It works well in solving the issues of having to mix technologies, being normally a more sane programming language than the target but also mixing well, so you can mix haxe php, haxe js and haxe flash ( http://haxe.org/doc/remoting ), or use NME library to hit all the phones and have a web version in flash for users to try online.
[+] [-] pizzaman|14 years ago|reply
[+] [-] clemos|14 years ago|reply
[+] [-] wiradikusuma|14 years ago|reply
[+] [-] clemos|14 years ago|reply
I think Appcelerator is more adapted to applications that want to use native UIs elements (menus, buttons, layouts, etc).
Then you can still write an Appcelerator app using Haxe :) https://github.com/skial/haXe-titanium-desktop
I don't know how/if it's possible to mix both, for example embed a NME app inside an Appcelerator app (besides using UI.WebView and embed it as HTML...)
[+] [-] vamed|14 years ago|reply
[deleted]
[+] [-] tbergeron|14 years ago|reply
Stop fragmenting languages, we don't need another one except if it's revolutionary.
There's some very good principles like the fact that it can compile to many languages but like CoffeeScript I just don't see the point. Want to do some c++ why not using it? Want to do some JavaScript? Then use JavaScript.
There is just too much on the table when it comes to language compilation, I mean if the compiler itself has a problem with your code? It's a bug between what you built and its runtime: what can you do about it? A client is waiting for you, you've got no time to lose contacting the compiler's developers, you're just fucked. Don't get me wrong, I like to play with these languages but that is what they are: toys.
The hard reality is that browsers only support n amount of languages and we are stuck using them.
[+] [-] b2d|14 years ago|reply
[+] [-] dsirijus|14 years ago|reply