Scriptable Objects

Bady Mebarki,
XR Developer @Numix

Today I'm going to introduce you to one of the ingredients behind the technical success of our DeepTwin solution. But as with Coca-Cola, we won't reveal the exact dosage, so as to keep our recipe a secret.

To give you a quick introduction, DeepTwin is our in-house engine, with which we develop our virtual reality training courses.

DeepTwin is a kind of toolbox comprising technological building blocks corresponding to generic needs.

Would you like to retrieve the pedagogical report and track each of your learners by interfacing with your Learning Management System (LMS)? Simply import the module and configure it to meet your requirements!

Would you like to use a collaborative mode to bring several people together for your training course? We have a proven network architecture (local or remote) that can be deployed.

Our solution is much less restrictive and limited than an authoring tool. And because it's our homemade mayonnaise (another culinary metaphor), we can easily create new modules to meet your specific needs.

So you have the perfect balance between an off-the-shelf application and a custom application!

If this introduction has convinced you and you'd like to digitize a training course with us, please don't hesitate to contact us.

THE PROBLEM

As any developer will tell you, it's generally very difficult to reuse the code of a feature made for one project to integrate it into another, if it hasn't been thought of from the outset as an independent module. Just as it's difficult to maintain and test a complex application feature by feature, because everything is interconnected and nothing really works independently.

To address these issues DeepTwin was created. We wanted to design an engine fed by various modules to meet as many customer needs as possible.

But please note that our aim is not to deliver a prefabricated application, because the time we save with these technological building blocks means we can spend more time on the overall quality of the application. And so we can spend more time on the design and development of your specific requirements.

THE GAME CHANGER

In 2017, Unite took place in Austin, Texas, a major event organized by Unity to bring together the international community of creators who use the Unity game engine (with which we develop our serious game solutions).

We weren't able to go to the USA, but fortunately most of the conferences were published onUnity's youtube channel. And since we're in the business of technology watch, my colleagues and I started to watch the videos. Little did we know that a conference would profoundly change the way we design an application on Unity!

Here is the video in question, from Ryan Hipple (Senior Engineer at Schell Games) :

RENAISSANCE ARCHITECTURE

To quickly summarize the video: with a few examples, dear Ryan will show us how Scriptable Objects have become the architectural basis of his projects.

To quickly explain what Scriptable Objects are: they are data containers that need to be pre-configured. These containers can be used, for example, to create a database.

But Ryan isn't just going to decentralize data with Scriptables Objects, he's also going to enable that data to execute code when it's updated.

In the video, Ryan illustrates this system with life point management. When the player loses health points, the health bar automatically updates, whereas the "Player" and "Health Bar" components are not linked and don't know each other. The only thing they have in common is the reference to the "Life Points" Scriptable Object. When updated by the "Player", it will execute code on the "Life Bar" side to update itself visually.

That's when your face should show a subtle mixture of bewilderment and euphoria, because yes, we're going to have decentralized elements to which we can subscribe functions!

According to Ryan, this way of organizing his code makes his project :

  • Modular, because systems will no longer be strongly interdependent,
  • Editable, for easy configuration even by non-developers, and faster test times
  • Debuggable, because behavior is isolated

AN IMAGE IS WORTH A THOUSAND LINES OF CODE

I'm going to illustrate this now, without showing a single line of code, so as not to scare off the most sensitive of you.

To access certain values, such as session duration, we needed the " ScenarioManager " script as a reference.

And each time this value was updated, the " ScenarioManager " script was responsible for updating the value in the other scripts. On the diagram, you can see the back and forth that this interdependence entails.

Basically, it's as if a chef had to tell each of his assistants every time a dish was ready to come out of the oven.

In the screenshot above you can see Scriptable Objects type " NumixEvent ". This is equivalent to the scripts Ryan had named " GameEvent " but with a Numix twist. And if you've followed, it's all about data containers.

Here's a screenshot of the " InGame menu " which the user can open during the game. The dynamic content of this interface, i.e., title, duration, completion rate and number of steps completed, is managed via the Scriptable Objects.

As shown in this diagram, session duration is used by different components.

As a result, they are linked only to the Scriptable Object instead of being linked to a script. This reduces dependency between components and makes it easy, for example, to add or remove UI elements. Thanks to this architecture, you can also quickly test the UI by modifying the Scriptable Object itself.

To return to our comparison with the kitchen, with this approach, the oven triggers an alarm when the dish is ready, so all the staff are aware of this and will process the information as they see fit.

CONCLUSION

So you see, our DeepTwin engine also uses Scriptable Objects. And it's thanks to this system that our toolbox is so modular.

So we can easily add and remove features in our projects, because we've taken care not to make them interdependent.
So, as with Coca-Cola, if you don't want sugar, that's fine, but if you want vanilla, we'll be there to guide you towards a better idea.

Founded in 2014 by Jeff Sebrechts and his business partner Amélie Raffenaud, Numix specializes in the creation of Immersive and Digital Learning for its major corporate clients. Real digital twins, these industry -led immersive simulators are known for their technical and pedagogic quality. Forever looking for new challenges, our 15-strong team are developing tomorrow’s tools to revolutionize the training sector.

Share this article

Twitter
Facebook
LinkedIn