A small game built with Unity to demonstrate how to use the new Amazon GameLift large match features.
- An AWS account: https://aws.amazon.com/getting-started/
- Unity LTS Release 2018.4 (will not work on higher versions): https://unity.com/
- Amazon GameLift Server SDK: https://aws.amazon.com/gamelift/getting-started/
- AWS Mobile SDK for Unity: https://docs.aws.amazon.com/mobile/sdkforunity/developerguide/what-is-unity-plugin.html
├── AWS # Lambda functions, IAM policies, rulesets, etc. └── UltraFrogRoyale # The root of the Unity project ├── Assets # Editable assets, source files │ ├── Scenes # Unity scene definition files │ ├── Prefabs # Player prefab for networking │ └── Textures # Images used by the game ├── Packages # Unity packages folder └── ProjectSettings # Unity project folder
- Open the project in Unity
- Build and add the Amazon GameLift Server SDK to the project following the instructions here (specifically for .Net 4.5): https://docs.aws.amazon.com/gamelift/latest/developerguide/integration-engines-unity-using.html
- Add the AWS Mobile SDK for Unity to the project. https://docs.aws.amazon.com/mobile/sdkforunity/developerguide/what-is-unity-plugin.html
- Create a client and server build from Unity. A server build can be created by selecting "Server Build" from the Build Settings dialog.
- Make sure you have the latest AWS command line installed.
- Upload the server build to GameLift. For example:
aws gamelift upload-build --operating-system WINDOWS_2012 --build-root "C:\amazon-gamelift-largematch-sample-ultrafrogroyale\UltraFrogRoyale\ServerBuild" --name "Demo Build" --build-version "build 1" --region us-east-1
- Create a new fleet.
- Select the build uploaded in step 2.
- c4.large works well and is in the free tier
- Fleet type: On-Demand
- Binary type: Build
- Set the launch path to UltraFrogRoyale.exe with 1 concurrent process
- Add port range 7000-8000, protocol UDP, IP address range 0.0.0.0/0
- Add port range 7000-8000, protocol TCP, IP address range 0.0.0.0/0
- Create a queue, adding the fleet just created. Don't set up autoscaling for the purpose of this demo.
- Create matchmaking ruleset using the file AWS/UltraFrogRoyaleFreeForAll-debug_MatchmakingRuleSet.json
- Create matchmaking configuration using the ruleset and queues created earlier. Make sure "acceptance required" is set to "no".
Refer to the instructions found in step 2 of the article https://aws.amazon.com/blogs/gametech/creating-servers-for-multiplayer-mobile-games-with-amazon-gamelift/ with the following differences: * Call the Lambda ConnectUltraFrogRoyaleClient * Use Node.js 8, the default is 10, but it doesn't support UUID. * Set the Lambda IAM role using the rules found in AWS/ConnectUltraFrogRoyaleClient_LambdaIAMRole.json (this differs from step 15-17, you can skip the action editor and just paste in the json) * Use the Lambda source code found in AWS/ConnectUltraFrogRoyaleClient_Lambda.js
At this point, you'll be able to run the game client and hit the "Start A Match" button. Note that the way the matchmaking rules are configured, you'll need to connect at least 3 clients before you get a match. You can run these clients on the same machine.
- The steps in this file are condensed from the article found here: https://aws.amazon.com/blogs/gametech/creating-a-battle-royale-game-using-unity-and-amazon-gamelift/
- Please contact gametech@amazon.com for any comments or requests regarding this content
This sample code is made available under the Apache-2.0 license. See the LICENSE file.