Skip to main content

Multiplayer Service (Beta)

Pretia AR Cloud provides a series of services to let developers get started quickly with creating multiplayer experiences. This document will explain what features are currently available, and what kinds of multiplayer experiences we currently support.

Match-making Service

At the moment, we only provide a basic match-making based on the application key, which can be get from the developer console. Any clients joining a session will be matched into the same game session with the application key, up to a maximum number which can be set from the application settings in developer console. After the maximum number of clients have joined a game session, a new game session will be created and new clients will be matched to this new session.

Game Session

Pretia AR Cloud currently only supports the host-client network architecture, of which there is a relay service that broadcasts the messages between each other, and there is one client which is appointed as the host to be the session authority. Host appointment happens when a client joins an empty game session, or when the host disconnects and there are still other clients in the session.

To learn more about how the connection with game session gets initialized in more details, please refer to this diagram in the Networking API docs

This implies that our multiplayer features excel at supporting an experience which is short and can be enjoyed by multiple people at the same time (and the same place, assuming the use of relocalization). However, our services is not the right fit yet for multiplayer experiences which requires persistant states or dedicated game server, such as a Massively Multiplayer Online (MMO) game.

Host-client Architecture

With the host-client architecture, generally the host holds authority over the state of the session, and is responsible for:

  • Receiving inputs from the other clients
  • Simulating the updates
  • Sending the updates back to the other clients

The other clients should generally be only communicating their inputs, and applying the updates received from the host. With this architecture, it is also important for all the other clients to keep track of the whole state, so that when the host disconnects another client can take over as the host smoothly.

Relay Service

Any communication that happens in a game session goes through a relay service. The relay service provides four communication methods:

  • Host Message (Let host broadcast a message to all connected clients),
  • Player Message (Let any client broadcast a message to all other connected clients),
  • Player-to-host Message (Let any client send a message to the host),
  • Host-to-player Message (Let the host send a message to any one client),