PDA

View Full Version : server-side Compiled C++ to Flash? possible?


dialectric
12-02-2008, 07:13 PM
Hi,

I am trying to sort out how best to go about a project which is a word game. It requires as an input an array of all of the words that can be made from a sequence of 2-8 letters (anagrams). There are several examples in C, and a few in python, that generate this output, and I would like to know if its possible to compile C code in some way to have it run on a server, receive a string of 2-8 letters, and either produce the array of possible words as an xml, or somehow send said array directly to an SWF (AS2 or 3).

Alternatively, could this be run locally and use external interface calls?

This ideally would support multiple dictionary files, starting with SOWPODS.
One example of such a utility, with source, is Ken Silverman's FindWords, from http://advsys.net/ken/utils.htm

I am currently attempting to code the word finder in flash, but expect that it will be much slower than a c++ tree-based version - and I don't really understand tree search yet.

- dialectric

yell0wdart
12-02-2008, 09:09 PM
Was it compiled in Visual Studio? If so, you should be able to use ASP.NET and C# or VB to write a basic facade in the code behind of your aspx page or a basic web service to reference your compiled C++ assemblies.

dialectric
12-03-2008, 06:37 PM
Hi Yellowdart,

Thanks for the suggestions. Its actually an uncompiled *.c source file - which I assume means its not C++ after all. In another thread someone suggested trying to use the relatively new adobe alchemy to incorporate the C code into a flash project, which, since actionscript is the only language I'm proficient in, might be somewhat easier to attempt than getting into .NET or VB as well. Not much discussion of alchemy yet on these boards, but I'm hoping not to mess with the C code much, and just take the output for AS3.

- dialectric

CyanBlue
12-03-2008, 06:51 PM
FYI, you do need to mess with the C++ code when using in Alchemy... It won't be major, but you at least need to make some changes... That's what I have seen in Max at least...

dialectric
12-04-2008, 02:57 PM
One question about how to structure this adobe Alchemy project: in checking a set of user letters, or words, against a dictionary, (in this case the sowpods.txt file which is widely available, contains 260,000 words, and is 2.6 mb uncompressed), would it be best, speedwise, to include the dictionary as a string in the AS code, as a string in the C code, as some other datatype, or as an imported file?

- dialectric

CyanBlue
12-04-2008, 03:43 PM
Well... Alchemy is all new to me as well so I might not be giving you right information... ;)

A simplified version of Alchemy is that you create SWF/SWC out of your C/C++ codes and execute a function defined in it from the ActionScript...
So, technically it does not matter where your data file is located... But I'd use external text file rather than hard coding that into your code base... and probably separate them into smaller chunks like sowpods_a.txt, sowpods_b.txt, ... , sowpods_z.txt so that the files are lighter to handle...