Haxe in away3d development

Software: Away3D 4.x

Avatar
Huck, Jr. Member
Posted: 08 February 2012 04:18 PM   Total Posts: 45

Hi Guys,

a few weeks ago i mentioned i was going to start development of my new game in haxe using away3d 4 (as3). Someone asked for me to give updates on how it goes using haxe, so here is my first update.

Using haxe up to now has been a real charm and an immense pleasure.

For one, the compiler is so much faster than the flex compiler, the build/test cycle is much faster in haxe freeing us from those long build times. As for the runtime speed itself, not only is the as3 code generated by haxe much faster than pure as3 (game logic for example), but you can use all as3 libraries compiled as swc’s in your haxe application just like you would in as3. for example with away3d, i compiled away3d 4 in a swc and included the swf in haxe (extract the swf from the swc) and i use it just like if i was in as3. I also use a pletora of as3 libraries such as as3crypto and other useful libraries without any difficulty.

and finally, one final benefit, you are not “stuck” in the flash platform. Should anything happen and say, for example that webgl should emerge as a more viable alternative in the future, all you game logic written in haxe can be compiled to javascript with a simple switch (-js) on the compiler. You can thus change direction without have to do costly rewriting of all the previous code you did. And if you want as3 code from your haxe code, just use -as3 on the compiler and Voila!, you have as3 code. simple smile

so really, I highly recommend to everyone to use haxe when building their game, there really aren’t any downfall if you use flashDevelop, only advantages.

regards


edit: i post the very useful “as3tohaxe” conversion tool in this post (i post it here because it can be cumbersome to build yourself using haskell). This tool will take you 98% of the way in converting source code from as3 to haxe. the last 2% is a breeze to complete manually and there you go, welcome to haxe. smile

 

File Attachments
as3tohaxe.7z  (File Size: 800KB - Downloads: 0)
   

Avatar
Matse, Sr. Member
Posted: 08 February 2012 05:29 PM   Total Posts: 149   [ # 1 ]

Hey Huck,

Just want to thank you for this very interesting post : makes me wanna take a deeper look into haxe now ! I still can’t seem to really grasp what it is exactly, but that’s just me not taking the time to “learn” so far wink

edit : can’t seem to manage to download your 7-zip file, maybe the forum would like a .zip extension better ?

 

   

Avatar
Huck, Jr. Member
Posted: 08 February 2012 05:58 PM   Total Posts: 45   [ # 2 ]

HI Matse,


haxe is really just a programing language and is designed to be a “common denominator” between many languages, allowing it to transform its sources from haxe “abstract language” to different targets such as as3, c++, javascript, etc. The nice thing for as3 developers is that the haxe syntax is very similar to as3, making reading code form one to the other very easy and straightforward.


for the as3tohaxe tool, i wanted to post a .zip but the upload limit on this forum is 1024kb, and the zip is larger than this. The only compression that allows me to beat this limit is .7z and .rar formats. I recommend you install the opensource 7zip application which will allow you to extract these archives. Here is a rar archive which also beats the size limit.

regards,

 

File Attachments
as3tohaxe.rar  (File Size: 891KB - Downloads: 0)
   

Avatar
Huck, Jr. Member
Posted: 08 February 2012 06:10 PM   Total Posts: 45   [ # 3 ]

HI Again,

here is a self extracting archive, hope this helps.

 

File Attachments
as3tohaxe.7z.exe  (File Size: 956KB - Downloads: 504)
   

Avatar
Matse, Sr. Member
Posted: 08 February 2012 06:29 PM   Total Posts: 149   [ # 4 ]

Hi again Huck,

Thanks for the explanation, that’s exactly what I needed : I was still wondering about the “nature” of Haxe basically smile

I still have tons of question about it but I’ll kick my butt and go figure it out myself ^^

I have 7zip installed, I love it, the problem is when I click the link it doesn’t lead to a file download, and right-clicking “save target as” doesn’t work either, same for the .rar file : maybe that’s just me ? I have a fairly regular system though : XP SP3 and Firefox 10 with AdBlock plugin.

Werid that the only file I’m able to download amongst those 3 is the self extracting one but thank you very much for putting it up man wink

 

   

3dNewb, Sr. Member
Posted: 29 April 2012 03:15 PM   Total Posts: 105   [ # 5 ]

I understand that when you wrtie Haxe, the resulting AS3 code is faster then when you write it with Flash Builder.

Is existing AS3 code also faster when compiled using Haxe? I mean: Does Away3D run faster because you compile the .swc with Haxe?

 

   

Colin Cohen, Newbie
Posted: 29 April 2012 06:26 PM   Total Posts: 7   [ # 6 ]

You can’t compile as3 code directly with Haxe. You have to compile the .swc file using something like Flashdevelop, and then you use the resulting library.swf file with Haxe.

 

   

3dNewb, Sr. Member
Posted: 29 April 2012 07:03 PM   Total Posts: 105   [ # 7 ]
Colin Cohen - 29 April 2012 06:26 PM

You can’t compile as3 code directly with Haxe. You have to compile the .swc file using something like Flashdevelop, and then you use the resulting library.swf file with Haxe.

Yes, I know. But would it make it run faster?

 

   

Avatar
Huck, Jr. Member
Posted: 29 April 2012 07:56 PM   Total Posts: 45   [ # 8 ]

Hi,

as far as i know exising as3 code, NOT compiled with haxe would run just the same in flash, even if called in haxe code. It is only the haxe compiler that will generate faster as3 code than what the flex compiler would.

so in short there is no speed gain to call as3 compiled code (a swf) in haxe except for convinience.

if you develop a game in haxe using away3d 4, away3d will run at the same speed as it would if you built your game in as3. BUT, your game logics themsleves will be faster if built with haxe.

i use 100% haxe now for my game (except for swf libraries such as away3d 4) and up to now it has been a charm, im very happy with haxe and my game is pretty elaborate.

 

   

JuanitaThompson, Newbie
Posted: 13 May 2012 09:46 AM   Total Posts: 2   [ # 9 ]
Huck - 08 February 2012 05:58 PM

HI Matse,


haxe is really just a programing language and is designed to be a “common denominator” between many languages, allowing it to transform its sources from haxe “abstract language” to different targets such as as3, c++, javascript, etc. The nice thing for as3 developers is that the haxe syntax is very similar to as3, making reading code form one to the other very easy and straightforward.


for the as3tohaxe tool, i wanted to post a .zip but the upload limit on this forum is 1024kb, and the zip is larger than this. The only compression that allows me to beat this limit is .7z and .rar formats. I recommend you install the opensource 7zip application which will allow you to extract these archives. Here is a rar archive which also beats the size limit.

regards,

Yep, the .7z file type is smaller and faster than the .RAR format.

Downloaded and saved it :)

Thanks

 

   

Vagasvau, Newbie
Posted: 23 August 2012 01:51 PM   Total Posts: 2   [ # 10 ]

hey Huck,

What i’m wondering Away3D is using Stage3D. It is not possible to compile a 3D game to another platform like Windows (exe) for example or is it?

 

   

Avatar
Huck, Jr. Member
Posted: 23 August 2012 02:05 PM   Total Posts: 45   [ # 11 ]

Hi,

Stage3D is only for flash / AIR. Using haxe allows you to reuse your game logics on many pltforms, but the actual opengl bindings (3D engine for example) will change for each platform.

for example, i have quite elaborate game code and 3D mesh handling routines in haxe. On flash i have away3D specific code, and on webgl i have three.js specific code. on c++, you might use another 3D engine with its own bindings.

note that haxe NME is trying to offer a multipleform game engine that is the same code for all. It looks pretty cool but sadly doesnt support opengl yet, until someone wants to volunteer and add it, that would be very cool.

makes sense?

regards

 

   

Vagasvau, Newbie
Posted: 23 August 2012 02:35 PM   Total Posts: 2   [ # 12 ]

So building 3D content in Haxe using multi platform isn’t gone work very well? Because your Haxe code will party/completely exists of specific 3D code for every platform. like that?

 

   

Avatar
Huck, Jr. Member
Posted: 23 August 2012 02:40 PM   Total Posts: 45   [ # 13 ]

well it depends how you look at it. On various platforms, you wil have platform specific code for the bindings with the 3D engine yes. But you can still reuse all the rest.

for example i had my game logics (thats quite a bit of code) for away3d and decided to make a webgl version. well all i had to do was create new bindings for three.js, but all the rest of the game logics worked just out of the box.

the way i see it with haxe is you just cant go wrong, because if you choose as3, the you are stuck with flash/air no matter what. with haxe, you get the same features on flash/air, but if you decide to create other versions for html5, ios, android, windows, etc, well then you are much better off.

regards

 

   

aeki, Member
Posted: 16 March 2013 07:00 AM   Total Posts: 73   [ # 14 ]

Very interresting post !!!

Would you have a link demonstrating the use of away3d 4 linked with webGL?

Could you tell us about your experience using webgl compared to pure as3 stage3d flash platform?

 

   

AFCAS, Newbie
Posted: 09 April 2013 08:05 AM   Total Posts: 3   [ # 15 ]

note that haxe NME is trying to offer a multipleform game engine that is the same code for all. It looks pretty cool but sadly doesnt support opengl yet,

_________________
Runescape Gold|cheap runescape gold|Diablo 3 Gold

 

 

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X