6 July 2020

DadenU Day: WebXR


MozVR Hello WebXR Demo Room

For my DadenU Day I decided to get to grips with WebXR. WebXR is an new standard (well an evolution of WebVR) designed to enable web-based 3D/VR applications to detect and run on any connected VR or AR hardware, and to detect user input controls (both 6POS and hand controllers). This should mean that:

  • You can write and host VR applications natively on the web and launch then from a VR headsets built-in web browser
  • Not worry whether its Oculus, HTC or A.N.Other headset, both for display and for reading controllers
  • Have a 2D/3D view automatically available in the web browser for people without a VR HMD.
What WebXR does NOT do is actually build the scene, you use existing WebGL for that (essentially a 3D HTML standard, not to be confused with WebXR or WebVR!) through something like the Three.js or A-Frame frameworks.


To get a good sense of what web-delivered VR (via WebXR) can do I headed over to Mozilla's demo at https://blog.mozvr.com/hello-webxr/. This room has a bunch of different demos, and a couple of "doorways" to additional spaces with further demos. If you view on a 2D browser you just see the room, but can't navigate or interact (don't see why WebXR should pick up ASDW same way as its picks up a 6DOF controller). If you go to the page in your Oculus Quest (or other) browser you also see the same 3D scene in 2D. BUT it also offers you an "Enter VR" button, click this and your VR lobby and the 2D browser disappears and you are fully in the VR space as though you'd loaded a dedicated VR app. Awesome. In the space you can:

  • Play a virtual xylophone (2 sticks and sounds)
  • Spray virtual graffiti
  • Zoom in on some art
  • View 360 photospheres - lovely interface clicking on a small sphere that replaces the VR room with a full 360/720 photosphere. I'd always been dubious about mixing photospheres and full 3D models in the same app but his works well
  • View a stereoscopic 360 photosphere - so you can sense depth, pretty awesome
  • Enter a room to chase sound and animation effects
  • View a really nice photogrammetry statue which proves that web VR doesn't need to mean angular low-rez graphics 
MozVR Photogrammetry Demo

There's a really good "how we did it" post by the Mozilla team at: https://blog.mozvr.com/visualdev-hello-webxr/

Having seen just what you can do with WebXR the next step was to learn how its done. For that I went to the WebXR sample pages at https://immersive-web.github.io/webxr-samples/

Although thee are a lot simpler than the MozVR one, each shows how to do a particular task - such as user interaction, photospheres etc. You can also download the code and libraries for each from GitHub at https://github.com/immersive-web/webxr-samples.

Movement demo

Controller demo

The only downside of these seems to be that they use Cottontail - a small WebGL/WebXR library/framework purely developed for these demos and not recommended for general use - so adapting them to your own needs is not as simple as it would be if they were written in Three.js or A-Frame.

Keen to actually start making my own WebXR I started by copying the GitHUb repository to my own server and running the demo's up. Issue #1 was that any link from a web page to the WebXR page MUST use https, using http fails!

Starting simply I took the photosphere demo and replaced the image with one of my own. The image had worked fine on the photosphere display in Tabletop Simulator but refused to work in WebXR. Eventually I found that the image had to be in 2048x1024, higher resolutions (but same ratio) fail. Also the photosphere demo is for stereoscopic photospheres so you have to remove the " displayMode: 'stereoTopBottom'" parameter.

Hougoumont Farm at Waterloo in WebXR Photosphere

Next up was to try and add my own 3D object. I liked the block room in one of the demos and worked out how to remove their demo blocks form the middle, and to hide the stats screen. Nice empty room loaded up. Then I hit the bump that I usually write in Three.js or A-Frame and I could't just cut-and-past into their WebXR/Cottontail template. Then I ran out of time (it was Friday after all!)

I've now found a page of really basic Three.js WebXR demos at https://threejs.org/examples/?q=webxr so the aim for this week is to get those working and start on my own WebXR spaces.

It's obviously early days for WebXR, but given the MozVR demo this really could be a lovely download-free way of delivering both 2D/3D to ordinary browsers, and full VR to headsets without any downloads. Joy!




29 June 2020

9 Business as Usual Uses for VR and AR in College Classrooms - Our take!


Saw an interesting looking article on "9 Amazing Uses for VR and AR in College Classrooms" on  Immersive Learning news the other day - although actually a retweet of a 2019 article. But reading it I was struck by how most of the uses they talk about are things that we've been doing for years.

So here's their Top 9 uses, and what we've done that's identical or close.

1) Grasping Concepts



When we built a virtual lab for the University of Leicester we also built 3D animations of what happens at  a molecular level. Students had found it hard to link the theory of a process with the mechanics of using the kit, and the combination of both really helped them to link and understand the two.

In another example a finance trainer we helped build for the University of Central Florida represented financial flows as tanks of water and piles of virtual money so as to better enable students to grasp more complex financial concepts.


2) Recreating Past Experiences for New Learners



Not one of ours but there was an awesome recreations of the WW1 trenches, augmented by the poetry of the war created by the University of Oxford back in the 2000s. We have though also used immersive 3D to recreate conversations between analysts and patients so that new learners can revisit these and actually sit in the virtual shoes of the analyst or patient.


3) Stagecraft for Theater Students



One of the first projects we got involved with was helping theatre educators at Coventry University make of us immersive 3D to teach stage craft and even create new cross-media pieces. There was also the wonderful Theatron project back in the 2000s that recreated a set of ancient theatres in order to better understand how they were used by staging virtual plays, and we did the Theatrebase project were we built Birmingham's Hippodrome Theatre and digitised a set of scenery from their archives to show how virtual environments could be used to both teach stagecraft but also to act as an interactive archives and to help plan and share stage sets between venues.

4) Virtual Reconstruction of History



With Bournemouth University and the National Trust we recreated Avebury Ring as part of an AHRC funded project and ran it for the summer at the visitors centre so that visitors could explore the Ring as it was 5000 years ago in VR - and without the village that has now been built in the middle of it!


5) Going on Space Walks



We've done the Apollo 11 Tranquility Base site 3 times now, in Second Life, Open Sim and now Trainingscapes. We've also done an exploration of the 67P comet and a whole Solar System explorer.


6) Reimagining the Future

                               

Back in 2010 we built the new Library of Birmingham virtually (hence VLOB) for Birmingham City Council so they could use it to plan the new building and to engage with the public and later subcontractors. The multi-user space even had a magic carpet ride!

7) Practicing Clinical Care



We have done almost a dozen immersive 3D exercises for health and care workers, ranging from paramedics and urinalysis to end of life pathway care and hospitalised diabetic patients.


8) Hands-on Railroading



OK, hands-up, we've never built a virtual railroad - but we have done equipment operation simulations on things ranging from air conditioners to jet engines!


9) Feeling the Impact of Decisions




In the article this is actually about team-work and collaboration within virtual spaces. Whilst we have had some "fun" builds - for instance virtual snowballs for Christmas parties we're also really interested in how to use these spaces to discuss issues and approaches through tools like walk-maps and 3D post-it notes. The classic though has got to be the fire demo where if you choose the wrong extinguisher then the fire blows up in your face - and as seen from the image above your body flinches away exactly as it would do in real life!


So there you are, 9 business as usual use cases for immersive 3D and VR as far as we're concerned!



25 June 2020

Daden joins Team iMAST



We're pleased to announce that Daden has been selected as a member of Team iMAST, the Babcock and Qinetiq led team which is bidding to support the modernisation of the UK Royal Navy’s individual maritime training.

Down selected to bid earlier this year, the bespoke Team iMAST collaboration – led by Babcock and comprising, QinetiQ and Centerprise International along with the Universities of Portsmouth and Strathclyde – has recently been joined by Thales and Learning Technologies Group to further bolster its highly-experienced offering. And boasting its Innovation Ecosystem of more than 50 Small to Medium sized Enterprises (SMEs) - including Daden, Team iMAST is ready to deliver training to the Royal Navy when and where it is required, if selected.

Team iMAST and the Innovation Ecosystem will enable critical technology integration, backed by proven naval training resources, to drive future-ready training solutions for all elements of the Royal Navy. To launch this Ecosystem, two successful events have already been held with the most recent hosted by Team iMAST at the Digital Catapult, the UK’s leading agency for the early adoption of advanced digital technologies.

With its wealth of proven expertise, Team iMAST is uniquely placed to support this training outsource programme through its unrivalled industry know-how. The programme will provide an opportunity to help shape the future of Royal Navy training as a strategic partner and drive efficiencies and new technology. 

Daden is focusing on a variety of use cases of virtual humans in support of the project.



23 June 2020

Intelligent Virtual Personas and Digital Immortality




David's just done a guest post for the VirtualHumans.org site on "Intelligent Virtual Personas and Digital Immortality", pulling together some of our current work on Virtual Personas with David's writings on Digital Immortality and the site's interest in Virtual Influencers.

You can read the full article here: https://www.virtualhumans.org/article/intelligent-virtual-personas-and-digital-immortality




11 June 2020

Daden Newsletter - June 2020




In the latest issue of the Daden Newsletter we cover:

  • COVID19 and 3D Immersive Learning -  With corporate training and academic syllabuses and delivery being revised to cope with the challenges of social distancing stretching out until mid 2021 at least, to what extent will trainers and educators look again at the potential of 3D immersive learning and virtual reality - or will they fallback on the more "traditional" approaches of VLEs and Zoom?

  • Virtual Conferences - It's not just in virtual training and learning that immersive 3D can help - several organisations are now using immersive 3D conference and meeting environments to give participants more sense of "being there" and encouraging more serendipitous networking than yet another Zoom webinar. David reports on two recent events he attended.

  • Trainingscapes 2.0 Sneak Peak - We're getting close to the launch of version 2.0 of Trainingscapes - see some screenshots of the new-look application.

  • Plus snippets of other things we've been up to in the last 6 months - like being named one of the West Midlands Top 50 most innovative companies.

We hope you enjoy the newsletter, and do get in touch if you would like to discuss any of the topics raised in the newsletter, or our products and services, in more detail!

8 June 2020

Daden U Day: My Beautiful Soup

From Darrell Smith:

On a recent project we had difficulties in scraping the summary paragraph from Wikipedia article pages and Beautiful Soup was suggested as a possible tool to help with this.  The Beautiful Soup Python library has functions to iterate, search and update the elements in the parsed tree of a html (and xml) document.


So download and install the library do a quick test was to fetch the URL of the web page we’re interested using the ‘requests’ HTTP library to make things easy. The http document is then passed to create a ‘soup’ object,.

result = requests.get("https://en.wikipedia.org/wiki/HMS_Sheffield_(D80)")

src = result.content

soup = BeautifulSoup(src, 'lxml')

print(soup)

 

The prettify # makes the html more readable by indenting the parent and sibling structure

print(soup.prettify())

 

Searching for tag types (such as ‘a’ for anchor links) is simple using ‘find’ (first instance) or ‘find_all’,  this shows all internal (Wikimedia links) and external links (“https://”)


 

Lets just get links that refer to “HMS …”


 

Now lets get the text paragraphs we’re interested in, this can be done using the ‘p’ tag


Then index to 2nd paragraph using list to get summary paragraph (n.b. first paragraph is blank) we’re after.


Dedicated Wikipedia Library

While Beautiful Soup is a good generic tool for parsing web pages, it turns out that for Wikipedia there are dedicated python utilities for dealing with the content such as the Wikipedia library (https://pypi.org/project/wikipedia/) which wraps the Wikimedia API simply


wp.search(“HMS Sheffield”) returns the Wikipedia pages for all incarnations of HMS Sheffield, and we can use wp.summary(“HMS Sheffield (D80)”)  to give hte element from page we’re interested in.

The wp.page(“HMS Sheffield (D80)”) also gives the full text content in a readable form with headings.




Again we can select the first paragraph for the summary (exclude URL), and possible use other paragraphs using the headings as index/topic markers.

 

Smart Quotes!  While trying this out I also found a useful function to get rid of those pesky Microsoft smart quotes causing trouble in RDF definitions on the same task. Unicode, Dammit converts Microsoft smart quotes to HTML or XML entities:






1 June 2020

Choices in Immersive Learning Design




When designing a new immersive learning experience we find that there are a number of dichotomies or spectra  that it is helpful to talk through with a client in order to ensure that all parties have a good idea of what is driving the immersive learning design and what the experience might feel like. Often there is a lot taken for granted, a lot discounted or assumed, and its not until you start talking about all these options that some of the preconceptions on both sides emerge.

To help us talk these through with clients we've even realised them as cubes within our virtual campus so that we can go in remotely with clients and move the boxes around as we talk about them, and typically lay them out on a cost/effort vs importance floor map - the sheer act of doing that helps to create visual and spatial cues which help in recall and even help to show the thinking that is going on.

So here are what we think are some of the key dichotomies, and you can find a fuller list and discussion of the remaining items in our Immersive Learning White Paper.




- Simulation vs Serious Game

In recent years this has become the big one – to what extent do you want the immersive experience to be a “simulation” of reality (so high on accuracy), and to what extent do you want it to be game-like (and so highly motivating)? The situation gets even further confused when people start talking about “gamification”. Having been involved in games design since before the days of personal computers we know that this really all comes down to game mechanics. To us something becomes a “game” as soon as you start to introduce (or exclude) rules or features that do not exist in the real world. Those things you introduce are called game mechanics – and might range from a simple countdown timer or scoring system to highly artificial features such as power-ups and upgrades.


- Linear vs Freeform

When we first engage with tutors and learning designers who have been used to working on eLearning projects we find that they tend to come with a very linear mindset. The learning is a sequence of actions and tasks, and each screen only provides a few options as you don't want to crowd the screen or confuse the learner. Coming from a virtual worlds background we are far more used to open learning spaces with lots of possibilities – trying to get tutors and designers to “unlearn” can be hard. One of the best approaches we have found is to get them to think of a learning exercise in terms of drama, or even e-drama. In fact, it's not even scripted drama we're often after, it's improvised drama. It's telling the student: this is the scene, here are the props, the actors are going to do something and you need to respond.

- Single vs Multi User

A major design decision is whether an environment is designed to be used by a single user (so they only see themselves) or by multiple users (so everyone sees and can interact with everyone else). Obviously multi-user is essential if you are looking at team and collaborative learning, or you want staff (or actors) to role-play characters in the simulation “live”. But multi-user suggests an element of scheduling, and also requires the users to have a network connection, so doesn't give the individual learner the maximum flexibility (e.g. learning on the underground), or let them practice in private.


- Synchronous vs Asynchronous

This choice is only relevant in multi-user mode – should the environment be designed for asynchronous use – i.e. everyone uses it at their own time and pace, or for synchronous use – more like a physical world team learning session where the team (and the tutor/assessor) are all present at the same time.  In asynchronous mode we are really talking about lots of individual single-user experiences, people using the environment as and when. With synchronous mode we are talking about timetabling and co-ordination, but the benefit is that we get to practice those team tasks that it may just not be feasible to practice and rehearse in the physical world due to limitations of time or distance.





We hope that's made you think through our ideas for immersive in a new way, and don't forget to check out the white paper for more details, or contact us if you'd like to talk them through - or even play around with the box set in our virtual collaborative 3D space.


22 May 2020

A Tale of Two Seminars





Yesterday I attended two seminars in "3D", one in EngageVR and one in Second Life. Whilst in many ways they shared similar features, and both miles away from your typical Zoom webinar, they couldn't have been more different.

EngageVR



The Engage VR event was an ImmerseUK event on the Future of Work in VR: Training the Next Workforce. The format was very conventional with 4 speakers, each presenting their work/views and then a panel session to take questions, followed by networking. Some attendees (~50%?) were using VR HMDs, and the rest the 2D/3D interface from their PCs. There was also a livestream to YouTube. No idea what the level of knowledge or background of attendees was - but just knowing of the event and getting into VR suggests a reasonably knowledgable crowd - about 30 I'd guess.

I don't want to dwell on the session itself, all the presentations were interesting and had something to say, although some going back over decades now of arguments about affordances and use cases of immersive 3D/VR. Some nice multi-user/multi-site virtual surgery, and a new use of an "in their shoes" perspective for safeguarding training where trainees played the exercise as the counsellor, and then sat in the "victims" position and saw their own avatar reply what they did! Mind you one speaker talked about how they "brought down their project costs into 5 figures" whereas our clients tend to get upset if they go up into 5 figures!

What I do want to do is just collect my reflections from the event - my first "proper" VR seminar, and at 2h15m probably the longest I've had my Quest on for in one go. So, in no particular order:

  • The whole space very reminscent of 2010 SL, nice distant backdrop of Golden Gate to set it in "reality"
  • No on-boarding experience, only found out afterwards how to "hold" my tablet, and not sure there was anyway to "sit", I kept being sat by an organiser
  • When I heard a helicopter I started looking for it in the sky - but it was in RL. Truly immersed.
  • Attendee avatars were just trunk/head/hands, whereas presenters (at least when on panel) where full body, which also seems to be the Engage default, I just the lo-rez attendees to keep performance up
  • If you wanted to ask a question you just stuck you hand up - no need for a "raise hand" button, very natural
  • Not being able to go into 3rd person in order to see myself made me very self-conscious - I couldn't remember what outfit I had on, and was I sat half in the concrete like some people? I had to use the selfie mode on the camera to at least check my outfit. My sense of proprioception was completely gone with 3rd person or proper arms or legs. I almost felt embarrassed -  a bit like newbie SL users wondering what happens to their avatars when they log out
  • In VR you currently can't multi-task - no checking emails or twitter or working on a document whilst half listening to the seminar. I could take some notes (which this post is derived from) using the in-world tablet, but with a pick keyboard very slow. It also means that the content has got to be ace to keep the attention - and whilst this was OK it wasn't ace and I did find myself almost wishing it was on Zoom so I could also do some other stuff - being in VR, or at least HMD VR didn't really add a lot at this stage
  • The absence of any text chat made the whole event seem very passive. I'm used to SL conference (and see below) where text chat and voice run in parallel (and a good RL/twitter event) so people can side comment and research and have private one-to-ones.
  • This whole text entry in VR is an ongoing issue. As one speaker said voice may be part of the solution, but wouldnt cope with multiple streams very easily. Thinking back, the "classic" image from Neuromancer era Cyberpunk is of the cyber-hacker with a "deck" (keyboard) and VR headset or jack. So why haven't we gone down this route - why can't I get my Bluetooth keyboard to hook up to my VR HMD - probably still a faster option than finger tracking and virtual keyboards (UPDATE: See Facebook announcement).
  • May be able to solve this next time I go in but why couldnt I just sit my virtual tablet on my knees so it doesn't block the view. 
  • Would be really useful if avatars had an HMD/No HMD icon on them. In SL days we also experimented with things like icons to show what timezone you were in so you know if you were talking to someone for whom it was the middle of the night.
  • When the presenters switched to the panel session it was very "realistic" since they now had full bodies and as they naturally moved their arms and head it just looked so natural. I think they should have been given full bodies when they did their own bits for this reason.
  • Really need "teleport" effect as each presenter popped on stage
  • Certainly with a Quest it was impossible to read the smaller print on the slides - just a pixel blur. KEEP TEXT BIG on VR slidedecks.
  • I really missed the SL fly-cam so I could zoom in on slides or presenters, or to get an overview of the site.
  • Why stick to conventional PPT one slide at a time? My standard slide viewer in SL leaves a copy of each viewed slide visible so that people can refer back, and also in questions lets me quickly hop back to slides.
  • The headset weight was noticeable, but bearable for the 2hrs. I noticed the fan humming a lot (it was 23 degrees outside), but actually gave a bit of a cool breeze. I got a power warning about 2h in, but cable is long enough to plug in.
  • No user profiles so I couldn't click on people to find out more about them - either from scripted event badges or their Engage profile.
  • You need a straw if you want to drink an RL drink when wearing a VR HMD!
When formal session ended and it opened up into networking the whole space suddenly felt far more "real". There was certainly that RL anxiety over who to speak to, whether to hand on the edge of a group already engaged with each other or to button-hole the 1 person you may have briefly met. Spatial voice was switched on so it was a very noisy place. In the end I started talking to Christophe, one of the speakers and CEO of Bodyswop VR. We actually had to walk over to a quieter part of the build to talk due to the noise of other discussions (I don't think cocktail effect works in VR). Again animation of the hands and head and pretty good "gabber" for the mouth all made it seem sort of natural - probably the weight of the HMD was the thing that anchored me most back to this being "virtual". In the end Christophe and I both noticed how quiet it had got and looking around found we were the only people left - so we obviously had a good chat, just as good as we'd have managed in RL.



So overall a seminar of two halves - some basic SL era lessons to be learned, some affordances and challenges of HMDs to be dealt with, and apart from the desire to multi-task an improvement on most Zoom calls - at least I had the sense of being there in that place with everyone.

Second Life

Pity the SL images came out so dark - should have turned the sun up!


Two hour later, post 8pm clap, and I'm in Second Life for a meeting of the Virtual Worlds Education Roundtable to listen to Mark Childs of the OU (and long time SL/RL colleague) talk about "Choose your reality".

A slightly smaller crowd (~20), most long term SL residents, some newer, all passionate RL educators and SL enthusiasts. Only a few had every tried HMD VR. This session was on the standard (only) SL interface of 2D/3D on a PC screen driving your avatar in 1st or 3rd person.

In contrast to the formal ampitheatre space in Engage everyone started sat around a large outdoor table, or in deck chairs aroudn the edge. But once Mark got going we never saw our chair (or sat) again!

Mark had a number of questions for us to rate out of 5 and discuss. All very combinations of how good is RL/SL/VR in terms of ease of use/creativity/fun. Mark used a novel variation of a walk map. A walk-map is where you put a big graphic on the floor and have people walk to the relevant point on it that reflects what is being discussed or their view (so it could be a process map, a 2x2 matrix, a set of post-it note topics etc). But in this particular system (the Opinionator?) you walked in to the coloured and number "pen" for your choice and then a central pie chart dynamically adjusted itself to show the relevant spread of people. Neat! And remember that this was built and scripted by an SL user, not by Linden Lab. One enterprising attendee was then taking photos of the central pie and posting them onto panels around the event to provide a history.



Most of the discussion was on text-chat, and only some on voice. This is not only often easier to follow but encourages more people to contribute and provides an immediate record to circulate and analyse afterwards. A few people used voice, and the balance was about right.

Every avatar looked unique, not the clones of Engage, and being SL many looked incredibly stylish (my jeans and jacket based on my RL ones looking pretty faded in comparison). The costuming really helps with 2 things 1) remembering who is who and 2) getting some sense of how the person wants to project themselves - which may of course be different to (or more a more honest reflection of?) their RL personality.

I could happily multi-task, so whilst I was typing furiously I could also keep one eye on the Clueless Tweetalong streaming by on my iPad.

As well as the main text chat a couple of people DM'd me so we could have side chats and renew Friend links.

It was only a 1 hour session, but full-one  the whole time and making pretty full use of the capabilities of the platform and of "virtual reality".

Thoughts


Of course this is a bit of an apples and pears comparison in terms of events, and possibly in terms of platforms, and I know that Engage does have some collaboration tools (although they do seem to slavishly follow RL). At the moment (and probably forever) Engage is a meeting, conferencing, training and collaboration space, whereas SL is a true virtual world - with more or less full agency and with full persistence. One of the presenters at the engage event talked about the different platforms identifying their own furrow and sticking to it, and I'm sure that that's what Engage and Linden Lab will do, and certainly what we're doing with Trainingscapes.

One final point though was around Mark's comparison of SL to RL and VR. One participant talked about how we should think in terms of multiple realities rather than extended realities. SL in particular isnt just an extension of  RL, it is its own reality. The point that got me though was comparing SL to VR. Back in the day SL was defined as VR, in the sense of being a "virtual" reality. Nowadays of course VR is associated with HMD delivered experiences - but back the Oculus DK-1 days there was an HMD enabled browser for Second Life, and I've certainly experienced SL through a VR HMD (walking through our Virtual Library of  Birmingham), and it was as good as any other VR experience a that time.

Virtual Library of  Birmingham in SL through Oculus DK1

So to me comparing SL to "VR" is perhaps a category error (but an acceptable - if lazy :-) - shorthand). The distinction is perhaps between true virtual worlds (VWs - with full agency/persistence as in SL) and more constrained Virtual Environments (CVEs, the MUVEs beloved of academics) - SL being just the most real-life-like MUVE and least constrained VE. I feel a 2x2 grid coming on........







19 May 2020

DadenU Day: GraphQL

From Steven:

GraphQL is a data query language to make it easier and more intuitive to use APIs. Existing APIs use fixed endpoints to give the user what they want, however, the fixed nature means that that endpoint can give too much or too little information. These are called over-fetching and under-fetching. Over-fetching uses more intensive database calls on the server and more bandwidth, whereas under-fetching requires more API calls and more complexity on the client. GraphQL allows the user to define what data they want.

I used a prewritten example to experiment with this in the C# library GraphQL for .NET. The example includes a nice GUI playground to test queries. An example GraphQL query is show in Figure 1.



Figure 1:An example query from the playground.

The GraphQL query consists of a type “query”, a name “TestQuery”, a reference to the query to query “reservations”, a list of arguments to the query, and a list of fields to include in the result. This allows the ability to include only the fields you want and no more. It is passed in a standard get or post request to /graphql by default, so very easy to use.

The result of this GraphQL query is shown in Figure 2. It is in JSON format so is easily read by humans and easily parsed with standard libraries. It looks similar in structure to the query, which allows quick checking of the results.




Figure 2:The result from the query in Figure 1.

The example uses a simple hotel reservation system with rooms, reservations and guests. Each of these has its own C# class as normal. To make the GraphQL classes, we need to define a new ObjectGraphType that takes the existing type as a generic parameter as in Figure 3.



Figure 3:The reservation ObjectGraphType. It takes the existing Reservation type as a generic parameter, but fields still need to be defined in the constructor.


Each property in that type must then be given in the constructor by applying the Field method to it. Complex properties are defined manually by giving the type as a generic parameter and the string for querying, though this seems like a library limitation.

A GraphQL query is defined as another ObjectGraphType where the Field method defines the name of the query, a list of arguments to pick up on, and a resolve method that is called to resolve the GraphQL query using the defined arguments. This is shown in Figure 4. The return type is a List of Reservations as expected, but each type is its counterpart in GraphQL.



Figure 4:The reservation query. The argument and resolve parameters are defined unlike in Figure 3.

The resolve function gets passed a context, which contains all the arguments and subfields from the GraphQL query. In the function you can then build up a query to access data depending on what is in the GraphQL query. The arguments can end up triggering complex filters, not just equality checks, and could include sorting.

In GraphQL, there are not just “queries”, there are also “mutations” that allow data change, and “subscriptions” that allow real-time updates. These are wrapped up in a schema, although I am only using queries here. The schema is shown in Figure 5.



Figure 5:The schema used in the example.

All these classes are made available through dependency injection in Startup.cs as shown in Figure 6. Every GraphQL type needs added, and the Query is retrieved in the Schema through the service provider.



Figure 6:The Startup.cs showing the level of dependancy injection required.

The resolve function was originally a list of if-else statements with similar structure. I changed it to a series of chained calls to the same function to remove code duplication and improve readability. I also added conditional inclusion so that the extra fields are only included if they exist in the GraphQL query. This cuts down on the cost of database calls. These methods are shown in Figure 7.

Overall GraphQL is something I will consider in a future project. Once the initial hurdle has been overcome it is powerful, and can be backed up by a standard API if necessary.

Expressions



Figure 7:IQueryable extensions to enable conditional including and generic equal functions.

I wanted to be able to pass a lambda to select a field in the class, a string for the argument and a list of validation functions with messages. I am using Entity Framework Core (EF) to do the database calls, so to avoid execution of the query until the end, I had to write the lambda as an expression. Expressions are the form the C# compiler keeps the function logic until they are compiled and are also used by EF to translate queries into SQL, instead of C#.

In C# you can define a lambda as an Expression<Func<>> and C# will automatically convert the lambda into an expression. However, building on an expression requires you to use the expression tree API and define every little part of the lambda including parameters to build up the tree. In the AddEqual method, you can see the method I wanted to write commented out at the end of the return line. The expression tree building took four statements to build up, by defining the next small bit of the function its own statement. In the end though, it allows the same method to be used for a generic type where you want to check equality in an EF query.

As an aside, checking equality generically for all types in a function (value vs reference, nullable vs non-nullable) required a call to EqualityComparer<T>.Default.Equals(x, default) instead of just using == or .Equals().

In the Include function I had to pass an expression and examine the PropertyInfo to check if that property exists in the subfields.

18 May 2020

DadenU Day: Virtual World/VR Conferencing


For my DadenU Day I decided to check out some of the VR virtual conferencing environments which are around at the moment (apps seems too limiting, but they lack the agency and persistency to be worlds). I managed to squeeze 4 into the day: EngageVR, VirBela, SomniumSpace and Mozilla Hubs. All comments are based on about an hours play in each, so I may well have missed or misunderstood features.

EngageVR



EngageVR (https://engagevr.io/) is the one that seems to be getting the most attention at the moment, and it is pretty slick. Although primarily aimed at VR the 2D/3D interface is fine, and recognises that a lot of people who want to do this sort of virtual conference don't yet (or ever will) have a VR headset.

After a nice avatar designer your dropped into a virtual lecture theatre for a basic tutorial. All "experiences"/environments are accessed through a Oculus style home space and tiled menu. As well as watching a recording (see below) of a panel debate I also wandered around Mars and the Moon (obligatory for VR).

The basics work really well, but the positives that really stood out were:

  • Your avatar has arms as well as hands, and the IK is pretty good
  • You have feet, and legs! When you walk your legs sometimes hang doll like, but other times they get traction and try and walk (although often more slowly than you!). The neatest trick though is that if you bend down your knees bend - even though there is no knees/leg tracking!
  • You can record a session. This records the 3D data, not the visuals. This means if you replay it you are still in the space and see the action unfold around you (as in the panel session). Really weirdly if you've recorded yourself moving around so see yourself moving - from your "current" avatar - you have a clone! Not sure how many times you can repeat this trick!
  • Load times impressively fast

On the negatives:
  • All content is built by/through Engage, so you have minimal agency beyond what the experience lets you have. An "author" mode is promised. So whilst on Mars I could rez a dinosaur and click on points of interest on Curiosity that was it.
  • There is a big difference between the 2D/3D graphics (great) and the Oculus Quest graphics (lower rez) - particularly noticeable on Mars. Obvious impact of the lower memory and power of the Quest headset, but a reasonable way of addressing it.
  • Had to sideload onto Quest - but manageable through Sidequest.
  • Didn't spot text chat (which would be hard in HR, but near essential in 2D/3D)

Overall a very impressive platform, and one which we'd probably have clients consider if there focus is more on 3D/VR events than training.

VirBela


Seen quite a few VirBela (https://www.virbela.com/) events being held recently - Laval Virtual in particular. The whole place has a deliberately cartoony look, and feels a bit like ActiveWorlds did in the late 90s, but with more doll like avatars. Again there's a quick avatar designer and then you arrive at a central plaza (very AW). No tutorial or anything. Information boards tell you a bit about the place and what you can do, and you can TP to example private office suites.

Pros:

  • Very easy set up and access
Cons:
  • VR only on pro
  • Cartoony look probably wont suite most corporate (UK) users
  • No agency or building, very much for virtual meetings/conferences

Overall simple but works well, but not sure the look is for most of our clients.


Somnium Space


I keep hearing about this one (https://www.somniumspace.com/), and wasn't sure what to expect. Overall it felt a bit like Second Life Alpha c.2004 (actually not that good) or early High Fidelity. It is very aiming at a persistent VW rather than a conference/training space. Huge download, and VR promised for 2020. There is scripting (LUA?) and building a la SL, but it that's what you want why not just to go to SL. They also have an SL like land model, although backed by blockchain. I guess they'd say their differentiation is blockchain (so what) and VR building (when it comes). If SL had VR then I think any need for SS would just disappear. Couldn't really get much to work, and very laggy. Maybe check back in a year.

Trying to build/terraform

Mozilla Hubs



Again heard a bit about this one (https://hubs.mozilla.com/#/). Feels like Google Lively more than anything else. Very angular and low rez, and a weird perspective so its hard to tell if an object is small and close, or big and far away! Trying to build anything complex would be a pain. You can though just drop in objects from Google Poly or Sketchfab. Probably more of a fun space to get kids to build things in, and people are using it for more serious work, but probably not for most of our clients. Be an interesting challenge to build a very "serious" space in it though.

A more "serious" space - til I brought the Elephant in!

The avatars are trunk and head only.



Comparing to Trainingscapes

Coming back to Trainingscapes after those 4 actually felt quite liberating. Would love to have EngageVrs recording and avatars, but would probably trade that for the ability to build and create things (which any non-student account can do) and have agency. And for persistence SL still seems streaks ahead. But I can certainly see that EngageVR (and possibly for the right client VirBela) would be a good option for clients after virtual meetings conferences. But then again if they want to do more than sit and listen they're stuck - so not really for collaborative activities, you couldn't do this for instance:




There's also no sign of any of them working on mobile/tablets which Trainingscapes does!

I'll try and test out a few more worlds this week, and then dive back into SL/Open Sim.