Skip to content

Multiplayer

Some immersive applications are built to allow multiple Participants to interact in a shared world. When multiple sessions have the same LobbyId, it allows our system to logically group these sessions together with minimal client side effort.

Networking Structure

The CognitiveVR SDK is not designed to record multiple sessions from a centralized server. It is designed to run on a client.

Lobby Id

A LobbyId connects multiple participant sessions together to display a multiplayer experience. The Lobby Id value should be requested and set before beginning the session.

Example

There are many possible ways to sync the LobbyId value across Clients. Please get in touch if you are using this feature.

A Server should follow this pseudocode to get a unique LobbyId from our Dashboard. This will then be replicated to the connected Clients.

//game server

map<string,string> headers;
headers.Add("Authorization","APIKEY:DATA " + APIKey);
auto response = http::post("https://data.cognitive3d.com/v0/lobbies",headers);
auto json = json::parse(response.Content);
string lobbyid = json["id"];
//send lobbyid to each client

lobby id

//game client
TWeakPtr<FAnalyticsProviderCognitiveVR> cognitive = FAnalyticsCognitiveVR::Get().GetCognitiveVRProvider();
if (cognitive.IsValid())
{
    cognitive.Pin()->SetLobbyId(lobbyid);
}