Contributors
Overview

Overview

The Decentraland scene runtime is the sandboxed execution environment where a scene runs its main script.

Each scene runs inside its own isolated runtime. Within it, it has access to certain global objects and can import modules from the runtime library.

R u n t S i c m e e n e R u n t W i o m r R e l u d n m t S o E i c d x m e u p e n l l e e o r l e i r b r a r y R u n t S i c m e e n e

By importing modules from the runtime library, scenes have access a wide array of functionality, including:

  • Create entities and control their behavior
  • Interact with the player
  • Communicate with other players
  • Inspect the state of the world
  • Connect to external services
  • Make web3 payments

In practice, scenes bundle the Decentraland SDK with their code, which encapsulates the RPC-style interface of the runtime library and provides a nicer and more comfortable API.

Note that the SDK is not part of the Decentraland protocol, only the lower-level interfaces are. Scenes can decide whether to bundle the SDK or use alternative libraries.

Global Objects #

Inside the sandboxed environment, scenes assume certain objects and functions are globally available. Some are standard ES2020 objects (like Date or Math), and others are injected by the runtime to implement functionality such as requiring modules, logging messages and scheduling callbacks.

Se globals for more details.

Modules #

The require global function can import modules provided by the runtime library . These modules allow selectively importing utilities such as the ECS or Communications systems.

See the runtime modules section for a comprehensive list.

Execution #

The runtime requires that scenes implement a specific set of methods, and guarantees they will be called according to certain rules.

See execution for more on this.

Permissions #

Sensitive functionality, such as making HTTP requests to 3rd party services, is restricted by the runtime unless certain permissions are requested by the scene , and granted by the player.

See permissions to learn more.