Sign in to follow this  
_orm_

Feature suggestion - On function called callback for asIScriptContext

Recommended Posts

_orm_    112
i am currently implementing network synchronization for my game engine and have already been able to figure out how to label class functions ans global functions as synchronized (meaning, when the server calls a function, the client should call it as well). however, i know for a fact i will have to figure out wheb a scripted function is called. so i can check it against the table of synchronized functions. so i will, in my build, be implementing a callback interface for the asIScriptContext, and would like to run it by youall if it is a good thing to add to the core. or perhaps there is a better way to detect when a particular function is called?

Share this post


Link to post
Share on other sites
WitchLord    4678
Have you seen the [url="http://www.angelcode.com/angelscript/sdk/docs/manual/classas_i_script_context.html#e2747f643bf9a07364f922c460ef57dd"]asIScriptContext::LineCallback[/url] method?

I don't quite see the usefulness of having a specific callback for when functions are called, but I could potentially adjust the LineCallback routine to have a flag that tells the VM to only invoke it when a function is called rather than for each line of code.

How will this synchronization work? I mean, will the client and server have the same script? If that is the case wouldn't be easier just to synchronize the execution of the scripts, rather than trying to synchronize each function call within the scripts?

Share this post


Link to post
Share on other sites
_orm_    112
I see it as a convenience and efficiency thing. Synchronzed functions are called first on the server, then the fact it was called is broadcasted to the clients, which could have different implementations of the same function (courtesy of the preprocessing directives the builder provides). Being able to tell the engine to broadcast this function call in compiled code automatically rather than writing a message buffer in script and broadcasting that could be potentially faster.

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