adr icon indicating copy to clipboard operation
adr copied to clipboard

StaticEntities

Open menduz opened this issue 1 year ago • 0 comments

Context

In order to facilitate communication between the renderer and the scenes, a special number of reserved entities are needed. These entities hold no special logic compared to other entities, but they have static IDs that systems can use to share information about the renderer, player, camera, etc. Decision

We will reserve 512 static entities numbers, starting at 0. The "0" entity will be the root entity of the scenes, and all other entities will be parented to it by default. List of static entities per scene

  • RootEntity = 0: It is the root of the scene.

    • The SceneInformation component (READ ONLY) of the root entity has the scene metadata (scene.json), the content mappings, and the scene id.
    • TBD: The ForeignEntitiesFrom { names: string[] } component is set from the scene itself and is used to signal the renderer about Foreign entity replication policies.
    • TBD: The ForeignEntitiesReservation { name: string, from: Entity, to: Entity } component is used to signal the renderer (or other actors) that this scene CAN share its entities as ForeignEntities.
    • The LoadingState { status = LOADING/RUNNING/PAUSED } component is set by the renderer.
    • TBD: The CommsState component is set by the kernel and used to query information about the current Comms connection (including realm).
  • PlayerEntity = 1: Represents the current player avatar.

    • The Transform component is READ/WRITE from the scene.
    • TBD: The PlayerPortableExperiences component (READ ONLY) contains information about the current portable experiences run by the user.
    • TBD: The PlayerIdentity component (READ ONLY) contains information about the Ethereum address, guest mode, and names of the player.
    • TBD: The (internal) AvatarShape component (READ ONLY) contains information about the wearables, hair, eyes and skin colors, and the equipped wearables.
  • CameraEntity = 2:

    • The Transform component is READ ONLY from the scene.
    • The PointerLocked component (READ ONLY) presence signals the status of the pointer-locking of the renderer.
    • The `WindowIdle`` component (READ ONLY) presence signals if the renderer is in background-mode or it is actively rendering.
    • The CameraMode { mode = ThirdPerson/FirstPerson } component is used to get the current camera mode; it is only set from the Renderer.

Consequences

By reserving a fixed number of static entities and assigning specific roles to them, we simplify the renderer-scene communication. This decision will make it easier for systems to share information about the renderer, player, camera, etc.

However, it is important to note that some of the components mentioned above are still TBD and may be subject to future revisions.

menduz avatar Apr 19 '23 14:04 menduz