> 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-zh/chang-jing-yun-xing-shi/overview.md).

# 概览

Decentraland 场景运行时是一个沙盒化执行环境，在其中一个 [场景](https://github.com/decentraland/docs/blob/main/content/entity-types/scenes.md) 运行其主脚本。

每个场景都在其各自隔离的运行时中运行。在其中，它可以访问某些 [全局对象](https://github.com/decentraland/docs/blob/main/contributor/globals.md) 并且可以导入 [模块](https://github.com/decentraland/docs/blob/main/contributor/modules.md) 来自运行时库。

{% @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" %}
```

通过从运行时库导入模块，场景可以访问广泛的功能，包括：

* 创建实体并控制其行为
* 与玩家交互
* 与其他玩家通信
* 检查世界状态
* 连接到外部服务
* 进行 web3 支付

实际上，场景会捆绑 [Decentraland SDK](https://github.com/decentraland/docs/blob/main/contributor/creator/sdk7/getting-started/sdk-101.md) 以及其代码，它封装了运行时库的 RPC 风格接口，并提供更优雅、更易用的 API。

{% hint style="info" %}
请注意，SDK *不是* Decentraland 协议的一部分，只有底层接口才是。场景可以决定是否捆绑 SDK，或使用替代库。
{% endhint %}

### 全局对象

在沙盒环境中， [场景](https://github.com/decentraland/docs/blob/main/content/entity-types/scenes.md) 假定某些对象和函数是全局可用的。其中一些是标准的 ES2020 对象（例如 `Date` 或 `Math`），而其他则由运行时注入，用于实现诸如加载模块、记录消息和安排回调等功能。

参见 [全局对象](https://github.com/decentraland/docs/blob/main/contributor/globals.md) 了解更多详情。

### 模块

该 [`require`](https://github.com/decentraland/docs/blob/main/contributor/globals.md#module) 全局函数可以导入由 [运行时库](https://github.com/decentraland/docs/blob/main/contributor/execution.md)提供的模块。这些模块允许选择性导入诸如 ECS 或通信系统等实用工具。

请参阅运行时模块部分以获取完整列表。

### 执行

运行时要求场景实现一组特定的方法，并保证它们会按照某些规则被调用。

参见 [执行](https://github.com/decentraland/docs/blob/main/contributor/execution.md) 以了解更多。

### 权限

敏感功能，例如向第三方服务发起 HTTP 请求，会受到运行时限制，除非由 [场景](https://github.com/decentraland/docs/blob/main/content/entity-types/scenes.md)，并由玩家授予。

参见 [权限](https://github.com/decentraland/docs/blob/main/contributor/permissions.md) 了解更多。


---

# 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 dynamically by asking a question.

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

```
GET https://docs.decentraland.org/contributor/contributor-zh/chang-jing-yun-xing-shi/overview.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
