SlideShare a Scribd company logo
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

More Related Content

DOCX
Laporan multi client
PDF
INTRODUCTION TO CLIENT SIDE PROGRAMMING
ODP
Android Nâng cao-Bài 9-Debug in Android Application Development
PDF
Integration Testing With ScalaTest and MongoDB
PDF
Building an app with Google's new suites
PDF
Daggerate your code - Write your own annotation processor
PPT
JavaScript
PDF
JavaScript 101
Laporan multi client
INTRODUCTION TO CLIENT SIDE PROGRAMMING
Android Nâng cao-Bài 9-Debug in Android Application Development
Integration Testing With ScalaTest and MongoDB
Building an app with Google's new suites
Daggerate your code - Write your own annotation processor
JavaScript
JavaScript 101

What's hot (20)

PPTX
Use Eclipse technologies to build a modern embedded IDE
PDF
03 - Qt UI Development
PPTX
201410 2 fiware-orion-contextbroker
PPTX
WPF and Prism 4.1 Workshop at BASTA Austria
PPT
Java script -23jan2015
PPTX
Scala for Test Automation
PPTX
WinRT Holy COw
PDF
Dependency Injection Smells
PPTX
Android development with Scala and SBT
PPTX
Java script Techniques Part I
PPTX
Reactive Model-View-ViewModel Architecture
PDF
ADG Poznań - Kotlin for Android developers
PPTX
From C++ to Objective-C
PDF
Interpreter implementation of advice weaving
PDF
Javascript Best Practices
PDF
OrientDB - The 2nd generation of (multi-model) NoSQL
PPT
Android - Api & Debugging in Android
PDF
OpenCL 3.0 Reference Guide
PDF
Patterns for JVM languages - Geecon 2014
Use Eclipse technologies to build a modern embedded IDE
03 - Qt UI Development
201410 2 fiware-orion-contextbroker
WPF and Prism 4.1 Workshop at BASTA Austria
Java script -23jan2015
Scala for Test Automation
WinRT Holy COw
Dependency Injection Smells
Android development with Scala and SBT
Java script Techniques Part I
Reactive Model-View-ViewModel Architecture
ADG Poznań - Kotlin for Android developers
From C++ to Objective-C
Interpreter implementation of advice weaving
Javascript Best Practices
OrientDB - The 2nd generation of (multi-model) NoSQL
Android - Api & Debugging in Android
OpenCL 3.0 Reference Guide
Patterns for JVM languages - Geecon 2014
Ad

Similar to Dynamic virtual evironments (6)

PDF
Maxbox starter18
PPTX
West Coast DevCon 2014: The Slate UI Framework (Part 2) - Game UI & Unreal Mo...
TXT
PDF
OSVR Client Application Design
PPT
Cross-Platform Mobile Development in Visual Studio
PDF
Unreal Engine Basics 05 - User Interface
Maxbox starter18
West Coast DevCon 2014: The Slate UI Framework (Part 2) - Game UI & Unreal Mo...
OSVR Client Application Design
Cross-Platform Mobile Development in Visual Studio
Unreal Engine Basics 05 - User Interface
Ad

Dynamic virtual evironments

  • 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.