TheCodeTherapy / mml

Metaverse Markup Language

Home Page:https://mml.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MML: Metaverse Markup Language

main github actions npm version GitHub top language GitHub license

MML is a markup language for describing 3D multi-user interactive Metaversal objects and experiences based on HTML.

Getting Started

What is MML?

The "MML stack" is a combination of two main pieces usually combined together:

  • MML (Language) - 3D HTML elements and attributes for describing 3D objects and experiences
  • Networked DOM (Networking) - A library and network protocol for running MML/HTML documents on a server so that multiple users can interact with them in a multi-user mode.

MML (Language)

E.g.

<m-cube id="my-cube" color="red"></m-cube>
<script>
  const cube = document.getElementById("my-cube");
  cube.addEventListener("click", () => {
    cube.setAttribute("color", "blue");
  });
</script>

HTML and JavaScript in the form of the DOM (Document Object Model) provide an existing foundation for describing and mutating a hierarchy of elements. MML uses this foundation with new elements and attributes to allow describing 3D concepts.

Network Model

In the common use case an MML document is run on a server and is observed and interacted with by multiple users.

This capability is achieved by running an MML Document on a server using a library (built expressly for MML) called "Networked DOM".

The server and network components necessary to support this multi-user mode are independent of the MML additions to HTML (and can be used with regular 2D HTML).

Combined

The Networked DOM server and MML client can then be used to allow multiple users to interact with the same instance of an object at the same time, and bring these objects into game engines and web virtual world experiences.

Benefits

  • Familiarity: MML is based on HTML, the most common way to author documents for the web. This makes it approachable for a wide range of creators.
  • Ecosystem: the HTML ecosystem is vast, and because MML is based on HTML, creators can take advantage of this existing ecosystem of libraries, frameworks, and learning resources.
  • Portability: MML documents can run in any modern web browser, making them easy to share and view.
  • Composability: MML documents can be composed of multiple documents running on different servers, making it possible to create complex virtual world objects without having to provide all the compute power and technical capability on a single server.

High-Level Package Architecture

Language (MML)

MML is a set of HTML elements and attributes that can be used to describe 3D objects and experiences.

These elements and attributes can be used without networking. However, when a HTML document including MML tags is run on a server and exposed via a websocket multiple users can interact with the same instance of the document at the same time.

Networking (Networked DOM)

MML is based on a set of libraries (built expressly for MML) called "Networked DOM".

The server and network components necessary to support the multi-user mode are independent of the MML additions to HTML (and can be used with regular 2D HTML).

Usage of this repo

This repo contains libraries and schema definitions for MML. The most likely way to use this repo is cloning it as libraries for other projects.

  1. Clone the repo
  2. npm install
  3. npm run iterate Builds and starts incrementally building package artefacts from sources

To use any of the libraries in this repo in another project, you can use npm link to make these dependencies linkable to your other npm project.

  • npm run link-all Runs npm link in all would-be-published packages to allow using as local dependencies to develop with. It will also print the commands to link the dependencies.

Architecture Diagram

The below diagram shows the high-level architecture of the MML system when used in a web browser with the Networked DOM server running an MML document.

graph TD
  subgraph Networked DOM Server
    networked-dom-server[Networked DOM Server]
    networked-dom-document[Networked DOM Document]
    jsdom[JSDOM]
    websocket[Websocket Handler]
    networked-dom-server --> networked-dom-document
    networked-dom-document --> jsdom
  end
  mml-source["MML Source Code (HTML)"]
  mml-source --> networked-dom-document
  subgraph Web Browser
    web-browser[Web Browser]
    subgraph "3D Web Experience"
      three-js-scene[THREE.js Scene]
      subgraph Networked DOM Client
        networked-dom-client[Networked DOM Client]
        dom["DOM (HTML)"]
        networked-dom-client --> dom
      end
      subgraph MML Client Library
        web-browser-mml-client[MML Remote\nDocument Instance]
        mml-three-js[MML THREE.js]
        mml-three-js -- Events --> web-browser-mml-client
        web-browser-mml-client --> mml-three-js
      end
      dom -- Rendered By --> mml-three-js
      mml-three-js -- Composed into --> three-js-scene
    end
  end
  networked-dom-client --> ws-addr
  ws-addr --> websocket
  ws-addr["ws://..."]
  websocket --> networked-dom-server
  web-browser --> web-browser-mml-client
  web-browser-mml-client --> networked-dom-client
Loading


Documentation:

MML is an Open Source markup language designed to facilitate the creation of interactive 3D multi-user experiences.

Building on top of the proven foundations of HTML and JavaScript, MML provides a recognizable environment for creators while extending the capabilities of these technologies for use in shared virtual worlds.

MML was created from the ground up to be multi-user, and it has interoperability and composability in its core values.

Central to MML's applicability for multi-user virtual world applications is the Networked DOM networking model.

By running the logic for a document in one place, separate from the world server, MML enables documents to interact with web service APIs (such as generative AI), be portable across many worlds and engines, and also to be more computationally complex whilst avoiding a lot of challenging race conditions.


Elements:

  • m-group: The m-group element can contain other MML tags, allowing all of them to be transformed as single item.

    Attributes:

    • debug (boolean): A boolean that indicates whether the element should be drawn with debug information (e.g. axes helper). Default value is false.

    • x (float): The position of the element along the X-axis in meters. Default value is 0.

    • y (float): The position of the element along the Y-axis in meters. Default value is 0.

    • z (float): The position of the element along the Z-axis in meters. Default value is 0.

    • rx (float): The rotation of the element around the X-axis in degrees. Default value is 0.

    • ry (float): The rotation of the element around the Y-axis in degrees. Default value is 0.

    • rz (float): The rotation of the element around the Z-axis in degrees. Default value is 0.

    • sx (float): The scale of the element along the X-axis. Default value is 1.

    • sy (float): The scale of the element along the Y-axis. Default value is 1.

    • sz (float): The scale of the element along the Z-axis. Default value is 1.

    • visible (boolean): Whether the element is visible (true) or hidden (false) in the scene. Default value is true.

    • socket (string): The name of a bone in the parent element's skeletal mesh to which this element will be attached. If not specified, the element will attach to the origin of its parent.

    • id (id): A unique identifier for the element, used for selection and manipulation through scripting. It must be unique within the document.

    • class (nmtokens): A space-separated list of class names that can be used for scripting purposes.

    • onclick (script): A script expression that is executed when the element is clicked. Events are also dispatched to "click" event listeners.



  • m-cube: The m-cube element is a primitive 3D cube that can be coloured. It is often used for debugging or initial development purposes.

    Attributes:

    • width (float): The width of the cube in meters. Default value is 1 meter.

    • height (float): The height of the cube in meters. Default value is 1 meter.

    • depth (float): The depth of the cube in meters. Default value is 1 meter.

    • opacity (float): The opacity of the cube, ranging from 0 (completely transparent) to 1 (completely opaque). Default value is 1.

    • debug (boolean): A boolean that indicates whether the element should be drawn with debug information (e.g. axes helper). Default value is false.

    • x (float): The position of the element along the X-axis in meters. Default value is 0.

    • y (float): The position of the element along the Y-axis in meters. Default value is 0.

    • z (float): The position of the element along the Z-axis in meters. Default value is 0.

    • rx (float): The rotation of the element around the X-axis in degrees. Default value is 0.

    • ry (float): The rotation of the element around the Y-axis in degrees. Default value is 0.

    • rz (float): The rotation of the element around the Z-axis in degrees. Default value is 0.

    • sx (float): The scale of the element along the X-axis. Default value is 1.

    • sy (float): The scale of the element along the Y-axis. Default value is 1.

    • sz (float): The scale of the element along the Z-axis. Default value is 1.

    • visible (boolean): Whether the element is visible (true) or hidden (false) in the scene. Default value is true.

    • socket (string): The name of a bone in the parent element's skeletal mesh to which this element will be attached. If not specified, the element will attach to the origin of its parent.

    • collide (boolean): Whether or not this object should participate in collision detection by other systems. Default value is true. If set to true, the object will be considered for collision tests.

    • collision-interval (integer): If set, the time in milliseconds between user collision events being sent to the element. By default collision events are not sent.

    • oncollisionstart (script): A script expression to be executed when a user starts colliding with the element. Receives a CollisionStartEvent.

    • oncollisionmove (script): A script expression to be executed when a user moves the collision point they are colliding at on the element. Receives a CollisionMoveEvent.

    • oncollisionend (script): A script expression to be executed when a user stops colliding with the element. Receives a CollisionEndEvent.

    • color (string): The color of the element. Accepts color values in formats such as "#FF0000", "red", or "rgb(255,0,0)". If not specified, the default color is "white".

    • id (id): A unique identifier for the element, used for selection and manipulation through scripting. It must be unique within the document.

    • class (nmtokens): A space-separated list of class names that can be used for scripting purposes.

    • onclick (script): A script expression that is executed when the element is clicked. Events are also dispatched to "click" event listeners.

    • cast-shadows (boolean): Whether the element casts shadows onto other elements (true) or not (false). Default value is true.



  • m-sphere: The m-sphere element is a primitive 3D sphere that can be coloured. It is often used for debugging or initial development purposes.

    Attributes:

    • radius (float): The radius of the sphere in meters. Default value is 0.5 meters.

    • opacity (float): The opacity of the sphere, ranging from 0 (completely transparent) to 1 (completely opaque). Default value is 1.

    • debug (boolean): A boolean that indicates whether the element should be drawn with debug information (e.g. axes helper). Default value is false.

    • x (float): The position of the element along the X-axis in meters. Default value is 0.

    • y (float): The position of the element along the Y-axis in meters. Default value is 0.

    • z (float): The position of the element along the Z-axis in meters. Default value is 0.

    • rx (float): The rotation of the element around the X-axis in degrees. Default value is 0.

    • ry (float): The rotation of the element around the Y-axis in degrees. Default value is 0.

    • rz (float): The rotation of the element around the Z-axis in degrees. Default value is 0.

    • sx (float): The scale of the element along the X-axis. Default value is 1.

    • sy (float): The scale of the element along the Y-axis. Default value is 1.

    • sz (float): The scale of the element along the Z-axis. Default value is 1.

    • visible (boolean): Whether the element is visible (true) or hidden (false) in the scene. Default value is true.

    • socket (string): The name of a bone in the parent element's skeletal mesh to which this element will be attached. If not specified, the element will attach to the origin of its parent.

    • collide (boolean): Whether or not this object should participate in collision detection by other systems. Default value is true. If set to true, the object will be considered for collision tests.

    • collision-interval (integer): If set, the time in milliseconds between user collision events being sent to the element. By default collision events are not sent.

    • oncollisionstart (script): A script expression to be executed when a user starts colliding with the element. Receives a CollisionStartEvent.

    • oncollisionmove (script): A script expression to be executed when a user moves the collision point they are colliding at on the element. Receives a CollisionMoveEvent.

    • oncollisionend (script): A script expression to be executed when a user stops colliding with the element. Receives a CollisionEndEvent.

    • color (string): The color of the element. Accepts color values in formats such as "#FF0000", "red", or "rgb(255,0,0)". If not specified, the default color is "white".

    • id (id): A unique identifier for the element, used for selection and manipulation through scripting. It must be unique within the document.

    • class (nmtokens): A space-separated list of class names that can be used for scripting purposes.

    • onclick (script): A script expression that is executed when the element is clicked. Events are also dispatched to "click" event listeners.

    • cast-shadows (boolean): Whether the element casts shadows onto other elements (true) or not (false). Default value is true.



  • m-cylinder: The m-cylinder element is a primitive 3D cylinder that can be coloured. It is often used for debugging or initial development purposes.

    Attributes:

    • radius (float): The radius of the cylinder in meters. Default value is 0.5 meters.

    • height (float): The height of the cylinder in meters.

    • opacity (float): The opacity of the cylinder, ranging from 0 (completely transparent) to 1 (completely opaque). Default value is 1.

    • debug (boolean): A boolean that indicates whether the element should be drawn with debug information (e.g. axes helper). Default value is false.

    • x (float): The position of the element along the X-axis in meters. Default value is 0.

    • y (float): The position of the element along the Y-axis in meters. Default value is 0.

    • z (float): The position of the element along the Z-axis in meters. Default value is 0.

    • rx (float): The rotation of the element around the X-axis in degrees. Default value is 0.

    • ry (float): The rotation of the element around the Y-axis in degrees. Default value is 0.

    • rz (float): The rotation of the element around the Z-axis in degrees. Default value is 0.

    • sx (float): The scale of the element along the X-axis. Default value is 1.

    • sy (float): The scale of the element along the Y-axis. Default value is 1.

    • sz (float): The scale of the element along the Z-axis. Default value is 1.

    • visible (boolean): Whether the element is visible (true) or hidden (false) in the scene. Default value is true.

    • socket (string): The name of a bone in the parent element's skeletal mesh to which this element will be attached. If not specified, the element will attach to the origin of its parent.

    • collide (boolean): Whether or not this object should participate in collision detection by other systems. Default value is true. If set to true, the object will be considered for collision tests.

    • collision-interval (integer): If set, the time in milliseconds between user collision events being sent to the element. By default collision events are not sent.

    • oncollisionstart (script): A script expression to be executed when a user starts colliding with the element. Receives a CollisionStartEvent.

    • oncollisionmove (script): A script expression to be executed when a user moves the collision point they are colliding at on the element. Receives a CollisionMoveEvent.

    • oncollisionend (script): A script expression to be executed when a user stops colliding with the element. Receives a CollisionEndEvent.

    • color (string): The color of the element. Accepts color values in formats such as "#FF0000", "red", or "rgb(255,0,0)". If not specified, the default color is "white".

    • id (id): A unique identifier for the element, used for selection and manipulation through scripting. It must be unique within the document.

    • class (nmtokens): A space-separated list of class names that can be used for scripting purposes.

    • onclick (script): A script expression that is executed when the element is clicked. Events are also dispatched to "click" event listeners.

    • cast-shadows (boolean): Whether the element casts shadows onto other elements (true) or not (false). Default value is true.



  • m-light: The m-light element is a light that supports various types (e.g. point, spotlight) and can be coloured.

    Attributes:

    • intensity (float): The intensity of the light in candela (cd). Default value is 1.

    • distance (float): The maximum distance in meters that the light will affect objects. Objects beyond this distance will not be illuminated. Default value is 0, which means the light has no maximum distance.

    • angle (float): The angle of the light in degrees (only applicable to spotlight type). Default value is 45.

    • enabled (boolean): Whether the light is enabled (true) or disabled (false). Default value is true.

    • cast-shadow (boolean): Whether the light cast shadows (true) or not (false). Default value is true.

    • type : No description available.

    • debug (boolean): A boolean that indicates whether the element should be drawn with debug information (e.g. axes helper). Default value is false.

    • x (float): The position of the element along the X-axis in meters. Default value is 0.

    • y (float): The position of the element along the Y-axis in meters. Default value is 0.

    • z (float): The position of the element along the Z-axis in meters. Default value is 0.

    • rx (float): The rotation of the element around the X-axis in degrees. Default value is 0.

    • ry (float): The rotation of the element around the Y-axis in degrees. Default value is 0.

    • rz (float): The rotation of the element around the Z-axis in degrees. Default value is 0.

    • sx (float): The scale of the element along the X-axis. Default value is 1.

    • sy (float): The scale of the element along the Y-axis. Default value is 1.

    • sz (float): The scale of the element along the Z-axis. Default value is 1.

    • visible (boolean): Whether the element is visible (true) or hidden (false) in the scene. Default value is true.

    • socket (string): The name of a bone in the parent element's skeletal mesh to which this element will be attached. If not specified, the element will attach to the origin of its parent.

    • color (string): The color of the element. Accepts color values in formats such as "#FF0000", "red", or "rgb(255,0,0)". If not specified, the default color is "white".

    • id (id): A unique identifier for the element, used for selection and manipulation through scripting. It must be unique within the document.

    • class (nmtokens): A space-separated list of class names that can be used for scripting purposes.

    • onclick (script): A script expression that is executed when the element is clicked. Events are also dispatched to "click" event listeners.



  • m-plane: The m-plane element is a primitive 3D plane that can be coloured.

    Attributes:

    • width (float): The width of the plane in meters. Default value is 1 meter.

    • height (float): The height of the plane in meters. Default value is 1 meter.

    • opacity (float): The opacity of the plane, ranging from 0 (completely transparent) to 1 (completely opaque). Default value is 1.

    • debug (boolean): A boolean that indicates whether the element should be drawn with debug information (e.g. axes helper). Default value is false.

    • x (float): The position of the element along the X-axis in meters. Default value is 0.

    • y (float): The position of the element along the Y-axis in meters. Default value is 0.

    • z (float): The position of the element along the Z-axis in meters. Default value is 0.

    • rx (float): The rotation of the element around the X-axis in degrees. Default value is 0.

    • ry (float): The rotation of the element around the Y-axis in degrees. Default value is 0.

    • rz (float): The rotation of the element around the Z-axis in degrees. Default value is 0.

    • sx (float): The scale of the element along the X-axis. Default value is 1.

    • sy (float): The scale of the element along the Y-axis. Default value is 1.

    • sz (float): The scale of the element along the Z-axis. Default value is 1.

    • visible (boolean): Whether the element is visible (true) or hidden (false) in the scene. Default value is true.

    • socket (string): The name of a bone in the parent element's skeletal mesh to which this element will be attached. If not specified, the element will attach to the origin of its parent.

    • collide (boolean): Whether or not this object should participate in collision detection by other systems. Default value is true. If set to true, the object will be considered for collision tests.

    • collision-interval (integer): If set, the time in milliseconds between user collision events being sent to the element. By default collision events are not sent.

    • oncollisionstart (script): A script expression to be executed when a user starts colliding with the element. Receives a CollisionStartEvent.

    • oncollisionmove (script): A script expression to be executed when a user moves the collision point they are colliding at on the element. Receives a CollisionMoveEvent.

    • oncollisionend (script): A script expression to be executed when a user stops colliding with the element. Receives a CollisionEndEvent.

    • color (string): The color of the element. Accepts color values in formats such as "#FF0000", "red", or "rgb(255,0,0)". If not specified, the default color is "white".

    • id (id): A unique identifier for the element, used for selection and manipulation through scripting. It must be unique within the document.

    • class (nmtokens): A space-separated list of class names that can be used for scripting purposes.

    • onclick (script): A script expression that is executed when the element is clicked. Events are also dispatched to "click" event listeners.

    • cast-shadows (boolean): Whether the element casts shadows onto other elements (true) or not (false). Default value is true.



  • m-model: The m-model element is a 3D model. It can be used to load and display various 3D model file formats, such as OBJ, FBX, or GLTF, depending on the rendering engine being used. The model can be positioned, rotated, and scaled within the 3D scene. It also supports animations.

    Attributes:

    • src (uri): The source URI of the 3D model file. Supported formats may vary depending on the rendering engine used.

    • anim (uri): The source URI of the animation file, if applicable. Supported formats may vary depending on the rendering engine used.

    • anim-loop (boolean): Whether the animation should loop (true) or play once (false). Default value is true.

    • anim-enabled (boolean): Whether the animation is enabled (true) or disabled (false). Default value is true.

    • anim-start-time (integer): The time in milliseconds since the start of the document lifecycle when the animation should begin. Default value is 0.

    • anim-pause-time (integer): The time in milliseconds since the start of the document lifecycle when the animation should pause. If there is no value the animation will not be paused.

    • debug (boolean): A boolean that indicates whether the element should be drawn with debug information (e.g. axes helper). Default value is false.

    • x (float): The position of the element along the X-axis in meters. Default value is 0.

    • y (float): The position of the element along the Y-axis in meters. Default value is 0.

    • z (float): The position of the element along the Z-axis in meters. Default value is 0.

    • rx (float): The rotation of the element around the X-axis in degrees. Default value is 0.

    • ry (float): The rotation of the element around the Y-axis in degrees. Default value is 0.

    • rz (float): The rotation of the element around the Z-axis in degrees. Default value is 0.

    • sx (float): The scale of the element along the X-axis. Default value is 1.

    • sy (float): The scale of the element along the Y-axis. Default value is 1.

    • sz (float): The scale of the element along the Z-axis. Default value is 1.

    • visible (boolean): Whether the element is visible (true) or hidden (false) in the scene. Default value is true.

    • socket (string): The name of a bone in the parent element's skeletal mesh to which this element will be attached. If not specified, the element will attach to the origin of its parent.

    • collide (boolean): Whether or not this object should participate in collision detection by other systems. Default value is true. If set to true, the object will be considered for collision tests.

    • collision-interval (integer): If set, the time in milliseconds between user collision events being sent to the element. By default collision events are not sent.

    • oncollisionstart (script): A script expression to be executed when a user starts colliding with the element. Receives a CollisionStartEvent.

    • oncollisionmove (script): A script expression to be executed when a user moves the collision point they are colliding at on the element. Receives a CollisionMoveEvent.

    • oncollisionend (script): A script expression to be executed when a user stops colliding with the element. Receives a CollisionEndEvent.

    • id (id): A unique identifier for the element, used for selection and manipulation through scripting. It must be unique within the document.

    • class (nmtokens): A space-separated list of class names that can be used for scripting purposes.

    • onclick (script): A script expression that is executed when the element is clicked. Events are also dispatched to "click" event listeners.

    • cast-shadows (boolean): Whether the element casts shadows onto other elements (true) or not (false). Default value is true.



  • m-character: The m-character element is a 3D character. It supports containing other m-model elements, allowing for composing a character from multiple models.

    Attributes:

    • src (uri): The source URI of the 3D character model file. Supported formats may vary depending on the rendering engine used.

    • anim (uri): The source URI of the character animation file, if applicable. Supported formats may vary depending on the rendering engine used.

    • anim-loop (boolean): Whether the character animation should loop (true) or play once (false). Default value is true.

    • anim-enabled (boolean): Whether the character animation is enabled (true) or disabled (false). Default value is true.

    • anim-start-time (integer): The time in milliseconds since the start of the document lifecycle when the character animation should begin. Default value is 0.

    • anim-pause-time (integer): The time in milliseconds since the start of the document lifecycle when the character animation should pause. If there is no value the animation will not be paused.

    • debug (boolean): A boolean that indicates whether the element should be drawn with debug information (e.g. axes helper). Default value is false.

    • x (float): The position of the element along the X-axis in meters. Default value is 0.

    • y (float): The position of the element along the Y-axis in meters. Default value is 0.

    • z (float): The position of the element along the Z-axis in meters. Default value is 0.

    • rx (float): The rotation of the element around the X-axis in degrees. Default value is 0.

    • ry (float): The rotation of the element around the Y-axis in degrees. Default value is 0.

    • rz (float): The rotation of the element around the Z-axis in degrees. Default value is 0.

    • sx (float): The scale of the element along the X-axis. Default value is 1.

    • sy (float): The scale of the element along the Y-axis. Default value is 1.

    • sz (float): The scale of the element along the Z-axis. Default value is 1.

    • visible (boolean): Whether the element is visible (true) or hidden (false) in the scene. Default value is true.

    • socket (string): The name of a bone in the parent element's skeletal mesh to which this element will be attached. If not specified, the element will attach to the origin of its parent.

    • collide (boolean): Whether or not this object should participate in collision detection by other systems. Default value is true. If set to true, the object will be considered for collision tests.

    • collision-interval (integer): If set, the time in milliseconds between user collision events being sent to the element. By default collision events are not sent.

    • oncollisionstart (script): A script expression to be executed when a user starts colliding with the element. Receives a CollisionStartEvent.

    • oncollisionmove (script): A script expression to be executed when a user moves the collision point they are colliding at on the element. Receives a CollisionMoveEvent.

    • oncollisionend (script): A script expression to be executed when a user stops colliding with the element. Receives a CollisionEndEvent.

    • id (id): A unique identifier for the element, used for selection and manipulation through scripting. It must be unique within the document.

    • class (nmtokens): A space-separated list of class names that can be used for scripting purposes.

    • onclick (script): A script expression that is executed when the element is clicked. Events are also dispatched to "click" event listeners.

    • cast-shadows (boolean): Whether the element casts shadows onto other elements (true) or not (false). Default value is true.



  • m-frame: The m-frame element is a 3D frame. It enables composing other MML documents into the document and transforming them as a unit.

    Attributes:

    • src (uri): The source URI of the MML document to be embedded within the current document.

    • min-x (float): The minimum X coordinate of the frame's contents in meters. If not specified, the content is not constrained.

    • max-x (float): The maximum X coordinate of the frame's contents in meters. If not specified, the content is not constrained.

    • min-y (float): The minimum Y coordinate of the frame's contents in meters. If not specified, the content is not constrained.

    • max-y (float): The maximum Y coordinate of the frame's contents in meters. If not specified, the content is not constrained.

    • min-z (float): The minimum Z coordinate of the frame's contents in meters. If not specified, the content is not constrained.

    • max-z (float): The maximum Z coordinate of the frame's contents in meters. If not specified, the content is not constrained.

    • load-range (float): The distance in meters from the observer at which the frame will be loaded. If bounds are specified for the frame then the range is a box expanded by this value from the bounds. If no value is specified, the frame will be loaded regardless of distance.

    • unload-range (float): The distance beyond the load-range that the frame stay loaded for if currently loaded. This prevents rapid changes between loading and unloading. Default value is 1 meter.

    • debug (boolean): A boolean that indicates whether the element should be drawn with debug information (e.g. axes helper). Default value is false.

    • x (float): The position of the element along the X-axis in meters. Default value is 0.

    • y (float): The position of the element along the Y-axis in meters. Default value is 0.

    • z (float): The position of the element along the Z-axis in meters. Default value is 0.

    • rx (float): The rotation of the element around the X-axis in degrees. Default value is 0.

    • ry (float): The rotation of the element around the Y-axis in degrees. Default value is 0.

    • rz (float): The rotation of the element around the Z-axis in degrees. Default value is 0.

    • sx (float): The scale of the element along the X-axis. Default value is 1.

    • sy (float): The scale of the element along the Y-axis. Default value is 1.

    • sz (float): The scale of the element along the Z-axis. Default value is 1.

    • visible (boolean): Whether the element is visible (true) or hidden (false) in the scene. Default value is true.

    • socket (string): The name of a bone in the parent element's skeletal mesh to which this element will be attached. If not specified, the element will attach to the origin of its parent.

    • id (id): A unique identifier for the element, used for selection and manipulation through scripting. It must be unique within the document.

    • class (nmtokens): A space-separated list of class names that can be used for scripting purposes.



  • m-audio: The m-audio element is used to play audio in a 3D scene.

    Attributes:

    • src (uri): The source URI of the audio file. Supported formats may vary depending on the rendering engine used.

    • loop (boolean): Whether the audio should loop (true) or play once (false). Default value is true.

    • loop-duration (float): The duration in seconds of the audio loop if loop is true. Can be shorter or longer than the audio file duration. Durations longer than the audio file will add silence. If not specified, the entire audio file will loop.

    • enabled (boolean): Whether the audio is enabled (true) or disabled (false). Default value is true.

    • volume (float): The volume of the audio, ranging from 0 (silent) to 1 (maximum volume). Default value is 1.

    • cone-angle (float): The angle in degrees within which sound is at full volume. Default value is 360 (the sound is not directional).

    • cone-falloff-angle (float): The angle in degrees beyond which sound is inaudible. Must be greater than cone-angle to have an effect. Default value is 0 (there is no gradual drop-off).

    • start-time (integer): The time in milliseconds since the start of the document lifecycle when the audio should start playing. Default value is 0.

    • pause-time (integer): The time in milliseconds since the start of the document lifecycle when the audio should pause. If there is no value the audio will not be paused.

    • debug (boolean): A boolean that indicates whether the element should be drawn with debug information (e.g. axes helper). Default value is false.

    • x (float): The position of the element along the X-axis in meters. Default value is 0.

    • y (float): The position of the element along the Y-axis in meters. Default value is 0.

    • z (float): The position of the element along the Z-axis in meters. Default value is 0.

    • rx (float): The rotation of the element around the X-axis in degrees. Default value is 0.

    • ry (float): The rotation of the element around the Y-axis in degrees. Default value is 0.

    • rz (float): The rotation of the element around the Z-axis in degrees. Default value is 0.

    • sx (float): The scale of the element along the X-axis. Default value is 1.

    • sy (float): The scale of the element along the Y-axis. Default value is 1.

    • sz (float): The scale of the element along the Z-axis. Default value is 1.

    • visible (boolean): Whether the element is visible (true) or hidden (false) in the scene. Default value is true.

    • socket (string): The name of a bone in the parent element's skeletal mesh to which this element will be attached. If not specified, the element will attach to the origin of its parent.

    • id (id): A unique identifier for the element, used for selection and manipulation through scripting. It must be unique within the document.

    • class (nmtokens): A space-separated list of class names that can be used for scripting purposes.



  • m-image: The m-image element is used to display an image in a 3D scene.

    Attributes:

    • src (uri): The source URI of the image file. Supported formats may vary depending on the rendering engine used.

    • width (float): The width of the image in meters. Default value is 1 meter.

    • height (float): The height of the image in meters. Default value is 1 meter.

    • emissive (float): The emissiveness strength of the image (how much perceived light it will emit). Default value is 0.

    • opacity (float): The opacity of the image, ranging from 0 (completely transparent) to 1 (completely opaque). Default value is 1.

    • debug (boolean): A boolean that indicates whether the element should be drawn with debug information (e.g. axes helper). Default value is false.

    • x (float): The position of the element along the X-axis in meters. Default value is 0.

    • y (float): The position of the element along the Y-axis in meters. Default value is 0.

    • z (float): The position of the element along the Z-axis in meters. Default value is 0.

    • rx (float): The rotation of the element around the X-axis in degrees. Default value is 0.

    • ry (float): The rotation of the element around the Y-axis in degrees. Default value is 0.

    • rz (float): The rotation of the element around the Z-axis in degrees. Default value is 0.

    • sx (float): The scale of the element along the X-axis. Default value is 1.

    • sy (float): The scale of the element along the Y-axis. Default value is 1.

    • sz (float): The scale of the element along the Z-axis. Default value is 1.

    • visible (boolean): Whether the element is visible (true) or hidden (false) in the scene. Default value is true.

    • socket (string): The name of a bone in the parent element's skeletal mesh to which this element will be attached. If not specified, the element will attach to the origin of its parent.

    • collide (boolean): Whether or not this object should participate in collision detection by other systems. Default value is true. If set to true, the object will be considered for collision tests.

    • collision-interval (integer): If set, the time in milliseconds between user collision events being sent to the element. By default collision events are not sent.

    • oncollisionstart (script): A script expression to be executed when a user starts colliding with the element. Receives a CollisionStartEvent.

    • oncollisionmove (script): A script expression to be executed when a user moves the collision point they are colliding at on the element. Receives a CollisionMoveEvent.

    • oncollisionend (script): A script expression to be executed when a user stops colliding with the element. Receives a CollisionEndEvent.

    • id (id): A unique identifier for the element, used for selection and manipulation through scripting. It must be unique within the document.

    • class (nmtokens): A space-separated list of class names that can be used for scripting purposes.

    • cast-shadows (boolean): Whether the element casts shadows onto other elements (true) or not (false). Default value is true.



  • m-video: The m-video element is used to display a video in a 3D scene.

    Attributes:

    • src (uri): The source URI of the video file. Supported formats may vary depending on the rendering engine used.

            Some engines support streaming video using WHEP (WebRTC video streaming). In this case, the URI should use the protocol "whep://" rather than "https://".
      
    • width (float): The width of the video in meters. Default value is 1 meter.

    • height (float): The height of the video in meters. Default value is 1 meter.

    • emissive (float): The emissiveness strength of the video (how much perceived light it will emit). Default value is 0.

    • loop (boolean): Whether the video should loop (true) or play once (false). Default value is true.

    • enabled (boolean): Whether the video is enabled (true) or disabled (false). Default value is true.

    • volume (float): The volume of the video's audio, ranging from 0 (silent) to 1 (maximum volume). Default value is 1.

    • start-time (integer): The time in milliseconds since the start of the document lifecycle when the video should start playing. Default value is 0.

    • pause-time (integer): The time in milliseconds since the start of the document lifecycle when the video should pause. If there is no value the video will not be paused.

    • debug (boolean): A boolean that indicates whether the element should be drawn with debug information (e.g. axes helper). Default value is false.

    • x (float): The position of the element along the X-axis in meters. Default value is 0.

    • y (float): The position of the element along the Y-axis in meters. Default value is 0.

    • z (float): The position of the element along the Z-axis in meters. Default value is 0.

    • rx (float): The rotation of the element around the X-axis in degrees. Default value is 0.

    • ry (float): The rotation of the element around the Y-axis in degrees. Default value is 0.

    • rz (float): The rotation of the element around the Z-axis in degrees. Default value is 0.

    • sx (float): The scale of the element along the X-axis. Default value is 1.

    • sy (float): The scale of the element along the Y-axis. Default value is 1.

    • sz (float): The scale of the element along the Z-axis. Default value is 1.

    • visible (boolean): Whether the element is visible (true) or hidden (false) in the scene. Default value is true.

    • socket (string): The name of a bone in the parent element's skeletal mesh to which this element will be attached. If not specified, the element will attach to the origin of its parent.

    • collide (boolean): Whether or not this object should participate in collision detection by other systems. Default value is true. If set to true, the object will be considered for collision tests.

    • collision-interval (integer): If set, the time in milliseconds between user collision events being sent to the element. By default collision events are not sent.

    • oncollisionstart (script): A script expression to be executed when a user starts colliding with the element. Receives a CollisionStartEvent.

    • oncollisionmove (script): A script expression to be executed when a user moves the collision point they are colliding at on the element. Receives a CollisionMoveEvent.

    • oncollisionend (script): A script expression to be executed when a user stops colliding with the element. Receives a CollisionEndEvent.

    • id (id): A unique identifier for the element, used for selection and manipulation through scripting. It must be unique within the document.

    • class (nmtokens): A space-separated list of class names that can be used for scripting purposes.

    • cast-shadows (boolean): Whether the element casts shadows onto other elements (true) or not (false). Default value is true.



  • m-label: The m-label element is used to display text on a plane in a 3D scene.

    Attributes:

    • content (string): The text content to be displayed on the label.

    • width (float): The width of the label in meters. Default value is 1 meter.

    • height (float): The height of the label in meters. Default value is 1 meter.

    • emissive (float): The emissiveness strength of the label (how much perceived light it will emit). Default value is 0.

    • font-size (float): The font size of the text in centimeters. Default value is 24 centimeters.

    • font-color (string): The color of the text on the label. Accepts color values in formats such as "#FF0000", "red", or "rgb(255,0,0)". If not specified, the default color is "black".

    • padding (float): The padding around the text in centimeters. Default value is 8 centimeters.

    • alignment : The horizontal alignment of the text. Default value is left.

    • debug (boolean): A boolean that indicates whether the element should be drawn with debug information (e.g. axes helper). Default value is false.

    • x (float): The position of the element along the X-axis in meters. Default value is 0.

    • y (float): The position of the element along the Y-axis in meters. Default value is 0.

    • z (float): The position of the element along the Z-axis in meters. Default value is 0.

    • rx (float): The rotation of the element around the X-axis in degrees. Default value is 0.

    • ry (float): The rotation of the element around the Y-axis in degrees. Default value is 0.

    • rz (float): The rotation of the element around the Z-axis in degrees. Default value is 0.

    • sx (float): The scale of the element along the X-axis. Default value is 1.

    • sy (float): The scale of the element along the Y-axis. Default value is 1.

    • sz (float): The scale of the element along the Z-axis. Default value is 1.

    • visible (boolean): Whether the element is visible (true) or hidden (false) in the scene. Default value is true.

    • socket (string): The name of a bone in the parent element's skeletal mesh to which this element will be attached. If not specified, the element will attach to the origin of its parent.

    • color (string): The color of the element. Accepts color values in formats such as "#FF0000", "red", or "rgb(255,0,0)". If not specified, the default color is "white".

    • id (id): A unique identifier for the element, used for selection and manipulation through scripting. It must be unique within the document.

    • class (nmtokens): A space-separated list of class names that can be used for scripting purposes.

    • onclick (script): A script expression that is executed when the element is clicked. Events are also dispatched to "click" event listeners.

    • cast-shadows (boolean): Whether the element casts shadows onto other elements (true) or not (false). Default value is true.



  • m-position-probe: The m-position-probe element is used to request the position of a user (either camera or avatar depending upon the experience).

    Attributes:

    • range (float): The range from its position that the position probe requests user positions for in meters. Default value is 10 meters.

    • interval (integer): The time in milliseconds between user positions being sent to the position probe. Default value is 1000 (1 second).

    • onpositionenter (script): A script expression to be executed when a user enters the range of the position probe. Receives a PositionEnterEvent.

    • onpositionmove (script): A script expression to be executed when a user moves within the range of the position probe. Receives a PositionMoveEvent.

    • onpositionleave (script): A script expression to be executed when a user leaves the range of the position probe. Receives a PositionLeaveEvent.

    • debug (boolean): A boolean that indicates whether the element should be drawn with debug information (e.g. axes helper). Default value is false.

    • x (float): The position of the element along the X-axis in meters. Default value is 0.

    • y (float): The position of the element along the Y-axis in meters. Default value is 0.

    • z (float): The position of the element along the Z-axis in meters. Default value is 0.

    • rx (float): The rotation of the element around the X-axis in degrees. Default value is 0.

    • ry (float): The rotation of the element around the Y-axis in degrees. Default value is 0.

    • rz (float): The rotation of the element around the Z-axis in degrees. Default value is 0.

    • sx (float): The scale of the element along the X-axis. Default value is 1.

    • sy (float): The scale of the element along the Y-axis. Default value is 1.

    • sz (float): The scale of the element along the Z-axis. Default value is 1.

    • visible (boolean): Whether the element is visible (true) or hidden (false) in the scene. Default value is true.

    • socket (string): The name of a bone in the parent element's skeletal mesh to which this element will be attached. If not specified, the element will attach to the origin of its parent.

    • id (id): A unique identifier for the element, used for selection and manipulation through scripting. It must be unique within the document.

    • class (nmtokens): A space-separated list of class names that can be used for scripting purposes.



  • m-prompt: The m-prompt element is used to request a string from the user when the element is clicked in a 3D scene.

    Attributes:

    • message (string): The message text to be displayed to the user when the prompt is activated.

    • placeholder (string): The hint text displayed in the input field when the prompt is activated.

    • prefill (string): The default text pre-populated in the input field when the prompt is activated.

    • onprompt (script): A script expression to be executed when a user submits their input.

    • debug (boolean): A boolean that indicates whether the element should be drawn with debug information (e.g. axes helper). Default value is false.

    • x (float): The position of the element along the X-axis in meters. Default value is 0.

    • y (float): The position of the element along the Y-axis in meters. Default value is 0.

    • z (float): The position of the element along the Z-axis in meters. Default value is 0.

    • rx (float): The rotation of the element around the X-axis in degrees. Default value is 0.

    • ry (float): The rotation of the element around the Y-axis in degrees. Default value is 0.

    • rz (float): The rotation of the element around the Z-axis in degrees. Default value is 0.

    • sx (float): The scale of the element along the X-axis. Default value is 1.

    • sy (float): The scale of the element along the Y-axis. Default value is 1.

    • sz (float): The scale of the element along the Z-axis. Default value is 1.

    • visible (boolean): Whether the element is visible (true) or hidden (false) in the scene. Default value is true.

    • socket (string): The name of a bone in the parent element's skeletal mesh to which this element will be attached. If not specified, the element will attach to the origin of its parent.

    • id (id): A unique identifier for the element, used for selection and manipulation through scripting. It must be unique within the document.

    • class (nmtokens): A space-separated list of class names that can be used for scripting purposes.



  • m-link: The m-link element is used to open a web address when the element is clicked in a 3D scene.

    The web address is opened in a new tab or window depending on the client implementation.
    
    The `m-link` element has no visual representation in the scene; clicking children of element activates the link.
    

    Attributes:

    • href (string): The web address to open when the link is clicked.

    • debug (boolean): A boolean that indicates whether the element should be drawn with debug information (e.g. axes helper). Default value is false.

    • x (float): The position of the element along the X-axis in meters. Default value is 0.

    • y (float): The position of the element along the Y-axis in meters. Default value is 0.

    • z (float): The position of the element along the Z-axis in meters. Default value is 0.

    • rx (float): The rotation of the element around the X-axis in degrees. Default value is 0.

    • ry (float): The rotation of the element around the Y-axis in degrees. Default value is 0.

    • rz (float): The rotation of the element around the Z-axis in degrees. Default value is 0.

    • sx (float): The scale of the element along the X-axis. Default value is 1.

    • sy (float): The scale of the element along the Y-axis. Default value is 1.

    • sz (float): The scale of the element along the Z-axis. Default value is 1.

    • visible (boolean): Whether the element is visible (true) or hidden (false) in the scene. Default value is true.

    • socket (string): The name of a bone in the parent element's skeletal mesh to which this element will be attached. If not specified, the element will attach to the origin of its parent.

    • id (id): A unique identifier for the element, used for selection and manipulation through scripting. It must be unique within the document.

    • class (nmtokens): A space-separated list of class names that can be used for scripting purposes.



  • m-interaction: The m-interaction element is used to describe an action that a user can take at a point in 3D space.

    Attributes:

    • range (float): The range that this interaction can be used from in meters. Default value is 5 meters.

    • in-focus (boolean): Whether the interaction must be in the direction of the camera to be used. Default value is true.

    • line-of-sight (boolean): Whether the interaction must be visible to the camera to be used. Default value is false.

    • priority (integer): The priority of this interaction. Lower priority interactions will be shown first. Default value is 1.

    • prompt (string): The prompt to be displayed when the interaction is presented to the user.

    • oninteract (script): A script expression that is executed when the element is interacted with. Events are also dispatched to "interact" event listeners.

    • debug (boolean): A boolean that indicates whether the element should be drawn with debug information (e.g. axes helper). Default value is false.

    • x (float): The position of the element along the X-axis in meters. Default value is 0.

    • y (float): The position of the element along the Y-axis in meters. Default value is 0.

    • z (float): The position of the element along the Z-axis in meters. Default value is 0.

    • rx (float): The rotation of the element around the X-axis in degrees. Default value is 0.

    • ry (float): The rotation of the element around the Y-axis in degrees. Default value is 0.

    • rz (float): The rotation of the element around the Z-axis in degrees. Default value is 0.

    • sx (float): The scale of the element along the X-axis. Default value is 1.

    • sy (float): The scale of the element along the Y-axis. Default value is 1.

    • sz (float): The scale of the element along the Z-axis. Default value is 1.

    • visible (boolean): Whether the element is visible (true) or hidden (false) in the scene. Default value is true.

    • socket (string): The name of a bone in the parent element's skeletal mesh to which this element will be attached. If not specified, the element will attach to the origin of its parent.

    • id (id): A unique identifier for the element, used for selection and manipulation through scripting. It must be unique within the document.

    • class (nmtokens): A space-separated list of class names that can be used for scripting purposes.



  • m-chat-probe: The m-chat-probe element is used to receive messages from a chat system. Which chat system that is depends on the client implementation.

    Attributes:

    • range (float): If the sender of a chat message is within this range (in meters) of the chat probe, the message is expected to be forwarded to the probe. Default value is 1 meter.

    • onchat (script): A script expression that is executed when a chat message is forwarded to the probe. The message itself is contained within the message parameter.

    • debug (boolean): A boolean that indicates whether the element should be drawn with debug information (e.g. axes helper). Default value is false.

    • x (float): The position of the element along the X-axis in meters. Default value is 0.

    • y (float): The position of the element along the Y-axis in meters. Default value is 0.

    • z (float): The position of the element along the Z-axis in meters. Default value is 0.

    • rx (float): The rotation of the element around the X-axis in degrees. Default value is 0.

    • ry (float): The rotation of the element around the Y-axis in degrees. Default value is 0.

    • rz (float): The rotation of the element around the Z-axis in degrees. Default value is 0.

    • sx (float): The scale of the element along the X-axis. Default value is 1.

    • sy (float): The scale of the element along the Y-axis. Default value is 1.

    • sz (float): The scale of the element along the Z-axis. Default value is 1.

    • visible (boolean): Whether the element is visible (true) or hidden (false) in the scene. Default value is true.

    • socket (string): The name of a bone in the parent element's skeletal mesh to which this element will be attached. If not specified, the element will attach to the origin of its parent.

    • id (id): A unique identifier for the element, used for selection and manipulation through scripting. It must be unique within the document.

    • class (nmtokens): A space-separated list of class names that can be used for scripting purposes.



  • m-attr-anim: The m-attr-anim element is used to describe document time-synchronized changes to element attributes.

    Attributes:

    • attr (string): The attribute of the parent element that this animation will animate.

    • start (stringorfloat): The value of the attribute that the animation should start at.

    • end (stringorfloat): The value of the attribute that the animation should end at.

    • start-time (integer): The time in milliseconds since the start of the document lifecycle when the animation should start playing. Default value is 0.

    • pause-time (integer): The time in milliseconds since the start of the document lifecycle when the animation should pause. This animation will be considered active if the pause-time has passed. If there is no value the animation will not be paused.

    • duration (integer): The duration of the animation in milliseconds. This is the time taken to go from the start value to the end value (unless ping-pong is enabled). Default value is 1000 (1 second).

    • loop (boolean): Whether this animation should loop indefinitely. Default value is true.

    • easing : The name of the easing function to apply to the animation ratio to achieve effects such as smooth animations. If the attribute is not specified or is empty the animation will be linear.

    • ping-pong (boolean): Whether this animation should go from the start value to the end value, and then return to the start value, all within the time specified by the duration attribute. Default value is false.

    • ping-pong-delay (float): If ping-pong is true then the ping-pong-delay attribute specifies the time in milliseconds that the animation should pause at the start and end values. This time is part of the overall duration (it does not extend the time taken), and as the ping-pong-delay is the time held at both start and end, the total time where the value is held is double the value of ping-pong-delay. Default value is 0.

    • id (id): A unique identifier for the element, used for selection and manipulation through scripting. It must be unique within the document.

    • class (nmtokens): A space-separated list of class names that can be used for scripting purposes.



  • m-attr-lerp: The m-attr-lerp element is used to describe time-transitioned changes to element attributes.

    Attributes:

    • attr (string): The attribute(s) of the parent element that this lerp will animate. Multiple attributes can be specified by separating them with a comma. A value of "all" applies this lerp to all attributes.

    • duration (integer): The duration of the lerp in milliseconds. This is the time taken to go from the previous value of the attribute to the latest value. Default value is 1000 (1 second).

    • easing : The name of the easing function to apply to the lerp ratio to achieve effects such as smooth animations. If the attribute is not specified or is empty the lerp will be linear.

    • id (id): A unique identifier for the element, used for selection and manipulation through scripting. It must be unique within the document.

    • class (nmtokens): A space-separated list of class names that can be used for scripting purposes.



About

Metaverse Markup Language

https://mml.io

License:MIT License


Languages

Language:TypeScript 91.5%Language:HTML 6.2%Language:JavaScript 1.4%Language:Shell 0.9%