SlideShare a Scribd company logo
Synchronization GE
Bootcamp presentation
Rationale
● When creating a multi-user, real time Web application, two
things are commonly needed
○ The underlying data (or scene) model
○ The communication protocol for synchronizing the data
between participants
● Custom-building these for an application is often not cost-
effective; a generic solution can be preferable
Synchronization GE
● Contains a generic, lightweight scene data model
● Provides a real time two-way synchronization mechanism
between server and clients
○ Uses the WebSocket protocol for web clients
● Implementation based on realXtend open source virtual world
technology (www.realxtend.org) developed from 2007
onward
● Catalogue page: catalogue.fi-
ware.org/enablers/synchronization
Reference client and server
● Server and desktop client: the realXtend Tundra SDK
○ Core written in C++, JavaScript scripting
○ Relatively complex and heavyweight
○ github.com/realXtend/tundra
● Web client: Javascript
○ github.com/realXtend/WebTundra
○ Same codebase contains also the related 3D-UI
(WebTundra) GE
Web client demo
● N-player Pong game 130.206.81.111/pong/Pong.html
● Open multiple tabs/windows to join in more players
● Clients connect to a server, server sends scene changes (ball
+ bats moving) to all clients
Scene data model
● Based on Entities, Components and Attributes
● Using the Pong game example
○ The ball and bats are separate Entities
○ Entities contain components to separate functionality:
■ Mesh: visual representation
■ RigidBody: physics & collision
■ Placeable: positioning
○ Components contain attributes
■ For example Mesh has URL to the 3D model that
should be rendered, Placeable has position, rotation &
scale
● Application can define its own components
High-level view of the protocol
● When a new client connects, the server sends all entities to it
● After this, the following operations are automatically
synchronized both ways:
○ Create or remove an entity
○ Create or remove a component from an entity
○ Change an attribute value inside a component
■ This is commonly the bulk of network data
○ Send an RPC-like Entity Action
■ Has a string name and list of string parameters, can
be used for custom messaging, for example controls
handling in a virtual world
Protocol implementation
● Based on binary formatted messages for efficiency
● The protocol is described at
github.com/realXtend/tundra/wiki/Tundra-protocol
Running the server
● Typical command line to run Tundra without rendering, load a
specific scene file, and serve it to clients
./Tundra --headless --file <filename.txml> --server
● Optionally specify --port <portnumber> to select the port in
which to listen for clients (default 2345)
● On Unix machines without x11, use xvfb
xvfb-run ./Tundra --headless --file ...
Client code example
● Minimal JavaScript client code to connect to a server
var client = new Tundra.WebSocketClient();
var scene = new Tundra.Scene();
var syncManager = new Tundra.SyncManager(client, scene);
var loginData = {"username": "Test User"};
client.connect("localhost", 2345, loginData);
● Tundra.WebSocketClient manages the WebSocket connection to the server
● Tundra.Scene is the scene data model (initially empty)
● Tundra.SyncManager implements the synchronization protocol
● After successfully connecting, the SyncManager receives messages from the
WebSocketClient, and acts upon the Scene
○ As server sends the initial scene contents, and any changes, SyncManager mirrors
them to our local scene
● Note the default Tundra port 2345. This can be configured
Sending changes & scene signals
● SyncManager applies changes from server automatically as
WebSocket messages are received. To send client’s scene
changes to server requires an explicit call:
syncManager.sendChanges();
● Scene has change signals (using JS Signals library) which are
fired both for server- and client-side changes to the data:
scene.entityCreated
scene.entityRemoved
scene.componentAdded
scene.componentRemoved
scene.attributeChanged
scene.actionTriggered
...
Where to get + further resources
Links to guides & download links at: catalogue.fi-
ware.org/enablers/synchronization
Prebuilt server packages exist for Windows (32/64bit) &
Ubuntu Linux (32/64bit), can also build the server from
source (warning: may be involved)
github.com/realXtend/tundra
3D-UI WebTundra GE
Bootcamp presentation
realXtend
Background: realXtend history
● Open source networked virtual world and game platform
(2007-)
● Originally started by consortium of companies and later on
joined by the University of Oulu, Finland
● Governed by non-profit realXtend Association
Stakeholders
● International user and developer base from research and
commercial sides
● Deployed applications used by several companies and
organisations in production
realXtend
Tundra
● Virtual world platform / 3D application framework
○ Server + Client sharing the same native code (C++)
○ Qt as main framework, Ogre3D for rendering
○ Multi-platform: Windows, Mac, and Linux
● Built-in efficient and versatile networking
● Uses Entity-Component-Attribute scene model
○ Automatic networking for components
● App development: Javascript or C++ for plugin extensions
● Import 3D assets from Blender, 3DS Max etc.
RealXtend Tundra based virtual world hosting service
● Distributed cloud hosting and asset storage
● One of the biggest contributors to the Tundra open source repositories
● Free plan for anyone to get their own 3D virtual world in minutes
● Growing fast -> over 3100 hosted worlds -> over 155 000 logins
Adds end-user functionality that the Tundra SDK does not address
● Web interface to manage your virtual worlds, user access, application settings
etc.
● Fast and easy Facebook / Google authentication or direct Meshmoon auth
● Web hosted asset storage access, importing 3D models, build tools, additional
entity-components, avatar editor, in-world applications, etc.
Check it out at www.meshmoon.com
Case: Meshmoon
Games
Presentations, art, showrooms etc.
Data visualization
Building industry
Education
● Javascript library that uses three.js and Synchronization GE
to implement a Tundra client and WebGL rendering
● Asset loading, mapping three.js objects to Tundra EC:s,
handling networked changes to these in real time
● For a preview about what you can do with three.js, look in
http://threejs.org/examples/
WebTundra
● Building web-based multiuser networked 3D apps
○ Or: Easy to use networking for three.js WebGL apps
● Client for existing Tundra scenes and applications,
interoperating with the native desktop Tundra client
● Both cases benefit from Tundra’s existing production-tested
networking system and scriptable server implementation
Use cases
Entity-Component system
● Replication of objects and changes to their state are handled
by Entity-Component system
● EC systems are a common way to use composition instead of
inheritance to compose things in 3D engines and games
● In this case the EC system also supports network sync, so
creating and modifying entities and their components can be
replicated over the network to the server
● More closely covered in Synchronization GE presentation
Anatomy of a basic WebTundra app
● Start from an existing three.js WebGL application
● Replication of objects and changes to their state are handled
by the network-aware Entity-Component system
● For each network-aware three.js 3D geometry object, an
entity with Placeable and Mesh components is created.
● Mesh component loads the 3D asset off the web and creates
a corresponding three.js mesh in the scene
● Changing Placeable attributes like position, scale, rotation are
synced to other clients via the server (and changed in the
corresponding three.js object).
Setting up
● Need to have a server to connect to, can use FIWARE Lab or
own machine, we also have a server running you can use
right away
● Set up your local development environment and download
WebTundra, or develop client on a FIWARE Lab vm - we have
an installation recipe
Pong example
● We’ve made available a multiplayer Pong game and covered
the internals in some detail in our User’s and Programmer’s
guide at http://catalogue.fi-
ware.org/enablers/documentation-21
● Browse source code at:
https://github.com/playsign/PongThreeJS/tree/ec
● Uses JQuery for 2D menus, server-side Bullet physics - more
“bells and whistles” than strictly necessary but aiming to be
a complete
Pong example
● Script running on Tundra server
creates U-shaped areas for each
player and receives bat movement
events from clients, and simulates
ball movements, sending resulting
entity movements to clients
● WebTundra clients present
synchronized entity state from
server and send events to server
based on player actions
Development tips and workflow
● Familiarize with three.js first
● Use Chrome/Firefox developer tools
● Watch Tundra server console
● Run server locally in graphical mode to see GUI for inspecting
entity state, triggering actions interactively, etc.
● Get help on realxtend-dev mailing list & #realxtend-dev on
irc.freenode.net
Real Virtual Interaction GE
Bootcamp presentation
Rationale
Need for open specification
● Every manufacturer have their own systems and those are not
compatible with other manufacturers systems
→ Objective was to create open source based infrastructure to be
used with next generation IoT applications
Real Virtual Interaction GE
● Real virtual interaction GE provides
o Services to interact with real objects (sensors) in the world
o UI components and associated (remote) services.
● Provides RESTful and WebSocket API’s for data requests
● Main GE components:
o Real virtual interaction server
o Reference RvI client
● (RvI is one of the key components for future IoT systems)
Possible use cases to utilize GE
● Monitor and control
o District heating system
o Bus locations
o Room temperatures
Key features
● Collect and store data from sensors
● Two directional data flow
● Real time data publication from server to client with WebSocket
● HTTP POST/GET request for third party services (for example to POI data provider)
Real Virtual Interaction Back-end Server
How to use GE
• Generic things for device application developers
• Data is sent over UDP
• Data should be formatted with RESTful data format specification
– format specification can be found from: http://forge.fi-
ware.org/plugins/mediawiki/wiki/fiware/index.php/Real_Virtual_Open_API_Specification
• Data may be compressed with gzip
• Device should publish its configurable parameters
• Configuration must be done with HTTP POST calls
How to use GE
● API example for web client application developers
http://serverUrl:port/
?action=
loadBySpatial
loadByID
device_id
&lon=
&lat=
&maxResults=
&radius=
Code samples for HTTP requests
● HTTP Get request: http://server_url:port/?action=loadBySpatial&lat=65.4&lon=25.4&radius=1500&maxResults=10
○ Sample form code
○ Sample JavaScript code
var xhr = new XMLHttpRequest();
xhr.open("GET", "http://server_url:port/?action=loadBySpatial&lat=65.4&lon=25.4&radius=1500&maxResults=10", true);
xhr.onload = function() {
console.log(this.response);
}
<form action="http://server_url:port/" method="get">
<input type="hidden" name="action" value="loadBySpatial">
Latitude: <input type="text" name="lat"><br>
Longitude: <input type="text" name="lon"><br>
Radius: <input type="text" name="radius"><br>
Maxresults: <input type="text" name="maxResults"><br>
<input type="submit" value="Submit">
</form>
How to control sensor
• Sample form to create POST call
• Sample javascript code to create POST call
<form action="http://server_url:port/upload" enctype="multipart/form-data" method="post">
Device id: <input type="text" name="device_id"><br>
Choose marker to upload: <input type="file" name="datafile" size="40"></br>
<input type="submit" value="Send">
function sendData(data) {
var xhr = new XMLHttpRequest();
var fd = new FormData();
for(name in data) {
fd.append(name, data[name]);
}
xhr.open('POST', 'http://server_url:port/upload');
xhr.send(fd);
}
Demo
acquire sensor data via RvI infrastructure
http://130.206.81.238:8080/rvi_client/
Where to get more information
FIWARE Wiki
• Real Virtual Interaction - Installation and Administration Guide
– http://forge.fi-ware.org/plugins/mediawiki/wiki/fiware/index.php/Real_Virtual_Interaction_-
_Installation_and_Administration_Guide
• Real Virtual Interaction - User and Programmers Guide
– http://forge.fi-ware.org/plugins/mediawiki/wiki/fiware/index.php/Real_Virtual_Interaction_-
_User_and_Programmers_Guide
FIWARE Catalogue
• Real Virtual Interaction
– http://catalogue.fi-ware.org/enablers/real-virtual-interaction
Thanks!Thanks!

More Related Content

PPT
FIWARE Developers Week_FIWARE IoT: Beginner's tutorial_conference
PPTX
Fiware Developers Week Iot exercises (Advanced)
PPT
Fiware io t_ul20_cpbr8
PPTX
Fiware IoT_IDAS_intro_ul20_v2
PPTX
Fiware Developers Week IoT Agents (Advanced)
PPTX
Introduction to FIWARE IoT
PPTX
FIWARE Developers Week_IoT Agents with Thinking Things and OMA lightweight M...
PPT
FIWARE IoT Proposal & Community
FIWARE Developers Week_FIWARE IoT: Beginner's tutorial_conference
Fiware Developers Week Iot exercises (Advanced)
Fiware io t_ul20_cpbr8
Fiware IoT_IDAS_intro_ul20_v2
Fiware Developers Week IoT Agents (Advanced)
Introduction to FIWARE IoT
FIWARE Developers Week_IoT Agents with Thinking Things and OMA lightweight M...
FIWARE IoT Proposal & Community

What's hot (20)

PPT
Io t idas_intro_ul20_nobkg
PPTX
Context Information Management in IoT enabled smart systems - the basics
PPTX
IoT Agents (With Lightweight M2M)
PPTX
201410 1 fiware-overview
PDF
FIWARE Internet of Things
PPTX
IoT Agents (Introduction)
PPTX
FIWARE Developers Week_IoT basic exercises
PPTX
Io t basic-exercises
PPTX
A Complete IoT Backend Infrastructure in FIWARE
PPTX
Developing an IoT System FIWARE Based from the Scratch
PPTX
FIWARE Primer - Learn FIWARE in 60 Minutes
PPTX
IoT-Broker Developers Week
PPTX
Developing your first application using FI-WARE
PPTX
Fiware, the future internet
PPTX
Setting up your virtual infrastructure using FIWARE Lab Cloud
PPTX
Fiware, the future internet
PPTX
FIWARE IoT Introduction 1
PPT
Fiware IoT Proposal & Community
PDF
What is an IoT Agent
PDF
Connecting to the internet of things (IoT)
Io t idas_intro_ul20_nobkg
Context Information Management in IoT enabled smart systems - the basics
IoT Agents (With Lightweight M2M)
201410 1 fiware-overview
FIWARE Internet of Things
IoT Agents (Introduction)
FIWARE Developers Week_IoT basic exercises
Io t basic-exercises
A Complete IoT Backend Infrastructure in FIWARE
Developing an IoT System FIWARE Based from the Scratch
FIWARE Primer - Learn FIWARE in 60 Minutes
IoT-Broker Developers Week
Developing your first application using FI-WARE
Fiware, the future internet
Setting up your virtual infrastructure using FIWARE Lab Cloud
Fiware, the future internet
FIWARE IoT Introduction 1
Fiware IoT Proposal & Community
What is an IoT Agent
Connecting to the internet of things (IoT)
Ad

Similar to FIWARE Developers Week_BootcampWeBUI_presentation1 (20)

PDF
Real time web apps
PPTX
Outburst 3D
PPT
Realtime html5 multiplayer_games_with_node_js
PPT
Realtime html5 multiplayer_games_with_node_js
PDF
38199728 multi-player-tutorial
PPTX
Supporting an Advanced User Experience Using FIWARE
PPTX
VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Frame...
PDF
Dragoncraft Architectural Overview
PDF
Albion Online - Software Architecture of an MMO (talk at Quo Vadis 2016, Berlin)
PPTX
Lightweight Multiplayer HTML5 Games with PubNub
PPTX
Why WebRTC DataChannel excites me
PDF
Jan Hloušek, Keen Software House
PDF
Spring Boot for WebRTC Signaling Servers: A Comprehensive Guide
PPTX
Networking Architecture of Warframe
PDF
Dynamic Apps with WebSockets and MQTT - IBM Impact 2014
PDF
Web of Things (wiring web objects with Node-RED)
PDF
A new interface between smart device and web using html5 web socket and qr code
PDF
Real-Time with Flowdock
PDF
WebSocket Perspectives 2015 - Clouds, Streams, Microservices and WoT
PDF
Firebase introduction
Real time web apps
Outburst 3D
Realtime html5 multiplayer_games_with_node_js
Realtime html5 multiplayer_games_with_node_js
38199728 multi-player-tutorial
Supporting an Advanced User Experience Using FIWARE
VisualWeb - Building a NodeJS Server Meshwork and Full-Javascript Stack Frame...
Dragoncraft Architectural Overview
Albion Online - Software Architecture of an MMO (talk at Quo Vadis 2016, Berlin)
Lightweight Multiplayer HTML5 Games with PubNub
Why WebRTC DataChannel excites me
Jan Hloušek, Keen Software House
Spring Boot for WebRTC Signaling Servers: A Comprehensive Guide
Networking Architecture of Warframe
Dynamic Apps with WebSockets and MQTT - IBM Impact 2014
Web of Things (wiring web objects with Node-RED)
A new interface between smart device and web using html5 web socket and qr code
Real-Time with Flowdock
WebSocket Perspectives 2015 - Clouds, Streams, Microservices and WoT
Firebase introduction
Ad

More from FIWARE (20)

PPTX
Behm_Herne_NeMo_akt.pptx
PDF
Katharina Hogrebe Herne Digital Days.pdf
PPTX
Christoph Mertens_IDSA_Introduction to Data Spaces.pptx
PPTX
Behm_Herne_NeMo.pptx
PPTX
Evangelists + iHubs Promo Slides.pptx
PPTX
Lukas Künzel Smart City Operating System.pptx
PPTX
Pierre Golz Der Transformationsprozess im Konzern Stadt.pptx
PPTX
Dennis Wendland_The i4Trust Collaboration Programme.pptx
PPTX
Ulrich Ahle_FIWARE.pptx
PPTX
Aleksandar Vrglevski _FIWARE DACH_OSIH.pptx
PDF
Water Quality - Lukas Kuenzel.pdf
PPTX
Cameron Brooks_FGS23_FIWARE Summit_Keynote_Cameron.pptx
PPTX
FiWareSummit.msGIS-Data-to-Value.2023.06.12.pptx
PPTX
Boris Otto_FGS2023_Opening- EU Innovations from Data_PUB_V1_BOt.pptx
PPTX
Bjoern de Vidts_FGS23_Opening_athumi - bjord de vidts - personal data spaces....
PDF
Abdulrahman Ibrahim_FGS23 Opening - Abdulrahman Ibrahim.pdf
PDF
FGS2023_Opening_Red Hat Keynote Andrea Battaglia.pdf
PPTX
HTAG_Skalierung_Plattform_lokal_final_versand.pptx
PPTX
WE_LoRaWAN _ IoT.pptx
PPTX
EU Opp_Clara Pezuela - German chapter.pptx
Behm_Herne_NeMo_akt.pptx
Katharina Hogrebe Herne Digital Days.pdf
Christoph Mertens_IDSA_Introduction to Data Spaces.pptx
Behm_Herne_NeMo.pptx
Evangelists + iHubs Promo Slides.pptx
Lukas Künzel Smart City Operating System.pptx
Pierre Golz Der Transformationsprozess im Konzern Stadt.pptx
Dennis Wendland_The i4Trust Collaboration Programme.pptx
Ulrich Ahle_FIWARE.pptx
Aleksandar Vrglevski _FIWARE DACH_OSIH.pptx
Water Quality - Lukas Kuenzel.pdf
Cameron Brooks_FGS23_FIWARE Summit_Keynote_Cameron.pptx
FiWareSummit.msGIS-Data-to-Value.2023.06.12.pptx
Boris Otto_FGS2023_Opening- EU Innovations from Data_PUB_V1_BOt.pptx
Bjoern de Vidts_FGS23_Opening_athumi - bjord de vidts - personal data spaces....
Abdulrahman Ibrahim_FGS23 Opening - Abdulrahman Ibrahim.pdf
FGS2023_Opening_Red Hat Keynote Andrea Battaglia.pdf
HTAG_Skalierung_Plattform_lokal_final_versand.pptx
WE_LoRaWAN _ IoT.pptx
EU Opp_Clara Pezuela - German chapter.pptx

Recently uploaded (20)

PDF
Enhancing emotion recognition model for a student engagement use case through...
PDF
A comparative analysis of optical character recognition models for extracting...
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Mushroom cultivation and it's methods.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Hybrid model detection and classification of lung cancer
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PPTX
A Presentation on Touch Screen Technology
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
August Patch Tuesday
Enhancing emotion recognition model for a student engagement use case through...
A comparative analysis of optical character recognition models for extracting...
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
Group 1 Presentation -Planning and Decision Making .pptx
Mushroom cultivation and it's methods.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Heart disease approach using modified random forest and particle swarm optimi...
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Unlocking AI with Model Context Protocol (MCP)
Assigned Numbers - 2025 - Bluetooth® Document
Hybrid model detection and classification of lung cancer
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
A Presentation on Touch Screen Technology
gpt5_lecture_notes_comprehensive_20250812015547.pdf
August Patch Tuesday

FIWARE Developers Week_BootcampWeBUI_presentation1

  • 2. Rationale ● When creating a multi-user, real time Web application, two things are commonly needed ○ The underlying data (or scene) model ○ The communication protocol for synchronizing the data between participants ● Custom-building these for an application is often not cost- effective; a generic solution can be preferable
  • 3. Synchronization GE ● Contains a generic, lightweight scene data model ● Provides a real time two-way synchronization mechanism between server and clients ○ Uses the WebSocket protocol for web clients ● Implementation based on realXtend open source virtual world technology (www.realxtend.org) developed from 2007 onward ● Catalogue page: catalogue.fi- ware.org/enablers/synchronization
  • 4. Reference client and server ● Server and desktop client: the realXtend Tundra SDK ○ Core written in C++, JavaScript scripting ○ Relatively complex and heavyweight ○ github.com/realXtend/tundra ● Web client: Javascript ○ github.com/realXtend/WebTundra ○ Same codebase contains also the related 3D-UI (WebTundra) GE
  • 5. Web client demo ● N-player Pong game 130.206.81.111/pong/Pong.html ● Open multiple tabs/windows to join in more players ● Clients connect to a server, server sends scene changes (ball + bats moving) to all clients
  • 6. Scene data model ● Based on Entities, Components and Attributes ● Using the Pong game example ○ The ball and bats are separate Entities ○ Entities contain components to separate functionality: ■ Mesh: visual representation ■ RigidBody: physics & collision ■ Placeable: positioning ○ Components contain attributes ■ For example Mesh has URL to the 3D model that should be rendered, Placeable has position, rotation & scale ● Application can define its own components
  • 7. High-level view of the protocol ● When a new client connects, the server sends all entities to it ● After this, the following operations are automatically synchronized both ways: ○ Create or remove an entity ○ Create or remove a component from an entity ○ Change an attribute value inside a component ■ This is commonly the bulk of network data ○ Send an RPC-like Entity Action ■ Has a string name and list of string parameters, can be used for custom messaging, for example controls handling in a virtual world
  • 8. Protocol implementation ● Based on binary formatted messages for efficiency ● The protocol is described at github.com/realXtend/tundra/wiki/Tundra-protocol
  • 9. Running the server ● Typical command line to run Tundra without rendering, load a specific scene file, and serve it to clients ./Tundra --headless --file <filename.txml> --server ● Optionally specify --port <portnumber> to select the port in which to listen for clients (default 2345) ● On Unix machines without x11, use xvfb xvfb-run ./Tundra --headless --file ...
  • 10. Client code example ● Minimal JavaScript client code to connect to a server var client = new Tundra.WebSocketClient(); var scene = new Tundra.Scene(); var syncManager = new Tundra.SyncManager(client, scene); var loginData = {"username": "Test User"}; client.connect("localhost", 2345, loginData); ● Tundra.WebSocketClient manages the WebSocket connection to the server ● Tundra.Scene is the scene data model (initially empty) ● Tundra.SyncManager implements the synchronization protocol ● After successfully connecting, the SyncManager receives messages from the WebSocketClient, and acts upon the Scene ○ As server sends the initial scene contents, and any changes, SyncManager mirrors them to our local scene ● Note the default Tundra port 2345. This can be configured
  • 11. Sending changes & scene signals ● SyncManager applies changes from server automatically as WebSocket messages are received. To send client’s scene changes to server requires an explicit call: syncManager.sendChanges(); ● Scene has change signals (using JS Signals library) which are fired both for server- and client-side changes to the data: scene.entityCreated scene.entityRemoved scene.componentAdded scene.componentRemoved scene.attributeChanged scene.actionTriggered ...
  • 12. Where to get + further resources Links to guides & download links at: catalogue.fi- ware.org/enablers/synchronization Prebuilt server packages exist for Windows (32/64bit) & Ubuntu Linux (32/64bit), can also build the server from source (warning: may be involved) github.com/realXtend/tundra
  • 14. realXtend Background: realXtend history ● Open source networked virtual world and game platform (2007-) ● Originally started by consortium of companies and later on joined by the University of Oulu, Finland ● Governed by non-profit realXtend Association Stakeholders ● International user and developer base from research and commercial sides ● Deployed applications used by several companies and organisations in production
  • 15. realXtend Tundra ● Virtual world platform / 3D application framework ○ Server + Client sharing the same native code (C++) ○ Qt as main framework, Ogre3D for rendering ○ Multi-platform: Windows, Mac, and Linux ● Built-in efficient and versatile networking ● Uses Entity-Component-Attribute scene model ○ Automatic networking for components ● App development: Javascript or C++ for plugin extensions ● Import 3D assets from Blender, 3DS Max etc.
  • 16. RealXtend Tundra based virtual world hosting service ● Distributed cloud hosting and asset storage ● One of the biggest contributors to the Tundra open source repositories ● Free plan for anyone to get their own 3D virtual world in minutes ● Growing fast -> over 3100 hosted worlds -> over 155 000 logins Adds end-user functionality that the Tundra SDK does not address ● Web interface to manage your virtual worlds, user access, application settings etc. ● Fast and easy Facebook / Google authentication or direct Meshmoon auth ● Web hosted asset storage access, importing 3D models, build tools, additional entity-components, avatar editor, in-world applications, etc. Check it out at www.meshmoon.com Case: Meshmoon
  • 17. Games
  • 22. ● Javascript library that uses three.js and Synchronization GE to implement a Tundra client and WebGL rendering ● Asset loading, mapping three.js objects to Tundra EC:s, handling networked changes to these in real time ● For a preview about what you can do with three.js, look in http://threejs.org/examples/ WebTundra
  • 23. ● Building web-based multiuser networked 3D apps ○ Or: Easy to use networking for three.js WebGL apps ● Client for existing Tundra scenes and applications, interoperating with the native desktop Tundra client ● Both cases benefit from Tundra’s existing production-tested networking system and scriptable server implementation Use cases
  • 24. Entity-Component system ● Replication of objects and changes to their state are handled by Entity-Component system ● EC systems are a common way to use composition instead of inheritance to compose things in 3D engines and games ● In this case the EC system also supports network sync, so creating and modifying entities and their components can be replicated over the network to the server ● More closely covered in Synchronization GE presentation
  • 25. Anatomy of a basic WebTundra app ● Start from an existing three.js WebGL application ● Replication of objects and changes to their state are handled by the network-aware Entity-Component system ● For each network-aware three.js 3D geometry object, an entity with Placeable and Mesh components is created. ● Mesh component loads the 3D asset off the web and creates a corresponding three.js mesh in the scene ● Changing Placeable attributes like position, scale, rotation are synced to other clients via the server (and changed in the corresponding three.js object).
  • 26. Setting up ● Need to have a server to connect to, can use FIWARE Lab or own machine, we also have a server running you can use right away ● Set up your local development environment and download WebTundra, or develop client on a FIWARE Lab vm - we have an installation recipe
  • 27. Pong example ● We’ve made available a multiplayer Pong game and covered the internals in some detail in our User’s and Programmer’s guide at http://catalogue.fi- ware.org/enablers/documentation-21 ● Browse source code at: https://github.com/playsign/PongThreeJS/tree/ec ● Uses JQuery for 2D menus, server-side Bullet physics - more “bells and whistles” than strictly necessary but aiming to be a complete
  • 28. Pong example ● Script running on Tundra server creates U-shaped areas for each player and receives bat movement events from clients, and simulates ball movements, sending resulting entity movements to clients ● WebTundra clients present synchronized entity state from server and send events to server based on player actions
  • 29. Development tips and workflow ● Familiarize with three.js first ● Use Chrome/Firefox developer tools ● Watch Tundra server console ● Run server locally in graphical mode to see GUI for inspecting entity state, triggering actions interactively, etc. ● Get help on realxtend-dev mailing list & #realxtend-dev on irc.freenode.net
  • 30. Real Virtual Interaction GE Bootcamp presentation
  • 31. Rationale Need for open specification ● Every manufacturer have their own systems and those are not compatible with other manufacturers systems → Objective was to create open source based infrastructure to be used with next generation IoT applications
  • 32. Real Virtual Interaction GE ● Real virtual interaction GE provides o Services to interact with real objects (sensors) in the world o UI components and associated (remote) services. ● Provides RESTful and WebSocket API’s for data requests ● Main GE components: o Real virtual interaction server o Reference RvI client ● (RvI is one of the key components for future IoT systems)
  • 33. Possible use cases to utilize GE ● Monitor and control o District heating system o Bus locations o Room temperatures
  • 34. Key features ● Collect and store data from sensors ● Two directional data flow ● Real time data publication from server to client with WebSocket ● HTTP POST/GET request for third party services (for example to POI data provider)
  • 35. Real Virtual Interaction Back-end Server
  • 36. How to use GE • Generic things for device application developers • Data is sent over UDP • Data should be formatted with RESTful data format specification – format specification can be found from: http://forge.fi- ware.org/plugins/mediawiki/wiki/fiware/index.php/Real_Virtual_Open_API_Specification • Data may be compressed with gzip • Device should publish its configurable parameters • Configuration must be done with HTTP POST calls
  • 37. How to use GE ● API example for web client application developers http://serverUrl:port/ ?action= loadBySpatial loadByID device_id &lon= &lat= &maxResults= &radius=
  • 38. Code samples for HTTP requests ● HTTP Get request: http://server_url:port/?action=loadBySpatial&lat=65.4&lon=25.4&radius=1500&maxResults=10 ○ Sample form code ○ Sample JavaScript code var xhr = new XMLHttpRequest(); xhr.open("GET", "http://server_url:port/?action=loadBySpatial&lat=65.4&lon=25.4&radius=1500&maxResults=10", true); xhr.onload = function() { console.log(this.response); } <form action="http://server_url:port/" method="get"> <input type="hidden" name="action" value="loadBySpatial"> Latitude: <input type="text" name="lat"><br> Longitude: <input type="text" name="lon"><br> Radius: <input type="text" name="radius"><br> Maxresults: <input type="text" name="maxResults"><br> <input type="submit" value="Submit"> </form>
  • 39. How to control sensor • Sample form to create POST call • Sample javascript code to create POST call <form action="http://server_url:port/upload" enctype="multipart/form-data" method="post"> Device id: <input type="text" name="device_id"><br> Choose marker to upload: <input type="file" name="datafile" size="40"></br> <input type="submit" value="Send"> function sendData(data) { var xhr = new XMLHttpRequest(); var fd = new FormData(); for(name in data) { fd.append(name, data[name]); } xhr.open('POST', 'http://server_url:port/upload'); xhr.send(fd); }
  • 40. Demo acquire sensor data via RvI infrastructure http://130.206.81.238:8080/rvi_client/
  • 41. Where to get more information FIWARE Wiki • Real Virtual Interaction - Installation and Administration Guide – http://forge.fi-ware.org/plugins/mediawiki/wiki/fiware/index.php/Real_Virtual_Interaction_- _Installation_and_Administration_Guide • Real Virtual Interaction - User and Programmers Guide – http://forge.fi-ware.org/plugins/mediawiki/wiki/fiware/index.php/Real_Virtual_Interaction_- _User_and_Programmers_Guide FIWARE Catalogue • Real Virtual Interaction – http://catalogue.fi-ware.org/enablers/real-virtual-interaction