# Overview

The Decentraland scene runtime is the sandboxed execution environment where a [scene](https://github.com/decentraland/docs/blob/main/content/entity-types/scenes.md) runs its main script.

Each scene runs inside its own isolated runtime. Within it, it has access to certain [global objects](https://github.com/decentraland/docs/blob/main/contributor/globals.md) and can import [modules](https://github.com/decentraland/docs/blob/main/contributor/modules.md) from the runtime library.

{% @mermaid/diagram content="flowchart TB
subgraph WorldExplorer\["World Explorer"]
subgraph Runtime1\["Runtime 1"]
Scene1\["Scene"]
end

```
    subgraph Runtime2["Runtime 2"]
        Scene2["Scene"]
    end
    
    subgraph Runtime3["Runtime 3"]
        Scene3["Scene"]
    end
    
    Scene1 --> Library["Runtime Module Library"]
    Scene2 --> Library
    Scene3 --> Library
end" %}
```

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](https://github.com/decentraland/docs/blob/main/contributor/creator/sdk7/getting-started/sdk-101.md) with their code, which encapsulates the RPC-style interface of the runtime library and provides a nicer and more comfortable API.

{% hint style="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.
{% endhint %}

### Global Objects

Inside the sandboxed environment, [scenes](https://github.com/decentraland/docs/blob/main/content/entity-types/scenes.md) 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](https://github.com/decentraland/docs/blob/main/contributor/globals.md) for more details.

### Modules

The [`require`](https://github.com/decentraland/docs/blob/main/contributor/globals.md#module) global function can import modules provided by the [runtime library](https://github.com/decentraland/docs/blob/main/contributor/execution.md). 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](https://github.com/decentraland/docs/blob/main/contributor/execution.md) 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](https://github.com/decentraland/docs/blob/main/content/entity-types/scenes.md), and granted by the player.

See [permissions](https://github.com/decentraland/docs/blob/main/contributor/permissions.md) to learn more.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.decentraland.org/contributor/scene-runtime/overview.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
