Hey guys,
I'm working on a game title and I wish to use javascript for the cut-
scenes and the AI. I've been reading the documentation for the past 3
hours, and I'm still having trouble figuring out how I'm going to
incorporate Rhino.
I read that the scope each script is determined by the thread where
you obtained the Context in. So if I want to make two different
virtual environments (one for cut-scenes, one for AI), I have to do it
in different threads?? That doesn't really make sense for what I'm
doing. I wish that scopes were determined by some sort of object key
instead of threads.
Ideally, what I want to be able to do is something like this:
pre_game_load(){
Context cutSceneEnvironment = getNewContext();
Script sceneA = new Script( sourceCodeFileA, cutSceneEnvironment);
Script sceneB = new Script( sourceCodeFileB, cutSceneEnvironment);
Script sceneC = new Script( sourceCodeFileC, cutSceneEnvironment);
//now load the AI scripts
for(Entity e : entityTypes){
Context aiContext = getNewContext();
e.setAILogicScript(new Script( e.getScriptSource(),
aiContext));
}
}
then, whenever I wanted to run a cut-scene, I would just do
sceneA.execute(application_hooks);
or a round of AI logic inside the Entity,
logic.execute(application_hooks);
So I know how to get java to call javascript methods, and how to get
javascript methods to call java methods, but I'm unable to figure out
how I'm going to structure everything so that I don't use an insane
amount of RAM or have variables from one entity's AI overriding
variables from another one's.
Thanks,
Jason
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino