Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: ADR-204 new comms architecture #272

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from
Draft

docs: ADR-204 new comms architecture #272

wants to merge 20 commits into from

Conversation

pentreathm
Copy link
Member

No description provided.

@pentreathm pentreathm requested a review from a team as a code owner October 21, 2024 19:19
@pentreathm pentreathm marked this pull request as draft October 21, 2024 19:19
Copy link

cloudflare-workers-and-pages bot commented Oct 21, 2024

Deploying adr with  Cloudflare Pages  Cloudflare Pages

Latest commit: 70a24cf
Status: ✅  Deploy successful!
Preview URL: https://10d9d153.adr-cvq.pages.dev
Branch Preview URL: https://adr-comms-ea.adr-cvq.pages.dev

View logs

@pentreathm pentreathm changed the title Adr comms ea docs: ADR-204 new comms architecture Oct 21, 2024
Copy link
Contributor

@nachomazzara nachomazzara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @pentreathm

content/ADR-204-comms-architecture.md Outdated Show resolved Hide resolved
content/ADR-204-comms-architecture.md Outdated Show resolved Hide resolved

#### Design Considerations

The establishment of the connection with the island remains unchanged, as that portion of the protocol is the same. The key difference lies in the types of messages sent through the channel. To establish a connection with a scene-room, a new service called [Gatekeeper](https://github.com/decentraland/comms-gatekeeper/) will be introduced to manage token permissions for the transport layer ([LiveKit](https://livekit.io/)). Only one scene room can be active at a time, as a user can only be present in one scene at any given moment. The scene room operates similarly to the communication service implementation used in worlds, where each scene has its own dedicated room. The Gatekeeper service will also allow scene owners to create authorizations for users, which will be reflected in the LiveKit token. This capability will enable them to moderate voice interactions and data streams within the scene effectively.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only one scene room can be active at a time,

What is the limit of connected peers and what happpens if that limit is achieved?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LiveKit does not have a hard limit on the number of participants in a room, allowing us to define our own limits as needed based on client needs.

The client receives information about users through the island and scene rooms. It must determine how many avatars it can render efficiently, especially in scenarios with a high number of participants. An approach could be prioritizing the processes of messages from players based on their proximity, rendering only the closest 200 avatars and ignoring the rest. This selective rendering can reduce processing load by discarding non-essential messages. This requires fine-tuning but these behaviors were deferred to a later phase as it is not a problem in the current state of the platform and the door is opened to different possible solutions. The key point is that based on LiveKit, there could be no limit on the amount of players connected to the room and we would probably find some bottlenecks in the bandwidth and the processing of the messages

I will add a comment in the ADR.

@kuruk-mm
Copy link
Member

Hi, how are you? Great work @pentreathm! I have just a few questions:

  1. Is it possible to connect to multiple scene rooms at the same time, or is only one scene room connection allowed at once?
  2. With this design, are we going to lose the ability to walk around with a friend, explore Decentraland, and voice chat together? It seems like you'll be reconnecting with each scene change, and I think that's one of the best features of Islands. Has this been considered in the design? Are there any future plans for private rooms where we can stay with our friends to mitigate this issue?
  3. I read in the "Consequences" section that you're not going to hear someone who is near you but in a different scene. If the reason for this is to give the scene owner control over the voice chat content, shouldn't the nearby chat be treated the same way?

content/ADR-204-comms-architecture.md Show resolved Hide resolved
content/ADR-204-comms-architecture.md Show resolved Hide resolved
content/ADR-204-comms-architecture.md Show resolved Hide resolved

![comms](/resources/ADR-204/comms.png)

In the illustrated scenario, Peers 1, 2, and 3 are connected to the scene room `E1`. Additionally, Peer 1 establishes a connection to the island `I1`, while Peers 2 and 3 are linked to the island `I2`. This example serves as a simplified illustration. Users may be far apart within the same scene, but this aims to demonstrate that if a peer is at the edge of a scene, they will be able to see other players who are not within the scene but are within viewing range. On the other hand, the scene channel will be there to share consistent data among the visitors, like a stream of video on a texture or the state of an object like a door that can be opened or closed besides also sharing information about the users visiting the scene.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious about this scenario:

  • User A is on scene 101
  • User B is on scene 102 which borders on scene 101
  • Both users shares a single channel because of proximity but also are connected to different channels because of the scene distinct (one channel for scene 101 and another one for scene 102)
  • If User A opens a door in scene 101
  • And User B after the door was opened, joins scene 101, will it see the door open or close?

The question is if when a user enters a new scene it replicates the current state of the scene that has been changing by another users who were already on that scene.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, yes. The state of the scene (CRDT State) should be saved, and when it enters the scene room, it should receive the state and synchronize the scene.

So User B will see the door opened when it joins the scene and the state gets syncronized.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, what @kuruk-mm said is correct.

content/ADR-204-comms-architecture.md Outdated Show resolved Hide resolved
content/ADR-204-comms-architecture.md Outdated Show resolved Hide resolved
content/ADR-204-comms-architecture.md Outdated Show resolved Hide resolved
pentreathm and others added 3 commits October 28, 2024 11:02
Co-authored-by: Alejo Thomas Ortega <alejothomasortega@gmail.com>
Signed-off-by: pentreathm <pentreathm@decentraland.org>
Co-authored-by: Ignacio Mazzara <nachomazzara@gmail.com>
Signed-off-by: pentreathm <pentreathm@decentraland.org>
@pentreathm
Copy link
Member Author

pentreathm commented Oct 28, 2024

  • Is it possible to connect to multiple scene rooms at the same time, or is only one scene room connection allowed at once?

A user should always be connected to only one scene at a time, only one scene connection should remain open.

  • With this design, are we going to lose the ability to walk around with a friend, explore Decentraland, and voice chat together? It seems like you'll be reconnecting with each scene change, and I think that's one of the best features of Islands. Has this been considered in the design? Are there any future plans for private rooms where we can stay with our friends to mitigate this issue?

Indeed, this feature will be lost in this initial version, it was a necessary trade-off in the design to give scene owners greater control over audio streams and the ability to moderate content. That said, there is potential for improvements. For instance, if a user is connected to Archipelago but not to a specific Scene, they could leverage that channel to share audio, enabling this use case. Additionally, a future "party mode" could be developed using the comms gatekeeper, allowing users to create a private communication channel with friends. This would facilitate sharing audio and text chat, irrespective of other connections in the environment.

  • I read in the "Consequences" section that you're not going to hear someone who is near you but in a different scene. If the reason for this is to give the scene owner control over the voice chat content, shouldn't the nearby chat be treated the same way?

yes, and I agree with your point, however, the decision was made because text chat is generally less intrusive for other users compared to voice chat. With voice, individuals can disrupt the experience for others, whereas text chat can simply be muted or turned off when needed.

cc @kuruk-mm

@@ -39,6 +40,7 @@ The Archipelago protocol scales efficiently due to its dynamic island calculatio
Maintain the current Archipelago implementation while establishing a new scene room connection specific to the active scene. The Archipelago channel should be reserved solely for receiving avatar positions, profile update notifications, and nearby chat messages with the objective to be able to interact with users beyond the limits of a scene. All communications, including voice chat, scene objects state, and streams, will be shared within the scene channel.
This new model grants scene owners authority over the communication channel, allowing them to share content streams, share object states or handling speakers, providing a consistent experience for all users visiting the scene.

At any given moment, a user can maintain up to two connections: one with the current scene and another with the island. When the scene changes, the existing connection to the previous scene should be closed, and a new connection to the current scene must be established.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a specific reason to limit to only one scene connection? Wouldn't it be up to the explorer to determine how many scene-rooms can handle?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ultimately, it is the client’s responsibility to manage the number of open connections. However, keep in mind that maintaining multiple open connections is resource-intensive, and the data transmitted over the scene channel can require substantial bandwidth to share scene state and other streams. It is advisable to keep a connection open only with the scene that the user is currently interacting with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants