ADR-281: Items in Decentraland tooling

More details about this document
Latest published version:
https://adr.decentraland.org/adr/ADR-281
Authors:
cazala
Feedback:
GitHub decentraland/adr (pull requests, new issue, open issues)
Edit this documentation:
GitHub View commits View commits on githistory.xyz

Abstract

This document describes the Items abstraction in Decentraland tooling, which provides a way to add pre-configured entities with components into scenes through a drag-and-drop interface, without requiring coding knowledge.

Context

Decentraland provides an Entity Component System (ECS) SDK for building interactive scenes. Items are an abstraction built on top of this ECS system, allowing creators to easily add pre-configured entities with components into their scenes through a drag-and-drop interface, without requiring coding knowledge. When an item is dropped into a scene, it creates one or more entities and applies the appropriate components to them.

Types of Items

Static Items

Basic 3D models with no interactive behavior, including but not limited to:

Smart Items

Interactive items with programmable behaviors, primarily defined through actions and triggers. They can include various types:

Smart items typically include:

Custom Items

User-created items that can be either static or interactive, allowing creators to:

Item Sources

Asset Packs Repository

Custom items can be added to the default asset-packs registry by copying their folder and contents from the custom items folder into the appropriate asset-pack folder in the asset-packs repository.

Custom Items Storage

Custom items are stored locally with the following structure:

custom/
  item-name/
    data.json      # metadata
    composite.json # entity data
    thumbnail.png  # preview image
    resources/     # associated assets (models, textures, etc.)

Technical Implementation

Composites

Items are defined using composites - a versioned collection of components and their values:

interface Composite {
  version: number
  components: Array<{
    name: string
    data: {
      [entityId: string]: {
        json: any
      }
    }
  }>
}

ID Mapping System

When instantiating items, the system handles entity references through special notation:

Resource Path Management

Custom Item Creation

The process involves:

  1. Selecting existing entities in the scene
  2. Creating a composite from the selection
  3. Processing and copying all required resources
  4. Generating metadata and thumbnails
  5. Storing the item in the custom items directory

Usage

Library Integration

Items are available through a drag-and-drop interface where users can:

Instantiation

When an item is added to a scene:

  1. The composite is loaded
  2. New entities are created
  3. Components are instantiated with proper references
  4. Resources are loaded with correct paths
  5. For smart items, behaviors are initialized

Consequences

Positive

Negative

References

License

Copyright and related rights waived via CC0-1.0. Final