game / pragma.gameinstance / GameInstanceService /

GameInstanceService #

internal class GameInstanceService(pragmaNode: PragmaNode, instanceId: <ERROR CLASS>, routingUtils: RoutingUtils = RoutingUtils.defaultInstance, gameInstanceProxy: GameInstanceProxy = GameInstanceProxy(), gameInstanceManager: GameInstanceManager = GameInstanceManager(), notificationClient: GameInstanceNotificationClient = GameInstanceNotificationClient(), matchmakingClient: MatchmakingClient = MatchmakingClient(), partyClient: PartyClient = PartyClient(), multiplayerClient: MultiplayerClient = MultiplayerClient(), timeProxy: TimeProxy = TimeProxy.defaultInstance, foundMorePlayersManager: FoundMorePlayersManager = FoundMorePlayersManager()) : DistributedService, ConfigHandler<GameInstanceServiceConfig>

GameInstanceService is a game flow service responsible for creating game instances, sending connection details to players, and handling any game end processing.

Constructors #

GameInstanceService

fun GameInstanceService(pragmaNode: PragmaNode, instanceId: <ERROR CLASS>, routingUtils: RoutingUtils = RoutingUtils.defaultInstance, gameInstanceProxy: GameInstanceProxy = GameInstanceProxy(), gameInstanceManager: GameInstanceManager = GameInstanceManager(), notificationClient: GameInstanceNotificationClient = GameInstanceNotificationClient(), matchmakingClient: MatchmakingClient = MatchmakingClient(), partyClient: PartyClient = PartyClient(), multiplayerClient: MultiplayerClient = MultiplayerClient(), timeProxy: TimeProxy = TimeProxy.defaultInstance, foundMorePlayersManager: FoundMorePlayersManager = FoundMorePlayersManager())

Functions #

NameSummary

addPlayersServiceV1

suspend fun addPlayersServiceV1(session: ServiceSession, request: GameInstanceRpc.AddPlayersServiceV1Request): GameInstanceRpc.AddPlayersServiceV1Response

Called by other backend services to add players to an existing GameInstance.

connectMorePlayersV1

suspend fun connectMorePlayersV1(session: PartnerSession, request: GameInstanceRpc.ConnectMorePlayersV1Request): GameInstanceRpc.ConnectMorePlayersV1Response

Called by a game server with connection details and ext data for previously found players, and connects them to the game instance. Each player receives a GameInstanceRpc.GameInstanceDetailsV1Notification containing all host connection details.

connectPlayersV1

suspend fun connectPlayersV1(session: PartnerSession, request: GameInstanceRpc.ConnectPlayersV1Request): GameInstanceRpc.ConnectPlayersV1Response

Signals a game is ready to be joined by players. Invoked by the game server.

createGameInstanceServiceV1

suspend fun createGameInstanceServiceV1(session: ServiceSession, request: GameInstanceRpc.CreateGameInstanceServiceV1Request): GameInstanceRpc.CreateGameInstanceServiceV1Response

Create a new game instance.

createGameInstanceV1

suspend fun createGameInstanceV1(session: ServiceSession, request: GameInstanceRpc.CreateGameInstanceV1Request): GameInstanceRpc.CreateGameInstanceV1Response

Create a new game instance.

createV1

suspend fun createV1(session: PlayerSession, request: GameInstanceRpc.CreateV1Request): GameInstanceRpc.CreateV1Response

Create a game. Invokes the GameInstancePlugin.handlePlayerCreateRequest function to customize the newly created game instance.

declineReconnectV1

suspend fun declineReconnectV1(session: PlayerSession, request: GameInstanceRpc.DeclineReconnectV1Request): GameInstanceRpc.DeclineReconnectV1Response

DEPRECATED in 0.4.0, removal by 0.5.0. Use leaveV1 which offers the same functionality with an additional request ext for customization.

endGameV1

suspend fun endGameV1(session: PartnerSession, request: GameInstanceRpc.EndGameV1Request): GameInstanceRpc.EndGameV1Response

Signals a game has completed. Invoked by the game server.

enterMatchmakingV1

suspend fun enterMatchmakingV1(session: PartnerSession, request: GameInstanceRpc.EnterMatchmakingV1Request): GameInstanceRpc.EnterMatchmakingV1Response

Reenters a game instance into matchmaking to find more players. This endpoint will call the Matchmaking Service to add the game instance to the requested queue.

foundMorePlayersV1

suspend fun foundMorePlayersV1(session: ServiceSession, request: GameInstanceRpc.FoundMorePlayersV1Request): GameInstanceRpc.FoundMorePlayersV1Response

Called by the MatchmakingService when matchmaking has found additional players for the game instance.

gameKeepAliveV1

suspend fun gameKeepAliveV1(session: PartnerSession, request: GameInstanceRpc.GameKeepAliveV1Request): GameInstanceRpc.GameKeepAliveV1Response

Invoked by the game server to indicate that a game instance is still operating normally.

getCacheInfoOperatorV1

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

Queries cached game instance data by game instance id.

getCacheInfoServiceV1

suspend fun getCacheInfoServiceV1(session: ServiceSession, request: GameInstanceRpc.GetCacheInfoServiceV1Request): GameInstanceRpc.GetCacheInfoServiceV1Response

Queries cached game instance data by game instance id.

getGameStartDataV1

suspend fun getGameStartDataV1(session: PartnerSession, request: GameInstanceRpc.GetGameStartDataV1Request): GameInstanceRpc.GetGameStartDataV1Response

Called by the game server when allocated a game to get the game start data.

joinGameInstanceV1

suspend fun joinGameInstanceV1(session: PlayerSession, request: GameInstanceRpc.JoinGameInstanceV1Request): GameInstanceRpc.JoinGameInstanceV1Response

Join a game. Invokes the GameInstancePlugin.handlePlayerJoinRequest function to customize game relevant data for the player.

leaveMatchmakingV1

suspend fun leaveMatchmakingV1(session: PartnerSession, request: GameInstanceRpc.LeaveMatchmakingV1Request): GameInstanceRpc.LeaveMatchmakingV1Response

Request made by the game server to remove a game instance from matchmaking. The MatchmakingService may complete any pending changes to the game instance before it is removed.

leaveV1

suspend fun leaveV1(session: PlayerSession, request: GameInstanceRpc.LeaveV1Request): GameInstanceRpc.LeaveV1Response

Leave a game. Invokes the GameInstancePlugin.handlePlayerLeaveRequest function to validate whether to allow the player to leave.

onSessionTerminated

open suspend override fun onSessionTerminated(notification: PlayerSessionRpc.SessionTerminatedForServiceV1Notification)

Notification handler for player disconnect. Marks player as REMOVED from a game instance.

removedGameInstanceFromMatchmakingV1

suspend fun removedGameInstanceFromMatchmakingV1(session: ServiceSession, request: GameInstanceRpc.RemovedGameInstanceFromMatchmakingV1Request): GameInstanceRpc.RemovedGameInstanceFromMatchmakingV1Response

Update the status of a game instance to reflect that it is no longer in matchmaking.

removePlayersServiceV1

suspend fun removePlayersServiceV1(session: ServiceSession, request: GameInstanceRpc.RemovePlayersServiceV1Request): GameInstanceRpc.RemovePlayersServiceV1Response

Remove players from a game instance. Invoked by other backend services or plugins via the GameInstanceApi.

removePlayersV1

suspend fun removePlayersV1(session: PartnerSession, request: GameInstanceRpc.RemovePlayersV1Request): GameInstanceRpc.RemovePlayersV1Response

Deprecated as of 0.4.0, removal by 0.5.0. Please use removePlayersV2 instead.

removePlayersV2

suspend fun removePlayersV2(session: PartnerSession, request: GameInstanceRpc.RemovePlayersV2Request): GameInstanceRpc.RemovePlayersV2Response

Remove players from a game instance. Invoked by the game server.

syncServiceV1

suspend fun syncServiceV1(session: ServiceSession, request: GameInstanceRpc.SyncServiceV1Request): GameInstanceRpc.SyncServiceV1Response

Retrieves the latest cached game instance info for a specific player.

updateGameInstancePartnerV1

suspend fun updateGameInstancePartnerV1(session: PartnerSession, request: GameInstanceRpc.UpdateGameInstancePartnerV1Request): GameInstanceRpc.UpdateGameInstancePartnerV1Response

Called by the game server to update a running game instance with new data.

updateGameInstanceServiceV1

suspend fun updateGameInstanceServiceV1(session: ServiceSession, request: GameInstanceRpc.UpdateGameInstanceServiceV1Request): GameInstanceRpc.UpdateGameInstanceServiceV1Response

Called by other backend services to update a running game instance with new data.

updateGameInstanceV1

suspend fun updateGameInstanceV1(session: PlayerSession, request: GameInstanceRpc.UpdateGameInstanceV1Request): GameInstanceRpc.UpdateGameInstanceV1Response

Called by a player to update a running game instance with new data.

updatePlayerPartyServiceV1

suspend fun updatePlayerPartyServiceV1(session: ServiceSession, request: GameInstanceRpc.UpdatePlayerPartyServiceV1Request): GameInstanceRpc.UpdatePlayerPartyServiceV1Response

Updates a given game instance with a player’s new party id.

verifyPlayerPartnerV1

suspend fun verifyPlayerPartnerV1(session: PartnerSession, request: GameInstanceRpc.VerifyPlayerPartnerV1Request): GameInstanceRpc.VerifyPlayerPartnerV1Response

Called by the game server to verify that connecting players are not misrepresenting their pragma identity.