An Introduction to MML: Somnia’s core language for defining interoperable objects

22 Jun 2024

Interoperability is a critical aspect of web3, often focusing on the movement of blockchain records across different chains. This is fundamental to creating the future digital economy we envision, but it’s just one layer of the solution needed. 

In order to create a digital asset that can move between spaces you need 3 things:

  • A language which you can define the asset and it’s behavior
  • A way to verify who owns it
  • Experiences and engines that support the language

Metaverse markup language (MML) will be the language that Somnia uses to define interoperable objects and avatars.

What is MML?

Metaverse markup language (MML) is a markup language designed to facilitate the creation of interactive multiplayer experiences (aka a metaverse). MML enables the definition of objects and avatars and their behavior using well-known HTML and JavaScript formats and tools, allowing those objects and avatars to be used across many engines and environments.

The key value of MML is:

  • Familiarity and Ecosystem: MML is based on HTML, making it approachable for a wide range of creators already familiar with web development.
  • Portability: MML documents can run in any modern web browser, and game engine support can be achieved using MML integrations.
  • Composability: Virtual worlds can be composed of multiple documents running on different servers, simplifying the creation of complex virtual spaces.

The architecture of MML allows servers to run interoperable content separate from an experience engine, enabling the loading of a given live instance of interoperable content into one or more virtual worlds. It does this through a networked Document Object Model (DOM), which is basically a programming interface that represents a web document as a tree of objects, allowing scripts to read and manipulate the page’s content, structure, and styles.

Multi user documents

Central to MML’s applicability for multi-user virtual world applications is the Networked DOM networking model. This model separates the logic for a document from the “world” server enabling object logic to be portable across various worlds and engines.

The Networked DOM works by using a WebSocket connection between the document and the client, with the document sending DOM updates to the client to update the state the client sees, and the client sending DOM events to the document to interact with it.

This effect can also be simulated in your browser. Below is an video demonstrating one document seen by multiple clients complete with live editing. You can think of each of these white worlds as their own metaverse.

Getting Started with MML

To start exploring MML and to create your own live MML document that others can access, head over to the MML Starter Project repository which includes a link to run a simple MML document on CodeSandbox, providing a hands-on introduction to MML’s features and capabilities. You can also go to mmleditor.io where you can edit and share MML objects all within the browser.

Up Next: Going Beyond NFTs

The next step is taking MML objects and linking them to NFTs. This solves the ownership verification problem we noted in the opening of this article. This is what the Somnia Object Protocol is looking to solve. To get started with MML head over to mml.io or mmleditor.com. To join the Somnia community for more information go to Twitter and Discord.

Events