I tend to make with one master JS and one EC_Script for the whole
application. I like normal programming, and also that used to be way to
make it efficiently (minimal mem use as there's only one ScriptEngine).
Have that in an invisible entity called MyGame or so.
The system is however made so that using a Script component in each
scripted entity can be nice. For example for a non-programming level
designer to put a script to an object. And nowadays there's the
ScriptApplication system, which basically allows you to make several
script components to be executed with a single engine, so you get the
same optimally minimal memory usage. I think it's well suited for
instanciating several entities that use the same script, basically
declaring a class in JS and then marking entities in the scene as
instances of that. Similar to the RexScript IronPython system in old
realXtend with Linden based viewer and Opensim which is there in ModRex.
One cool upside of using several EC_Scripts can perhaps be that the live
reloading may work less instrusively as only one script engine is
reseted and not the whole app. For example if you make AI for a predator
and it's prey, can modify either code, just save the file so it gets
reloaded in Tundra, and at least the other animal keeps working cleanly
from the old state as it was untouched. It's possible to make a main app
support restart too, quite easy perhaps even if keep the data in EC
attributes (script's can create their own so-called DynamicComponents
for custom data). The attribute values are ofc untouched when the script
engine is reseted, so that state can always stay (position of the
objects etc., but if you put e.g. some AI mode or tracking target in own
DynamicComponent, that stays too.)
> Vik.
~Toni
Another option is to use the app name and app class in EC_Script, this way you can have the component in all of the doors but they share the same script engine. With this tech "me" in the script refers to the entity that has the actual scriptRef set. But every instance will get a conatructor call that passes the real "me" entity. This might sound complicated but it's really not, check out scenes/Avatar script files. At least simpleavatar.js uses this tech.
Best Regards,
Jonne Nauha
Adminotech developer
> --
> http://groups.google.com/group/realxtend
> http://www.realxtend.org
No the point was that using the Script *Application* mechanism with
multiple EC_Scripts is performant -- then you again only get a single
engine. The same thing that Jonne mentioned and indeed the reference
Avatar app uses.
But yep I think a single EC_Script can still be nice.
> And I don't think in this case live reloading will be useful...
I think it's always useful when developing :)
And you do get that with a single Script component too, it just resets
the whole app then.
> Vik.
~Toni
Adding 10x10 fish is ok by two method. But adding 20x20 fish with
Fish.js (many instance of javascript) will fail with error "Could not
allocate register file N" where N is different 2, 33.
I would like to know what this mean?
I have also question about how to know when scene is ready for
manipulation. I used some sort of tentative every 1 sec... It is
correct or i can use more clean approach?
About parameter --run and AddRigidBody. This is due to the fact that I
have exported scene from some works in a blender. This export do not
add RigidBody, so I decided to add it for some element at startup in
JavaScript. Another reason - this script will change the scene on the
server, and thus, the client should not know about this JS. If I added
it to the scene, as you say, I have to give it to the client as well.
About --storage options - I use it, and I have a question about this.
When I start Tundra server in the remote real server machine, I run
the client with option --storage src=http://someserver.com/webdav. In
this case, I need to replace all assets references 'local://somefile'
with simple 'somefile', if not, this 'somefile' refuse to the auto-
download from server ... I have other solutions for the local://
thing?
But I want to put some validation for UserConnection (check username
and password). I did this already in Python (as well using command
line option --python filename.py). But in the latest version, Python
has been temporarily removed, and I thought about validating users in
the same JS script through qt.webkit as Tony pointed me in another
thread.