game / pragma.multiplayer / MultiplayerService /

MultiplayerService #

internal class MultiplayerService(pragmaNode: PragmaNode, instanceId: <ERROR CLASS>, partyClient: PartyClient = PartyClient(), gameInstanceClient: GameInstanceClient = GameInstanceClient(), cache: MultiplayerCache = MultiplayerCache()) : DistributedService, ConfigHandler<MultiplayerConfig>

The MultiplayerService is intended to handle the routing mismatch between players and their various multiplayer states.

Underlying systems like PartyService have their endpoints routed based on their entity id (in this case PartyId). Player clients may lose track of their entity ids due to disconnect or desyncing, making it difficult to rely on the client as a source of truth.

This service is responsible for caching and receiving cache updates on various multiplayer states, so it can provide a consistent routing mechanism and act as the source of truth for the client.

Constructors #

MultiplayerService

fun MultiplayerService(pragmaNode: PragmaNode, instanceId: <ERROR CLASS>, partyClient: PartyClient = PartyClient(), gameInstanceClient: GameInstanceClient = GameInstanceClient(), cache: MultiplayerCache = MultiplayerCache())

Functions #

NameSummary

getCacheInfoOperatorV1

suspend fun getCacheInfoOperatorV1(session: OperatorSession, request: MultiplayerRpc.GetCacheInfoOperatorV1Request): MultiplayerRpc.GetCacheInfoOperatorV1Response

Queries cached multiplayer data by player id.

getPlayerRoutingValuesServiceV1

suspend fun getPlayerRoutingValuesServiceV1(session: ServiceSession, request: MultiplayerRpc.GetPlayerRoutingValuesServiceV1Request): MultiplayerRpc.GetPlayerRoutingValuesServiceV1Response

Gets the cached routing values for a given player.

initializeGameInstanceV1

suspend fun initializeGameInstanceV1(session: PlayerSession, request: MultiplayerRpc.InitializeGameInstanceV1Request): MultiplayerRpc.InitializeGameInstanceV1Response

Retrieves latest game instance state. Used to synchronize the client to the platform.

initializePartyV1

suspend fun initializePartyV1(session: PlayerSession, request: MultiplayerRpc.InitializePartyV1Request): MultiplayerRpc.InitializePartyV1Response

Retrieves latest party state. Used to synchronize the client to the platform.

leavePartyServiceV1

suspend fun leavePartyServiceV1(session: ServiceSession, request: MultiplayerRpc.LeavePartyServiceV1Request): MultiplayerRpc.LeavePartyServiceV1Response

Leaves a party, via a service to service call.

removePlayerPendingPartyInviteServiceV1

suspend fun removePlayerPendingPartyInviteServiceV1(session: ServiceSession, request: MultiplayerRpc.RemovePlayerPendingPartyInviteServiceV1Request): MultiplayerRpc.RemovePlayerPendingPartyInviteServiceV1Response

Removes a cached pending party invite for a given player.

removePlayerRoutingValueServiceV1

suspend fun removePlayerRoutingValueServiceV1(session: ServiceSession, request: MultiplayerRpc.RemovePlayerRoutingValueServiceV1Request): MultiplayerRpc.RemovePlayerRoutingValueServiceV1Response

Removes the cached party id for a given player.

syncGameInstanceV1

suspend fun syncGameInstanceV1(session: PlayerSession, request: MultiplayerRpc.SyncGameInstanceV1Request): MultiplayerRpc.SyncGameInstanceV1Response

Synchronizes latest game instance state. Used to resynchronize the client to the platform.

syncPartyV1

suspend fun syncPartyV1(session: PlayerSession, request: MultiplayerRpc.SyncPartyV1Request): MultiplayerRpc.SyncPartyV1Response

Retrieves latest party state. Used to synchronize the client to the platform.

updatePlayerPendingPartyInviteServiceV1

suspend fun updatePlayerPendingPartyInviteServiceV1(session: ServiceSession, request: MultiplayerRpc.UpdatePlayerPendingPartyInviteServiceV1Request): MultiplayerRpc.UpdatePlayerPendingPartyInviteServiceV1Response

Adds or modifies a cached pending party invite for a given player.

updatePlayerRoutingValueServiceV1

suspend fun updatePlayerRoutingValueServiceV1(session: ServiceSession, request: MultiplayerRpc.UpdatePlayerRoutingValueServiceV1Request): MultiplayerRpc.UpdatePlayerRoutingValueServiceV1Response

Adds or modifies the cached routing value for a given player.