
Try Haxe  - clemos
http://try.haxe.org
======
rufugee
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.

Thanks.

~~~
ido
I used haxe for all my games(e.g. <http://cardinalquest.com/>) for over a year
now & it's working quite well.

There are some annoying differences between the different targets but it's
>99% the same and you can work around the differences.

~~~
joering2
Cardinal Quest looks very cool. Could you share some light from business
perspective. Profits?

Thanks.

~~~
ido
Revenue is mid 5 figure so far from desktop and flash versions, the ios &
android version were just released but I'm hoping to break into 6 figures
altogether across the game's total lifespan.

~~~
aerique
Did you use Haxe for the iOS and Android versions as well? It wasn't quite
there yet when I checked it out a couple of years ago.

~~~
ido
Yep, all from the same code base.

~~~
aerique
Thanks, I'll go and play with Haxe again then!

------
barik
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.

~~~
clemos
Ok, ok, I switched back to monospace...

~~~
dfc
Out of curiosity do you normally write code in a proportional font?

~~~
clemos
Not usually, but I wanted the app to look a bit less "hardcore techie" than
the rest of the Haxe evangelism material :)

~~~
jacobolus
The little code box on the front page need more space between lines. Currently
they’re right on top of each-other.

------
clemos
demos :

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
Impressive stuff clemos. Thanks for sharing.

------
zserge
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.

~~~
conanite
Hey, it has macros! But it doesn't compile to coffeescript ... yet ...

<http://haxe.org/manual/macros>

~~~
HoLyVieR
What's the point of compiling to CoffeeScript when it compiles to JavaScript ?

~~~
prezjordan
Because trendy technologies.

~~~
Avshalom
Coffeescript is webscale.

------
yxhuvud
You lost me at 'public static function main.'

~~~
boofar
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.

~~~
jonpacker
I think his comment could be refrased as "This language looks like Java"

~~~
clemos
Also, IMHO the fact that Haxe looks familiar to people coming from Javascript,
ActionScript, or Java is a plus.

~~~
WiseWeasel
Agreed. I'd wager there are substantially more people learning JavaScript
these days than PHP, not that PHP looks _too_ foreign, relatively speaking.

------
st3fan
The cross-platform thing is a bold claim. How about a more complete example
than that 5 line hello world program to show us how that would work?

~~~
singmajesty
Here is a good example:

[http://www.joshuagranick.com/blog/2012/04/12/html5-pirate-
pi...](http://www.joshuagranick.com/blog/2012/04/12/html5-pirate-pig-sample/)

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

------
lucian1900
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.

~~~
chipsy
The syntax is curly-brace, and on a surface level closest to AS3, but the
underlying design borrows a lot from Pascal in terms of minimalism(something
which Nicolas has mentioned once or twice):

The types are based on JS without truthy or falsy values; comparison is
required to get boolean values.

Like Coffeescript, while+iterators are used instead of C-style for loops. (no
"do while" blocks either)

Case statements don't fall through.

These little changes(plus a few others) help bring in a lot of the enforced-
cleanliness that you'd get with a bigger syntax change, it just "looks" curly-
brace. One that I miss is :=, since I have run into the ==/= typo
occasionally(it just occurs in much more limited situations). No-truthiness is
particularly interesting since you only really notice it's there when you try
to port C or JS code.

------
joneil
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.

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
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?

~~~
clemos
<http://haxe.org/ref/conditionals>

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>

------
misuba
So, what's a good resource for _learning_ Haxe as opposed to trying it?

~~~
novalis
Hello misuba, here are some that I have found to be very handy for some
projects I have worked on. Hope they are a good start for you, or at least
will intice your curiosity.

<http://www.haxenme.org/documentation/examples/tutorials/>
<http://haxe.org/doc> <http://www.haxejs.org/> <http://www.haxenode.org/>
[http://mikecann.co.uk/personal-project/more-html5-haxe-
speed...](http://mikecann.co.uk/personal-project/more-html5-haxe-speed-tests/)

If you do have a go, I recommend HaxeNME for it is a framework that will
install all you need for Haxe to just "work" straight up and it also adds some
cool stuff like mobile compilation targets (webos, ios, android) and HTML5.

You will have to pick a IDE, people go for FlashDevelop and Mono a lot now,
but do read through the Haxe or HaxeNME site setup sections for full list.
There are lots of add-ons for a lot of IDE's.

For install, start here: <http://www.haxenme.org/documentation/setup/>

------
jetz
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.

------
xyzzyb
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.

------
Fargren
Can I use my .swc files in a Haxe project? I love the concept, but losing all
my libraries is harsh.

~~~
clemos
Given that a .swc is basically a zipped .swf, this currently depends on
runtimes:

\- 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-...](http://www.joshuagranick.com/blog/2012/02/08/quick-notes-on-the-swf-
library-for-nme/)

\- 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
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.

~~~
ketchupy
You can use FlashDevelop's debugger when targeting Flash.

------
clemos
... and the editor has autocompletion on dot :)

~~~
Liongadev
does not work for me

~~~
mahmud
tell them what browser you're using and what version.

------
justinfront
tbergeron

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
sounds great, but i'm afraid that this is the reality:
<http://haxe.org/forum/thread/2988>

~~~
clemos
So ?

------
wiradikusuma
does anyone know any comparison with similar offerings ("cross native") e.g.
Appcelerator?

~~~
clemos
NME is particularily good in building "Flash-like" applications, so mainly
games.

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...)

------
tbergeron
Nope.

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
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.

