Saving byte code

Started by
12 comments, last by doneval 20 years, 1 month ago
OK I think I understand what you want.

You want to use AngelScript to develop the system, and then when everything is working ok, you want to transparently exchange the scripts for a C++ DLL, or perhaps a statically linked library.

Well, what you would need is to hide AngelScript from the main application in a wrapper class. This wrapper class will do all the compilation of script code, and supply function pointers for the main application to call. When you decide to switch to C++ code you continue to use the same interface, but instead of compiling scripts it loads a DLL and take the function pointers from that one instead.

Example:

class IDynamicCode{public:  virtual int Initialize() = 0;  virtual int Uninitialize() = 0;  virtual void *GetProcAddress(const char *name) = 0;}; 


In the Initialize() function you create an AngelScript engine, load the scripts, and compile them. In GetProcAddress() you map the name to a function that calls the script function like in the example I showed earlier.

When you switch to DLL, the Initialize() function would load the DLL instead, and GetProcAddress() would call the global GetProcAddress() for the DLL.


www.AngelCode.com - game development and more...
AngelScript - free scripting library

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement
Thanks a lot,

I''ll try it out once i get to work on these things. I would also like to know which is the best available method for file packaging. I want to package ".X" files along with their textures into packed composite files so that other people dont get to mess around with them ( say encryption with TEA maybe ).

Regards

Jayanth.K
Raptor Entertainment Pvt. Ltd.
http://www.raptorentertainment.com
Jayanth.KRaptor Entertainment Pvt. Ltd.http://www.raptorentertainment.com---------------------------------------------------------Why Mr. Anderson? Why? ...Why keep fighting? Do you think you're fighting for something - for more than your survival? Can you tell me what it is? Do you even know? Is it freedom, or truth, perhaps peace, could it be for love? Illusions Mr. Anderson, vagaries of perception. Temporary constructs of a feeble human intellect trying desperately to justify an existence without meaning or purpose.
File packages are kind of off-topic in this thread, don''t you think? The question is fine in my forum, but try to keep each thread on topic. Please start another thread with your question, that way you will get much more answers.

What I''m thinking about doing is to use a simple zip file, and then encrypt it, but I haven''t started with that yet so I may change my mind before I come that far in my game.

www.AngelCode.com - game development and more...
AngelScript - free scripting library

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Oops.

I had gotten used to the mailing system i used to follow with you earlier. It certain ly is off topic, but i thought we could bring up some info out about your TEA implementation.

Regards

Jayanth.K
Raptor Entertainment Pvt. Ltd.
http://www.raptorentertainment.com
Jayanth.KRaptor Entertainment Pvt. Ltd.http://www.raptorentertainment.com---------------------------------------------------------Why Mr. Anderson? Why? ...Why keep fighting? Do you think you're fighting for something - for more than your survival? Can you tell me what it is? Do you even know? Is it freedom, or truth, perhaps peace, could it be for love? Illusions Mr. Anderson, vagaries of perception. Temporary constructs of a feeble human intellect trying desperately to justify an existence without meaning or purpose.

This topic is closed to new replies.

Advertisement