game / pragma.gameinstance / GameInstanceService /

GameInstanceService #

internal class GameInstanceService( pragmaNode: PragmaNode, instanceId: <ERROR CLASS>, routingUtils: RoutingUtils = RoutingUtils.defaultInstance, gameInstancesInProcess: GameInstancesInProcess = GameInstancesInProcess(), sessionClient: SessionClient = SessionClient(), notificationClient: GameInstanceNotificationClient = GameInstanceNotificationClient(), matchmakingClient: MatchmakingClient = MatchmakingClient(), fleetClient: FleetClient = FleetClient(), partyClient: PartyClient = PartyClient() ) : 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, gameInstancesInProcess: GameInstancesInProcess = GameInstancesInProcess(), sessionClient: SessionClient = SessionClient(), notificationClient: GameInstanceNotificationClient = GameInstanceNotificationClient(), matchmakingClient: MatchmakingClient = MatchmakingClient(), fleetClient: FleetClient = FleetClient(), partyClient: PartyClient = PartyClient() )

Functions #

NameSummary

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.HostConnectionDetailsV1Notification 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.

createGameInstanceV1

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

Create a new game instance and find a game server for it run on.

declineReconnectV1

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

Prevent the player from reconnecting to the game instance. Game instance reconnect must be configured to OPTIONAL. A notification with the game instance id and player id will be sent to the game server running the game instance.

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.

gameInstanceAllocationFailureV1

suspend fun gameInstanceAllocationFailureV1( session: ServiceSession, request: GameInstanceRpc.GameInstanceAllocationFailureV1Request ): GameInstanceRpc.GameInstanceAllocationFailureV1Response

Signals a game server has failed to start for a game instance. Invoked by the FleetService.

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.

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.

getHostConnectionDetailsV1

suspend fun getHostConnectionDetailsV1( session: PlayerSession, request: GameInstanceRpc.GetHostConnectionDetailsV1Request ): GameInstanceRpc.GetHostConnectionDetailsV1Response

Provides the current game instance details for a 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.

onSessionTerminated

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

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

onSessionV1Reconnected

suspend fun onSessionV1Reconnected( notification: PlayerSessionRpc.SessionReconnectedV1Notification)

Notification handler for player reconnect. Attempt to reconnect them to their game, if they were in one.

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.

removePlayersV1

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

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

updateGameInstanceV1

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

Called by the game server 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.