AS3 (Flash) vs HaXe
I've been writing game stuff in AS3 (Flash) long enough to realize it's decently suited for that purpose. I don't like a few of the language features but overall it's reasonable enough. Flash has a closed nature which I don't like. Making a mobile version of anything that uses Flash requires embedding a runtime environment and adds about 10MB to the overall download size regardless of what you make (not too keen on this).
Flash is not well supported on Linux any longer. Though it can be done it's really not my idea to alienate a large part of my fellow OGA crowd. Using Chrome on Linux offers some relief from this but forces users to rely on Chrome for all their Flash needs. Adobe does make a stand-alone Flash player that works up through Flash 11.2 but downloading a flash game defeats the purpose of making a web-based game...
I see forums talk about HaXe and how it can be used to compile to other languages. It supports making SWF files (Flash) natively and it does all these great things. I understand the documentation is limited (only 1 official book on the language, haven't looked too hard online for further docs). It's 100% open source (which I really prefer over Flash). It forces everything to be strongly typed (which I highly prefer). I have no idea how well it handles graphics, sound, etc.
Could someone give me a side-by-side of AS3 and HaXe that might push me one direction or the other? I've invested in Flash tools and I'm familiar enough with AS3 that I could make a decent game now (assuming my family, full-time job, and school would let me have more time). I would prefer to use a completely open-source tool like HaXe but have no experience or clear understanding of its limitations. I'm also aware that HaXe can use Flash resources somehow but I have no experience with it.
I'm also concerned about how hard it might be to work with a Javascript or AS3 API if I make a game in HaXe. My intention is to make free flash games and put them on Kongregate (GameStop flash game site). My secondary intention is to compile those games for mobile devices (iOS and Android). Using HaXe would allow compiling to C++ source and numerous other languages which allows me to do all of those things but again, I have no experience with it so I'm skeptical.
Thank you for the responses in advance.
Just by looking at HaXe and by finding Haxe Flixel I've convinced myself that Haxe is better for making 100% open source content than Flash. With Haxe I can compile to source code in several other languages and can compile for mobile, all with the same code base. Now the task of rewriting what I had so far with HaXe...
HaXe also now has a port of the Love2D framework called HOVE, which looks pretty promising.
My project: Bits & Bots
I'm going to make some simple clone games using HaXe to get started. So far I've done loads of mucking around with AS3 and produced nothing. Maybe if I make something small and simple with HaXe I'll actually finish it and then move on to finishing bigger projects!
Funny to see this when I'm about halfway through installing HaxeFlixel right now! I've never worked with Flash but it looks pretty promising.
As someone who used to use AS3 and Flixel exclusively, I can tell you that using Haxe/OpenFL and HaxeFlixel is definitely a step up. Haxe feels like an "Actionscript 4", and HaxeFlixel is more actively maintained than Flixel.
I would suggest reading up on the AS3 developer's guide, as it'll show you the syntax differences between the two languages (though you may already be well along, as the last post in here was a while ago):
http://www.openfl.org/developer/documentation/actionscript-developers/
The ability to use your same code for different platforms is really awesome. I used to have separate web/desktop projects for my AS3 games. In Haxe you can have the one project, and distinguish the code differences with conditional compilation tags, such as
Normally importing these in the web version would fail when building, as they can't be used for the web. With the conditional tags, it'll skip this part of the code unless it's the target platform. You can create custom tags as well.
Further reading:
http://www.openfl.org/archive/developer/documentation/conditional-compilation/
Three Game Trifecta
@LaughingLeader
I genuinely appreicate the feedback. I've been experimenting with Haxe/OpenFL and HaxeFlixel for a bit and it's definitely more interesting than AS3 and flixel. I've been slowly plugging away at making an infinite runner and I'm almost ready to upload the tutorial to the blog I started about Haxe game dev. I'm not trying to plug my blog but if you're interested I'll be happy to provide the URL. Once I have a full game tutorial on it and a finished, working game I'll use that blog as the project url on my profile here on OGA.
@William
No problemo! Happy to help.
Sure, I'll take a look at your blog. I've got one too that I use to post updates on my game development, and tutorials and whatnot (link: http://www.laughingleader.com/).
If you need more information on compilation tags, I'd check out this page on the project file format:
http://www.openfl.org/developer/documentation/project-file-format/
I use a few custom tags for my games, like so:
These go in the ProjectName xml file.
In my actual code I can then do stuff like this:
Pretty handy for compiling release builds if you have all your debug stuff managed by a haxedef tag.
I also recommend looking at some of the HaxeFlixel addons. There's some good stuff in there.
Flixel-ui is also handy (link: https://github.com/HaxeFlixel/flixel-ui) as well as Firetongue for doing some cool localization stuff: https://github.com/larsiusprime/firetongue
Three Game Trifecta
"Making a mobile version of anything that uses Flash requires embedding a runtime environment and adds about 10MB to the overall download size regardless of what you make (not too keen on this)."
Although bear in mind that Haxe (or anything else) may do the same - the libraries still have to be bundled - so it's worth checking that out before making a choice. (Particularly for C++ on Android, where I believe there's less availability of built-in libraries, most of them are only available via Java.)
To go with mdwh's post, here's a relevant page on HaxeFlixel mobile targets:
http://haxeflixel.com/documentation/mobile-targets/
I haven't messed around with mobile targets personally, but I do know that HaxeFlixel was tailored to run on mobile devices - something Flixel has trouble with.
Three Game Trifecta
@mdwh
The fact you have to embed a flash runtime environment in a mobile app to make it work is exactly why I looked for something like Haxe in the first place. As soon as I realized mobile was not a real option with flash I gave it up for dead.
@LaughingLeader
Thanks for the link and the info. I've seen the conditional macro tags, those are pretty great for targetting particular platforms and only compiling what's needed for any given release. I'll probably work with them more later but haven't had much reason to mess with them much yet,
Have a look at OpenFL, it offers most of the Flash API as a cross platform solution, and you also get some performance focused bonuses (similar to Stage 3D). For the most part, you can target Flash, Native, and HTML 5. This gives you the advantage of supporting Flash while there's still a demand, but also being ready for newer technology as it emerges.
FlashDevelop is a freely available IDE, for Windows, that makes creating Haxe/OpenFL (and Actionscript) projects easy. The biggest issue seems to be SWF creation, but if you already have the Flash tools, that's not an issue. And, from everything I've seen Adobe is running away from Flash, and trying to create a toolset for HTML 5.
The biggest advantage of HaXE/OpenFL is that it has a future (be it Flash, Native, or HTML 5). The creator of NME/OpenFL (Joshua Granick) is taking steps to provide the software as open source, but also generate an income.
Flash probably isn't dead (yet), but the negative backlash has started, and Adobe has wavered a lot lately on supporting Flash.
Using HaXe and OpenFL, the same functionality is available on Android as on any other platform. The Java based system isn't really a limitation, you may have to jump through JNI to do a few things, but most things can be handled from the native (C++) side, as long as you limit the target device to Android 2.3 or higher. The native code runs outside the JVM, and has access to a nearly complete c/c++ library, including STL.
In porting my Super Play (http://superplay.info/) game engine to Android, using NativeActivity, I ran into one place where I needed the JNI interface, and I found the solution online. The NativeActivity does have a Java class you can customize if you need to.
And, TBH, dealing with iOS is more cumbersome, as a certain amount of code has to be written in Objective C.
@cdoty
I've become a huge fan of Haxe, HaxeFlixel, OpenFL, and Nape since I started this thread. I'm still working out the kinks and hopefully my week off (starting tomorrow) will give me the time needed to finish the infinite runner I teased in the Haxe game dev blog I started.
http://williamthompsonj.blogspot.de/
I don't look forward to tinkering with Objective C again but I know it's coming if I want to make phone apps that see a wide audience. I'll cross that bridge when I get there.
Thanks for the link, I checked out your site. Looks pretty awesome. I love SNES style games and graphics, that's what drew me to LPC.
I'm nearly done with my first HaXeFlixel game (infinite runnner for tutorial on my blog). It's close enough to a playable state I'd like feedback. Here's the link to play (graphics by surt):
http://will-thompson.net/runner
It has no sound effects, no background images, and no visual effects aside from jumping and an animated sprite because it's meant to be used for a tutorial. What do ya'll think of it?
Well it works nice and fast. Seriously needs proper physics and jump distance based on key press duration.
instead of toying with objective c for ios have you considered using the unity 3d engine. it supports ios and many other platforms. you dont have to learn unity script you can use c#. which may be light years easier to learn. so you can code your game using unity and c# and deploy for ios.
@cemkalyoncu
I agree complete about button press vs jump height. I'm using the native flixel physics engine, it's not built to be highly advanced. If there's a way I'll have to figure it out, otherwise I'll have to emulate it somehow. Shouldn't be too bad.
@Acorn
I've looked at Unity3d and it does look good. The only problem is I'm trying to make FOSS games (Unity3d is a paid platform like Flash, not open-source). I like it but I want to stick to FOSS ideals since this community is FOSS oriented. That was one of the driving factors that made me switch away from AS3 Flash over to using HaXe.
@cemkalyoncu
I did some more tinkering with the infinite runner. I found a simple way to impliment mario style jumping. There is a page about how to do this with flash-based flixel but it's old and the logic required some modification. Also, graphics are a tad bit prettier now.
@everyone
Please tell me what you think of the infinite runner now. If it's usable enough I'll finish writing the tutorial on how to make it and post it to my blog.
Made it to 1459! I like that you can control jump height now, but I miss the smooth parabolic jump from before.
Also, there might be a bug when determining how wide the gaps should be. I had one run where the very first gap was about twice as wide as the character could jump..
All in all, it's looking pretty great so far!
My project: Bits & Bots
@MoikMellah
Damn, you're better than me. I lose it after 1k pretty consistently. Glad to hear you enjoyed it enough to post a high score. You give me hope it's worth making a game dev tutorial out of it. It's not going to get too much more crazy, mostly tweaking little things here to make it look and feel decent. At some point I have to call it done so I can make a tutorial out of it.
1393, pretty playable. I noticed an issue though. When the game is slow, there is some sort of flickering, but when it got faster its more smooth. This is on Intel GPU. Another small issue if you want to fix, when the jump is complete, if I dont let go of up key, it keeps jumping.
Updates to infinite runner since last upload:
It would be cool if you cound jump with a mouse-click/finger-touch so it's playable on a slate/phone.
Also think jumping would feel better if you held button to charge jump power while running then the character jumps on button release. I don't think mario-floaty-jump really fits.
Red warrior needs caffeine badly.
@surt: I have to object to your second statement. Later stages you have jump right away instantly, there won't be any time to charge.
@surt
I do have plans to add touch/mouse click support because the idea is to compile it for all possible platforms. For the tutorial I'm making I wanted to make that happen with macros so I could show how to use them effective when compiling to different targets. Thanks for the suggestion though, it reassures me that I'm on the right track.
@cemkalyoncu
Have to agree with you about jumping in later stages. It would be next to impossible if it required charging.
I don't like Haxe as a language as much as I like AS3 as a language, but Haxe is a better platform that Air. Air isn't even supported on Linux any more. For web games, AS3 is probably the better choice, but Haxe is lightyears ahead of Air for desktop games and mobile apps.
Syrsly
Twitch Streamer, Web/Game Developer, & Artist
syrsly.com - contact me for commissions, thanks!
@Tap
The Flash API is available in Haxe through OpenFL, right? That, coupled with Flash Develop and a more intelligent macro system and precompiler usually produces a faster and more optimized SWF than just ASC2 in Flash Pro or Flash Builder. In addition, you can use SWC and FLA resources when compiling Haxe against any target, not just the web. Unless you're talking about the IDE with Flash Pro, I don't understand why Haxe is an inferior language. You can even compile AS3 directly with little or no modification in a Haxe project using Flash Develop.
My opinion is probably skewed in favor of Haxe from poor experiences with AS3. Having tried and failed at producing things using both Flash Pro and Flash Builder I have a preference for Haxe because it's a software engineer tool more than a graphic designer tool. Obviously that's my opinion but I've seen that same opinion shared a lot on forums on the Internet.
"The Flash API is available in Haxe through OpenFL, right?"
That is an odd question to me, because Flash doesn't have an API. OpenFL is a recent development that I have not investigated thoroughly, but I used its predecessor, NME, a lot, and while it was very good at emulating the Flash standard libraries, it did not change how the Haxe language works. It also required a lot of tinkering to get it to compile with FlashDevelop, something I never had to do with Adobe Air and AS3. As far as web game development goes, it is simply easier to use AS3.
Syrsly
Twitch Streamer, Web/Game Developer, & Artist
syrsly.com - contact me for commissions, thanks!
Certainly Flash does not have an API, though Action Script does. It would be facetious to think of Flash as different than Action Script when talking about AS3 development vs Haxe though, especially since Flash is owned, developed, licenced through, and controlled by the same company that created Action Script. Doesn't leave much room for the imagination to wander. In other environments I'd call that splitting hairs but because we're talking on OGA I'll refrain from pointing out the obvious.
From what I've read about NME it wasn't the most elegant solution for emulating Action Script, I'll agree with that. OpenFL is a lot better port of the Action Script 3 API and includes recent developments, including Stage3D, and seems to function more consistently. I have yet to run into any gotcha's or any kind of malfunctions (though I haven't done anything significnatly with it yet).
What is it about the Haxe language you don't like? It's pretty generic in nature and doesn't seem that different from AS3 to me. Forgive my ignorance if I'm missing something blatant but Haxe seems like a fairly generic and high level version of C++ logic flow with a lot of convenience features very similar to AS3.
"Certainly Flash does not have an API, though Action Script does."
In a way, yes, AS3 is an API for Flash. However, I doubt that's what you meant by API.
Haxe's not extremely different from AS3. I just think AS3 is easier to work with. AS3 is more flexible as a language. Haxe is a broader platform with better support for desktop apps and other cool things. On the language side, there are a few things that Haxe simply does not do that AS3 does and vise-versa. It's really a trade-off of performance and ease-of-use and portability. Neither is better than the other in every way.
Syrsly
Twitch Streamer, Web/Game Developer, & Artist
syrsly.com - contact me for commissions, thanks!
"HaXe also now has a port of the Love2D framework called HOVE, which looks pretty promising."
That looks very interesting. I'll have to try that out soon. :)
Syrsly
Twitch Streamer, Web/Game Developer, & Artist
syrsly.com - contact me for commissions, thanks!
Picking at semantics doesn't make you look more intelligent, it makes you look asinine. You might want to troll less if you're trying to make friends.
I understand in a very vague and cloudy way that you don't like the way Haxe works and I'm supposed to understand that AS3 is somehow superior to it for purposes of web content. Would you mind elaborating in a bit more detail what you mean? Maybe point at something specific? Thanks.
And yes, AS3 is an application programming interface; it specifies a language that can be compiled to bytecode and that works with the Flash virtual machine. By definition, an API is a specification of how some software component interacts with others. Haxe happens to be another API that can be compiled to multiple target platforms. Yes, they are both languages but they are both an API.
@William: I think you already agree with me about NME being unintuitive. OpenFL is not something I really delved into, but I have toyed with it a tiny bit, and it seems very similar to NME. I will have to try making a Flixel game using OpenFL on top of Haxe and compare the experience to my older experiences with the language/platform. However, Haxe has always been more strict than AS3, and the syntax is a little different, so porting from AS3 to Haxe takes a very long time.
I'm sorry if I seem to be insulting you at any point in this thread, but I never insult anyone intentionally. You have intentionally called me a stupid troll. I do not appreciate the hate and am therefore backing out of this thread permanently before things get out of hand somehow.
Syrsly
Twitch Streamer, Web/Game Developer, & Artist
syrsly.com - contact me for commissions, thanks!
@Tap: I appreciate the feedback. I agree that NME is less than intuitive and that Haxe is strongly typed. NME is abandonware at this point since it's been replaced by OpenFL so that's a moot point. Part of what drew me to Haxe was the strongly typed language since it compiles cleanly and I don't question what it's doing so much.
My intention is not to call you stupid or a troll. Your second post basically says "Haxe requires a lot of tinkering because NME doesn't work perfectly" and your third post says "you didn't say something technically perfectly and AS3 is better because I like it more." I appreciate your experience and knowledge and would like you to share. I understand and agree that NME sucked back in the day and that Haxe is more strongly typed so it's hard to port AS3 over to Haxe.
My frustration came from the wording you chose in your second and third posts; "That is an odd question to me, because Flash doesn't have an API." Flash is a virtual machine, it has an API that all compiled Flash bytecode must conform to. Whether Adobe makes that standard public or not is entirely different. "In a way, yes, AS3 is an API for Flash. However, I doubt that's what you meant by API." The first sentence is fine by itself. The second sentence doesn't give me a warm and fuzzy feeling about what you meant. It implies I'm either ignorant or stupid because I don't know enough about Flash or what API means. I don't mean to pick at your word choice but you could have chosen better phrasing.
@Tap
It's pretty obvious I read your comments wrong. I don't think you're a stupid troll. I'm sorry. I'm human, I make retarded mistakes and read things wrong sometimes. I still value your input and welcome your insight. Please disregard my stupid comments.
@Tap
I know you're probably still questioning my sanity and I can't blame you. This is a homage to you and my way of asking forgiveness. Please have a laugh at my expense and smile about this stupid guy on the Internet acting like a retard.
http://will-thompson.net/tap/
@william.thompsonj Thats brightened up my evening :) I hope tap enjoys it. p.s. I hope for your sake your wife never sees that first picture.
"I hope tap enjoys it." - ryan
Don't worry. I thought it was hilarious. Good way to start a night of gaming. Thanks, Will. :D
Just to be clear, I want to restate that I have nothing against Haxe as a platform. I would love to use it for a professional or collaborative project sometime in the near future. Godot game engine also looks very promising for collaborative projects, and I intend to look further into it as part of a viable game creation suite.
Syrsly
Twitch Streamer, Web/Game Developer, & Artist
syrsly.com - contact me for commissions, thanks!
Yay Tap isn't upset at me for acting like a retard.
This runner tutorial game is no longer going to be a single blog entry. It's gonna be a mini series because it's grown so much. Trying to fit everything I did to make this game into one blog post would be like a mountain of text and quite intensive to make readable and followable.