ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

How to bundle a game's source file and its interpreter into a single EXE

<< < (4/7) > >>

Eóin:
Ah ok, well you're right then when you say it sounds challenging, but you needn't lose heart either. Off hand I wouldn't have a solution for you, as I mentioned I don't use C# and/or .NET myself properly. But I do know it is possible.

I would suggest working away at steps (1) and (2) because they are the real challenge. You'll need your interpreter to not be fussy about where it gets the binary source data from. So it should be able to read it from a file, and also quite happily accept being given a raw pointer to the data already in memory. With prototypes of the interpreter existing as a single exe as well as a prototype binary source file which is self-contained also as one file then the final step of putting them together shouldn't prove too difficult.

Someone here may be ale to help you with step (3). I'm intrigued enough by it myself that I might hack away if I've the time (which honestly isn't too likely :( ). But if not here I can pretty much guarantee you'll get an answer at say programmingforums.org or codeproject.com. The key though will be going to those people with basic working prototypes of part (1) and (2) so that they can narrow in on the best solution for your problem.

I'm slightly wary about mentioning this because I thought the poor OP got a hard doing but at the same time more knowledge is rarely a bad thing. You might like to read this thread where someone with similar (I use that word VERY lightly, in truth the OP was being wildly naive and unrealistic whereas I do not think you are being so) goals was frustrated by not getting an answer for the equivalent of your step (3) when he didn't have a prototype therefore making it very difficult for people to help. Don't dwell on the negative bits of the thread but take heart that there are very knowledgible and helpful people out there if you can just meet them halfway :)

On a final note, I suspect that if you write the interpreter in a native language like C++ it might make the step (3) much easier. But if doing so would make step (2) much more difficult for you then don't switch, stick with what you know.

hollowlife1987:
If you want I can write a program that will take an interpreter program and a compiled script file.
Then execute the script using the interpreter and give you the source code.

mouser:
You'll need your interpreter to not be fussy about where it gets the binary source data from. So it should be able to read it from a file, and also quite happily accept being given a raw pointer to the data already in memory.
--- End quote ---

yep, that's a good place to start.

kyrathaba:
Thank you all for the input, it's much appreciated.

Obviously, I'm only doing this project in my spare time, as a learning exercise (an exercise made more interesting/fun because I like text-adventures).  I have no aspirations to one-up mature authoring tools like Inform 7 or TADS 3.  However, I am going to incorporate such elements in my game language that -- to me -- are easier to use.

HollowLife, thank you for your offer.  It's much appreciated.  If I understand you correctly, you're staying that if I can come up with a working interpreter EXE, I can supply that, plus a binary game file produced by my game compiler, and you can give me source code that would incorporate those two files into an EXE.  What language would you supply this in?  I am only familiar with C# and (to a lesser extent) Visual Basic.  However, I do have a couple of different C/C++ compilers.

Eoin, thank you for the link, and the advice.

You'll need your interpreter to not be fussy about where it gets the binary source data from. So it should be able to read it from a file, and also quite happily accept being given a raw pointer to the data already in memory.

--- End quote ---

I was planning on using .NET's object serialization capabilities, so that my compiler would read in the source file, syntax check it, and if it doesn't fail any syntax checks it would incorporate the data read in from file into game objects (rooms, items, actors, etc.).  The resultant compiled game file would be a master game object (containing all other objects), serialized to disk.

Then, the interpreter would deserialize the file and cast it to the master game object, then proceed to use that master game object's properties and methods to produce the interactive game that the end-user experiences.

kyrathaba:
I've discovered that .NET 2.0 contains a compiler class that permits runtime compilation of sourcecode.  So it's possible to have a C# program that can itself produce a physical executable.  This opens up more possibilities.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version