Method: Aws::GameLift::Client#start_matchmaking

Defined in:
lib/aws-sdk-gamelift/client.rb

#start_matchmaking(params = {}) ⇒ Types::StartMatchmakingOutput

Uses FlexMatch to create a game match for a group of players based on custom matchmaking rules. With games that use Amazon GameLift managed hosting, this operation also triggers Amazon GameLift 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][1
Set Up FlexMatch event notification][2
How Amazon GameLift FlexMatch works][3

[1]: docs.aws.amazon.com/gamelift/latest/flexmatchguide/match-client.html [2]: docs.aws.amazon.com/gamelift/latest/flexmatchguide/match-notification.html [3]: docs.aws.amazon.com/gamelift/latest/flexmatchguide/gamelift-match.html

Examples:

Request syntax with placeholder values


resp = client.start_matchmaking({
  ticket_id: "MatchmakingIdStringModel",
  configuration_name: "MatchmakingConfigurationName", # required
  players: [ # required
    {
      player_id: "PlayerId",
      player_attributes: {
        "NonZeroAndMaxString" => "value", # value <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
      },
      team: "NonZeroAndMaxString",
      latency_in_ms: {
        "NonEmptyString" => 1,
      },
    },
  ],
})

Response structure


resp.matchmaking_ticket.ticket_id #=> String
resp.matchmaking_ticket.configuration_name #=> String
resp.matchmaking_ticket.configuration_arn #=> String
resp.matchmaking_ticket.status #=> String, one of "CANCELLED", "COMPLETED", "FAILED", "PLACING", "QUEUED", "REQUIRES_ACCEPTANCE", "SEARCHING", "TIMED_OUT"
resp.matchmaking_ticket.status_reason #=> String
resp.matchmaking_ticket.status_message #=> String
resp.matchmaking_ticket.start_time #=> Time
resp.matchmaking_ticket.end_time #=> Time
resp.matchmaking_ticket.players #=> Array
resp.matchmaking_ticket.players[0].player_id #=> String
resp.matchmaking_ticket.players[0].player_attributes #=> Hash
resp.matchmaking_ticket.players[0].player_attributes["NonZeroAndMaxString"] #=> <Hash,Array,String,Numeric,Boolean,IO,Set,nil>
resp.matchmaking_ticket.players[0].team #=> String
resp.matchmaking_ticket.players[0].latency_in_ms #=> Hash
resp.matchmaking_ticket.players[0].latency_in_ms["NonEmptyString"] #=> Integer
resp.matchmaking_ticket.game_session_connection_info.game_session_arn #=> String
resp.matchmaking_ticket.game_session_connection_info.ip_address #=> String
resp.matchmaking_ticket.game_session_connection_info.dns_name #=> String
resp.matchmaking_ticket.game_session_connection_info.port #=> Integer
resp.matchmaking_ticket.game_session_connection_info.matched_player_sessions #=> Array
resp.matchmaking_ticket.game_session_connection_info.matched_player_sessions[0].player_id #=> String
resp.matchmaking_ticket.game_session_connection_info.matched_player_sessions[0].player_session_id #=> String
resp.matchmaking_ticket.estimated_wait_time #=> Integer

Parameters:

  • params (Hash) (defaults to: {})

    ({})

Options Hash (params):

  • :ticket_id (String)

    A unique identifier for a matchmaking ticket. If no ticket ID is specified here, Amazon GameLift will generate one in the form of a UUID. Use this identifier to track the matchmaking ticket status and retrieve match results.

  • :configuration_name (required, String)

    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 (required, Array<Types::Player>)

    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.

Returns:

See Also:



9734
9735
9736
9737
# File 'lib/aws-sdk-gamelift/client.rb', line 9734

def start_matchmaking(params = {}, options = {})
  req = build_request(:start_matchmaking, params)
  req.send_request(options)
end