GameLift / Client / start_matchmaking

start_matchmaking#

GameLift.Client.start_matchmaking(**kwargs)#

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

Set Up FlexMatch event notification

How Amazon GameLift FlexMatch works

See also: AWS API Documentation

Request Syntax

response = client.start_matchmaking(
    TicketId='string',
    ConfigurationName='string',
    Players=[
        {
            'PlayerId': 'string',
            'PlayerAttributes': {
                'string': {
                    'S': 'string',
                    'N': 123.0,
                    'SL': [
                        'string',
                    ],
                    'SDM': {
                        'string': 123.0
                    }
                }
            },
            'Team': 'string',
            'LatencyInMs': {
                'string': 123
            }
        },
    ]
)
Parameters:
  • TicketId (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.

  • ConfigurationName (string) –

    [REQUIRED]

    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 (list) –

    [REQUIRED]

    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.

    • (dict) –

      Represents a player in matchmaking. When starting a matchmaking request, a player has a player ID, attributes, and may have latency data. Team information is added after a match has been successfully completed.

      • PlayerId (string) –

        A unique identifier for a player

      • PlayerAttributes (dict) –

        A collection of key:value pairs containing player information for use in matchmaking. Player attribute keys must match the playerAttributes used in a matchmaking rule set. Example: "PlayerAttributes": {"skill": {"N": "23"}, "gameMode": {"S": "deathmatch"}}.

        You can provide up to 10 PlayerAttributes.

        • (string) –

          • (dict) –

            Values for use in player attribute key-value pairs. This object lets you specify an attribute value using any of the valid data types: string, number, string array, or data map. Each AttributeValue object can use only one of the available properties.

            • S (string) –

              For single string values. Maximum string length is 100 characters.

            • N (float) –

              For number values, expressed as double.

            • SL (list) –

              For a list of up to 100 strings. Maximum length for each string is 100 characters. Duplicate values are not recognized; all occurrences of the repeated value after the first of a repeated value are ignored.

              • (string) –

            • SDM (dict) –

              For a map of up to 10 data type:value pairs. Maximum length for each string value is 100 characters.

              • (string) –

                • (float) –

      • Team (string) –

        Name of the team that the player is assigned to in a match. Team names are defined in a matchmaking rule set.

      • LatencyInMs (dict) –

        A set of values, expressed in milliseconds, that indicates the amount of latency that a player experiences when connected to @aws; Regions. If this property is present, FlexMatch considers placing the match only in Regions for which latency is reported.

        If a matchmaker has a rule that evaluates player latency, players must report latency in order to be matched. If no latency is reported in this scenario, FlexMatch assumes that no Regions are available to the player and the ticket is not matchable.

        • (string) –

          • (integer) –

Return type:

dict

Returns:

Response Syntax

{
    'MatchmakingTicket': {
        'TicketId': 'string',
        'ConfigurationName': 'string',
        'ConfigurationArn': 'string',
        'Status': 'CANCELLED'|'COMPLETED'|'FAILED'|'PLACING'|'QUEUED'|'REQUIRES_ACCEPTANCE'|'SEARCHING'|'TIMED_OUT',
        'StatusReason': 'string',
        'StatusMessage': 'string',
        'StartTime': datetime(2015, 1, 1),
        'EndTime': datetime(2015, 1, 1),
        'Players': [
            {
                'PlayerId': 'string',
                'PlayerAttributes': {
                    'string': {
                        'S': 'string',
                        'N': 123.0,
                        'SL': [
                            'string',
                        ],
                        'SDM': {
                            'string': 123.0
                        }
                    }
                },
                'Team': 'string',
                'LatencyInMs': {
                    'string': 123
                }
            },
        ],
        'GameSessionConnectionInfo': {
            'GameSessionArn': 'string',
            'IpAddress': 'string',
            'DnsName': 'string',
            'Port': 123,
            'MatchedPlayerSessions': [
                {
                    'PlayerId': 'string',
                    'PlayerSessionId': 'string'
                },
            ]
        },
        'EstimatedWaitTime': 123
    }
}

Response Structure

  • (dict) –

    • MatchmakingTicket (dict) –

      Ticket representing the matchmaking request. This object include the information included in the request, ticket status, and match results as generated during the matchmaking process.

      • TicketId (string) –

        A unique identifier for a matchmaking ticket.

      • ConfigurationName (string) –

        Name of the matchmaking configuration that is used with this ticket. Matchmaking configurations determine how players are grouped into a match and how a new game session is created for the match.

      • ConfigurationArn (string) –

        The Amazon Resource Name ( ARN) associated with the GameLift matchmaking configuration resource that is used with this ticket.

      • Status (string) –

        Current status of the matchmaking request.

        • QUEUED – The matchmaking request has been received and is currently waiting to be processed.

        • SEARCHING – The matchmaking request is currently being processed.

        • REQUIRES_ACCEPTANCE – A match has been proposed and the players must accept the match. This status is used only with requests that use a matchmaking configuration with a player acceptance requirement.

        • PLACING – The FlexMatch engine has matched players and is in the process of placing a new game session for the match.

        • COMPLETED – Players have been matched and a game session is ready to host the players. A ticket in this state contains the necessary connection information for players.

        • FAILED – The matchmaking request was not completed.

        • CANCELLED – The matchmaking request was canceled. This may be the result of a StopMatchmaking operation or a proposed match that one or more players failed to accept.

        • TIMED_OUT – The matchmaking request was not successful within the duration specified in the matchmaking configuration.

        Note

        Matchmaking requests that fail to successfully complete (statuses FAILED, CANCELLED, TIMED_OUT) can be resubmitted as new requests with new ticket IDs.

      • StatusReason (string) –

        Code to explain the current status. For example, a status reason may indicate when a ticket has returned to SEARCHING status after a proposed match fails to receive player acceptances.

      • StatusMessage (string) –

        Additional information about the current status.

      • StartTime (datetime) –

        Time stamp indicating when this matchmaking request was received. Format is a number expressed in Unix time as milliseconds (for example "1469498468.057").

      • EndTime (datetime) –

        Time stamp indicating when the matchmaking request stopped being processed due to successful completion, timeout, or cancellation. Format is a number expressed in Unix time as milliseconds (for example "1469498468.057").

      • Players (list) –

        A set of Player objects, each representing a player to find matches for. Players are identified by a unique player ID and may include latency data for use during matchmaking. If the ticket is in status COMPLETED, the Player objects include the team the players were assigned to in the resulting match.

        • (dict) –

          Represents a player in matchmaking. When starting a matchmaking request, a player has a player ID, attributes, and may have latency data. Team information is added after a match has been successfully completed.

          • PlayerId (string) –

            A unique identifier for a player

          • PlayerAttributes (dict) –

            A collection of key:value pairs containing player information for use in matchmaking. Player attribute keys must match the playerAttributes used in a matchmaking rule set. Example: "PlayerAttributes": {"skill": {"N": "23"}, "gameMode": {"S": "deathmatch"}}.

            You can provide up to 10 PlayerAttributes.

            • (string) –

              • (dict) –

                Values for use in player attribute key-value pairs. This object lets you specify an attribute value using any of the valid data types: string, number, string array, or data map. Each AttributeValue object can use only one of the available properties.

                • S (string) –

                  For single string values. Maximum string length is 100 characters.

                • N (float) –

                  For number values, expressed as double.

                • SL (list) –

                  For a list of up to 100 strings. Maximum length for each string is 100 characters. Duplicate values are not recognized; all occurrences of the repeated value after the first of a repeated value are ignored.

                  • (string) –

                • SDM (dict) –

                  For a map of up to 10 data type:value pairs. Maximum length for each string value is 100 characters.

                  • (string) –

                    • (float) –

          • Team (string) –

            Name of the team that the player is assigned to in a match. Team names are defined in a matchmaking rule set.

          • LatencyInMs (dict) –

            A set of values, expressed in milliseconds, that indicates the amount of latency that a player experiences when connected to @aws; Regions. If this property is present, FlexMatch considers placing the match only in Regions for which latency is reported.

            If a matchmaker has a rule that evaluates player latency, players must report latency in order to be matched. If no latency is reported in this scenario, FlexMatch assumes that no Regions are available to the player and the ticket is not matchable.

            • (string) –

              • (integer) –

      • GameSessionConnectionInfo (dict) –

        Connection information for a new game session. Once a match is made, the FlexMatch engine creates a new game session for it. This information is added to the matchmaking ticket, which you can be retrieve by calling DescribeMatchmaking .

        • GameSessionArn (string) –

          A unique identifier for the game session. Use the game session ID.

        • IpAddress (string) –

          The IP address of the game session. To connect to a Amazon GameLift game server, an app needs both the IP address and port number.

        • DnsName (string) –

          The DNS identifier assigned to the instance that is running the game session. Values have the following format:

          • TLS-enabled fleets: <unique identifier>.<region identifier>.amazongamelift.com.

          • Non-TLS-enabled fleets: ec2-<unique identifier>.compute.amazonaws.com. (See Amazon EC2 Instance IP Addressing.)

          When connecting to a game session that is running on a TLS-enabled fleet, you must use the DNS name, not the IP address.

        • Port (integer) –

          The port number for the game session. To connect to a Amazon GameLift game server, an app needs both the IP address and port number.

        • MatchedPlayerSessions (list) –

          A collection of player session IDs, one for each player ID that was included in the original matchmaking request.

          • (dict) –

            Represents a new player session that is created as a result of a successful FlexMatch match. A successful match automatically creates new player sessions for every player ID in the original matchmaking request.

            When players connect to the match’s game session, they must include both player ID and player session ID in order to claim their assigned player slot.

            • PlayerId (string) –

              A unique identifier for a player

            • PlayerSessionId (string) –

              A unique identifier for a player session

      • EstimatedWaitTime (integer) –

        Average amount of time (in seconds) that players are currently waiting for a match. If there is not enough recent data, this property may be empty.

Exceptions