script for flash & C ++

Started by
8 comments, last by mrbastard 15 years, 5 months ago
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]
<SkilletAudio> Your framerate proves your lack of manhood
Advertisement
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.
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).

---When I'm in command, every mission's a suicide mission!
ActionScript is (IIRC) just ECMAScript, same as &#106avascript. You could use an existing &#106avascript interpreter in your c project, allowing you to share some game logic code between the two. If you really wanted to...
[size="1"]
bump

i actually just want to reuse the same code in C and AC projects.
<SkilletAudio> Your framerate proves your lack of manhood
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 &#106avascript 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?
[size="1"]
Hmm I'm now wondering if your question is actually "can I work in a common subset of C/C++/ActionScript as they are superficially similar in syntax".
[size="1"]
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?)
<SkilletAudio> Your framerate proves your lack of manhood
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.
[size="1"]
They just released it [smile]

Alchemy
[size="1"]

This topic is closed to new replies.

Advertisement