Sign in to follow this  
AcidZombie24

script for flash & C ++

Recommended Posts

I want to program a small game but i want it to work in flash and in C. So if i want to port it from desktop to web or web to desktop the majority of code i wont need to change. Is there a script language that works with both? If i can use c classes with inheritances in the desktop version of the script that would be great. [Edited by - AcidZombie24 on November 10, 2008 3:27:34 AM]

Share this post


Link to post
Share on other sites
Well, I don't do a lot of Flash stuff, but to my understanding, there's so little in common between the way games are written in Flash with ActionScript and the way games are usually written in C that it seems like achieving any kind of script commonality would be more trouble than it's worth.

Maybe I'm misinterpreting your question? It seems to me that if you want your game to run both on the web and on the desktop, you could just distribute a downloadable copy of your Flash game, without having to rewrite anything. You can also package Flash files as self-running executables if that's what you'd prefer.

Share this post


Link to post
Share on other sites
Quote:
Original post by AcidZombie24Is there a script language that works with both?


You seem to be slightly confused here. Flash is a standalone application that will run Actionscript, but C is a just language and as such can't 'run' anything itself. You could write a program in C to load actionscript files and display the contents somehow, but then you'd just be re-writing Flash which would be pointless and extrememly difficult.

If all you want is a game that runs on the web and on the desktop just do as MrAccident says and compile for both targets from the Flash environment. You set it in the Publish options. Create .swf (for web) and Create .exe (for standalone).

Share this post


Link to post
Share on other sites
ActionScript is (IIRC) just ECMAScript, same as javascript. You could use an existing javascript interpreter in your c project, allowing you to share some game logic code between the two. If you really wanted to...

Share this post


Link to post
Share on other sites
Quote:
Original post by AcidZombie24
bump

i actually just want to reuse the same code in C and AC projects.


OK... well you can't use C or C++ in Flash, and you can't use Actionscript in C or C++ without some kind of interpreter. As I said above, you may be able to use an existing javascript interpreter (there are several open source ones). However, the API provided to Actionscript inside Flash won't be available to your interpretted code in the C/C++ app, and any C/C++ libs you use won't be available in Flash.

So you may be able to share some bits of code as long as they are self contained and don't make any API calls. My guess was that any such code would probably be in your game logic.

At the end of the day though, it's unlikely you'll save any time by doing this, especially if you've not got any experience in hooking a scripting language into a C/C++ app.

Maybe explain in more detail what you think is possible and what you want to do?

Share this post


Link to post
Share on other sites
actually i heard there is a c++ compiler from AC3 http://www.google.ca/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&hs=tBO&q=actionscript+3+C%2B%2B+quake&btnG=Search&meta=

Maybe i'll just continue with C++ and see if i can compile the game logic part when it is out (when will it be out?)

Share this post


Link to post
Share on other sites
Ah yes, sorry I'd read about that some time ago and forgotten [smile]. Shame it sounds like it's not publicly released, it's a very interesting idea. I can't remember if the video presentation showed anything about how the interaction between the languages takes place or not.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this