ADR-294: Explorer ECS runtime architecture

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

Abstract

This ADR describes the ECS runtime architecture used in the Decentraland Explorer (decentraland/unity-explorer), which replaces the runtime architecture described in ADR-67 (now deprecated). The new architecture is built on the Arch ECS framework with a dual-world system, automated system ordering, and a hybrid ECS approach that allows Unity MonoBehaviours as components.

Context, Reach & Prioritization

The old runtime architecture (ADR-67) was designed for unity-renderer and focused on component registration patterns to avoid a god-object anti-pattern where the runtime knew about all components. It used UPM packages for segregation.

The new explorer client was built from scratch using a pure ECS approach with the Arch framework, introducing fundamentally different patterns for component registration, system lifecycle, and world management.

Specification

Dual-World Architecture

The runtime maintains two types of worlds:

System Lifecycle

Systems run on the main thread once per frame, organized into system groups. The Arch.SystemGroups library automates system creation and dependency resolution.

Key design rules:

Component Design

Components follow these guidelines:

Cross-World Communication

Two patterns for communication between Global and Scene worlds:

Safety guards:

Async Integration

ECS and async/await are married through the Asset Promise pattern:

Events and Callbacks

Callbacks are explicitly forbidden in ECS. No delegates, events, or subscriptions. Systems execute logic only in their Update function. Data propagation from Unity objects to systems must go through components, not events.

Key Differences from ADR-67

Aspect ADR-67 (Old) This ADR (New)
Framework Custom component registration Arch ECS framework
Worlds Single world Dual-world (Global + per-scene)
System ordering Manual Automated via Arch.SystemGroups
Component storage Plugin-level registration ComponentsContainer with unique IDs
Threading Main thread only Job System + MultiThreadSync mutex
Unity integration Traditional MonoBehaviour Hybrid ECS (MonoBehaviours as components)

RFC 2119 and RFC 8174

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 and RFC 8174.

License

Copyright and related rights waived via CC0-1.0. Draft