After several false starts, I have finally settled on using the expression parser / compiler to do the data binding. Ultimately, this seemed to make the most sense. Copying data from one arbitrary place to another is basically what a script is supposed to do, plus it gives some additional flexibility.
Quite often it seems that the best approach to solving problems is to ask, "how do I want to interact with this system" rather than, "how do I want to implement it?" Basically, I decided I wanted to specify data binding something like this:
ScriptComponentThat basically lets me map specific components to variable names in the script environment, and then operate on them. Since this all gets compiled at load time, and the above example only generates a tiny number of nodes in the parse tree (say, 4 or 5), this should execute insanely fast and be very flexible.
{
Context
{
src = BezierFunctionComponent
dst = SpawnComponent
}
Script = dst.Rate = src.Value(t)
}
Unfortunately, the variable system I had in place was somewhat limited. So, I'm about half way through getting a proper symbol table system implemented. This basically lets me memory-map a component into the script system, with the added benefit of putting structure definitions and stack frames (local variables) into the scripting system in general.
Still a ways to go, but making progress.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.