Flash and Away3D C++ Rewrite

Software: Other

Jesse Nicholson, Newbie
Posted: 15 March 2012 08:53 PM   Total Posts: 3

I’m in the process of re-writing the entire flash platform in C++ and Java, combined with a compiler front end that will intake normal AS3 and convert it to pure C++ so that we can code in AS3 and compile down to a true, fully native application using the platform we know and love.

My first project after this is to use this compiler front end to automate a conversion of Away3D to run on these C++ and Java implementations. The reason I’m posting here is to see if there are any fellow C++ developers who would be interested in contributing (yes it will be open source of course). I know it sounds like a big task but believe me when I say I’ve already done the vast majority of the difficult work.

Display list code is essentially complete, dynamic object types (classes that use the AS3 keyword dynamic) is done and supported, all classes including variable definitions and function declarations are done so basically it’s a matter of filling in the code needed inside the functions, which is not a difficult task (Except when it comes to TLFText implementation). We know how it’s supposed to work because we can see it in action in AVM2 and from the documentation, so it’s a matter of typing it out in C++. (This progress report is for the C++ version not the java version. Don’t really need help with the Java port. The Java port can basically be automated).

So, if anyone is interested in contributing and you feel you really have the skills to make good design and coding decisions during implementation, please let me know. Again, I realize this is slightly off topic but I think that the promise of sporting away3D running fully native on top of this at debut should make up for it. smile

   

Avatar
Alexander Seifert, Moderator
Posted: 26 March 2012 08:04 AM   Total Posts: 129   [ # 1 ]

Hey Jesse,

kudos for making such a bold move taking on the entire Flash platform wink
As I originally was a C++ developer before being forced to become a Flash code monkey wink I find this effort most interesting and inspiring.

Here’s a question: how are you going to re-create the Stage3D API in C++?

From what I understand is that you’re writing an AS3 to C++ compiler. The resulting binaries are native C++ and do not rely on any Adobe VM, is that correct?

Cheers!
Alex

 Signature 
signature_image

http://www.deltastrike.org

   

Jesse Nicholson, Newbie
Posted: 26 March 2012 09:48 AM   Total Posts: 3   [ # 2 ]

Hey Alex,

You’re right that the final result is a binary compiled down from pure C++ and will not rely on the flash virtual machine at all. It is a full, native replacement for the flash platform (AVM2).

As far as the compiler that’s not technically correct. I’m actually writing a portion of a compiler, just enough components to analyze the input AS3 and translate it into C++. A simple example of this would be.. say the import statements in a .as file. If they want to import flash.display.DisplayObject then this front end will understand this and convert it into an appropriate #include statement for the native C++ version of a DisplayObject (header). From here this same program would then perhaps generate makefiles for the targeted output and invoke the build system for the target. For example, after generating the native equivalent code, it would generate .mk files and invoke the Android NDK.

As far as your question about the Stage3D I have yet to sit down and work out the specifics of this particular class. In the flash VM this class is actually platform specific and will use DirectX on windows and GL/GLES on others. I plan on going pure GL/GLES but as I said I have yet to hash out the details and implement it. So far my focus has been on the standard stage/display list.

I appreciate the interest by the way. I was starting to get discouraged, so many people were looking and no one commenting. I believe this is something most flash developers are going to have to see in order to grasp the implications. To put it into perspective for people I guess the best comparison to make is against the upcoming version 2 of the Alchemy Toolchain. Adobe is gunning for performance up to 70% native C efficiency and this would put that to shame by a constant gain of more than 30% over even their peak performance. Anyway thanks again for your interest I’m hoping to get some code up on github in the very near future and I’ll keep you posted!

   

Avatar
Alexander Seifert, Moderator
Posted: 26 March 2012 05:04 PM   Total Posts: 129   [ # 3 ]

Jesse,

cool thing! Makes my fingers itch for more keyboard action wink

So, trying to boil down what you say, you’re writing a bunch of regexes taking in AS3 code and printing C++ to a file. Cool =) That should be a really simple and sweet piece of code. Where I see clouds on the horizon, though, is said Stage3D and the way Flash communicates with the hard-ware.

The beauty of Stage3D is that you have a single API to program against to be completely platform independent, which is the right way to go. Trying to recreate this functionality in pure C++ will lead you to re-engineering all of Stage3D’s internals, even when targeting GL/GLES only. Could be done in timely fashion, but what about the way Context3Ds are created and handled and more importantly, translating AGAL to CG? This will definitely take on quite different dimensions than a rather simple translation of AS3 code to C++. Do you already have ideas on that? =)

What I can definitely say right away is that C++ compiled AS3 code could be extremely useful when using Alchemy. Develop in ActionScript, easy debugging (esp. when using FDT! wink), than translate/compile to C++ and use via Alchemy. Nice! =) I’d use it right away =)

Looking forward for more! =)
Cheers!
Alex

 Signature 
signature_image

http://www.deltastrike.org

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X