This API works with the following fleet types: EC2, Anywhere, Container
Uses FlexMatch to create a game match for a group of players based on custom matchmaking rules. With games that use Amazon GameLift Servers managed hosting, this operation also triggers Amazon GameLift Servers to find hosting resources and start a new game session for the new match. Each matchmaking request includes information on one or more players and specifies the FlexMatch matchmaker to use. When a request is for multiple players, FlexMatch attempts to build a match that includes all players in the request, placing them in the same team and finding additional players as needed to fill the match.
To start matchmaking, provide a unique ticket ID, specify a matchmaking configuration, and include the players to be matched. You must also include any player attributes that are required by the matchmaking configuration's rule set. If successful, a matchmaking ticket is returned with status set to QUEUED.
Track matchmaking events to respond as needed and acquire game session connection information for successfully completed matches. Ticket status updates are tracked using event notification through Amazon Simple Notification Service, which is defined in the matchmaking configuration.
Learn more
Add FlexMatch to a game client
Set Up FlexMatch event notification
How Amazon GameLift Servers FlexMatch works
Parameters:
-
ticket_id
(Optional[MatchmakingIdStringModel], default:
None
)
–
A unique identifier for a matchmaking ticket. If no ticket ID is specified here, Amazon GameLift Servers will generate one in the form of a UUID. Use this identifier to track the matchmaking ticket status and retrieve match results.
-
configuration_name
(Optional[MatchmakingConfigurationName], default:
None
)
–
Name of the matchmaking configuration to use for this request. Matchmaking configurations must exist in the same Region as this request. You can use either the configuration name or ARN value.
-
players
(Optional[PlayerList], default:
None
)
–
Information on each player to be matched. This information must include a player ID, and may contain player attributes and latency data to be used in the matchmaking process. After a successful match, Player objects contain the name of the team the player is assigned to.
You can include up to 10 Players in a StartMatchmaking request.
Raises:
-
InternalServiceException
–
The service encountered an unrecoverable internal failure while processing the request. Clients can retry such requests immediately or after a waiting period.
-
InvalidRequestException
–
One or more parameter values in the request are invalid. Correct the invalid parameter values before retrying.
-
NotFoundException
–
The requested resource was not found. The resource was either not created yet or deleted.
-
UnsupportedRegionException
–
The requested operation is not supported in the Region specified.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_gamelift/_services/game_lift.py
| def start_matchmaking(
self,
*,
config_overrides: Optional[GameLiftClientConfig] = None,
ticket_id: Optional[
"capo_gamelift.types.matchmaking_id_string_model.MatchmakingIdStringModel"
] = None,
configuration_name: Optional[
"capo_gamelift.types.matchmaking_configuration_name.MatchmakingConfigurationName"
] = None,
players: Optional["capo_gamelift.types.player_list.PlayerList"] = None,
) -> "capo_gamelift.types.start_matchmaking_output.StartMatchmakingOutput":
"""<p> <b>This API works with the following fleet types:</b> EC2, Anywhere, Container</p> <p>Uses FlexMatch to create a game match for a group of players based on custom matchmaking rules. With games that use Amazon GameLift Servers managed hosting, this operation also triggers Amazon GameLift Servers to find hosting resources and start a new game session for the new match. Each matchmaking request includes information on one or more players and specifies the FlexMatch matchmaker to use. When a request is for multiple players, FlexMatch attempts to build a match that includes all players in the request, placing them in the same team and finding additional players as needed to fill the match. </p> <p>To start matchmaking, provide a unique ticket ID, specify a matchmaking configuration, and include the players to be matched. You must also include any player attributes that are required by the matchmaking configuration's rule set. If successful, a matchmaking ticket is returned with status set to <code>QUEUED</code>. </p> <p>Track matchmaking events to respond as needed and acquire game session connection information for successfully completed matches. Ticket status updates are tracked using event notification through Amazon Simple Notification Service, which is defined in the matchmaking configuration.</p> <p> <b>Learn more</b> </p> <p> <a href="https://docs.aws.amazon.com/gamelift/latest/flexmatchguide/match-client.html"> Add FlexMatch to a game client</a> </p> <p> <a href="https://docs.aws.amazon.com/gamelift/latest/flexmatchguide/match-notification.html"> Set Up FlexMatch event notification</a> </p> <p> <a href="https://docs.aws.amazon.com/gamelift/latest/flexmatchguide/gamelift-match.html"> How Amazon GameLift Servers FlexMatch works</a> </p>
Args:
ticket_id: <p>A unique identifier for a matchmaking ticket. If no ticket ID is specified here, Amazon GameLift Servers will generate one in the form of a UUID. Use this identifier to track the matchmaking ticket status and retrieve match results.</p>
configuration_name: <p>Name of the matchmaking configuration to use for this request. Matchmaking configurations must exist in the same Region as this request. You can use either the configuration name or ARN value.</p>
players: <p>Information on each player to be matched. This information must include a player ID, and may contain player attributes and latency data to be used in the matchmaking process. After a successful match, <code>Player</code> objects contain the name of the team the player is assigned to.</p> <p>You can include up to 10 <code>Players</code> in a <code>StartMatchmaking</code> request.</p>
Raises:
capo_gamelift.errors.internal_service_exception.InternalServiceException: <p>The service encountered an unrecoverable internal failure while processing the request. Clients can retry such requests immediately or after a waiting period.</p>
capo_gamelift.errors.invalid_request_exception.InvalidRequestException: <p>One or more parameter values in the request are invalid. Correct the invalid parameter values before retrying.</p>
capo_gamelift.errors.not_found_exception.NotFoundException: <p>The requested resource was not found. The resource was either not created yet or deleted.</p>
capo_gamelift.errors.unsupported_region_exception.UnsupportedRegionException: <p>The requested operation is not supported in the Region specified.</p>
capo_gamelift.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_gamelift.types.start_matchmaking_input.StartMatchmakingInput]",
) -> OperationResponse[
"capo_gamelift.types.start_matchmaking_output.StartMatchmakingOutput"
]:
import capo_gamelift._operations.game_lift.start_matchmaking
output, http_response = (
capo_gamelift._operations.game_lift.start_matchmaking.start_matchmaking(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
def _redact_input(
input_: "capo_gamelift.types.start_matchmaking_input.StartMatchmakingInput",
) -> dict[str, Any]:
import capo_gamelift.types.start_matchmaking_input
return capo_gamelift.types.start_matchmaking_input.redact_sensitive(input_)
def _redact_output(
output: "capo_gamelift.types.start_matchmaking_output.StartMatchmakingOutput",
) -> dict[str, Any]:
import capo_gamelift.types.start_matchmaking_output
return capo_gamelift.types.start_matchmaking_output.redact_sensitive(output)
interceptors_, options_ = self.operation_options(
config_overrides,
OperationLogging(
"StartMatchmaking",
redact_input=_redact_input,
redact_output=_redact_output,
),
)
input_: capo_gamelift.types.start_matchmaking_input.StartMatchmakingInput = {}
if ticket_id is not None:
input_["ticket_id"] = ticket_id
if configuration_name is not None:
input_["configuration_name"] = configuration_name
if players is not None:
input_["players"] = players
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|