> For the complete documentation index, see [llms.txt](https://docs.decentraland.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.decentraland.org/contributor/contributor-pt/runtime-da-scene/overview.md).

# Visão geral

O runtime da scene do Decentraland é o ambiente de execução isolado onde uma [scene](https://github.com/decentraland/docs/tree/main/content/entity-types/scenes.md) executa o seu script principal.

Cada scene executa dentro do seu próprio runtime isolado. Nele, tem acesso a certos [objetos globais](https://github.com/decentraland/docs/tree/main/contributor/globals.md) e pode importar [modules](https://github.com/decentraland/docs/tree/main/contributor/modules.md) da biblioteca do runtime.

```mermaid
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
```

Ao importar modules da biblioteca do runtime, as scenes têm acesso a uma ampla variedade de funcionalidades, incluindo:

* Criar entities e controlar o seu comportamento
* Interagir com o jogador
* Comunicar com outros jogadores
* Inspecionar o estado do mundo
* Conectar-se a serviços externos
* Fazer pagamentos web3

Na prática, as scenes incluem o [Decentraland SDK](https://github.com/decentraland/docs/tree/main/contributor/creator/sdk7/getting-started/sdk-101.md) com o seu código, que encapsula a interface no estilo RPC da biblioteca do runtime e fornece uma API mais agradável e confortável.

{% hint style="info" %}
Observe que o SDK é *não* parte do protocolo da Decentraland; apenas as interfaces de nível inferior o são. As scenes podem decidir incluir o SDK ou usar bibliotecas alternativas.
{% endhint %}

### Objetos Globais

Dentro do ambiente isolado, [cenas](https://github.com/decentraland/docs/tree/main/content/entity-types/scenes.md) assuma que certos objetos e funções estão globalmente disponíveis. Alguns são objetos padrão do ES2020 (como `Date` ou `Math`), e outros são injetados pelo runtime para implementar funcionalidades como importar modules, registar mensagens e agendar callbacks.

Veja [globals](https://github.com/decentraland/docs/tree/main/contributor/globals.md) para mais detalhes.

### Modules

O [`require`](https://github.com/decentraland/docs/tree/main/contributor/globals.md#module) A função global pode importar modules fornecidos pela [biblioteca do runtime](https://github.com/decentraland/docs/tree/main/contributor/execution.md). Estes modules permitem importar seletivamente utilitários como os systems ECS ou Communications.

Veja a secção runtime modules para uma lista completa.

### Execução

O runtime exige que as scenes implementem um conjunto específico de métodos e garante que serão chamadas de acordo com determinadas regras.

Veja [execução](https://github.com/decentraland/docs/tree/main/contributor/execution.md) para mais informações sobre isto.

### Permissões

Funcionalidades sensíveis, como fazer pedidos HTTP a serviços de terceiros, são restringidas pelo runtime, a menos que certas permissões sejam solicitadas pela [scene](https://github.com/decentraland/docs/tree/main/content/entity-types/scenes.md), e concedidas pelo jogador.

Veja [permissões](https://github.com/decentraland/docs/tree/main/contributor/permissions.md) para saber mais.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
