create-scene
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCreate a New Decentraland SDK7 Scene
创建新的 Decentraland SDK7 场景
Runtime constraint: Decentraland runs in a QuickJS sandbox. No Node.js APIs (,fs,http,path). Use the SDK'sprocess+executeTask()for async work. See the scene-runtime skill for details.fetch()
CRITICAL — read before generating any code: All initial scene entities (everything present at scene load) go in, NEVER inassets/scene/main.composite. See "Composite vs TypeScript — where entities go" (Step 4) for the rule, decision table, and rationale.src/index.ts
When the user wants to create a new scene, follow these steps:
运行时约束: Decentraland 运行在 QuickJS 沙箱中。无法使用 Node.js API(、fs、http、path)。异步工作请使用 SDK 的process+executeTask()。有关详细信息,请参阅 scene-runtime skill。fetch()
重要——生成任何代码前请先阅读: 加载场景时存在的所有初始场景实体都应放入,绝不能放入assets/scene/main.composite。有关规则、决策表和原因,请参阅“Composite 与 TypeScript——实体应放在哪里”(步骤 4)。src/index.ts
当用户想要创建新场景时,请遵循以下步骤:
1. Ask What They Want to Build
1. 了解用户想构建什么
If the user hasn't described their scene, ask them:
- What kind of scene? (gallery, game, social space, interactive art, etc.)
- How many parcels? (default: 1 parcel = 16x16m)
- Any specific features? (3D models, interactivity, UI, multiplayer)
如果用户尚未描述其场景,请询问:
- 场景类型是什么?(画廊、游戏、社交空间、互动艺术等)
- 有多少个地块(parcel)?(默认:1 个地块 = 16x16m)
- 有什么特定功能?(3D 模型、交互、UI、多人功能)
2. Scaffold the Project with /init
/init2. 使用 /init
搭建项目
/initAlways run first. This uses the official to create scene.json, package.json, tsconfig.json, and src/index.ts with the correct, up-to-date configuration, and installs dependencies automatically.
/init@dcl/sdk-commands initNever manually create scene.json, package.json, or tsconfig.json — the SDK templates may change between versions and hand-written copies will diverge.
The and tsconfig settings are already included by — do not modify them.
jsxjsxImportSource/init始终先运行 。 这会使用官方 创建 scene.json、package.json、tsconfig.json 和 src/index.ts,并配置正确且最新的参数,同时自动安装依赖项。
/init@dcl/sdk-commands init绝不要手动创建 scene.json、package.json 或 tsconfig.json——SDK 模板可能会在不同版本之间发生变化,手动复制的配置会产生偏差。
jsxjsxImportSource/init3. Find Matching 3D Assets
3. 查找匹配的 3D 资产
IMPORTANT: Only fetch models from the free catalogs below if the prompt explicitly asks to add new models. Confirm with the user always if they wish to add new models to their scene.
Before writing scene code, check the asset catalog for free models that match the user's theme:
- Search (8,800+ models with descriptions, dimensions, animations, and download URLs)
{baseDir}/../add-3d-models/references/model-catalog.md - Read (50 free sounds — music, ambient, SFX, game mechanics, etc.)
{baseDir}/../audio-video/references/audio-catalog.md - Suggest matching models and sounds to the user
- Download selected models into the scene's directory:
assets/Models/bashmkdir -p assets/Models curl -o assets/Models/arcade_machine.glb "https://models.dclregenesislabs.xyz/blobs/bafybei..."
Important:only works with local files. Never use external URLs for the modelGltfContainerfield.src
Important: Always download into. Never write to the scene root.assets/Models/
Existing folders take precedence. If the scene already has(legacy layout) or assets underassets/scene/Models/(Creator Hub asset packs) /assets/asset-packs/(Creator Hub custom items), reuse those paths instead of creating a parallelassets/custom/. Same rule applies forassets/Models/,assets/Audio/, andassets/Images/.assets/Videos/
Done when: every model the user approved exists in (or the pre-existing asset folder per the precedence rule above), each file is non-empty and begins with the magic bytes () — a curl that saved an HTML error page fails this check — and no downloaded file sits at the project root. If the user declined new models, this step is done with nothing downloaded.
assets/Models/glTFhead -c 4 file.glb重要:仅当提示明确要求添加新模型时,才从以下免费目录获取模型。务必始终向用户确认是否要在场景中添加新模型。
在编写场景代码之前,检查与用户主题匹配的资产目录:
- 搜索 (包含 8,800+ 个模型及其描述、尺寸、动画和下载 URL)
{baseDir}/../add-3d-models/references/model-catalog.md - 阅读 (包含 50 种免费音效——音乐、环境声、音效、游戏机制等)
{baseDir}/../audio-video/references/audio-catalog.md - 向用户建议匹配的模型和声音
- 将选定的模型下载到场景的 目录:
assets/Models/bashmkdir -p assets/Models curl -o assets/Models/arcade_machine.glb "https://models.dclregenesislabs.xyz/blobs/bafybei..."
重要:仅支持本地文件。模型的GltfContainer字段绝不能使用外部 URL。src
重要: 始终下载到。绝不能将文件写入场景根目录。assets/Models/
已有文件夹优先。 如果场景已经包含 (旧版布局),或 (Creator Hub 资产包)/ (Creator Hub 自定义项目)下的资产,请复用这些路径,不要创建平行的 。同样的规则也适用于 、 和 。
assets/scene/Models/assets/asset-packs/assets/custom/assets/Models/assets/Audio/assets/Images/assets/Videos/完成标准: 用户批准的每个模型都存在于 (或根据上述优先级规则使用已有资产文件夹)中,每个文件均非空且以 magic bytes 开头()——保存了 HTML 错误页面的 curl 操作无法通过此检查——并且项目根目录中没有任何下载文件。如果用户拒绝添加新模型,则此步骤无需下载任何内容即可完成。
assets/Models/glTFhead -c 4 file.glb4. Customize the Generated Files
4. 自定义生成的文件
After completes, customize the generated files based on what the user wants:
/init/initscene.json
scene.json
Update the fields and parcels:
display- — set to the scene name
display.title - — set to a short description
display.description - — for multi-parcel scenes, list all parcels (e.g.,
scene.parcelsfor 2x2)["0,0", "0,1", "1,0", "1,1"] - — set to the southwest corner parcel
scene.base
更新 字段和地块:
display- ——设置为场景名称
display.title - ——设置一段简短描述
display.description - ——对于多地块场景,列出所有地块(例如,2x2 场景为
scene.parcels)["0,0", "0,1", "1,0", "1,1"] - ——设置为西南角地块
scene.base
Composite vs TypeScript — where entities go
Composite 与 TypeScript——实体应放在哪里
NEVER create initial scene entities in TypeScript. They MUST go in . If you find yourself writing for a piece of scenery or a static prop, stop — put it in the composite instead.
assets/scene/main.compositeengine.addEntity()Use | Use |
|---|---|
| All entities present at scene load (models, lights, primitives, text, audio) | Entities spawned dynamically at runtime (e.g., projectiles, clones, NPCs that appear on demand) |
| Static and decorative objects | Entities whose count or existence depends on runtime state |
| Entities that need behavior added later (fetch by name/tag in code) | Entities whose identity/structure cannot be known at author time |
| Anything the Creator Hub should be able to display and edit visually | — |
Rationale: Composite assets load faster, are visually editable in the Creator Hub, and keep TypeScript code focused on logic rather than scene construction.
绝不要在 TypeScript 中创建初始场景实体。它们必须放在 中。 如果发现自己在为某个布景或静态道具编写 ,请立即停止——应将其放入 composite 中。
assets/scene/main.compositeengine.addEntity()对 | 对 |
|---|---|
| 加载场景时存在的所有实体(模型、灯光、基础几何体、文本、音频) | 在运行时动态生成的实体(例如投射物、克隆体、按需出现的 NPC) |
| 静态和装饰性对象 | 数量或存在与否取决于运行时状态的实体 |
| 之后需要添加行为的实体(可通过名称或标签在代码中获取) | 创作时无法确定其身份或结构的实体 |
| Creator Hub 应能以可视化方式显示和编辑的任何内容 | — |
原因: Composite 资产加载速度更快,可在 Creator Hub 中进行可视化编辑,并使 TypeScript 代码专注于逻辑而非场景构建。
assets/scene/main.composite
assets/scene/main.composite
Create with the initial scene entities. See for the full format.
assets/scene/main.composite{baseDir}/../composites/composite-reference.mdEditing an existing scene? Read the "Editing an existing composite (edit mode)" section of the composite reference FIRST. If the scene has been opened in the Creator Hub,already containsmain.compositecomponents; adding new entities without registering them ininspector::*leaves them rendering in-world but invisible and un-selectable in the Creator Hub entity tree. The reference spells out the exact procedure.inspector::Nodes
Minimal example — a single named box. Components share entity IDs across their maps, so all of entity 's data lives under the key:
data512"512"json
{
"version": 1,
"components": [
{
"name": "core::Transform",
"data": {
"512": {
"json": {
"position": { "x": 8, "y": 1, "z": 8 },
"scale": { "x": 1, "y": 1, "z": 1 },
"rotation": { "x": 0, "y": 0, "z": 0, "w": 1 },
"parent": 0
}
}
}
},
{
"name": "core::MeshRenderer",
"data": { "512": { "json": { "mesh": { "$case": "box", "box": {} } } } }
},
{
"name": "core-schema::Name",
"data": { "512": { "json": { "value": "BlueCube" } } }
}
]
}For multi-entity scenes, GLB models with collision masks, tags, and the full component-grouping pattern, see .
{baseDir}/../composites/composite-reference.mdIMPORTANT: When placing a floor entity, always set the y position to 0.01 or higher so that it doesn't z-fight with the default ground.
- Center of a single-parcel scene is (8, 0, 8) at ground level.
- Y axis is up; ground level is Y=0. Floors and walkable surfaces belong at Y ≥ 0 because players cannot descend below ground, but entities can be placed at negative Y — positioning objects underground is a legitimate technique for hiding them.
创建 并放入初始场景实体。完整格式参见 。
assets/scene/main.composite{baseDir}/../composites/composite-reference.md正在编辑现有场景? 请先阅读 composite 参考文档中的“编辑现有 composite(编辑模式)”一节。如果场景已在 Creator Hub 中打开,会包含main.composite组件;添加新实体时如果不将其注册到inspector::*,这些实体虽然会在场景中正常渲染,但在 Creator Hub 实体树中不可见且无法选择。参考文档给出了确切的操作步骤。inspector::Nodes
最小示例——一个带名称的盒子。组件通过各自的 映射共享实体 ID,因此实体 的所有数据都位于 键下:
data512"512"json
{
"version": 1,
"components": [
{
"name": "core::Transform",
"data": {
"512": {
"json": {
"position": { "x": 8, "y": 1, "z": 8 },
"scale": { "x": 1, "y": 1, "z": 1 },
"rotation": { "x": 0, "y": 0, "z": 0, "w": 1 },
"parent": 0
}
}
}
},
{
"name": "core::MeshRenderer",
"data": { "512": { "json": { "mesh": { "$case": "box", "box": {} } } } }
},
{
"name": "core-schema::Name",
"data": { "512": { "json": { "value": "BlueCube" } } }
}
]
}对于多实体场景、带碰撞掩码的 GLB 模型、标签以及完整的组件分组模式,请参阅 。
{baseDir}/../composites/composite-reference.md重要: 放置地板实体时,始终将 y 位置设为 0.01 或更高,以避免与默认地面发生 z-fighting。
- 单一地块场景的中心位于地面高度 (8, 0, 8)。
- Y 轴向上;地面高度为 Y=0。地板和可行走表面必须位于 Y ≥ 0,因为玩家无法下降到地面以下,但实体可以放在 Y 为负的位置——将物体置于地下是一种有效的隐藏方式。
src/index.ts
src/index.ts
Use only for:
index.ts- Behavior and interactivity on composite entities (fetch them by name or tag)
- Dynamically spawned entities (e.g., enemies, projectiles, clones)
- Systems, game logic, UI
To add interactivity to a composite entity, look it up by name or tag — do NOT re-create it in code:
typescript
import { engine, pointerEventsSystem, InputAction } from '@dcl/sdk/ecs'
import { EntityNames } from '../assets/scene/entity-names'
export function main() {
// Fetch an entity defined in the composite — never re-create it here
const cube = engine.getEntityOrNullByName(EntityNames.BlueCube)
if (cube) {
pointerEventsSystem.onPointerDown(
{
entity: cube,
opts: { button: InputAction.IA_PRIMARY, hoverText: 'Click me' },
},
() => {
console.log('Cube clicked!')
}
)
}
}To fetch groups of entities by tag () or add/remove tags at runtime, see the "Referencing Composite Entities from Code" section of .
engine.getEntitiesByTag{baseDir}/../composites/composite-reference.md仅将 用于:
index.ts- 为 composite 实体提供行为和交互(按名称或标签获取)
- 运行时动态生成的实体(例如敌人、投射物、克隆体)
- 系统、游戏逻辑、UI
要为 composite 实体添加交互性,请按名称或标签查找它——不要在代码中重新创建:
typescript
import { engine, pointerEventsSystem, InputAction } from '@dcl/sdk/ecs'
import { EntityNames } from '../assets/scene/entity-names'
export function main() {
// Fetch an entity defined in the composite — never re-create it here
const cube = engine.getEntityOrNullByName(EntityNames.BlueCube)
if (cube) {
pointerEventsSystem.onPointerDown(
{
entity: cube,
opts: { button: InputAction.IA_PRIMARY, hoverText: 'Click me' },
},
() => {
console.log('Cube clicked!')
}
)
}
}要按标签获取实体组()或在运行时添加/移除标签,请参阅 中的“在代码中引用 Composite 实体”一节。
engine.getEntitiesByTag{baseDir}/../composites/composite-reference.mdscene.json Reference
scene.json 参考
All valid fields:
scene.json| Field | Required | Description |
|---|---|---|
| Conventional | |
| Yes | Must be |
| Yes | Must be |
| Recommended | Scene name shown in the map and Places |
| Recommended | Short description for discovery |
| Optional | Image path for the Genesis City minimap |
| Yes | Array of |
| Yes | The origin parcel (usually southwest corner) |
| Optional | Where players appear when entering (see below) |
| Optional | Array of permissions (e.g., |
| Optional | Whitelisted domains for external media |
| Optional | Enable/disable SDK features |
| Optional | For Worlds deployment (see deploy-worlds skill) |
| Optional | Boolean, default |
scene.json| 字段 | 必需性 | 描述 |
|---|---|---|
| 惯例上 | SDK7 场景中为 |
| 是 | 必须为 |
| 是 | 必须为 |
| 推荐 | 在地图和 Places 中显示的场景名称 |
| 推荐 | 用于场景发现的简短描述 |
| 可选 | Genesis City 小地图的缩略图路径 |
| 是 | |
| 是 | 原点地块(通常为西南角) |
| 可选 | 玩家进入场景时的位置(见下文) |
| 可选 | 权限数组(例如 |
| 可选 | 外部媒体的白名单域名 |
| 可选 | 启用或禁用 SDK 功能 |
| 可选 | 用于 Worlds 部署(参见 deploy-worlds skill) |
| 可选 | 布尔值,默认 |
Tags
标签
Valid values for the array:
tags"art""game""casino""social""music""fashion""crypto""education""shop""business""sports""parkour"tags"art""game""casino""social""music""fashion""crypto""education""shop""business""sports""parkour"Required Permissions
必需权限
Add to when your scene uses these features:
requiredPermissionsThese are the exact 7 permission strings the runtime recognizes (the protocol enum names drop the prefix):
PI_| Permission | When needed |
|---|---|
| |
| |
| External video/audio streams — not required (see below) |
| Blockchain interactions |
| HTTP requests ( |
| WebSocket connections |
| |
Grounded caveat (from the engine test scenes): enforcement is uneven, so declare the correct permission for intent rather than relying on it being blocked. Thescene declares only80,-4-restricted-actions+ALLOW_TO_MOVE_PLAYER_INSIDE_SCENE, yet successfully runsALLOW_TO_TRIGGER_AVATAR_EMOTE,openExternalUrl,openNftDialog, andteleportTowithoutchangeRealm. TheOPEN_EXTERNAL_LINKscene calls66,6-signed-fetchwith an emptysignedFetch.requiredPermissionsand emotes are the two whose permissions the engine team consistently declares.movePlayerTo(jump to other Genesis City coords) needs no permission.teleportTo
[LEGACY]ALLOW_MEDIA_HOSTNAMESallowedMediaHostnames@dcl/schemasCHECK_ALLOWED_MEDIA_HOSTNAMESSceneData.TryGetMediaUrljson
"requiredPermissions": ["ALLOW_MEDIA_HOSTNAMES"],
"allowedMediaHostnames": ["youtube.com", "www.youtube.com", "player.vimeo.com", "twitch.tv"]当场景使用以下功能时,将其添加到 :
requiredPermissions以下是 runtime 识别的确切 7 个权限字符串(协议枚举名称会去掉 前缀):
PI_| 权限 | 何时需要 |
|---|---|
| |
| |
| 外部视频/音频流——不需要(见下文) |
| 区块链交互 |
| HTTP 请求( |
| WebSocket 连接 |
| |
实际情况说明(来自引擎测试场景): 权限执行并不一致,因此应根据使用意图声明正确权限,不要依赖权限一定会阻止操作。场景只声明了80,-4-restricted-actions和ALLOW_TO_MOVE_PLAYER_INSIDE_SCENE,却成功执行了ALLOW_TO_TRIGGER_AVATAR_EMOTE、openExternalUrl、openNftDialog和teleportTo,且未使用changeRealm。OPEN_EXTERNAL_LINK场景以空的66,6-signed-fetch调用requiredPermissions。signedFetch和 emote 是引擎团队始终会声明权限的两项功能。movePlayerTo(跳转到其他 Genesis City 坐标)不需要权限。teleportTo
[LEGACY]ALLOW_MEDIA_HOSTNAMESallowedMediaHostnames@dcl/schemasCHECK_ALLOWED_MEDIA_HOSTNAMESSceneData.TryGetMediaUrljson
"requiredPermissions": ["ALLOW_MEDIA_HOSTNAMES"],
"allowedMediaHostnames": ["youtube.com", "www.youtube.com", "player.vimeo.com", "twitch.tv"]Feature Toggles
功能开关
json
"featureToggles": {
"voiceChat": "enabled",
"portableExperiences": "enabled"
}Valid values: , . For also: .
"enabled""disabled"portableExperiences"hideUi"json
"featureToggles": {
"voiceChat": "enabled",
"portableExperiences": "enabled"
}有效值为 、。对于 ,还可以使用 。
"enabled""disabled"portableExperiences"hideUi"Spawn Points
出生点
Configure where and how players enter the scene:
json
{
"spawnPoints": [
{
"name": "spawn1",
"default": true,
"position": { "x": [1, 5], "y": [0, 0], "z": [2, 4] },
"cameraTarget": { "x": 8, "y": 1, "z": 8 }
}
]
}- Position ranges (e.g., ) spawn players randomly within the range
[1, 5] - orients the player's camera on spawn — point it at the scene's focal area
cameraTarget - Fixed spawn: use single values instead of ranges (e.g., )
"x": 8
配置玩家进入场景的位置和方式:
json
{
"spawnPoints": [
{
"name": "spawn1",
"default": true,
"position": { "x": [1, 5], "y": [0, 0], "z": [2, 4] },
"cameraTarget": { "x": 8, "y": 1, "z": 8 }
}
]
}- 位置范围(例如 )会让玩家在范围内随机出生
[1, 5] - 用于设置玩家出生时摄像机的朝向——应指向场景的核心区域
cameraTarget - 固定出生点:使用单个值而不是范围(例如 )
"x": 8
Multi-Parcel Layouts
多地块布局
| Layout | Parcels Array | Use Case |
|---|---|---|
| Single | | Small games, galleries, single-room experiences |
| Strip | | Hallways, racing tracks, linear journeys |
| L-Shape | | Corner buildings, split experiences |
| 2x2 Square | | Open plazas, arenas, medium games |
| 3x3 Square | 9 parcels from | Large games, multi-room buildings |
Base parcel: Always set to the southwest (lowest x,y) corner parcel.
scene.baseBoundaries: each parcel is 16m x 16m; a 2x2 scene spans 32m x 32m. The height limit applies to the whole scene and grows with parcel count: meters (1 parcel = 20m, 2x2 = ~46m, 3x3 = ~66m).
log2(n+1) × 20- Always validate entity positions against parcel bounds. With the default base parcel at the lower-left corner, valid range is and
0 ≤ x ≤ 16*parcelsWide. Any negative X or Z coordinate is outside the scene. An entity entirely outside the bounds is not rendered and no error is shown; a model that straddles the boundary still renders the part that is inside. The bound check uses world positions, so a child whose parent is moved out of bounds disappears with it, and exceeding the height limit hides the entity too. Multi-parcel scenes are only rectangular if you list every parcel; an L-shaped parcel set has "holes" that are out of bounds. (See the0 ≤ z ≤ 16*parcelsDeepexample scene.)5,90-scene-bounds-check
Changing parcels in an existing scene: Modifying shifts the coordinate bounds for the entire scene — entities near the current boundary may end up outside (invisible) after the change. Before editing this field, describe the proposed change and confirm with the user first. See the "Agent Behavioral Guidelines" section in the skill ().
scene.parcelssdk-scenes{baseDir}/../sdk-scenes/SKILL.mdDone when: (1) parses as JSON and every entity ID that appears in any component's map has a and a entry; (2) every composite position lies within parcel bounds (, ) — an entity placed entirely outside is silently hidden, and a model straddling the boundary renders only the part inside; (3) contains no for load-time scenery — grep for and confirm every hit is a runtime spawn; (4) has and is a member of ; (5) exits 0.
main.compositedatacore::Transformcore-schema::Name0 ≤ x ≤ 16·width0 ≤ z ≤ 16·depthsrc/index.tsengine.addEntity()engine.addEntityscene.json"runtimeVersion": "7"scene.basescene.parcelsnpm run build| 布局 | 地块数组 | 使用场景 |
|---|---|---|
| 单地块 | | 小型游戏、画廊、单房间体验 |
| 条形 | | 走廊、竞速赛道、线性旅程 |
| L 形 | | 转角建筑、分离式体验 |
| 2x2 方形 | | 开放广场、竞技场、中型游戏 |
| 3x3 方形 | 从 | 大型游戏、多房间建筑 |
基础地块: 始终将 设置为西南角(x、y 最低)的地块。
scene.base边界: 每个地块为 16m x 16m;2x2 场景占地 32m x 32m。高度限制适用于整个场景,并随地块数量增加: 米(1 个地块 = 20m,2x2 ≈ 46m,3x3 ≈ 66m)。
log2(n+1) × 20- 务必根据地块边界验证实体位置。 当基础地块默认位于左下角时,有效范围为 和
0 ≤ x ≤ 16*parcelsWide。任何负的 X 或 Z 坐标都位于场景之外。 完全位于边界之外的实体不会渲染,也不会显示错误;跨越边界的模型只会渲染其位于边界内的部分。边界检查使用世界坐标,因此如果父实体的位置被移到边界外,其子实体也会随之消失;超过高度限制同样会隐藏实体。只有列出每个地块时,多地块场景才是矩形;L 形地块集合会存在超出边界的“空洞”。(参见0 ≤ z ≤ 16*parcelsDeep示例场景。)5,90-scene-bounds-check - 修改现有场景的地块: 修改 会改变整个场景的坐标边界——修改后,靠近原边界的位置可能落到场景之外(不可见)。编辑此字段前,请先说明拟议的更改并向用户确认。请参阅
scene.parcelsskill(sdk-scenes)中的“Agent 行为准则”一节。{baseDir}/../sdk-scenes/SKILL.md
完成标准: (1) 可解析为 JSON,且任何组件 映射中出现的每个实体 ID 都有 和 条目;(2) 每个 composite 位置都位于地块边界内(、)——完全位于边界之外的实体会被静默隐藏,跨越边界的模型只会渲染其位于边界内的部分;(3) 中不包含用于加载时布景的 ——搜索 ,并确认每个命中项都是运行时生成;(4) 包含 ,且 是 的成员;(5) 的退出码为 0。
main.compositedatacore::Transformcore-schema::Name0 ≤ x ≤ 16·width0 ≤ z ≤ 16·depthsrc/index.tsengine.addEntity()engine.addEntityscene.json"runtimeVersion": "7"scene.basescene.parcelsnpm run build5. Post-Creation Steps
5. 创建完成后的步骤
After customizing the files:
- Use the tool to start the preview server (or run
previewmanually)npx @dcl/sdk-commands start --bevy-web - The scene will open in a browser at http://localhost:8000
自定义文件后:
- 使用 工具启动预览服务器(或手动运行
preview)npx @dcl/sdk-commands start --bevy-web - 场景将在浏览器中的 http://localhost:8000 打开
Preview CLI flags
预览 CLI 参数
| Flag | Type | Description |
|---|---|---|
| boolean | Open the preview in the Bevy Web browser client at |
| boolean | Enable the MCP server in the Explorer (forwarded as a deep-link parameter) |
| number | Port for the MCP server in the Explorer |
| boolean | Allow running multiple Explorer instances simultaneously |
| boolean | Suppress auto-launch (desktop deeplink, browser, mobile QR); the file watcher still notifies a desktop Explorer if it connects on its own |
| passthrough | Arguments after a standalone |
--web-explorer--web3--no-debug-dBevy renderer in Creator Hub: Settings > Editor > "Scene renderer" dropdown (Babylon default / Bevy preview). Gated behind the Experimental features toggle. The Bevy editor supports gizmos, multi-select, free-fly camera, spawn point visualization, drag-drop assets, animation clip dropdown, lock/hide entities, screenshots, and hot-reload.
Keep (project root) up to date. It lists files and extensions that are NOT uploaded on deploy. Whenever the project contains working files — Blender/FBX sources, draft models, concept art, spreadsheets, markdown notes — add them (or their extensions) to proactively so the deployed scene stays light. See the section in the deploy-scene skill.
.dclignore.dclignore.dclignoreDone when: the preview server responds at and the scene renders with no errors in the console.
http://localhost:8000| 参数 | 类型 | 描述 |
|---|---|---|
| boolean | 在 decentraland.org/bevy-web/ 的 Bevy Web 浏览器客户端中打开预览,而不是 Desktop Explorer。Chromium 142+ 需要 Local Network Access 权限,页面才能访问 localhost 预览服务器——当浏览器询问是否允许访问设备上的应用时,点击“允许”。 |
| boolean | 启用 Explorer 中的 MCP 服务器(作为 deep-link 参数转发) |
| number | Explorer 中 MCP 服务器的端口 |
| boolean | 允许同时运行多个 Explorer 实例 |
| boolean | 禁止自动启动(桌面端 deep link、浏览器、移动端二维码);如果 Desktop Explorer 自行连接,文件监视器仍会向其发送通知。 |
| 透传 | 独立 |
--web-explorer--web3--no-debug-dCreator Hub 中的 Bevy renderer: Settings > Editor > “Scene renderer”下拉框(默认 Babylon / Bevy 预览)。此功能受 Experimental features 开关控制。Bevy editor 支持 gizmos、多选、自由飞行摄像机、出生点可视化、拖放资产、动画片段下拉框、锁定/隐藏实体、截图和热重载。
保持项目根目录中的 为最新状态。 它会列出部署时不会上传的文件和扩展名。每当项目包含工作文件——Blender/FBX 源文件、模型草稿、概念图、电子表格、Markdown 笔记——都应主动将它们(或其扩展名)添加到 ,以确保部署的场景保持轻量。参见 deploy-scene skill 中的 一节。
.dclignore.dclignore.dclignore完成标准: 预览服务器能够在 http://localhost:8000 响应请求,且场景渲染时控制台中没有错误。
Vibe Coding with AI
使用 AI 进行 Vibe Coding
AI assistants (Cursor, Claude Code, etc.) can build entire scenes from plain-language prompts. Install Decentraland SDK skills first so the AI knows SDK patterns:
bash
npx skills add decentraland/sdk-skillsThe official quickstart teaches a Script-component-first workflow: attach a Script component to an entity in the Creator Hub, write a class with , , and , and use to reference the holder entity. This keeps behavior self-contained and reusable across entities. See the script-components skill for full details.
constructor(src, entity)start()update(dt)this.entityAI 助手(Cursor、Claude Code 等)可以根据自然语言提示构建完整场景。请先安装 Decentraland SDK skills,让 AI 掌握 SDK 模式:
bash
npx skills add decentraland/sdk-skills官方 quickstart 讲解了以 Script 组件优先的工作流:将 Script 组件附加到 Creator Hub 中的实体,编写包含 、 和 的类,并使用 引用承载该组件的实体。这样可以使行为自包含,并可在多个实体之间复用。完整详情请参阅 script-components skill。
constructor(src, entity)start()update(dt)this.entityCross-References
交叉引用
- Ready to deploy? See the deploy-scene skill (Genesis City) or deploy-worlds skill (personal Worlds)
- Need to optimize for parcel limits? See the optimize-scene skill
- Planning a game? See the game-design skill for design patterns and performance budgets
- Validate entity component combinations: see for rules on which components require each other, mutual exclusions, and common misconfigurations
{baseDir}/references/entity-validation-rules.md
- 准备部署?请参阅 deploy-scene skill(Genesis City)或 deploy-worlds skill(个人 Worlds)
- 需要针对地块上限进行优化?请参阅 optimize-scene skill
- 正在规划游戏?请参阅 game-design skill,了解设计模式和性能预算
- 验证实体组件组合:参阅 ,了解组件依赖关系、互斥关系和常见配置错误
{baseDir}/references/entity-validation-rules.md
Example scenes
示例场景
Engine-team test scenes illustrating configuration:
scene.json- https://github.com/decentraland/sdk7-test-scenes/tree/main/scenes/5,90-scene-bounds-check — multi-parcel, non-rectangular parcel layout (); moves many entity types across the parcel/height boundary to show what the engine hides out of bounds.
["5,90","5,89","6,89","6,88"] - https://github.com/decentraland/sdk7-test-scenes/tree/main/scenes/80,-4-restricted-actions — for
requiredPermissions+ emotes.movePlayerTo - https://github.com/decentraland/sdk7-test-scenes/tree/main/scenes/8,8-portable-experience — (see also the
featureToggles.portableExperiences: "enabled"anddisabledsibling scenes).hideUi
展示 配置的引擎团队测试场景:
scene.json- https://github.com/decentraland/sdk7-test-scenes/tree/main/scenes/5,90-scene-bounds-check——多地块、非矩形地块布局(`["5,90","5,89","6,89","6,88"]`);移动多种类型的实体跨越地块/高度边界,以展示引擎如何隐藏超出范围的实体。
- https://github.com/decentraland/sdk7-test-scenes/tree/main/scenes/80,-4-restricted-actions——`movePlayerTo` 和 emote 所需的 。
requiredPermissions - https://github.com/decentraland/sdk7-test-scenes/tree/main/scenes/8,8-portable-experience——`featureToggles.portableExperiences: "enabled"disabled
(另请参见hideUi` 对应场景)。和