Sign in to follow this  
Dentoid

Reloading modified scripts

Recommended Posts

Dentoid    122
Hey As I guess lots of us do here, I use AngelScript for scripting behaviours of stuff in a game engine. This often involves a lot of tweaking of scripts, which normally means restarting the app to see stuff take effect. However, in my previous setup I made a system that could reload the scripts and dynamically rebind any script functions on the fly. This, however, was based on the fact that it was just functions. No scripts had any data of their own; everything was stored in an owning game entity. Now, with the advent of script classes, I've rewritten it so that a game entity has an instance of a script class with members, so that the behaviour script easily can store entity specific data in its own members. That makes it easier to write stateful scripts. However, this also botches my reloading code totally. So... Basically... Before I start writing some new reloading stuff for my new setup, I thought I'd ask here if anyone has any thoughts, ideas or experiences about this? Any tips on what way to go? I guess the real problem is that I have to reinstantiate all existing instances script class instances, copy member data from the old ones (where it matches up), and then notify all events that they've got a new script class instance. It's of course doable just like that, but I'm wondering if there's any shortcuts... If there's something in AS that can help me out on the way? I'm thankful for any info that could be useful. Thanks /Anders Stenberg

Share this post


Link to post
Share on other sites
WitchLord    4678
I think you'll have a lot of problems with incompatibilities between the script changes. I mean, if you have an instanced object with 3 attributes, and the new script version only declares 2, or 4. What will you do then?

Perhaps it is easier if you simply restart the level, and start the scripts from scratch?

Share this post


Link to post
Share on other sites
Deyja    920
What's this 'script class' you speak of? My immense ego forces me to suspect you are using my wrapper library, but WL could have added something into AngelScript without me noticing...

Share this post


Link to post
Share on other sites
WitchLord    4678
With script classes we mean classes declared in the scripts.

AngelScript:


class MyClass
{
MyClass() {} // default constructor
void DoSomething() {} // a method
int prop; // property
}


Don't tell me you didn't know AngelScript supports this already? [wink]

With the current version in the SVN, AngelScript also supports interfaces, which work much like C++'s abstract base classes, or Java's interfaces.

Regards,
Andreas

Share this post


Link to post
Share on other sites
Dentoid    122
Quote:
Original post by Deyja
What's this 'script class' you speak of? My immense ego forces me to suspect you are using my wrapper library, but WL could have added something into AngelScript without me noticing...


Hehe, no I'm not using your wrapper. As WL said, I meant a class defined in a script.

/Anders

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this