Haxe dev

Discussion in 'Game Development (Technical)' started by Jack Norton, Apr 1, 2008.

  1. Jack Norton

    Indie Author

    Joined:
    Jul 28, 2004
    Messages:
    5,126
    Likes Received:
    0
    Hello,
    after playing a little with Shockwave demo, I am not really sure it's a good tool to develop my kind of games... :eek: I mean, I prefer a normal programming language and not all those menu/buttons...
    So I started to look for alternatives and found Haxe which seems a really nice tool, but I have some questions:
    1) there is a community behind it? ok the mailing list, but a forum with code examples? It seems a bit hard to learn (from the perspective of an average programmer like myself)
    2) it's really the best way to create swf files without having to use Flash? or maybe I should look also at Flashdev ?
    3) it's possible to create, from same source, both a online game (flash) and downloadables for Mac and Pc? I think the answer should be yes, using some .exe projectors like Zinc or such.

    if anyone knows some good tutorials about Haxe, or demos, feel free to post URLs :) thanks
     
  2. WaveRider

    Indie Author

    Joined:
    Aug 23, 2005
    Messages:
    222
    Likes Received:
    0
    The best way to create .swf files without using Flash is Flex.
     
  3. esrix

    Original Member

    Joined:
    Aug 11, 2005
    Messages:
    143
    Likes Received:
    0
    I started out using Haxe, but then I found Flash Develop which (I believe) uses Haxe, Flex, and SWFMill internally. It's a nice IDE to work with and has done a good job reporting errors so far. The only thing I found it lacking was native support for the trace() function, but after a few plugin downloads, that problem was solved relatively quickly.
     
  4. jankoM

    Indie Author

    Joined:
    Feb 17, 2005
    Messages:
    1,003
    Likes Received:
    0
    I used Haxe for almost all my flash games (around 7) and I like it.. you can produce f8 and f9 games without any problem... you get a regular swf from it so you can use it to create projector the same way as you would otherwise (but I used only flashplayer's "create projector" until now so I don't know how exactly others work).

    Haxe also has swhx for making desktop apps where flash can comunicate with native level which is also written in haxe language (for example write files, use sqlite).

    A very special future feature of haxe is that you will be able to write a game in flash using f9 API and you then use same code to make a native SDL based game. Look at Neash here: http://gamehaxe.com/

    I also tried to make a neko binding to PTK (I know you use it)... but I didn't continue because I dumped the game idea.

    All this 3 come from the fact that Haxe has Neko also..

    My view is that Haxe has some strong benefits and some negatives compared to Flex/Flash. I use it because use some of the advantages it has and because I like the language more than AS3. Benefit of AS3 is that you will have more libraries (like physics or 3d if you need them)

    The language is very similar to AS3 so if you learn either one you know both... At flash the lang is not the problem but you must get used to the flash API to do anything... you use exactly the same API flash when you are on Haxe or AS2 / AS3 (In haxe you can use f8 API to make a f8 game or f9 to make f9 -- well now f9 is the one you should use for sure).
     
  5. Jack Norton

    Indie Author

    Joined:
    Jul 28, 2004
    Messages:
    5,126
    Likes Received:
    0
    Thanks for the replies. I downloaded the Flash Develop and it's interesting indeed since you can experiment with haxe, flex and flash at same time. It's cool also the Neash SDL possibility, even if is only version 0.3.2... :)
     
  6. Bad Sector

    Original Member

    Joined:
    May 28, 2005
    Messages:
    2,742
    Likes Received:
    5
    0.x versioning means nothing. Its just the version the developer started with :). It could be 0.3, 0.5, 0.99, 1.2, or whetever else. A company i worked at, changed version number in an arbitrary, even including build numbers (in fact i was instructed for the first version of our program to use version 1.1 and start build numbers from 583 or something like that). My first public version of UndeadScript was 1.0, but it could be 0.1 or 0.0 or stuff like that :p.

    0.3.2 could mean he had 32 releases so far - if he used a similar scheme to one i used to use in another library of mine :). If one used Firefox's new versioning, that would be Firefox 16.0 now :).

    Personally what i *look for* when i want to be sure something is good is a) what it can do now, b) how much problems people have and most important c) when the last release was and since when (if it was one year ago with a previous release rate of around once every month, then there is a good chance that the project is dropped).


    On topic now. I use haXe because its the only method to make Flash games under Linux. Also i prefer the language to AC2, even if it has a few issues (like *requiring* the use of iterators in for -- f.e. for (i=0;i<13;i++) in haXe is for (i in 0...13) and you need to use while for more complex loops) and some stuff are missing (you absolutely *have* to use classes even for very simple stuff) or implemented in a strange way (constants are inline var foo:Int = 33; and enums can only be used in switch because they're some kind of classes/objects).

    However these are only minor issues :). haXe has some good points too (for example 'properties' -- although even there there are some problems, like you cannot set an accessor or mutator to a variable but you have to go through a function) and the syntax is clean enough.

    My major concern about the language is that it lacks a proper reference (the "reference" is actually a tutorial) and since the compiler is implemented in OCaml, i wonder what will happen to the project if Nicolas is bored with it.

    However this is not enough to keep me from making a little game (the character is placeholder :).
     
  7. jankoM

    Indie Author

    Joined:
    Feb 17, 2005
    Messages:
    1,003
    Likes Received:
    0
    I think enums in haxe are very powerful (but I don't understand them yet :) ) and are not that related to c++'s enums but more like some structures at some functional languages.

    I also think Nico can't get bored with haxe because their whole company relies on it for server side, flash and js (from my understanding)... they have a pile of project (motion-twin) and are really inspiration to me although there is very little talk about them in community (like giving them for examples of haxe usage).

    btw That game demo you showed is really cool...

    (OCaml is quite interesting lang :) ... I played with SDL/GL in it a little and made few tutorials on my blog ... if only I had any more time)
     
  8. oldschool

    Original Member

    Joined:
    Jan 23, 2006
    Messages:
    167
    Likes Received:
    0
    Hope this is useful :)

    dis-Emi-A haXe Library

    sample games at the bottom of the pagehttp://wiki.disemia.com/HaXe
    a tutorial for the second game on the page above http://www.geocities.com/vladimir_levin/palisaro_wall_tutorial/
     
  9. Jack Norton

    Indie Author

    Joined:
    Jul 28, 2004
    Messages:
    5,126
    Likes Received:
    0
    Yes my main concern is that there aren't tutorials for Haxe... also learning yet *another* language... hmm... at this point probably for me would be better to just learn AS3 and use Flash Develop I think.

    I'm trying to find the less painful way to switch from Visual C+Visual Assist X and PTK, to any language that lets me have also a web/online game (flash or shockwave).
     
  10. oNyx

    Original Member

    Joined:
    Jul 26, 2004
    Messages:
    1,211
    Likes Received:
    0
    A few issues from the top of my head:
    -no forums
    -no proper for loop
    -really bad documentation
    -very few resources available
    -31 bit ints
    -preloaders are problematic (mochiads do work at least)

    Well, I probably forgot half of the apparent issues. The biggest problem is the documentation. For one it only lists methods and variables (without explaining anything). But that isn't the real problem. The real issue is that it doesn't list the stuff from all its parent classes. E.g. coming up with the following line is almost impossible:

    Code:
    trace(flash.Lib.current.loaderInfo.loaderURL);
    flash.Lib.current is a MovieClip, alright.

    However, it's compiled as swf9 so we were already wrong there...

    http://haxe.org/api/flash9/Lib is the right location (no idea why they thought it would make sense to write "flash.Lib" instead of "flash9.Lib" there) and the current thingy is a flash.display.MovieClip which extends flash.display.Sprite which extends flash.display.DisplayObjectContainer which extends flash.display.InteractiveObject which extends flash.display.DisplayObject... and that's where flash.display.LoaderInfo comes from and there is also that loaderURL thing.

    Gee. That's the worst, really. I've used a dozen different programming languages so far and this is by far the worst documentation I've ever seen.
     
  11. Bad Sector

    Original Member

    Joined:
    May 28, 2005
    Messages:
    2,742
    Likes Received:
    5
    There is a mailing list which is the same (people come and ask questions and other people answer them).
    There is no "proper" way for a "for" loop to be made. Although i prefer the C for syntax is by no means the "proper" way. haXe is a language of its own and not C, despite the similarities. Other languages have other kind of for loops (like BASIC having FOR var = 1 TO 10 STEP something: NEXT, or Pascal having FOR i:=10 DOWNTO 3 DO something;).
    I agree with that, but see below.
    What do you mean by that?
    This is true only for Neko. In Flash this
    Code:
    var i:Int = 0xF<<31;
    trace(i);
    
    displays -2147483648, which is the same as C. If we were limited to 31bits, that would be 0.
    What do you mean by that (i mean whats the actual problem?)?

    Although i agree with the documentation part, i think you exaggerate a bit. First of all
    what you described is not language documentation but API documentation. The language is documented (although the documentation could be in a more reference-like way), but the API is not part of the language. The provided APIs are part of different platforms and for those a reference does exist (for example i read the Flash APIs from Adobe's livedocs). The documentation in haXe's site only shows what is available from haXe's viewpoint. However there is documentation for haXe-specific stuff, like the String class. For the other stuff (which are not part nor controlled by haXe and cannot even be legally copied into haXe's documentation), the reference exists but elsewhere. The flash guide mentions that (and really Adobe is in a much better position to say how their API work than the haXe developer).
     
  12. oNyx

    Original Member

    Joined:
    Jul 26, 2004
    Messages:
    1,211
    Likes Received:
    0
    Mailing lists are used by fewer people and they are less accessible. You wouldn't do customer support via mailing lists, right?

    It's sorta like a geek filter with a way too high threshold. It's dated technology most of the audience never used before.

    AS2/3 supports both kinds. Haxe only supports one, because the author doesn't like the other kind. And well, that's quite annoying if you want to port some code over. More work for you only because one French guy thinks they are hard to read.

    Tutorials and the like.

    Right.

    Single file with preloader:
    http://lists.motion-twin.com/pipermail/haxe/2008-February/014449.html

    Well, yes. However, the API documentation is what really matters. It's alright that they didn't copy/paste the stuff from Adobe's docs. But it's illogical that you write "flash.Lib" and it's then either that "flash.Lib" or that "flash9.Lib" stuff. And it's really bad that the inherited things aren't listed.

    It's a pretty big problem. Bad documentation wastes time. Over and over again. And they could have addressed that inherited stuff easily since that only requires some effort on the doc generating code.
     
  13. Huge

    Original Member

    Joined:
    Sep 22, 2005
    Messages:
    142
    Likes Received:
    0
    This is a pretty good list.
    If you want to write web games with haxe, you will first need to understand flash (as3). There is no way around this.

    To use it as an installed executable, there are a couple of options. One is somthing like Zinc that converts an swf to an exe. Another is AIR that installs a "runtime" on the users computer, and then your app runs inside that. Both these options basically require you to write "in the flash way", using flash APIs for graphics. At some stage, AIR will let you extend these APIs yourself. This is getting pretty much like the java model, except adobe with AIR will probably win the hearts of consumers - like they did in the web sapce.

    Alternatively, you can use it as a "scripting language" for your normal executables (you will need to write interfacing code) or you can use something like the existing NME library and "drive" the whole thing from haxe. When running like this, haxe uses the "neko" virtual machine, which has more permissive licensing for redistribution and a much smaller footprint.

    The Neash project aims to provide a way for the same code to compile for both the neko virtual machine and for swf (web development). Here again you would have to write "in the flash way", but in the executable code you could make additional calls (eg, update the filesystem).

    NME (sdl interface) is "mostly" complete as an inteface, and it has a few "value added" features, such as line drawing & gradient fills. If you just want to push some bitmap graphics around, you can get a pretty good result.

    Neash (flash -> nme/sdl interface) is not ready for production.

    Both haxe and actionscipt (via "flex") have free command-line interfaces, and also similar performance characteristics. So the main difference is in the language. Haxe has some nice shortcuts, eg:
    var x = 2; // x is now defined as an "int".
    The can be handy when the data type is, for example, a function that takes and int and returns a string. (side note: can't wait for c++0x to define the "auto" keyword)

    The "enum" construct provides a language solution to this c-code:
    struct data
    {
    DataType mType;
    union
    {
    DataType1 *ptr1;
    DataType2 *ptr2;
    ...
    };
    };
    by binding the "type" variable to its data.
    Haxe also has problems outlined above.


    So, in summary, to use haxe for web games, or if you want both downloadable and web games, you will need to undertstand how to program games in flash. There are plenty of tutes about for this. So why wouldn't you just use actionscript (flex)? I think there are 2 reasons, 1) you prefer the language, or 2) you are thinking about downloadable games and AIR does not suit your needs for some reason (such as runtime installation or the need to add your own DRM of some kind).
     
  14. Bad Sector

    Original Member

    Joined:
    May 28, 2005
    Messages:
    2,742
    Likes Received:
    5
    @oNyx:
    I prefer forums to mailing lists at any time, however i don't find them as unusable as you describe them. I don't believe being a "dated technology" matters (email itself is the most dated technology in the internet and is still the second most used).

    Never thought about the "geek filter" but if it works like this, then i believe that it is a good thing. haXe isn't made for non-technical people anyway (for these the Flash IDE itself is a much better option and will be much more productive).

    On the other hand, if you ask anything in the list, you are sure that people who know about it will see your message. Although i'm not written for very long, things are usually answered between a couple of hours (sometimes less).

    @Huge:
    This is not true. I never used Flash before, nor had any kind of flash experience before. Anything i learn t was from haXe's -poor- documentation and Adobe's API reference.
     
  15. oNyx

    Original Member

    Joined:
    Jul 26, 2004
    Messages:
    1,211
    Likes Received:
    0
    http://arstechnica.com/news.ars/post/20061002-7877.html
    http://www.engadget.com/2004/11/29/in-south-korea-email-is-for-old-people/

    etc ;)

    It's good if it's about writing a kernel or drivers. Web games, however, is pretty sloppy stuff mostly written by teens, artists, web designers, and programmers who aren't programming/online since the mid-nineties.

    If you ask in some programming IRC channel (being there apparently is pretty geeky), you'll see that half of the users there (or even more) never participated in any mailing lists. Forums, however, are used by pretty much everyone.

    Nowadays not having a forum is just plain silly. Even the geekier Linux distributions like Fedora have some.

    With forums you don't have to use that threaded view, you can show screenshots around, nice formatting, code highlighting, nicer to navigate, no need for gmail etc, you can easily access it from everywhere, no frigging email etc.

    In the past I talked about haxe with a few people. All of 'em quickly lost all interest once I told 'em there are no forums.

    "They do have a mailing list though." - "Meh."
     
  16. Bad Sector

    Original Member

    Joined:
    May 28, 2005
    Messages:
    2,742
    Likes Received:
    5
    There are many people in the haXe mailing list who refuse to use a forum (for several reasons, but the common factor is that most are members to many mailing lists and its much easier for them to keep track of the discussions of they are sent to them as opposed to checking for them - which is the forum way). These people currently tend to be the most knowledgeable of the haXe community and you really want them around. This combined with the fact that haXe currently has a small user base means that if a haXe forum pops up, the community will split in two, thus limiting the forum's appeal of "providing help" -- because not only the available people will be cut in half, but the helpful people (those who know stuff) will not be available in the medium that most people look for (a forum). And of course requiring from those people to be there is nothing more than selfish, so its out of question :).

    haXe is not for such people. haXe is an advanced language which requires good understanding of object-oriented programming and provides no visual means of creating content. It is a programmer's tool only. As i said in my previous post, a web designer, artist or teen who doesn't want to learn about programming is in a much better position with the Flash IDE. haXe is for programmers and if a "programmer" cannot use a mailing list then this will be the least of his problems with haXe.

    In the end, people who are serious about it, will join the list and learn from it. People who will refuse to learn and use haXe because there is not a forum doesn't seem to be serious about using haXe at all.

    Because from a practical point of view, a mailing list has little difference from a forum (and if you set it up like i have my mailing list it even looks like one :p).
     
  17. oNyx

    Original Member

    Joined:
    Jul 26, 2004
    Messages:
    1,211
    Likes Received:
    0
    >This combined with the fact that haXe currently has a small user base[...]

    Well, it's so small because there isn't a forum. ;)

    >haXe is not for such people. haXe is an advanced language[...]

    How so? It looks like any other language. Kids learn Java these days. Haxe isn't much different. For a simple 2d game you don't need much OO and you also don't need a good architecture.

    >In the end, people who are serious about it, will join the list and learn from it.
    >People who will refuse to learn and use haXe because there is not a forum
    >doesn't seem to be serious about using haXe at all.

    There is some information paradox. How can you be serious about a language if there is so little information available?

    >[image]

    Yuck. Way too many extraneous clicks and way too much repetition.
     
  18. Huge

    Original Member

    Joined:
    Sep 22, 2005
    Messages:
    142
    Likes Received:
    0
    My point is that you now also know how to write flash games using as3 and flex. Not that you can't learn, just that you have to learn as much as for as3.
     
  19. Jack Norton

    Indie Author

    Joined:
    Jul 28, 2004
    Messages:
    5,126
    Likes Received:
    0
    Thanks to Huge for his good reply to my original question. About the discussion "onyx vs bad sector" I find it quite pointless since everyone will want to have the last word.
    BUT in this contest (to my original question) onyx is right. I want to start making webgames but not get mad learning a ultratechnical geek language with NO tutorials/examples/etc.

    I'm a pratical guy - probably crap programmer - but have already released 9-10 games in past 4 years. When you live based on your game earnings (i.e. it's your PRIMARY source of income), you don't have really time to spend/waste hours with unfinished/undocumented languages, sorry :D
     
  20. oNyx

    Original Member

    Joined:
    Jul 26, 2004
    Messages:
    1,211
    Likes Received:
    0
    Eh... sorry, Jack. I just loathe email and mailing lists. It's one of my favorite pet peeves. ;)

    I forgot to mention one thing: over at the haxe channel I talked with some guys a bit about web games etc and the moral of the story was basically that one might better use straight AS3 if that JS/Neko stuff isn't of any use since Haxe won't make that any easier.

    So, that's the route I'll take. FlashDevelop, that AS3 compiler, and SWFMill.
     

Share This Page

  • About Indie Gamer

    When the original Dexterity Forums closed in 2004, Indie Gamer was born and a diverse community has grown out of a passion for creating great games. Here you will find over 10 years of in-depth discussion on game design, the business of game development, and marketing/sales. Indie Gamer also provides a friendly place to meet up with other Developers, Artists, Composers and Writers.
  • Buy us a beer!

    Indie Gamer is delicately held together by a single poor bastard who thankfully gets help from various community volunteers. If you frequent this site or have found value in something you've learned here, help keep the site running by donating a few dollars (for beer of course)!

    Sure, I'll Buy You a Beer