README_GAMELIFT.md 2.4 KB

MultiplayerSample Project with Amazon GameLift

This README covers testing and running MultiplayerSample with Amazon GameLift.

Local testing with GameLiftLocal

Setup

  1. Install the AWS CLI, if you don't already have it. You will need it to create a game session with GameLiftLocal.
  2. Download the AmazonGameLift Server SDK and extract the "GameLiftLocal-1.0.5" directory somewhere easy to find.
  3. Enable the "AWSGameLift" and "MPSGameLift" gem by adding them to MultiplayerSample/Gem/Code/enabled_gems.cmake
  4. Build the server and game launchers for MultiplayerSample as normal, per top-level README.

Testing

  1. Open a command terminal from within the GameLiftLocal directory you downloaded before, and run it with the following command:

    java -jar GameLiftLocal.jar
    
  2. From another terminal within the root of the MultiplayerSample project, start the server launcher (assumes the executable is the result of a profile build):

    ./build/windows/bin/profile/MultiplayerSample.ServerLauncher.exe --sv_gameLiftEnabled=true --sv_dedicated_host_onstartup=false --loadlevel=NewStarbase
    

    Note: You may be inclined to move these cvars into a cfg file and start the game by passing the --console-command-file parameter, but don't. Some cvars are used during a system component Activate(), but the console-command-file is executed after all system components have been activated. (example: sv_gameLiftEnabled is used inside AWSGameLiftServerSystemComponent::Activate()).

  3. Create a game session with the below command:

    aws gamelift create-game-session --endpoint-url http://localhost:8080 --maximum-player-session-count 2 --fleet-id fleet-123 --game-session-id hello-mps
    

    You should observe logs in the GameLiftLocal terminal which indicate it handled the create-game-session request, and see the ServerLauncher load its level.

  4. Finally, start the game launcher with the follow command:

    ./build/windows/bin/profile/MultiplayerSample.GameLauncher.exe --MPSGameLiftClientSystemComponent.JoinSession hello-mps --cl_gameliftLocalEndpoint "http://localhost:8080"