OpenSim.Region.ScriptEngine.DotNetEngine

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(DotNetEngine)
 
(20 intermediate revisions by 8 users not shown)
Line 1: Line 1:
 +
__NOTOC__
 +
{{Quicklinks}}
 +
<br />
 +
 
== DotNetEngine ==
 
== DotNetEngine ==
 +
 +
'''Note: DotNetEngine was removed entirely after OpenSimulator 0.6.8.  These notes are kept for historical purposes.'''
  
 
Namespace: OpenSim.Region.ScriptEngine.DotNetEngine
 
Namespace: OpenSim.Region.ScriptEngine.DotNetEngine
  
 
DotNetEngine is a ScriptEngine that executes LSL scripts contained within objects.<br />
 
DotNetEngine is a ScriptEngine that executes LSL scripts contained within objects.<br />
Developed by Tedd Hansen, development blog: [http://teddmaa.blogspot.com] <br />
+
[http://teddmaa.blogspot.com Core development blog] <br />
 +
 
 +
To look at the LSL command implementation status, go to [[LSL Status]].
  
 
----
 
----
===How it works===
+
=== How it works ===
1. Create instance of ScriptEngine(scene).<br />
+
* Create instance of ScriptEngine(scene).<br />
2. ScriptEngine will create instances of:<br />
+
* ScriptEngine will create instances of:<br />
 
  EventManager
 
  EventManager
 
  EventQueueManager
 
  EventQueueManager
 
  ScriptManager
 
  ScriptManager
3. EventManager will hook up all necessary events (all possible script events, script rez, script derez, etc).<br />
+
AppDomainManager
4. When events are received, they are processed inside EventManager.<br />
+
LSLLongCmdHandler
 +
* EventManager will hook up all necessary events. (all possible script events, script rez, script derez, etc)<br />
 +
* When events are received, they are processed inside EventManager.<br />
 
  For example:
 
  For example:
 
  Event for loading a script will be processed and EventManager will tell ScriptManager to load the script.
 
  Event for loading a script will be processed and EventManager will tell ScriptManager to load the script.
  Event such as touch_start is received in EventManager and translated to LSL-compatible request before being sent to EventQueueManager.
+
  Event such as touch_start is received in EventManager then sent to EventQueueManager that will tell SCriptManager to execute the
 +
touch_start function in the script.
 
Note! If event is for a particular object, EventQueueManager will queue event for all scripts inside that object.<br />
 
Note! If event is for a particular object, EventQueueManager will queue event for all scripts inside that object.<br />
5. If script is LSL (LSO ByteCode [http://libsecondlife.org/wiki/LSO]) then OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL is used to translate the bytecode from LSO to .Net Assembly.<br />
+
* If it is a script rez then OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL will compile the script to .Net Assembly.<br />
6. On script load, give script a private copy of XXX that it will use to access server. These are commonly know as ll-functions.<br />
+
* This assembly is loaded into an AppDomain created by AppDomainManager.<br />
6. EventQueueManager has a separate thread running to process its event queue. Events are actually functions inside the script .dll that is called "<state>_event_<event_name>" for example "0_event_touch_start". State is read from a global variable in the script .dll.<br />
+
* EventQueueManager has a separate thread running to process its event queue. Events are actually functions inside the script .dll that is called "<state>_event_<event_name>" for example "default_event_touch_start". State is read from a global variable in the script .dll.<br />
 +
* Some commands require more time before returning, processing these is done in LSLLongCmdHandler.<br />
 +
* Every script receives a private instance of LSL_BuiltIn_Commands. This is their only way of manipulating anything outside themselves.<br />
 +
 
 +
----
 +
 
 +
=== Places to extend script support ===
 +
* LSL_BuiltIn_Commands.cs
 +
These are the functions script can use to manipulate the scene. Commonly known as ll-functions. They are LSL functions such as llSay, llWhisper, etc. [[LSL Status]] contains up to date status on what functions have been implemented. Anyone who wants to contribute can implement a command and put a patch on the [http://www.opensimulator.org/mantis bug tracker}.
 +
* EventManager.cs
 +
This is where events are coming from server and being queued for scripts. All 16 or so LSL events needs to be implemented here.
 +
 
 +
This image is a bit (not much) outdated, but gives you an idea of the path script events/functions go through.<br />
 +
[[Image:ScriptEngineLayout2.png]]
 +
 
 +
[[Category:Modules]]

Latest revision as of 09:45, 1 October 2021


[edit] DotNetEngine

Note: DotNetEngine was removed entirely after OpenSimulator 0.6.8. These notes are kept for historical purposes.

Namespace: OpenSim.Region.ScriptEngine.DotNetEngine

DotNetEngine is a ScriptEngine that executes LSL scripts contained within objects.
Core development blog

To look at the LSL command implementation status, go to LSL Status.


[edit] How it works

  • Create instance of ScriptEngine(scene).
  • ScriptEngine will create instances of:
EventManager
EventQueueManager
ScriptManager
AppDomainManager
LSLLongCmdHandler
  • EventManager will hook up all necessary events. (all possible script events, script rez, script derez, etc)
  • When events are received, they are processed inside EventManager.
For example:
Event for loading a script will be processed and EventManager will tell ScriptManager to load the script.
Event such as touch_start is received in EventManager then sent to EventQueueManager that will tell SCriptManager to execute the
touch_start function in the script.

Note! If event is for a particular object, EventQueueManager will queue event for all scripts inside that object.

  • If it is a script rez then OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL will compile the script to .Net Assembly.
  • This assembly is loaded into an AppDomain created by AppDomainManager.
  • EventQueueManager has a separate thread running to process its event queue. Events are actually functions inside the script .dll that is called "<state>_event_<event_name>" for example "default_event_touch_start". State is read from a global variable in the script .dll.
  • Some commands require more time before returning, processing these is done in LSLLongCmdHandler.
  • Every script receives a private instance of LSL_BuiltIn_Commands. This is their only way of manipulating anything outside themselves.

[edit] Places to extend script support

  • LSL_BuiltIn_Commands.cs

These are the functions script can use to manipulate the scene. Commonly known as ll-functions. They are LSL functions such as llSay, llWhisper, etc. LSL Status contains up to date status on what functions have been implemented. Anyone who wants to contribute can implement a command and put a patch on the [http://www.opensimulator.org/mantis bug tracker}.

  • EventManager.cs

This is where events are coming from server and being queued for scripts. All 16 or so LSL events needs to be implemented here.

This image is a bit (not much) outdated, but gives you an idea of the path script events/functions go through.
ScriptEngineLayout2.png

Personal tools
General
About This Wiki