Jump to content

  • Log In with Google      Sign In   
  • Create Account


- - - - -

Saving byte code


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
13 replies to this topic

#1 doneval   Members   -  Reputation: 122

Like
Likes
Like

Posted 09 March 2004 - 08:41 PM

Hello all, It''s possible to save all byte code generated in a file and then execute it directly? thanks, ricard (great to hace an angelscript forum !!!) Tor Nec Donavam!

Sponsor:

#2 e c h o   Members   -  Reputation: 122

Like
Likes
Like

Posted 09 March 2004 - 10:19 PM

Work is in progress on this feature.
Right now, no you cannot save the bytecode and execute it directly.

admit nothing, deny everything and make counter accusations.

#3 doneval   Members   -  Reputation: 122

Like
Likes
Like

Posted 10 March 2004 - 12:40 AM

And is possible to contribute to the project with code ?

I'm thinking to add some features myself. Is the author accepting contributions?



[edited by - doneval on March 10, 2004 7:41:23 AM]

#4 Andreas Jonsson   Moderators   -  Reputation: 3227

Like
Likes
Like

Posted 10 March 2004 - 01:43 AM

Yes, I accept and welcome contributions. The contributions pass my avaliation of course. Contributions that follow my goals are generally accepted. If the contribution is sufficiently good it might even change my goals with AngelScript

So far I've accepted two contributions, the port to DJGPP (which is what made AngelScript available for Linux developers), and support for the for-loop statement (sent by echo, in fact ).

If you're planning some new features it might be a good idea if you tell me about them first so that I can tell you what I would like, or perhaps if it is already in development, or something like that.

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

[edited by - WitchLord on March 10, 2004 8:46:15 AM]

#5 doneval   Members   -  Reputation: 122

Like
Likes
Like

Posted 10 March 2004 - 03:29 AM

Great!

Have you any "TODO.txt" avaliable where we can check in a glance what is in development and what is planned for the future ?

--

Tor Nec Donavam!

#6 Andreas Jonsson   Moderators   -  Reputation: 3227

Like
Likes
Like

Posted 10 March 2004 - 04:25 AM

There is one in the sdk. Perhaps I should make it available as a page on the AngelScript page?

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

#7 EddHead   Members   -  Reputation: 140

Like
Likes
Like

Posted 10 March 2004 - 07:56 AM

Hey!

Since when was the for loop available, Anyway......I dont think i was reading the documentation. i would like to know if anyone has made a small compiler which can be plugged to VC for error checking a script before the actual Host App actually begins to run.

Cheers

Jayanth.K
Raptor Entertainment Pvt. Ltd.
http://www.raptorentertainment.com

#8 EddHead   Members   -  Reputation: 140

Like
Likes
Like

Posted 10 March 2004 - 08:35 AM

Hi Andreas
I would like to know how you can map a function like in AngelScript ( to a string or variable like the registersystemfunction method) that can be used in a dynamic situation just like a scripting language. the application for this would be making some sort of a AS-to-DLL/AS-to-C++ converter once to lock/hard code the script code to get a speedy version (or simply get the C++ compiler to compile AS code). this would also require us to make sure most of our code will remain very very simlar to C++ code.

Regards

Jayanth.K
Raptor Entertainment Pvt. Ltd.
http://www.raptorentertainment.com

#9 Andreas Jonsson   Moderators   -  Reputation: 3227

Like
Likes
Like

Posted 10 March 2004 - 09:21 AM

The for-loop is available since 1.6.1 beta 1 (2004/02/27). You missed out on a lot of updates during the latest 1.6.1. Coollist failed to deliver e-mails and it took a while for people to migrate to the new freelists.org mailing list.

Jayanth, it is a small chance that anybody has written such a compiler, because the compiler needs to know about the system functions that you register in your application in order to appropriately verify if the script is without syntax errors. I suggest you yourself write this compiler. When registering the system functions use a null pointer, that way you don''t have to link with the entire application.

I''m not sure what you mean by mapping an AngelScript function to be used in a dynamic situation. Do you want to have some kind of function like GetProcAddress() to get a C++ function pointer to call the script function? I remember you asking for this before, and I still have it in mind but it is very far down on my to-do list. What you can do is write some proxy function for calling the script function, e.g:

float DoSomething(int a)
{
float retVal;
engine->CreateContext();
int id engine->GetFunctionIDByName("DoSomething");
context->PrepareContext(id);
context->SetArguments(0, &a, 1);
context->Execute();
context->GetReturnValue(&retVal, 1);
context->Release();
return retVal;
}


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

#10 EddHead   Members   -  Reputation: 140

Like
Likes
Like

Posted 10 March 2004 - 04:01 PM

Hi
What i wanted was a way to bypass Angelscript and create a C++ file for the script( get the compiler to compile ). one of the main reasons for me using angelscript right now is the ability to call functions dynamically ( eg: strChacaterFrameMove = "char1framemovefunc" )

Now i want to be able to do a similar thing once i have finished work with a similar script. (to make it hard coded to increase performance until i decide to change it later) we could make a AS to C++. my question was to know how i could store a functions address instead of the way i use strings and functionIDs from angelscript.

i''ll check out some info on GetProcAddress() and get back. i still have''nt implemented 1.6.1 cos i have''nt found time.

Thanks

Jayanth.K
Raptor Entertainment Pvt. Ltd.
http://www.raptorentertainment.com

#11 Andreas Jonsson   Moderators   -  Reputation: 3227

Like
Likes
Like

Posted 11 March 2004 - 12:19 AM

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

#12 EddHead   Members   -  Reputation: 140

Like
Likes
Like

Posted 11 March 2004 - 06:12 AM

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

#13 Andreas Jonsson   Moderators   -  Reputation: 3227

Like
Likes
Like

Posted 11 March 2004 - 06:30 AM

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

#14 EddHead   Members   -  Reputation: 140

Like
Likes
Like

Posted 11 March 2004 - 09:19 AM

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




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS