SlideShare une entreprise Scribd logo
1  sur  36
Possible New OpenSim Based Approaches
About Triality and Intech
 Triality – open-source development
community
 http://www.itriality.ru
 Intech ltd.
 http://3d-virtual.ru
Some ideas to start…
Two points of view
 Developer
 Scripter
Developer
Client
Server
SL/OpenSim
protocol
Virtual
Environment
Scripter
Script
Client
Missing link
 Server/Client developer
 Server (core services/scene code/OMV protocol…)
 Client
 Server extensions developer
 Region modules, services…
 <missing>
 Scripter
Developer
Scripter
The subject of presentation is an attempt to discuss an ability to
create a missing link.
Virtual application
 Scripter set of tools could be extended
 Region modules
 OSSL API
 Various .Net languages (Xengine)
 ModInvoke
 …
 …when do we need to stop?
Dynamic virtual environment - a three-dimensional multi-user environment
where the minimum program unit – module of such environment is an object
of this environment.
Virtual application - a program unit of virtual environment, fully independent
from client-server realization and network protocol application, which
have a full access to programming language standard library, an ability
to use dependencies (assemblies) and full access to all client and server
methods.
 Analogy: a default application in modern OS.
Requirements for VA
 Modular client (client-side plugins)
 Possibility to use full .Net language in scripts
(classes, events, etc.)
 Possibility to use precompiled assemblies
 Reuse as much code as possible (client – server –
libOMV)
What was done…
LSL Classics
default
{
state_entry()
{
llSay(0, "Script running”);
}
touch_start(integer count)
{
llSay(0,"Touched.");
}
}
 State machine – based
 No classes
 At some point of complexity – pure “spaghetti” code
Basic C#
//c#o
namespace SecondLife
{
public class Script :
OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass
{
public Script():base(){}
public void default_event_state_entry()
{
llSay(0,"Hello,Avatar!");
}
public void default_event_touch_start(LSL_Integer count)
{
llSay(0,"Touched.");
}
}
}
C# classes
//c#o
namespace SecondLife
{
class Test
{
OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass main_script;
int i;
public Test(OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass ms){i=0; main_script=ms;}
public void Add(){i=i+1;main_script.llSay(0,"I changed!");}
public int Get() {return i;}
};
public class Script : OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass
{
Test t;
public Script():base(){}
public void default_event_state_entry()
{
llSay(0,"Hello,Avatar!");
t=new Test(this);
}
public void default_event_touch_start(LSL_Integer count)
{
t.Add();
llSay(0,"Touched."+t.Get());
}
}
}
Code editor problem
 Viewer code editor is bad for C#
 Syntax highlighting, autocomplete, etc.
 Xamarin studio integration
 How it works
○ We have project template and necessary .dll’s on client side
○ Client creates temporary project and open it by Xamarin
“Wrapper” classes
namespace SecondLife
{
public class Script : OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass
{
public Script():base(){}
CSHost host;
public override void InitGlobals()
{
host=getHost();
}
public void default_event_state_entry()
{
llSay(0,"Hello,Avatar!");
}
public void default_event_touch_start(LSL_Integer count)
{
host.Color=new LSL_Vector(1,0,0);
llSay(0,"Touched.");
}
}
}
• A set of “build-in” classes – “standard library” (with LSL/OSSL/LS)
•Not serializable, so we need InitGlobals()
New asset types
 “Generic file”
 Useful for generic file exchange. Default inventory function –
download.
 Assembly
 Precompiled script. Starts in prim inventory.
 Could be used as reference in default script or another assembly (not finished)
Mono plugins and all
Shared media controllers
<html>
<head>
<title></title>
<script type="text/javascript">
window.onload = init;
function init()
{
if(window.slviewer)
{
alert(“Viewer found");
}
}
function TestButton()
{
if(window.slviewer)
window.slviewer.BackMessage("UP");
}
function TestButton1()
{
if(window.slviewer)
window.slviewer.BackMessage("DOWN");
}
</script>
</head>
</body>
<form method="post">
<input name="UP" type="button" value="UP"
onclick="TestButton()"></form>
<input name="DOWN" type="button" value="DOWN"
onclick="TestButton1()"></form>
</html>
namespace SecondLife
{
public class Script :
OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass
{
public Script():base(){}
public void default_event_state_entry()
{
//from notecard “control”
string url=triServeHTML("/controller/","control");
LSL_List list=new LSL_List();
list.Add(PRIM_MEDIA_CURRENT_URL);
list.Add(url);
list.Add(PRIM_MEDIA_HOME_URL);
list.Add(url);
llSetPrimMediaParams(4,list);
}
public void default_event_media_message(LSL_String msg)
{
if(msg=="UP")
llSetPos(llGetPos()+new LSL_Vector(0,0,1));
if(msg=="DOWN")
llSetPos(llGetPos()-new LSL_Vector(0,0,1));
}
}
}
Embedding Mono
 Minimal runtime
 ~10 mb
 One main “entry point” assembly
 Main assembly defines the interface for
plugins

 Reusing libOMV
public interface ITrialityPlugin
{
void RegisterPlugin();
string GetName();
void RunPlugin();
}
Main plugin problems
 Message system
 Handle in and out SL-protocol messages
 Possibility to send message
 User interface
 Get and set the values of UI controls
 Handle messages from UI
 Add new controls
 Client internals
Message system
 Works like libOMV GridProxy
public void RegisterPlugin()
{
Triality.AddDelegate (PacketType.ChatFromSimulator, TestChatDelegate); //subscribe to in packet
Triality.AddOutDelegate (PacketType.ChatFromViewer, TestOutChatDelegate); //subscribe to out packet
}
public bool TestOutChatDelegate(Packet p)
{
ChatFromViewerPacket cp = (ChatFromViewerPacket)p;
string chatstr = System.Text.Encoding.UTF8.GetString (cp.ChatData.Message);
Triality.debug_output("______CHAT OUT PACKET:"+chatstr);
return true; //packet passed to server
}
public bool TestChatDelegate(Packet p)
{
ChatFromSimulatorPacket cp = (ChatFromSimulatorPacket)p;
string chatstr = System.Text.Encoding.UTF8.GetString (cp.ChatData.Message);
Triality.debug_output("______CHAT PACKET:"+chatstr);
return true; //packet passed to viewer
}
Packet injector
ChatFromViewerPacket inj_test = new ChatFromViewerPacket (); //from libOMV
inj_test.AgentData.AgentID = Triality.clientID;
inj_test.AgentData.SessionID = Triality.sessionID;
inj_test.ChatData.Channel = 0;
inj_test.ChatData.Message = System.Text.Encoding.UTF8.GetBytes ("HELLO FROM MONO");
inj_test.ChatData.Type = 2;
byte[] bpack = inj_test.ToBytes ();
Triality.internal_inject_mono_message (bpack);
Viewer controls
 Identified by GUID in XUI
 Plugin code:
<button
follows="top|left"
label="Button"
layout="topleft"
left_delta="0"
name="test_button"
tool_tip="button"
top="80"
mono_control_id="c69fea6b-b2c1-44d6-a9ba-f5859c960366"
width="100" />
TrialityPlugin.Triality.OnControl += OnControlTest; //in RegisterPlugin()
….
public void OnControlTest(string name,string id,string val)
{
string test_value =TrialityPlugin.Triality.internal_get_control_value ("856c0368-50ad-428d-939e-737d72b4fa56");
TrialityPlugin.Triality.debug_output ("_____TEST GET" + test_value);
OSDReal sd = new OSDReal (1.0);
string cval = OSDParser.SerializeLLSDXmlString (sd); //from libOMV
TrialityPlugin.Triality.debug_output ("_____TEST SET" + cval);
TrialityPlugin.Triality.internal_set_control_value ("856c0368-50ad-428d-939e-737d72b4fa56", cval);
Adding a new floater
namespace FloaterAndControlsMono
{
public class FloaterAndControls:ITrialityPlugin
{
Floater mTestFloater;
….
public void RegisterPlugin()
{
mTestFloater = new Floater ("test_mono_fltoater_controls", "floater_test_register_mono.xml");
Triality.internal_register_command_handler ("Mono.TestSetValue");
….
public void OnCommand(string command,string data)
{
switch (command)
{
case "Mono.TestSetValue“:
….
public void RunPlugin()
{
mTestFloater.Show ();
}
Client internals
 Mostly singletons
 Could be bound to Mono via static
wrappers
 Example:
public class SelectManager
{
/// <summary>
/// Gets selected object UUID
/// </summary>
/// <returns>The selected UUID.</returns>
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public static extern string getSelectedID();
Road to virtual application
What we have
 Client plugins
 Server assemblies
 Not a virtual application (different
projects)
Generic client/server calls
public class Script : OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass
{
CSClient test;
public Script():base(){}
public override void InitGlobals()
{
test=getAllClients(); //could be by UUID
}
public void default_event_touch_start(LSL_Integer count)
{
test.SendChat("TEST STRING"); //client method call
llSay(0,"Touched.");
}
Direct client/server calls
 Client:
 Server:
foreach (KeyValuePair<UUID,string> kv in Triality.mRegisteredSceneScripts)
{
Triality.debug_output (“Registered server script:" + kv.Value); //kv.Value – script registration name
Triality.SendDirectMessageToScript (kv.Key, "TEST DIRECT MESSAGE");
}
public override void InitGlobals()
{
osRegisterCSScript ("MessageTest"); //random UUID; could be predefined
}
public void default_event_message_from_client_plugin (LSL_Key client, LSL_String msg)
{
llSay(0,"Message from client plugin:"+msg);
}
Future
 Xamarin/Visual Studio plugin
 UI designer and code generation
 Project types: client plugin, server assembly,
full VA
 Testing environment
 Use attributes for remote calls code
generation
 On both (client and server sides)
 Virtual application.
Putting it’s all together…
Problems
 Security
 Precompiled assemblies on client and server
 Performance
 Mono calls and marchalling
 Hypergrid
Conclusions
 Modular client
 Full-scale server scripting language
 “Standard library” for client and server
 Xamarin/VS as a developer environment
 In the future – virtual application
 Possibility to distribute client plugins and
server assemblies on commercial base
And brief history
English language for
aviation
 2009, Aeroflot – Russian airlines
 Agent based English language training
for cabin crew
 Main features
 Using of bots (agents) for role-play games and demonstration of typical
situations
 XML scenarios of bots behavior, and visual designer for them
 An ability to take control of every bot (by teacher)
 Integration with Moodle, Airbus LMS, and internal ERP services
 Text-to-Speech (voices for bots)
 …..
 Could be realized by standard tools (LSL/server modules), but really
difficult.
QUESTIONS?
wchf@yandex.ru
http://www.itriality.ru

Contenu connexe

Tendances

Use Eclipse technologies to build a modern embedded IDE
Use Eclipse technologies to build a modern embedded IDEUse Eclipse technologies to build a modern embedded IDE
Use Eclipse technologies to build a modern embedded IDEBenjamin Cabé
 
03 - Qt UI Development
03 - Qt UI Development03 - Qt UI Development
03 - Qt UI DevelopmentAndreas Jakl
 
201410 2 fiware-orion-contextbroker
201410 2 fiware-orion-contextbroker201410 2 fiware-orion-contextbroker
201410 2 fiware-orion-contextbrokerFIWARE
 
WPF and Prism 4.1 Workshop at BASTA Austria
WPF and Prism 4.1 Workshop at BASTA AustriaWPF and Prism 4.1 Workshop at BASTA Austria
WPF and Prism 4.1 Workshop at BASTA AustriaRainer Stropek
 
Scala for Test Automation
Scala for Test AutomationScala for Test Automation
Scala for Test Automationrthanavarapu
 
Dependency Injection Smells
Dependency Injection SmellsDependency Injection Smells
Dependency Injection SmellsMatthias Noback
 
Android development with Scala and SBT
Android development with Scala and SBTAndroid development with Scala and SBT
Android development with Scala and SBTAnton Yalyshev
 
Java script Techniques Part I
Java script Techniques Part IJava script Techniques Part I
Java script Techniques Part ILuis Atencio
 
Reactive Model-View-ViewModel Architecture
Reactive Model-View-ViewModel ArchitectureReactive Model-View-ViewModel Architecture
Reactive Model-View-ViewModel ArchitectureGyuwon Yi
 
ADG Poznań - Kotlin for Android developers
ADG Poznań - Kotlin for Android developersADG Poznań - Kotlin for Android developers
ADG Poznań - Kotlin for Android developersBartosz Kosarzycki
 
From C++ to Objective-C
From C++ to Objective-CFrom C++ to Objective-C
From C++ to Objective-Ccorehard_by
 
Interpreter implementation of advice weaving
Interpreter implementation of advice weavingInterpreter implementation of advice weaving
Interpreter implementation of advice weavinginaseer
 
OrientDB - The 2nd generation of (multi-model) NoSQL
OrientDB - The 2nd generation of  (multi-model) NoSQLOrientDB - The 2nd generation of  (multi-model) NoSQL
OrientDB - The 2nd generation of (multi-model) NoSQLRoberto Franchini
 
Patterns for JVM languages - Geecon 2014
Patterns for JVM languages - Geecon 2014Patterns for JVM languages - Geecon 2014
Patterns for JVM languages - Geecon 2014Jaroslaw Palka
 

Tendances (20)

Use Eclipse technologies to build a modern embedded IDE
Use Eclipse technologies to build a modern embedded IDEUse Eclipse technologies to build a modern embedded IDE
Use Eclipse technologies to build a modern embedded IDE
 
03 - Qt UI Development
03 - Qt UI Development03 - Qt UI Development
03 - Qt UI Development
 
201410 2 fiware-orion-contextbroker
201410 2 fiware-orion-contextbroker201410 2 fiware-orion-contextbroker
201410 2 fiware-orion-contextbroker
 
WPF and Prism 4.1 Workshop at BASTA Austria
WPF and Prism 4.1 Workshop at BASTA AustriaWPF and Prism 4.1 Workshop at BASTA Austria
WPF and Prism 4.1 Workshop at BASTA Austria
 
WEB TECHNOLOGIES JavaScript
WEB TECHNOLOGIES JavaScriptWEB TECHNOLOGIES JavaScript
WEB TECHNOLOGIES JavaScript
 
Java script -23jan2015
Java script -23jan2015Java script -23jan2015
Java script -23jan2015
 
Scala for Test Automation
Scala for Test AutomationScala for Test Automation
Scala for Test Automation
 
WinRT Holy COw
WinRT Holy COwWinRT Holy COw
WinRT Holy COw
 
Dependency Injection Smells
Dependency Injection SmellsDependency Injection Smells
Dependency Injection Smells
 
Android development with Scala and SBT
Android development with Scala and SBTAndroid development with Scala and SBT
Android development with Scala and SBT
 
Java script Techniques Part I
Java script Techniques Part IJava script Techniques Part I
Java script Techniques Part I
 
Reactive Model-View-ViewModel Architecture
Reactive Model-View-ViewModel ArchitectureReactive Model-View-ViewModel Architecture
Reactive Model-View-ViewModel Architecture
 
ADG Poznań - Kotlin for Android developers
ADG Poznań - Kotlin for Android developersADG Poznań - Kotlin for Android developers
ADG Poznań - Kotlin for Android developers
 
From C++ to Objective-C
From C++ to Objective-CFrom C++ to Objective-C
From C++ to Objective-C
 
Interpreter implementation of advice weaving
Interpreter implementation of advice weavingInterpreter implementation of advice weaving
Interpreter implementation of advice weaving
 
Javascript Best Practices
Javascript Best PracticesJavascript Best Practices
Javascript Best Practices
 
OrientDB - The 2nd generation of (multi-model) NoSQL
OrientDB - The 2nd generation of  (multi-model) NoSQLOrientDB - The 2nd generation of  (multi-model) NoSQL
OrientDB - The 2nd generation of (multi-model) NoSQL
 
Android - Api & Debugging in Android
Android - Api & Debugging in AndroidAndroid - Api & Debugging in Android
Android - Api & Debugging in Android
 
OpenCL 3.0 Reference Guide
OpenCL 3.0 Reference GuideOpenCL 3.0 Reference Guide
OpenCL 3.0 Reference Guide
 
Patterns for JVM languages - Geecon 2014
Patterns for JVM languages - Geecon 2014Patterns for JVM languages - Geecon 2014
Patterns for JVM languages - Geecon 2014
 

Similaire à New OpenSim-Based Approach for Dynamic Virtual Environments

Native client
Native clientNative client
Native clientzyc901016
 
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web ToolkitJava Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web ToolkitIMC Institute
 
OpenERP Technical Memento
OpenERP Technical MementoOpenERP Technical Memento
OpenERP Technical MementoOdoo
 
Open erp technical_memento_v0.6.3_a4
Open erp technical_memento_v0.6.3_a4Open erp technical_memento_v0.6.3_a4
Open erp technical_memento_v0.6.3_a4openerpwiki
 
2008 - TechDays PT: Building Software + Services with Volta
2008 - TechDays PT: Building Software + Services with Volta2008 - TechDays PT: Building Software + Services with Volta
2008 - TechDays PT: Building Software + Services with VoltaDaniel Fisher
 
Cross Platform App Development with C++
Cross Platform App Development with C++Cross Platform App Development with C++
Cross Platform App Development with C++Joan Puig Sanz
 
Do you know what your drupal is doing? Observe it!
Do you know what your drupal is doing? Observe it!Do you know what your drupal is doing? Observe it!
Do you know what your drupal is doing? Observe it!Luca Lusso
 
Automated User Tests with Apache Flex
Automated User Tests with Apache FlexAutomated User Tests with Apache Flex
Automated User Tests with Apache FlexGert Poppe
 
Implementing Messaging Patterns in JavaScript using the OpenAjax Hub
Implementing Messaging Patterns in JavaScript using the OpenAjax HubImplementing Messaging Patterns in JavaScript using the OpenAjax Hub
Implementing Messaging Patterns in JavaScript using the OpenAjax HubKevin Hakanson
 
Thug: a new low-interaction honeyclient
Thug: a new low-interaction honeyclientThug: a new low-interaction honeyclient
Thug: a new low-interaction honeyclientAngelo Dell'Aera
 
Reverse engineering - Shellcodes techniques
Reverse engineering - Shellcodes techniquesReverse engineering - Shellcodes techniques
Reverse engineering - Shellcodes techniquesEran Goldstein
 
Logisland "Event Mining at scale"
Logisland "Event Mining at scale"Logisland "Event Mining at scale"
Logisland "Event Mining at scale"Thomas Bailet
 

Similaire à New OpenSim-Based Approach for Dynamic Virtual Environments (20)

Native client
Native clientNative client
Native client
 
OneTeam Media Server
OneTeam Media ServerOneTeam Media Server
OneTeam Media Server
 
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web ToolkitJava Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
 
OpenERP Technical Memento
OpenERP Technical MementoOpenERP Technical Memento
OpenERP Technical Memento
 
Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web Toolkit
 
Open erp technical_memento_v0.6.3_a4
Open erp technical_memento_v0.6.3_a4Open erp technical_memento_v0.6.3_a4
Open erp technical_memento_v0.6.3_a4
 
NodeJS for Beginner
NodeJS for BeginnerNodeJS for Beginner
NodeJS for Beginner
 
2008 - TechDays PT: Building Software + Services with Volta
2008 - TechDays PT: Building Software + Services with Volta2008 - TechDays PT: Building Software + Services with Volta
2008 - TechDays PT: Building Software + Services with Volta
 
Java script
Java scriptJava script
Java script
 
Cross Platform App Development with C++
Cross Platform App Development with C++Cross Platform App Development with C++
Cross Platform App Development with C++
 
Oopp Lab Work
Oopp Lab WorkOopp Lab Work
Oopp Lab Work
 
Do you know what your drupal is doing? Observe it!
Do you know what your drupal is doing? Observe it!Do you know what your drupal is doing? Observe it!
Do you know what your drupal is doing? Observe it!
 
Nodejs
NodejsNodejs
Nodejs
 
Automated User Tests with Apache Flex
Automated User Tests with Apache FlexAutomated User Tests with Apache Flex
Automated User Tests with Apache Flex
 
Implementing Messaging Patterns in JavaScript using the OpenAjax Hub
Implementing Messaging Patterns in JavaScript using the OpenAjax HubImplementing Messaging Patterns in JavaScript using the OpenAjax Hub
Implementing Messaging Patterns in JavaScript using the OpenAjax Hub
 
Thug: a new low-interaction honeyclient
Thug: a new low-interaction honeyclientThug: a new low-interaction honeyclient
Thug: a new low-interaction honeyclient
 
My Saminar On Php
My Saminar On PhpMy Saminar On Php
My Saminar On Php
 
Reverse engineering - Shellcodes techniques
Reverse engineering - Shellcodes techniquesReverse engineering - Shellcodes techniques
Reverse engineering - Shellcodes techniques
 
Html5
Html5Html5
Html5
 
Logisland "Event Mining at scale"
Logisland "Event Mining at scale"Logisland "Event Mining at scale"
Logisland "Event Mining at scale"
 

New OpenSim-Based Approach for Dynamic Virtual Environments

  • 1. Possible New OpenSim Based Approaches
  • 2. About Triality and Intech  Triality – open-source development community  http://www.itriality.ru  Intech ltd.  http://3d-virtual.ru
  • 3. Some ideas to start…
  • 4. Two points of view  Developer  Scripter
  • 7. Missing link  Server/Client developer  Server (core services/scene code/OMV protocol…)  Client  Server extensions developer  Region modules, services…  <missing>  Scripter Developer Scripter The subject of presentation is an attempt to discuss an ability to create a missing link.
  • 8. Virtual application  Scripter set of tools could be extended  Region modules  OSSL API  Various .Net languages (Xengine)  ModInvoke  …  …when do we need to stop? Dynamic virtual environment - a three-dimensional multi-user environment where the minimum program unit – module of such environment is an object of this environment. Virtual application - a program unit of virtual environment, fully independent from client-server realization and network protocol application, which have a full access to programming language standard library, an ability to use dependencies (assemblies) and full access to all client and server methods.  Analogy: a default application in modern OS.
  • 9. Requirements for VA  Modular client (client-side plugins)  Possibility to use full .Net language in scripts (classes, events, etc.)  Possibility to use precompiled assemblies  Reuse as much code as possible (client – server – libOMV)
  • 11. LSL Classics default { state_entry() { llSay(0, "Script running”); } touch_start(integer count) { llSay(0,"Touched."); } }  State machine – based  No classes  At some point of complexity – pure “spaghetti” code
  • 12. Basic C# //c#o namespace SecondLife { public class Script : OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass { public Script():base(){} public void default_event_state_entry() { llSay(0,"Hello,Avatar!"); } public void default_event_touch_start(LSL_Integer count) { llSay(0,"Touched."); } } }
  • 13. C# classes //c#o namespace SecondLife { class Test { OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass main_script; int i; public Test(OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass ms){i=0; main_script=ms;} public void Add(){i=i+1;main_script.llSay(0,"I changed!");} public int Get() {return i;} }; public class Script : OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass { Test t; public Script():base(){} public void default_event_state_entry() { llSay(0,"Hello,Avatar!"); t=new Test(this); } public void default_event_touch_start(LSL_Integer count) { t.Add(); llSay(0,"Touched."+t.Get()); } } }
  • 14. Code editor problem  Viewer code editor is bad for C#  Syntax highlighting, autocomplete, etc.  Xamarin studio integration  How it works ○ We have project template and necessary .dll’s on client side ○ Client creates temporary project and open it by Xamarin
  • 15. “Wrapper” classes namespace SecondLife { public class Script : OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass { public Script():base(){} CSHost host; public override void InitGlobals() { host=getHost(); } public void default_event_state_entry() { llSay(0,"Hello,Avatar!"); } public void default_event_touch_start(LSL_Integer count) { host.Color=new LSL_Vector(1,0,0); llSay(0,"Touched."); } } } • A set of “build-in” classes – “standard library” (with LSL/OSSL/LS) •Not serializable, so we need InitGlobals()
  • 16. New asset types  “Generic file”  Useful for generic file exchange. Default inventory function – download.  Assembly  Precompiled script. Starts in prim inventory.  Could be used as reference in default script or another assembly (not finished)
  • 18. Shared media controllers <html> <head> <title></title> <script type="text/javascript"> window.onload = init; function init() { if(window.slviewer) { alert(“Viewer found"); } } function TestButton() { if(window.slviewer) window.slviewer.BackMessage("UP"); } function TestButton1() { if(window.slviewer) window.slviewer.BackMessage("DOWN"); } </script> </head> </body> <form method="post"> <input name="UP" type="button" value="UP" onclick="TestButton()"></form> <input name="DOWN" type="button" value="DOWN" onclick="TestButton1()"></form> </html> namespace SecondLife { public class Script : OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass { public Script():base(){} public void default_event_state_entry() { //from notecard “control” string url=triServeHTML("/controller/","control"); LSL_List list=new LSL_List(); list.Add(PRIM_MEDIA_CURRENT_URL); list.Add(url); list.Add(PRIM_MEDIA_HOME_URL); list.Add(url); llSetPrimMediaParams(4,list); } public void default_event_media_message(LSL_String msg) { if(msg=="UP") llSetPos(llGetPos()+new LSL_Vector(0,0,1)); if(msg=="DOWN") llSetPos(llGetPos()-new LSL_Vector(0,0,1)); } } }
  • 19. Embedding Mono  Minimal runtime  ~10 mb  One main “entry point” assembly  Main assembly defines the interface for plugins   Reusing libOMV public interface ITrialityPlugin { void RegisterPlugin(); string GetName(); void RunPlugin(); }
  • 20. Main plugin problems  Message system  Handle in and out SL-protocol messages  Possibility to send message  User interface  Get and set the values of UI controls  Handle messages from UI  Add new controls  Client internals
  • 21. Message system  Works like libOMV GridProxy public void RegisterPlugin() { Triality.AddDelegate (PacketType.ChatFromSimulator, TestChatDelegate); //subscribe to in packet Triality.AddOutDelegate (PacketType.ChatFromViewer, TestOutChatDelegate); //subscribe to out packet } public bool TestOutChatDelegate(Packet p) { ChatFromViewerPacket cp = (ChatFromViewerPacket)p; string chatstr = System.Text.Encoding.UTF8.GetString (cp.ChatData.Message); Triality.debug_output("______CHAT OUT PACKET:"+chatstr); return true; //packet passed to server } public bool TestChatDelegate(Packet p) { ChatFromSimulatorPacket cp = (ChatFromSimulatorPacket)p; string chatstr = System.Text.Encoding.UTF8.GetString (cp.ChatData.Message); Triality.debug_output("______CHAT PACKET:"+chatstr); return true; //packet passed to viewer }
  • 22. Packet injector ChatFromViewerPacket inj_test = new ChatFromViewerPacket (); //from libOMV inj_test.AgentData.AgentID = Triality.clientID; inj_test.AgentData.SessionID = Triality.sessionID; inj_test.ChatData.Channel = 0; inj_test.ChatData.Message = System.Text.Encoding.UTF8.GetBytes ("HELLO FROM MONO"); inj_test.ChatData.Type = 2; byte[] bpack = inj_test.ToBytes (); Triality.internal_inject_mono_message (bpack);
  • 23. Viewer controls  Identified by GUID in XUI  Plugin code: <button follows="top|left" label="Button" layout="topleft" left_delta="0" name="test_button" tool_tip="button" top="80" mono_control_id="c69fea6b-b2c1-44d6-a9ba-f5859c960366" width="100" /> TrialityPlugin.Triality.OnControl += OnControlTest; //in RegisterPlugin() …. public void OnControlTest(string name,string id,string val) { string test_value =TrialityPlugin.Triality.internal_get_control_value ("856c0368-50ad-428d-939e-737d72b4fa56"); TrialityPlugin.Triality.debug_output ("_____TEST GET" + test_value); OSDReal sd = new OSDReal (1.0); string cval = OSDParser.SerializeLLSDXmlString (sd); //from libOMV TrialityPlugin.Triality.debug_output ("_____TEST SET" + cval); TrialityPlugin.Triality.internal_set_control_value ("856c0368-50ad-428d-939e-737d72b4fa56", cval);
  • 24. Adding a new floater namespace FloaterAndControlsMono { public class FloaterAndControls:ITrialityPlugin { Floater mTestFloater; …. public void RegisterPlugin() { mTestFloater = new Floater ("test_mono_fltoater_controls", "floater_test_register_mono.xml"); Triality.internal_register_command_handler ("Mono.TestSetValue"); …. public void OnCommand(string command,string data) { switch (command) { case "Mono.TestSetValue“: …. public void RunPlugin() { mTestFloater.Show (); }
  • 25. Client internals  Mostly singletons  Could be bound to Mono via static wrappers  Example: public class SelectManager { /// <summary> /// Gets selected object UUID /// </summary> /// <returns>The selected UUID.</returns> [MethodImplAttribute(MethodImplOptions.InternalCall)] public static extern string getSelectedID();
  • 26. Road to virtual application
  • 27. What we have  Client plugins  Server assemblies  Not a virtual application (different projects)
  • 28. Generic client/server calls public class Script : OpenSim.Region.ScriptEngine.Shared.ScriptBase.ScriptBaseClass { CSClient test; public Script():base(){} public override void InitGlobals() { test=getAllClients(); //could be by UUID } public void default_event_touch_start(LSL_Integer count) { test.SendChat("TEST STRING"); //client method call llSay(0,"Touched."); }
  • 29. Direct client/server calls  Client:  Server: foreach (KeyValuePair<UUID,string> kv in Triality.mRegisteredSceneScripts) { Triality.debug_output (“Registered server script:" + kv.Value); //kv.Value – script registration name Triality.SendDirectMessageToScript (kv.Key, "TEST DIRECT MESSAGE"); } public override void InitGlobals() { osRegisterCSScript ("MessageTest"); //random UUID; could be predefined } public void default_event_message_from_client_plugin (LSL_Key client, LSL_String msg) { llSay(0,"Message from client plugin:"+msg); }
  • 30. Future  Xamarin/Visual Studio plugin  UI designer and code generation  Project types: client plugin, server assembly, full VA  Testing environment  Use attributes for remote calls code generation  On both (client and server sides)  Virtual application.
  • 31. Putting it’s all together…
  • 32. Problems  Security  Precompiled assemblies on client and server  Performance  Mono calls and marchalling  Hypergrid
  • 33. Conclusions  Modular client  Full-scale server scripting language  “Standard library” for client and server  Xamarin/VS as a developer environment  In the future – virtual application  Possibility to distribute client plugins and server assemblies on commercial base
  • 35. English language for aviation  2009, Aeroflot – Russian airlines  Agent based English language training for cabin crew  Main features  Using of bots (agents) for role-play games and demonstration of typical situations  XML scenarios of bots behavior, and visual designer for them  An ability to take control of every bot (by teacher)  Integration with Moodle, Airbus LMS, and internal ERP services  Text-to-Speech (voices for bots)  …..  Could be realized by standard tools (LSL/server modules), but really difficult.