Overview of SharedSpaces
January 24, 2026 ยท View on GitHub
| Oculus | Group presence with destination, lobby, and match ids. |
| Photon Realtime | Transport via a room named after the lobby or match id. |
| Netcode for GameObjects | Replication between room members with the master client as host. |
A Private Lobby Connected to Rooms

SharedSpaces consists of several connected levels known as destinations. At the center is your personal lobby with doors leading to surrounding matches. The matches on the left are private and accessible only from your lobby. The match on the right is public and accessible from any lobby.
Social Layer - Destination, Lobby & Match Session IDs

This layout directly represents the new group presence APIs. To reach a SharedSpaces destination, we first set your destination and a pair of session identifiers in your group presence: one for your lobby session ID, which rarely changes, and one for your match session ID, set only when you join a match.
Destinations are specific areas of your application defined on the Oculus dashboard under Platform Services > Destinations. The lobby session ID represents a group of people who want to stay together between games and possibly play as a team during matches. The match session ID is shared by people currently playing a match together, whether on the same team or not.

When you launch SharedSpaces, you start in your private lobby, for which we create a unique ID. To form a group before and after matches, invite people to share your lobby. If they accept, their lobby session ID updates to match yours, and whenever you're in the lobby simultaneously, you'll be together in the same space.
Think of the lobby as the base camp for your group. Different groups always return to their respective lobbies after matches.

Group members can travel anytime between your lobby and their private matches. This only affects the match session IDs of their group presence.

You can also grant access to your private match to anyone. Invite them from that match, and they join you upon accepting the invitation. In SharedSpaces, accepting a match invitation only affects your match session ID, not your lobby session ID.

When they leave the match through the lobby door, users return to their separate lobbies if they are not in the same group.

SharedSpaces also features a purple room representing a public match accessible from all lobbies. Anyone can move from their lobby to the purple room anytime, affecting only their match session ID. It's a space to meet people outside your group without prior invitation.
Transport Layer - Photon Rooms
To connect users, Photon uses the concept of a room. People in the same match or lobby instance are in the same Photon room, allowing data to flow between them. The transport layer routes packets between users, who are likely behind network firewalls.

Photon rooms have unique names. The room name comes directly from the social layer: we use your match session ID if you have one, or your lobby session ID otherwise.
A key feature of the Photon room system is tracking the oldest member, called the "master client," identified with stars.

Consider Alice, Bob, and Charlie entering the Purple room. Charlie joins first, creating the room and becoming its master client. Alice and Bob join shortly after as normal clients.

If Charlie, the master client, leaves, a new master client is selected, and all remaining clients are notified. This feature is crucial for the next networking layer.
Game Replication Layer - Netcode for GameObjects
Extensive documentation on Netcode for GameObjects is available on the Unity Documentation site.
For applications like SharedSpaces, we can host the server on one of the headsets as a listen-server. In this mode, the game acts as both a server and its first connected client, accepting connections from other players.
For each room, we select one user as the listen-server. This decision comes from the transport layer: the master client of the corresponding Photon room becomes our host.

When the hosting player leaves, we perform a host migration. Here, Alice leaves the purple room. Photon selects Bob as the new master client. The remaining room members are notified, and they reestablish their Unity connections.

We end up with two Photon rooms; the Purple room is now hosted by Bob, with Charlie and Donna connected to him. Alice just left the room through the door to her lobby, but since she is the only one there, she becomes both the master client and host of her group lobby.