Configuring the Multiplayer Sample for Amazon GameLift - Lumberyard User Guide

Configuring the Multiplayer Sample for Amazon GameLift

To prepare the multiplayer sample for use with Amazon GameLift, follow the required procedures for server-side and client-side configuration.

Server-Side Configuration

On the server side, overwrite the GridMate::OnSessionStarted() handler. In the handler, synchronize the session state and load the corresponding map if the CVAR sv_map is set in the Multiplayer::Utils::SynchronizeSessionState() function.

The following example shows code for server-side configuration.

void GameManager::OnSessionCreated(GridMate::GridSession* session) { m_gameSession = session; if (m_gameSession) { if (m_gameSession->IsHost()) { if (gEnv->IsDedicated()) { Multiplayer::Utils::SynchronizeSessionState(m_gameSession); } } } }

Set the following server CVARs as needed:

gamelift_flexmatch_enable

gamelift_flexmatch_onplayerremoved_enable

gamelift_flexmatch_start_delay

For more details on these server CVARs provided by the Multiplayer Gem, see Server CVars.

Client-Side Configuration

On the client side, you must configure the following CVARs:

sv_port

sv_map

gamelift_aws_access_key

gamelift_aws_secret_key

gamelift_fleet_id or gamelift_alias_id

gamelift_queue_name

gamelift_end_point

gamelift_playerid

gamelift_matchmaking_config_name

You can set these CVARs with a console command or with the multiplayer sample user interface. For a list of all the supported CVARs in the Multiplayer Gem, see Multiplayer Gem CVars.

To use CVARs to set the client side configuration, enter the following console command.

+sv_port 33435 +gamelift_fleet_id <fleet> +gamelift_aws_access_key <aws access key> +gamelift_aws_secret_key <aws secret key>

To use the multiplayer sample user interface to configure Amazon GameLift

  1. By default, the multiplayer sample loads the Game Lobby map. To add or modify the CVARs, choose Amazon GameLift.

    
                        Click Amazon GameLift
  2. Fill in the details of the GameLift configuration and choose Connect.

    
                        Fill in the details of the GameLift configuration and choose
                                Connect
  3. To create a game session and join automatically, select the Create Server radio button and do the following:

    1. Specify the Server Name and the Map (sv_map) to load.

    2. Enter the Queue Name, Fleet ID, or Alias ID.

    3. Choose the Create Server button.

    
                        Specify server name and map. Enter queue name, fleet ID, or alias ID. Choose
                                Create Server to create a game session and join
                            automatically.
  4. To search for and join an active game session, select the Join Server radio button and do the following:

    1. Specify the Queue Name, Fleet ID, or Alias ID.

    2. Choose Refresh. Active game sessions will be listed.

    3. Select a session and choose Join.

    
                        Specify the Queue Name, Fleet ID, or
                                Alias ID. Choose Refresh to search
                            for active game sessions. Select an active session and choose
                                Join to join a session.
  5. To use matchmaking to get placed in a game session, select the FlexMatch radio button and do the following:

    1. Specify the matchmaking Config Name.

    2. Choose Start Matchmaking.

    
                        Specify the matchmaking Config Name. Choose
                                Start Matchmaking.

Create an Amazon GameLift Package

To create a Amazon GameLift package, complete the following steps.

To create a Amazon GameLift package

  1. Before you create an Amazon GameLift package, do the following:

    • Compile game assets

    • Build the Lumberyard executable

  2. Run the following commands to create the Amazon GameLift package:

    mkdir GameLiftPackageWindows
    cp -r MultiplayerSample_pc_Paks_Dedicated/* GameLiftPackageWindows/
    cp -r Bin64vc141.Dedicated/* GameLiftPackageWindows/
  3. Copy the corresponding Visual Studio redistributable into the GameLiftPackageWindows folder.

  4. Verify the dedicated server runs from the GameLiftPackageWindows folder.

  5. Upload your build and create a fleet from the Amazon GameLift console. For more information, see Uploading Your Game to Amazon GameLift.

Secured Connection (Not Amazon GameLift Specific)

Amazon GameLift uses the OpenSSL-based secure socket driver to create a secured connection. However, instead of verifying the server, the secure socket driver can verify the client.

To enable a secured connection, make the following change to the game.cfg file:

gm_netsec_enable = 1

If client verification is needed, make the following change to the game.cfg file:

gm_netsec_verify_client = 1
Note

By default, the certificate and private key are loaded from the multiplayersample.cert.pem file (shared by the certificate and CA root) and from the multiplayersample.key.pem file. To specific different files, use the gm_netsec_certificate and gm_netsec_private_key CVARs.