githubEdit

Overview

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

Each scene runs inside its own isolated runtime. Within it, it has access to certain global objectsarrow-up-right and can import modulesarrow-up-right from the runtime library.

spinner

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 SDKarrow-up-right with their code, which encapsulates the RPC-style interface of the runtime library and provides a nicer and more comfortable API.

circle-info

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, scenesarrow-up-right 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 globalsarrow-up-right for more details.

Modules

The requirearrow-up-right global function can import modules provided by the runtime libraryarrow-up-right. 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 executionarrow-up-right 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 scenearrow-up-right, and granted by the player.

See permissionsarrow-up-right to learn more.

Last updated