├── .github ├── solutionid_validator.sh └── workflows │ └── maintainer_workflows.yml ├── Backend ├── .gitignore ├── bin │ ├── persistent-world-gamelift.d.ts │ └── persistent-world-gamelift.ts ├── cdk.json ├── lambda │ ├── join_world.py │ ├── list_worlds.py │ └── world_manager.py ├── lib │ ├── persistent-world-fleet-role-stack.ts │ ├── persistent-world-gamelift-stack.d.ts │ └── persistent-world-gamelift-stack.ts ├── package.json ├── test │ ├── persistent-world-gamelift.test.d.ts │ └── persistent-world-gamelift.test.ts └── tsconfig.json ├── CODEOWNERS ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── LinuxServerBuild ├── .DS_Store ├── amazon-cloudwatch-agent.json └── install.sh ├── README.md ├── UnityBotClient ├── Build │ └── Dockerfile ├── README.md ├── buildSetupAndRunBots.sh ├── configuration.sh ├── destroyBots.sh └── gamelift-example-bot-resources.yaml ├── UnityProject ├── .gitignore ├── .vscode │ └── settings.json ├── .vsconfig ├── Assets │ ├── Dependencies.meta │ ├── Dependencies │ │ ├── AWSSDK.meta │ │ └── GameLiftServerSDK.meta │ ├── DesertTerrain.asset │ ├── DesertTerrain.asset.meta │ ├── Editor.meta │ ├── Editor │ │ ├── ClientServerConfiguration.cs │ │ └── ClientServerConfiguration.cs.meta │ ├── ForrestTerrain.asset │ ├── ForrestTerrain.asset.meta │ ├── PrefabsAndMaterials.meta │ ├── PrefabsAndMaterials │ │ ├── EnemyCharacter.prefab │ │ ├── EnemyCharacter.prefab.meta │ │ ├── EnemyMaterial.mat │ │ ├── EnemyMaterial.mat.meta │ │ ├── PlayerMaterial.mat │ │ ├── PlayerMaterial.mat.meta │ │ ├── SimpleCharacter.prefab │ │ ├── SimpleCharacter.prefab.meta │ │ ├── Terrain.meta │ │ ├── Terrain │ │ │ ├── Desert.jpeg │ │ │ ├── Desert.jpeg.meta │ │ │ ├── DesertLayer.terrainlayer │ │ │ ├── DesertLayer.terrainlayer.meta │ │ │ ├── Forrest.jpeg │ │ │ ├── Forrest.jpeg.meta │ │ │ ├── ForrestLayer.terrainlayer │ │ │ ├── ForrestLayer.terrainlayer.meta │ │ │ ├── TerrainMaterial.physicMaterial │ │ │ └── TerrainMaterial.physicMaterial.meta │ │ ├── UI.meta │ │ └── UI │ │ │ ├── Item.prefab │ │ │ └── Item.prefab.meta │ ├── Scenes.meta │ ├── Scenes │ │ ├── Desert.unity │ │ ├── Desert.unity.meta │ │ ├── Forrest.unity │ │ ├── Forrest.unity.meta │ │ ├── MainMenu.unity │ │ └── MainMenu.unity.meta │ ├── Scripts.meta │ ├── Scripts │ │ ├── Client.meta │ │ ├── Client │ │ │ ├── BackendApiAclient.cs │ │ │ ├── BackendApiAclient.cs.meta │ │ │ ├── BackendApiSerializationClasses.cs │ │ │ ├── BackendApiSerializationClasses.cs.meta │ │ │ ├── Client.cs │ │ │ ├── Client.cs.meta │ │ │ ├── NetworkClient.cs │ │ │ ├── NetworkClient.cs.meta │ │ │ ├── SimpleController.cs │ │ │ └── SimpleController.cs.meta │ │ ├── NetworkingShared.meta │ │ ├── NetworkingShared │ │ │ ├── MessageClasses.cs │ │ │ ├── MessageClasses.cs.meta │ │ │ ├── NetworkPlayer.cs │ │ │ ├── NetworkPlayer.cs.meta │ │ │ ├── NetworkProtocol.cs │ │ │ └── NetworkProtocol.cs.meta │ │ ├── Server.meta │ │ ├── Server │ │ │ ├── GameLift.cs │ │ │ ├── GameLift.cs.meta │ │ │ ├── NetworkServer.cs │ │ │ ├── NetworkServer.cs.meta │ │ │ ├── Server.cs │ │ │ ├── Server.cs.meta │ │ │ ├── SimpleStatsdClient.cs │ │ │ └── SimpleStatsdClient.cs.meta │ │ ├── UIManager.cs │ │ └── UIManager.cs.meta │ ├── link.xml │ └── link.xml.meta ├── Packages │ ├── manifest.json │ └── packages-lock.json ├── ProjectSettings │ ├── AudioManager.asset │ ├── ClusterInputManager.asset │ ├── DynamicsManager.asset │ ├── EditorBuildSettings.asset │ ├── EditorSettings.asset │ ├── GraphicsSettings.asset │ ├── InputManager.asset │ ├── NavMeshAreas.asset │ ├── PackageManagerSettings.asset │ ├── Physics2DSettings.asset │ ├── PresetManager.asset │ ├── ProjectSettings.asset │ ├── ProjectVersion.txt │ ├── QualitySettings.asset │ ├── TagManager.asset │ ├── TimeManager.asset │ ├── UnityConnectSettings.asset │ ├── VFXManager.asset │ ├── VersionControlSettings.asset │ └── XRSettings.asset └── UserSettings │ └── EditorUserSettings.asset ├── VirtualWorldsOnGameLiftReferenceArchitecture.png ├── WorldConfigExample.png ├── downloadAndSetupUnityDependencies.ps1 ├── downloadAndSetupUnityDependencies.sh └── sample_world_item.json /.github/solutionid_validator.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #set -e 3 | 4 | echo "checking solution id $1" 5 | echo "grep -nr --exclude-dir='.github' "$1" ./.." 6 | result=$(grep -nr --exclude-dir='.github' "$1" ./..) 7 | if [ $? -eq 0 ] 8 | then 9 | echo "Solution ID $1 found\n" 10 | echo "$result" 11 | exit 0 12 | else 13 | echo "Solution ID $1 not found" 14 | exit 1 15 | fi 16 | 17 | export result 18 | -------------------------------------------------------------------------------- /.github/workflows/maintainer_workflows.yml: -------------------------------------------------------------------------------- 1 | # Workflows managed by aws-solutions-library-samples maintainers 2 | name: Maintainer Workflows 3 | on: 4 | # Triggers the workflow on push or pull request events but only for the "main" branch 5 | push: 6 | branches: [ "main" ] 7 | pull_request: 8 | branches: [ "main" ] 9 | types: [opened, reopened, edited] 10 | 11 | jobs: 12 | CheckSolutionId: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v4 16 | - name: Run solutionid validator 17 | run: | 18 | chmod u+x ./.github/solutionid_validator.sh 19 | ./.github/solutionid_validator.sh ${{ vars.SOLUTIONID }} -------------------------------------------------------------------------------- /Backend/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | cdk.out 3 | node_modules/ 4 | cdk.out/ 5 | package-lock.json 6 | *.js 7 | LinuxServerBuild/*GameLiftExampleServer* 8 | 9 | -------------------------------------------------------------------------------- /Backend/bin/persistent-world-gamelift.d.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | import 'source-map-support/register'; 3 | -------------------------------------------------------------------------------- /Backend/bin/persistent-world-gamelift.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | import 'source-map-support/register'; 3 | import * as cdk from 'aws-cdk-lib'; 4 | import { PersistentWorldGameliftStack } from '../lib/persistent-world-gamelift-stack'; 5 | import { PersistentWorldFleetRoleStack } from '../lib/persistent-world-fleet-role-stack'; 6 | import { AwsSolutionsChecks, NagSuppressions } from 'cdk-nag' 7 | import { Aspects } from 'aws-cdk-lib'; 8 | 9 | var deploymentRegion = 'us-east-1'; 10 | 11 | const app = new cdk.App(); 12 | 13 | const fleetRoleStack = new PersistentWorldFleetRoleStack(app, 'PersistentWorldFleetRoleStack', { 14 | env: { account: process.env.CDK_DEFAULT_ACCOUNT, region: deploymentRegion }, 15 | description : "Guidance for Infrastructure for Persistent World Games (SO9157)" 16 | }); 17 | 18 | const backendStack = new PersistentWorldGameliftStack(app, 'PersistentWorldGameliftStack', { 19 | env: { account: process.env.CDK_DEFAULT_ACCOUNT, region: deploymentRegion }, 20 | gameliftFleetRole: fleetRoleStack.fleetRole, 21 | description : "Guidance for Infrastructure for Persistent World Games (SO9157)" 22 | }); 23 | 24 | /* CDK Nag, enable as needed 25 | // Add the cdk-nag AwsSolutions Pack with extra verbose logging enabled. 26 | Aspects.of(app).add(new AwsSolutionsChecks({})) 27 | 28 | // Suppress Cognito User Pool requirements, as we're using Identity Pools and AWS_IAM for access control to API 29 | NagSuppressions.addStackSuppressions(backendStack, [ 30 | { id: 'AwsSolutions-COG4', reason: 'Using Identity pools and AWS_IAM access control' }, 31 | ]); 32 | 33 | // We need unauthenticated access for guest users (standard in mobile applications) 34 | NagSuppressions.addStackSuppressions(backendStack, [ 35 | { id: 'AwsSolutions-COG7', reason: 'Using guest users (unauthenticated) for the game, which is standard for mobile games' }, 36 | ]); 37 | */ -------------------------------------------------------------------------------- /Backend/cdk.json: -------------------------------------------------------------------------------- 1 | { 2 | "app": "npx ts-node --prefer-ts-exts bin/persistent-world-gamelift.ts", 3 | "watch": { 4 | "include": [ 5 | "**" 6 | ], 7 | "exclude": [ 8 | "README.md", 9 | "cdk*.json", 10 | "**/*.d.ts", 11 | "**/*.js", 12 | "tsconfig.json", 13 | "package*.json", 14 | "yarn.lock", 15 | "node_modules", 16 | "test" 17 | ] 18 | }, 19 | "context": { 20 | "@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId": true, 21 | "@aws-cdk/core:stackRelativeExports": true, 22 | "@aws-cdk/aws-rds:lowercaseDbIdentifier": true, 23 | "@aws-cdk/aws-lambda:recognizeVersionProps": true, 24 | "@aws-cdk/aws-lambda:recognizeLayerVersion": true, 25 | "@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2_2021": true, 26 | "@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true, 27 | "@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": true, 28 | "@aws-cdk/core:checkSecretUsage": true, 29 | "@aws-cdk/aws-iam:minimizePolicies": true, 30 | "@aws-cdk/core:validateSnapshotRemovalPolicy": true, 31 | "@aws-cdk/aws-codepipeline:crossAccountKeyAliasStackSafeResourceName": true, 32 | "@aws-cdk/aws-s3:createDefaultLoggingPolicy": true, 33 | "@aws-cdk/core:target-partitions": [ 34 | "aws", 35 | "aws-cn" 36 | ] 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Backend/lambda/join_world.py: -------------------------------------------------------------------------------- 1 | """ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. """ 2 | """ SPDX-License-Identifier: MIT-0 """ 3 | 4 | import json 5 | import boto3 6 | import botocore 7 | from boto3.dynamodb.conditions import Key, Attr 8 | import os 9 | from datetime import datetime 10 | import time 11 | from decimal import * 12 | 13 | dynamodb = boto3.resource('dynamodb') 14 | gamelift = boto3.client('gamelift') 15 | 16 | """ Increases the world player count by one in DynamoDB""" 17 | def increase_player_count(location, world): 18 | try: 19 | table = dynamodb.Table(os.environ['WORLD_SESSIONS_TABLE']) 20 | response = table.update_item( 21 | Key={ 22 | 'Location': location, 23 | 'WorldID': world 24 | }, 25 | UpdateExpression='SET CurrentPlayerSessionCount = CurrentPlayerSessionCount + :value', 26 | ExpressionAttributeValues={ 27 | ':value': 1 28 | } 29 | ) 30 | except botocore.exceptions.ClientError as error: 31 | raise Exception('Error updating world session to DynamoDB: {}'.format(error)) 32 | 33 | """ The main entry point of the Lambda function """ 34 | def handler(event, context): 35 | 36 | print(event) 37 | 38 | location = event["queryStringParameters"]["location"] 39 | world_id = event["queryStringParameters"]["world_id"] 40 | player_id = event["requestContext"]["identity"]["cognitoIdentityId"] 41 | 42 | # Get the requested world 43 | table = dynamodb.Table(os.environ['WORLD_SESSIONS_TABLE']) 44 | response = table.get_item( 45 | Key={ 46 | 'Location': location, 47 | 'WorldID': world_id 48 | } 49 | ) 50 | 51 | item = response.get('Item') 52 | 53 | if item == None: 54 | return { 55 | "statusCode": 500, 56 | "body": { "Error" : "World doesn't exist"} 57 | } 58 | 59 | # Only try to reserve a slot if the world is initialized 60 | if item.get('CurrentPlayerSessionCount') != None: 61 | try: 62 | # If it has free player slots, try to request one 63 | if int(item['CurrentPlayerSessionCount']) < int(item['MaxPlayers']): 64 | print("There's free player sessions, try to claim one") 65 | response = gamelift.create_player_session( 66 | GameSessionId=item['GameSessionId'], 67 | PlayerId=player_id, 68 | #PlayerData='string' 69 | ) 70 | # Successful player placement, increase player sessions in DynamoDB by one (as this is synced only every 1 minute) 71 | increase_player_count(location, world_id) 72 | # Return the session info 73 | return { 74 | "statusCode": 200, 75 | "body": json.dumps(response["PlayerSession"], default=str) 76 | } 77 | else: 78 | print("No space left in the world.") 79 | return { 80 | "statusCode": 500, 81 | "body": { "Error" : "No space left in the world"} 82 | } 83 | except botocore.exceptions.ClientError as error: 84 | raise Exception('Error adding player to session: {}'.format(error)) 85 | else: 86 | print("World is not properly initialized yet, no player session count") 87 | return { 88 | "statusCode": 500, 89 | "body": { "Error" : "World is not ready yet"} 90 | } 91 | 92 | # Shouldn't ever reach this return statement 93 | return { 94 | "statusCode": 500, 95 | "body": {} 96 | } -------------------------------------------------------------------------------- /Backend/lambda/list_worlds.py: -------------------------------------------------------------------------------- 1 | """ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. """ 2 | """ SPDX-License-Identifier: MIT-0 """ 3 | 4 | import json 5 | import boto3 6 | import botocore 7 | from boto3.dynamodb.conditions import Key, Attr 8 | import os 9 | from datetime import datetime 10 | import time 11 | from decimal import * 12 | 13 | dynamodb = boto3.resource('dynamodb') 14 | 15 | class DecimalEncoder(json.JSONEncoder): 16 | def default(self, obj): 17 | if isinstance(obj, Decimal): 18 | return str(obj) 19 | return json.JSONEncoder.default(self, obj) 20 | 21 | """ Scans a DynamoDB table with pagination and returns the items in an array """ 22 | def query_worlds(table_name, location): 23 | 24 | table = dynamodb.Table(table_name) 25 | 26 | done_scanning = False 27 | worlds_queried = [] 28 | query_args = { 'KeyConditionExpression' : Key('Location').eq(location), 29 | 'FilterExpression' : Attr('Status').eq("ACTIVE") } 30 | 31 | while not done_scanning: 32 | try: 33 | response = table.query(**query_args) 34 | except botocore.exceptions.ClientError as error: 35 | raise Exception('Error querying DynamoDB: {}'.format(error)) 36 | 37 | worlds_queried.extend(response.get('Items', [])) 38 | next_key = response.get('LastEvaluatedKey') 39 | query_args['ExclusiveStartKey'] = next_key 40 | 41 | if next_key is None: 42 | done_scanning = True 43 | 44 | return worlds_queried 45 | 46 | """ The main entry point of the Lambda function """ 47 | def handler(event, context): 48 | 49 | print(event) 50 | 51 | location = event["queryStringParameters"]["location"] 52 | 53 | #Query the requested location 54 | worlds_queried = query_worlds(os.environ['WORLD_SESSIONS_TABLE'], location) 55 | 56 | worlds_response = { "Worlds" : worlds_queried } 57 | 58 | return { 59 | "statusCode": 200, 60 | "body": json.dumps(worlds_response, cls=DecimalEncoder) 61 | } 62 | -------------------------------------------------------------------------------- /Backend/lib/persistent-world-fleet-role-stack.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: MIT-0 3 | 4 | import { Stack, StackProps } from 'aws-cdk-lib'; 5 | import { Construct } from 'constructs'; 6 | import * as iam from "aws-cdk-lib/aws-iam"; 7 | import { NagSuppressions } from 'cdk-nag'; 8 | 9 | export class PersistentWorldFleetRoleStack extends Stack { 10 | 11 | public readonly fleetRole : iam.Role; 12 | 13 | constructor(scope: Construct, id: string, props?: StackProps) { 14 | super(scope, id, props); 15 | 16 | this.fleetRole = new iam.Role(this, 'GameLiftFleetRole', { 17 | assumedBy: new iam.CompositePrincipal( 18 | new iam.ServicePrincipal("gamelift.amazonaws.com"), 19 | new iam.ServicePrincipal("ec2.amazonaws.com")) 20 | }); 21 | //this.fleetRole.addManagedPolicy(iam.ManagedPolicy.fromAwsManagedPolicyName('CloudWatchAgentServerPolicy')); //not allowed for cdk-nag 22 | // Set up the CloudWatch Agent policy (same as the managed policy CloudWatchAgentServerPolicy) 23 | this.fleetRole.addToPolicy( 24 | new iam.PolicyStatement({ 25 | actions: ['cloudwatch:PutMetricData','ec2:DescribeVolumes','ec2:DescribeTags','logs:PutLogEvents','logs:DescribeLogStreams','logs:DescribeLogGroups', 26 | 'logs:CreateLogStream','logs:CreateLogGroup'], 27 | resources: ['*'], 28 | })); 29 | this.fleetRole.addToPolicy( 30 | new iam.PolicyStatement({ 31 | actions: ['ssm:GetParameter'], 32 | resources: ['arn:aws:ssm:*:*:parameter/AmazonCloudWatch-'], 33 | })); 34 | // cdk-nag suppression for the standard CloudWatch Agent policy of the fleet role 35 | NagSuppressions.addResourceSuppressions( 36 | this.fleetRole, 37 | [ 38 | { 39 | id: 'AwsSolutions-IAM5', 40 | reason: "We are using a policy similar to the standard managed Lambda policy to access logs", 41 | }, 42 | ], 43 | true 44 | ); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Backend/lib/persistent-world-gamelift-stack.d.ts: -------------------------------------------------------------------------------- 1 | import { Stack, StackProps } from 'aws-cdk-lib'; 2 | import { Construct } from 'constructs'; 3 | export declare class PersistentWorldGameliftStack extends Stack { 4 | constructor(scope: Construct, id: string, props?: StackProps); 5 | } 6 | -------------------------------------------------------------------------------- /Backend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "persistent-world-gamelift", 3 | "version": "0.1.0", 4 | "bin": { 5 | "persistent-world-gamelift": "bin/persistent-world-gamelift.js" 6 | }, 7 | "scripts": { 8 | "build": "tsc", 9 | "watch": "tsc -w", 10 | "test": "jest", 11 | "cdk": "cdk" 12 | }, 13 | "devDependencies": { 14 | "@types/jest": "^27.5.2", 15 | "@types/node": "10.17.27", 16 | "@types/prettier": "2.6.0", 17 | "aws-cdk": "2.31.0", 18 | "jest": "^27.5.1", 19 | "ts-jest": "^27.1.4", 20 | "ts-node": "^10.9.1", 21 | "typescript": "~3.9.7" 22 | }, 23 | "dependencies": { 24 | "@aws-cdk/aws-cognito-identitypool-alpha": "^2.31.1-alpha.0", 25 | "aws-cdk-lib": "^2.38", 26 | "cdk-nag": "^2.20.3", 27 | "constructs": "^10.1.152", 28 | "source-map-support": "^0.5.21" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Backend/test/persistent-world-gamelift.test.d.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-solutions-library-samples/guidance-for-persistent-world-game-hosting-on-aws/6af6942f1696296c9b9396eee241be28f72175a7/Backend/test/persistent-world-gamelift.test.d.ts -------------------------------------------------------------------------------- /Backend/test/persistent-world-gamelift.test.ts: -------------------------------------------------------------------------------- 1 | // import * as cdk from 'aws-cdk-lib'; 2 | // import { Template } from 'aws-cdk-lib/assertions'; 3 | // import * as PersistentWorldGamelift from '../lib/persistent-world-gamelift-stack'; 4 | 5 | // example test. To run these tests, uncomment this file along with the 6 | // example resource in lib/persistent-world-gamelift-stack.ts 7 | test('SQS Queue Created', () => { 8 | // const app = new cdk.App(); 9 | // // WHEN 10 | // const stack = new PersistentWorldGamelift.PersistentWorldGameliftStack(app, 'MyTestStack'); 11 | // // THEN 12 | // const template = Template.fromStack(stack); 13 | 14 | // template.hasResourceProperties('AWS::SQS::Queue', { 15 | // VisibilityTimeout: 300 16 | // }); 17 | }); 18 | -------------------------------------------------------------------------------- /Backend/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2018", 4 | "module": "commonjs", 5 | "lib": [ 6 | "es2018" 7 | ], 8 | "declaration": true, 9 | "strict": true, 10 | "noImplicitAny": true, 11 | "strictNullChecks": true, 12 | "noImplicitThis": true, 13 | "alwaysStrict": true, 14 | "noUnusedLocals": false, 15 | "noUnusedParameters": false, 16 | "noImplicitReturns": true, 17 | "noFallthroughCasesInSwitch": false, 18 | "inlineSourceMap": true, 19 | "inlineSources": true, 20 | "experimentalDecorators": true, 21 | "strictPropertyInitialization": false, 22 | "typeRoots": [ 23 | "./node_modules/@types" 24 | ] 25 | }, 26 | "exclude": [ 27 | "node_modules", 28 | "cdk.out" 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | CODEOWNERS @aws-solutions-library-samples/maintainers 2 | /.github/workflows/maintainer_workflows.yml @aws-solutions-library-samples/maintainers 3 | /.github/solutionid_validator.sh @aws-solutions-library-samples/maintainers 4 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | ## Code of Conduct 2 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). 3 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact 4 | opensource-codeofconduct@amazon.com with any additional questions or comments. 5 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing Guidelines 2 | 3 | Thank you for your interest in contributing to our project. Whether it's a bug report, new feature, correction, or additional 4 | documentation, we greatly value feedback and contributions from our community. 5 | 6 | Please read through this document before submitting any issues or pull requests to ensure we have all the necessary 7 | information to effectively respond to your bug report or contribution. 8 | 9 | 10 | ## Reporting Bugs/Feature Requests 11 | 12 | We welcome you to use the GitHub issue tracker to report bugs or suggest features. 13 | 14 | When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn't already 15 | reported the issue. Please try to include as much information as you can. Details like these are incredibly useful: 16 | 17 | * A reproducible test case or series of steps 18 | * The version of our code being used 19 | * Any modifications you've made relevant to the bug 20 | * Anything unusual about your environment or deployment 21 | 22 | 23 | ## Contributing via Pull Requests 24 | Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that: 25 | 26 | 1. You are working against the latest source on the *main* branch. 27 | 2. You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already. 28 | 3. You open an issue to discuss any significant work - we would hate for your time to be wasted. 29 | 30 | To send us a pull request, please: 31 | 32 | 1. Fork the repository. 33 | 2. Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change. 34 | 3. Ensure local tests pass. 35 | 4. Commit to your fork using clear commit messages. 36 | 5. Send us a pull request, answering any default questions in the pull request interface. 37 | 6. Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation. 38 | 39 | GitHub provides additional document on [forking a repository](https://help.github.com/articles/fork-a-repo/) and 40 | [creating a pull request](https://help.github.com/articles/creating-a-pull-request/). 41 | 42 | 43 | ## Finding contributions to work on 44 | Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels (enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start. 45 | 46 | 47 | ## Code of Conduct 48 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). 49 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact 50 | opensource-codeofconduct@amazon.com with any additional questions or comments. 51 | 52 | 53 | ## Security issue notifications 54 | If you discover a potential security issue in this project we ask that you notify AWS/Amazon Security via our [vulnerability reporting page](http://aws.amazon.com/security/vulnerability-reporting/). Please do **not** create a public github issue. 55 | 56 | 57 | ## Licensing 58 | 59 | See the [LICENSE](LICENSE) file for our project's licensing. We will ask you to confirm the licensing of your contribution. 60 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 7 | the Software, and to permit persons to whom the Software is furnished to do so. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 10 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 11 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 12 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 13 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 14 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 15 | 16 | -------------------------------------------------------------------------------- /LinuxServerBuild/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-solutions-library-samples/guidance-for-persistent-world-game-hosting-on-aws/6af6942f1696296c9b9396eee241be28f72175a7/LinuxServerBuild/.DS_Store -------------------------------------------------------------------------------- /LinuxServerBuild/amazon-cloudwatch-agent.json: -------------------------------------------------------------------------------- 1 | { 2 | "agent": { 3 | "metrics_collection_interval": 10, 4 | "logfile": "/opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log", 5 | "credentials": { 6 | "role_arn": "arn:aws:iam::YOURACCOUNT:role/YOURROLEARN" 7 | } 8 | }, 9 | "metrics":{ 10 | "metrics_collected":{ 11 | "statsd":{ 12 | "service_address":":8125", 13 | "metrics_collection_interval":60, 14 | "metrics_aggregation_interval":60 15 | }, 16 | "procstat": [ 17 | { 18 | "pattern": "-port 1935", 19 | "measurement": [ 20 | "cpu_usage", 21 | "memory_rss" 22 | ] 23 | }, 24 | { 25 | "pattern": "-port 7777", 26 | "measurement": [ 27 | "cpu_usage", 28 | "memory_rss" 29 | ] 30 | } 31 | ] 32 | } 33 | }, 34 | "logs": { 35 | "logs_collected": { 36 | "files": { 37 | "collect_list": [ 38 | { 39 | "file_path": "/opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log", 40 | "log_group_name": "AmazonCloudWatchAgentLogs", 41 | "log_stream_name": "AmazonCloudWatchAgentLogs-{instance_id}", 42 | "timezone": "UTC" 43 | }, 44 | { 45 | "file_path": "/local/game/logs/myserver1935.log", 46 | "log_group_name": "GameServerLogs", 47 | "log_stream_name": "GameServerLogs-{ip_address}-1935", 48 | "timezone": "Local" 49 | }, 50 | { 51 | "file_path": "/local/game/logs/myserver7777.log", 52 | "log_group_name": "GameServerLogs", 53 | "log_stream_name": "GameServerLogs-{ip_address}-7777", 54 | "timezone": "Local" 55 | } 56 | ] 57 | } 58 | }, 59 | "force_flush_interval" : 15 60 | } 61 | } -------------------------------------------------------------------------------- /LinuxServerBuild/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Set binary execution permissions 4 | sudo chmod 777 /local/game/GameLiftExampleServer.x86_64 5 | 6 | # Download and install the agent 7 | wget https://s3.amazonaws.com/amazoncloudwatch-agent/amazon_linux/amd64/latest/amazon-cloudwatch-agent.rpm 8 | sudo rpm -U ./amazon-cloudwatch-agent.rpm 9 | 10 | # Copy the cloudwatch agent configuration file to the right directory 11 | sudo cp amazon-cloudwatch-agent.json /opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.json 12 | 13 | # Start the agent 14 | sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -c file:/opt/aws/amazon-cloudwatch-agent/etc/amazon-cloudwatch-agent.json -s 15 | 16 | -------------------------------------------------------------------------------- /UnityBotClient/Build/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:18.04 2 | RUN apt-get update && apt-get upgrade -y 3 | RUN apt-get install ca-certificates -y 4 | COPY . /app 5 | CMD /app/BotClient.x86_64 -------------------------------------------------------------------------------- /UnityBotClient/README.md: -------------------------------------------------------------------------------- 1 | # Bot Client Implementation for testing the Unity deployment 2 | 3 | This additional component is designed to help test the Unity deployment option by running headless client bots on AWS Fargate, a fully managed serverless platform for running containerized applications. 4 | 5 | # Setup 6 | 7 | You need to have the backend, GameLift resources and client all set up and deployed first. 8 | 9 | 1. Make sure you have [Docker](https://docs.docker.com/get-docker/) installed and running on your system 10 | 2. Make sure you have AWS CLI configured on your system 11 | 3. Set your AWS Account ID in `configuration.sh` 12 | 4. Open the UnityProject and configure bots by selecting *Gamelift -> SetAsBotClientBuild*. You can test run a bot locally. 13 | 5. Build the bot client by selecting *Gamelift -> BuildLinuxBotClient*. Select the folder *UnityBotCLient/Build* as the output folder 14 | 6. Run `./buildSetupAndRunBots.sh` to start the bots. Modify the script if you want to change the bot count. Each Fargate Task will run 4 bots, so the default configuration 10 will run 40 bots on a continuous fashion as a Fargate Service, until you terminate them. The script will 15 | * Create an ECR repository 16 | * Build the container from your prebuilt binary and push it to the repository 17 | * Deploy the stack `gamelift-example-bot-resources.yaml` that creates a VPC, ECS Cluster and an ECS Service that hots your bots. Each Task in the service runs 4 bots and you can configure the amount of Tasks in the script. 18 | 7. When you're done, run `./destroyBots.sh` to destroy the whole infrastructure for the bots 19 | 20 | The bots will be deployed to your defined home region but you could easily modify the script to deploy the stack to multiple regions to better test latency-based matchmaking and multi-region fleets. 21 | 22 | # Note for MacOS M1 development machines 23 | 24 | If you're building the containers on an ARM-based Mac, please use the following build command instead in the `./buildSetupAndRunBots.sh` script: 25 | 26 | `docker buildx build ./Build/ --platform=linux/amd64 -t $accountid.dkr.ecr.$region.amazonaws.com/gamelift-example-bot-client:$build_id` 27 | 28 | This will build an x86 version of the Docker container so it will run correctly on AWS Fargate. 29 | 30 | -------------------------------------------------------------------------------- /UnityBotClient/buildSetupAndRunBots.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # The number of tasks to run (each task will have 4 bots) 4 | numberoftasks=10 5 | 6 | # Get the configuration variables 7 | source ./configuration.sh 8 | 9 | # Returns the status of a stack 10 | getstatusofstack() { 11 | aws cloudformation describe-stacks --region $region --stack-name $1 --query Stacks[].StackStatus --output text 2>/dev/null 12 | } 13 | 14 | # 0. Try to create the ECS Service linked role, if it doesn't exist already 15 | echo "Create service linked role. Ignore errors, this might exist already." 16 | aws iam create-service-linked-role --aws-service-name ecs.amazonaws.com --region $region 17 | 18 | # 1. Create ECR repository if it doesn't exits 19 | echo "************" 20 | echo "Create ECR repository. Ignore errors, this might exist already." 21 | aws ecr create-repository --repository-name gamelift-example-bot-client --region $region --output text 22 | 23 | # 2. Login to ECR (AWS CLI V2) 24 | aws ecr get-login-password --region $region | docker login --username AWS --password-stdin $accountid.dkr.ecr.$region.amazonaws.com/gamelift-example-bot-client 25 | #eval $(aws ecr get-login --region $region --no-include-email) #This if for CLI V1 26 | 27 | # 3. Create Docker Image from latest build (expected to be already created from Unity) 28 | build_id=$(date +%Y-%m-%d.%H%M%S) 29 | docker buildx build ./Build/ --platform=linux/amd64 -t $accountid.dkr.ecr.$region.amazonaws.com/gamelift-example-bot-client:$build_id 30 | 31 | # 4. Push the image to ECR 32 | docker push $accountid.dkr.ecr.$region.amazonaws.com/gamelift-example-bot-client:$build_id 33 | 34 | echo "************" 35 | 36 | # 5. Deploy an updated task definition with the new image 37 | stackstatus=$(getstatusofstack gamelift-example-bot-resources) 38 | if [ -z "$stackstatus" ]; then 39 | echo "Creating gamelift-example-bot-resources stack (this will take some time)..." 40 | aws cloudformation --region $region create-stack --stack-name gamelift-example-bot-resources \ 41 | --template-body file://gamelift-example-bot-resources.yaml \ 42 | --parameters ParameterKey=Image,ParameterValue=$accountid.dkr.ecr.$region.amazonaws.com/gamelift-example-bot-client:$build_id ParameterKey=TaskCount,ParameterValue=$numberoftasks\ 43 | --capabilities CAPABILITY_IAM 44 | aws cloudformation --region $region wait stack-create-complete --stack-name gamelift-example-bot-resources 45 | echo "Done creating stack!" 46 | else 47 | echo "Updating gamelift-example-bot-resources stack (this will take some time)..." 48 | aws cloudformation --region $region update-stack --stack-name gamelift-example-bot-resources \ 49 | --template-body file://gamelift-example-bot-resources.yaml \ 50 | --parameters ParameterKey=Image,ParameterValue=$accountid.dkr.ecr.$region.amazonaws.com/gamelift-example-bot-client:$build_id ParameterKey=TaskCount,ParameterValue=$numberoftasks \ 51 | --capabilities CAPABILITY_IAM 52 | aws cloudformation --region $region wait stack-update-complete --stack-name gamelift-example-bot-resources 53 | echo "Done updating stack!" 54 | fi 55 | 56 | echo "Your bots will be running as an ECS service as long as you keep them running! Use destroyBots.sh to destroy the stack" -------------------------------------------------------------------------------- /UnityBotClient/configuration.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Location to deploy the bots to 4 | region="us-east-1" 5 | 6 | # Account ID (replace with your own) 7 | accountid="1234567890" -------------------------------------------------------------------------------- /UnityBotClient/destroyBots.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Get the configuration variables 4 | source ../configuration.sh 5 | 6 | echo "Delete The Bots Stack.." 7 | aws cloudformation --region $region delete-stack --stack-name gamelift-example-bot-resources 8 | aws cloudformation --region $region wait stack-delete-complete --stack-name gamelift-example-bot-resources 9 | echo "Done deleting stack!" -------------------------------------------------------------------------------- /UnityBotClient/gamelift-example-bot-resources.yaml: -------------------------------------------------------------------------------- 1 | AWSTemplateFormatVersion: '2010-09-09' 2 | Description: A stack for deploying the task definition to be used by the GameLift example client bots 3 | 4 | Parameters: 5 | Image: 6 | Type: String 7 | Description: The url of the image to be used in the Task definition 8 | TaskCount: 9 | Type: Number 10 | Description: The number of tasks to run (each will have 4 bots in them) 11 | 12 | Resources: 13 | 14 | # Define the VPC 15 | BotClientVPC: 16 | Type: AWS::EC2::VPC 17 | Properties: 18 | CidrBlock: 10.0.0.0/16 19 | EnableDnsSupport: 'true' 20 | EnableDnsHostnames: 'true' 21 | 22 | # Two public subnets, where containers can have public IP addresses 23 | PublicSubnetOne: 24 | Type: AWS::EC2::Subnet 25 | Properties: 26 | AvailabilityZone: 27 | Fn::Select: 28 | - 0 29 | - Fn::GetAZs: {Ref: 'AWS::Region'} 30 | VpcId: !Ref BotClientVPC 31 | CidrBlock: 10.0.0.0/22 32 | MapPublicIpOnLaunch: true 33 | PublicSubnetTwo: 34 | Type: AWS::EC2::Subnet 35 | Properties: 36 | AvailabilityZone: 37 | Fn::Select: 38 | - 1 39 | - Fn::GetAZs: {Ref: 'AWS::Region'} 40 | VpcId: !Ref BotClientVPC 41 | CidrBlock: 10.0.4.0/22 42 | MapPublicIpOnLaunch: true 43 | 44 | # Setup networking resources for the public subnets. Containers 45 | # in the public subnets have public IP addresses and the routing table 46 | # sends network traffic via the internet gateway. 47 | InternetGateway: 48 | Type: AWS::EC2::InternetGateway 49 | GatewayAttachement: 50 | Type: AWS::EC2::VPCGatewayAttachment 51 | Properties: 52 | VpcId: !Ref BotClientVPC 53 | InternetGatewayId: !Ref InternetGateway 54 | PublicRouteTable: 55 | Type: AWS::EC2::RouteTable 56 | Properties: 57 | VpcId: !Ref BotClientVPC 58 | PublicRoute: 59 | Type: AWS::EC2::Route 60 | DependsOn: GatewayAttachement 61 | Properties: 62 | RouteTableId: !Ref 'PublicRouteTable' 63 | DestinationCidrBlock: '0.0.0.0/0' 64 | GatewayId: !Ref 'InternetGateway' 65 | PublicSubnetOneRouteTableAssociation: 66 | Type: AWS::EC2::SubnetRouteTableAssociation 67 | Properties: 68 | SubnetId: !Ref PublicSubnetOne 69 | RouteTableId: !Ref PublicRouteTable 70 | PublicSubnetTwoRouteTableAssociation: 71 | Type: AWS::EC2::SubnetRouteTableAssociation 72 | Properties: 73 | SubnetId: !Ref PublicSubnetTwo 74 | RouteTableId: !Ref PublicRouteTable 75 | 76 | 77 | # ECS cluster to host the Fargate Tasks 78 | ECSCluster: 79 | Type: 'AWS::ECS::Cluster' 80 | Properties: 81 | ClusterName: GameLiftSampleBotFargateCluster 82 | CapacityProviders: 83 | - FARGATE 84 | DefaultCapacityProviderStrategy: 85 | - CapacityProvider: FARGATE 86 | Weight: 1 87 | 88 | # This is a role which is used by the ECS tasks. 89 | ECSTaskExecutionRole: 90 | Type: AWS::IAM::Role 91 | Properties: 92 | AssumeRolePolicyDocument: 93 | Statement: 94 | - Effect: Allow 95 | Principal: 96 | Service: [ecs-tasks.amazonaws.com] 97 | Action: ['sts:AssumeRole'] 98 | Path: / 99 | Policies: 100 | - PolicyName: AmazonECSTaskExecutionRolePolicy 101 | PolicyDocument: 102 | Statement: 103 | - Effect: Allow 104 | Action: 105 | # Allow the ECS Tasks to download images from ECR 106 | - 'ecr:GetAuthorizationToken' 107 | - 'ecr:BatchCheckLayerAvailability' 108 | - 'ecr:GetDownloadUrlForLayer' 109 | - 'ecr:BatchGetImage' 110 | 111 | # Allow the ECS tasks to upload logs to CloudWatch 112 | - 'logs:CreateLogStream' 113 | - 'logs:PutLogEvents' 114 | Resource: '*' 115 | 116 | BotClientsLogGroup: 117 | Type: AWS::Logs::LogGroup 118 | Properties: 119 | RetentionInDays: 7 120 | LogGroupName: "gamelift-example-bot-clients" 121 | 122 | BotClientTaskDefinition: 123 | Type: AWS::ECS::TaskDefinition 124 | Properties: 125 | RequiresCompatibilities: 126 | - "FARGATE" 127 | NetworkMode: awsvpc 128 | Cpu: 512 129 | Memory: 1024 130 | ExecutionRoleArn: 131 | !Ref ECSTaskExecutionRole 132 | # 4 bot clients per Task 133 | ContainerDefinitions: 134 | - 135 | Name: "BotClient1" 136 | Image: !Ref Image 137 | Cpu: 128 138 | Memory: 256 139 | LogConfiguration: 140 | LogDriver: "awslogs" 141 | Options: 142 | "awslogs-group": "gamelift-example-bot-clients" 143 | "awslogs-region": !Ref AWS::Region 144 | "awslogs-stream-prefix": "gamelift-example" 145 | - 146 | Name: "BotClient2" 147 | Image: !Ref Image 148 | Cpu: 128 149 | Memory: 256 150 | LogConfiguration: 151 | LogDriver: "awslogs" 152 | Options: 153 | "awslogs-group": "gamelift-example-bot-clients" 154 | "awslogs-region": !Ref AWS::Region 155 | "awslogs-stream-prefix": "gamelift-example" 156 | - 157 | Name: "BotClient3" 158 | Image: !Ref Image 159 | Cpu: 128 160 | Memory: 256 161 | LogConfiguration: 162 | LogDriver: "awslogs" 163 | Options: 164 | "awslogs-group": "gamelift-example-bot-clients" 165 | "awslogs-region": !Ref AWS::Region 166 | "awslogs-stream-prefix": "gamelift-example" 167 | - 168 | Name: "BotClient4" 169 | Image: !Ref Image 170 | Cpu: 128 171 | Memory: 256 172 | LogConfiguration: 173 | LogDriver: "awslogs" 174 | Options: 175 | "awslogs-group": "gamelift-example-bot-clients" 176 | "awslogs-region": !Ref AWS::Region 177 | "awslogs-stream-prefix": "gamelift-example" 178 | 179 | ECSService: 180 | Type: AWS::ECS::Service 181 | Properties: 182 | Cluster: 183 | Ref: ECSCluster 184 | DesiredCount: !Ref TaskCount 185 | TaskDefinition: 186 | Ref: BotClientTaskDefinition 187 | NetworkConfiguration: 188 | AwsvpcConfiguration: 189 | AssignPublicIp: ENABLED 190 | Subnets: 191 | - !Ref PublicSubnetOne 192 | - !Ref PublicSubnetTwo 193 | 194 | Outputs: 195 | TaskDefinition: 196 | Description: The created Task Definition 197 | Value: !Ref BotClientTaskDefinition 198 | 199 | -------------------------------------------------------------------------------- /UnityProject/.gitignore: -------------------------------------------------------------------------------- 1 | # This .gitignore file should be placed at the root of your Unity project directory 2 | # 3 | # Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore 4 | # 5 | /[Ll]ibrary/ 6 | /[Tt]emp/ 7 | /[Oo]bj/ 8 | /[Bb]uild/ 9 | /[Bb]uilds/ 10 | /[Ll]ogs/ 11 | /[Mm]emoryCaptures/ 12 | 13 | # Never ignore Asset meta data 14 | !/[Aa]ssets/**/*.meta 15 | 16 | # Uncomment this line if you wish to ignore the asset store tools plugin 17 | # /[Aa]ssets/AssetStoreTools* 18 | 19 | # Autogenerated Jetbrains Rider plugin 20 | [Aa]ssets/Plugins/Editor/JetBrains* 21 | 22 | # Visual Studio cache directory 23 | .vs/ 24 | 25 | # Gradle cache directory 26 | .gradle/ 27 | 28 | # Autogenerated VS/MD/Consulo solution and project files 29 | ExportedObj/ 30 | .consulo/ 31 | *.csproj 32 | *.unityproj 33 | *.sln 34 | *.suo 35 | *.tmp 36 | *.user 37 | *.userprefs 38 | *.pidb 39 | *.booproj 40 | *.svd 41 | *.pdb 42 | *.mdb 43 | *.opendb 44 | *.VC.db 45 | 46 | # Unity3D generated meta files 47 | *.pidb.meta 48 | *.pdb.meta 49 | *.mdb.meta 50 | 51 | # Unity3D generated file on crash reports 52 | sysinfo.txt 53 | 54 | # Builds 55 | *.apk 56 | *.unitypackage 57 | 58 | # Crashlytics generated file 59 | crashlytics-build.properties 60 | 61 | .DS_Store 62 | 63 | #Ignore the dependencies 64 | Assets/Dependencies/*/*.dll* 65 | Assets/AWSSDK/*/*.dll* 66 | Assets/Dependencies/SignersAndUtilsFromS3SigningExample/* -------------------------------------------------------------------------------- /UnityProject/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.exclude": 3 | { 4 | "**/.DS_Store":true, 5 | "**/.git":true, 6 | "**/.gitmodules":true, 7 | "**/*.booproj":true, 8 | "**/*.pidb":true, 9 | "**/*.suo":true, 10 | "**/*.user":true, 11 | "**/*.userprefs":true, 12 | "**/*.unityproj":true, 13 | "**/*.dll":true, 14 | "**/*.exe":true, 15 | "**/*.pdf":true, 16 | "**/*.mid":true, 17 | "**/*.midi":true, 18 | "**/*.wav":true, 19 | "**/*.gif":true, 20 | "**/*.ico":true, 21 | "**/*.jpg":true, 22 | "**/*.jpeg":true, 23 | "**/*.png":true, 24 | "**/*.psd":true, 25 | "**/*.tga":true, 26 | "**/*.tif":true, 27 | "**/*.tiff":true, 28 | "**/*.3ds":true, 29 | "**/*.3DS":true, 30 | "**/*.fbx":true, 31 | "**/*.FBX":true, 32 | "**/*.lxo":true, 33 | "**/*.LXO":true, 34 | "**/*.ma":true, 35 | "**/*.MA":true, 36 | "**/*.obj":true, 37 | "**/*.OBJ":true, 38 | "**/*.asset":true, 39 | "**/*.cubemap":true, 40 | "**/*.flare":true, 41 | "**/*.mat":true, 42 | "**/*.meta":true, 43 | "**/*.prefab":true, 44 | "**/*.unity":true, 45 | "build/":true, 46 | "Build/":true, 47 | "Library/":true, 48 | "library/":true, 49 | "obj/":true, 50 | "Obj/":true, 51 | "ProjectSettings/":true, 52 | "temp/":true, 53 | "Temp/":true 54 | } 55 | } -------------------------------------------------------------------------------- /UnityProject/.vsconfig: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.0", 3 | "components": [ 4 | "Microsoft.VisualStudio.Workload.ManagedGame" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /UnityProject/Assets/Dependencies.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 778e4cb97dfd84048985c67d8b636ae7 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityProject/Assets/Dependencies/AWSSDK.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 74f4b8f1cbabb7043810d73526ccc959 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityProject/Assets/Dependencies/GameLiftServerSDK.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7d759dd9f0d7c428280815b91f68415c 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityProject/Assets/DesertTerrain.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-solutions-library-samples/guidance-for-persistent-world-game-hosting-on-aws/6af6942f1696296c9b9396eee241be28f72175a7/UnityProject/Assets/DesertTerrain.asset -------------------------------------------------------------------------------- /UnityProject/Assets/DesertTerrain.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7fea5cd2cedf7413a9720518583e8e72 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 15600000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityProject/Assets/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aa6a1a3e26eec4fe4a184788aced8036 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityProject/Assets/Editor/ClientServerConfiguration.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using UnityEditor; 4 | using UnityEditor.Build.Reporting; 5 | using System.Threading; 6 | 7 | public class ClientServerConfiguration : Editor 8 | { 9 | [MenuItem("GameLift/SetAsServerBuild")] 10 | private static void ServerBuild() 11 | { 12 | // Set scripting define symbols 13 | PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, "SERVER;UNITY_SERVER"); 14 | PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.iOS, "SERVER;UNITY_SERVER"); 15 | PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android, "SERVER;UNITY_SERVER"); 16 | 17 | UnityEditor.Compilation.CompilationPipeline.RequestScriptCompilation(); 18 | 19 | Debug.LogWarning("Complilation will start soon and you need to wait for that to finish before building the server..."); 20 | } 21 | 22 | [MenuItem("GameLift/SetAsClientBuild")] 23 | private static void ClientBuild() 24 | { 25 | // Set scripting define symbols 26 | PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, "CLIENT"); 27 | PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.iOS, "CLIENT"); 28 | PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android, "CLIENT"); 29 | } 30 | 31 | [MenuItem("GameLift/SetAsBotClientBuild")] 32 | private static void BotClientBuild() 33 | { 34 | // Set scripting define symbols 35 | PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, "CLIENT;BOTCLIENT"); 36 | PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.iOS, "CLIENT;BOTCLIENT"); 37 | PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android, "CLIENT;BOTCLIENT"); 38 | } 39 | 40 | [MenuItem("GameLift/BuildLinuxServer")] 41 | private static void BuildLinuxServer() 42 | { 43 | if (Application.unityVersion.Contains("2021")) 44 | { 45 | Debug.Log("Running on Unity 2021, create a dedicated server build manually, save it in LinuxServerBuild folder with the EXACT name GameLiftExampleServer"); 46 | return; 47 | } 48 | 49 | // We cannot set scripting define symbols here because it corrupts the game world, so we need the user to set them beforehand 50 | if (EditorApplication.isCompiling) 51 | { 52 | Debug.LogWarning("Wait for compilation to finish!"); 53 | return; 54 | } 55 | 56 | // We cannot set scripting define symbols here because it corrupts the game world, so we need the user to set them beforehand 57 | if (PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone) != "SERVER;UNITY_SERVER") 58 | { 59 | Debug.LogWarning("Select \"SetAsServerBuild\" from the menu before building the server!"); 60 | return; 61 | } 62 | 63 | // Get filename 64 | string path = EditorUtility.SaveFolderPanel("Choose Location of Server Build", "", ""); 65 | 66 | // Define the build settings 67 | BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions(); 68 | buildPlayerOptions.scenes = new[] { "Assets/Scenes/MainMenu.unity", "Assets/Scenes/Desert.unity", "Assets/Scenes/Forrest.unity" }; 69 | buildPlayerOptions.locationPathName = path + "/GameLiftExampleServer.x86_64"; 70 | buildPlayerOptions.target = BuildTarget.StandaloneLinux64; 71 | buildPlayerOptions.options = BuildOptions.EnableHeadlessMode; 72 | 73 | // Build 74 | BuildReport report = BuildPipeline.BuildPlayer(buildPlayerOptions); 75 | 76 | BuildSummary summary = report.summary; 77 | 78 | if (summary.result == BuildResult.Failed) 79 | { 80 | Debug.Log("Build failed"); 81 | } 82 | 83 | if (summary.result == BuildResult.Succeeded) 84 | { 85 | Debug.Log("Build succeeded: " + summary.totalSize + " bytes"); 86 | } 87 | } 88 | 89 | [MenuItem("GameLift/BuildMacOSClient")] 90 | private static void BuildMacOSClient() 91 | { 92 | // Set scripting define symbols 93 | PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, "CLIENT"); 94 | PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.iOS, "CLIENT"); 95 | PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android, "CLIENT"); 96 | 97 | // Get filename 98 | string path = EditorUtility.SaveFolderPanel("Choose Location of MacOS Build", "", ""); 99 | string[] levels = new[] { "Assets/Scenes/MainMenu.unity", "Assets/Scenes/Desert.unity", "Assets/Scenes/Forrest.unity" }; 100 | 101 | // Build player 102 | BuildPipeline.BuildPlayer(levels, path + "/GameClient.app", BuildTarget.StandaloneOSX, BuildOptions.None); 103 | } 104 | 105 | [MenuItem("GameLift/BuildWindowsClient")] 106 | private static void BuildWindowsClient() 107 | { 108 | // Set scripting define symbols 109 | PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, "CLIENT"); 110 | PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.iOS, "CLIENT"); 111 | PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android, "CLIENT"); 112 | 113 | // Get filename 114 | string path = EditorUtility.SaveFolderPanel("Choose Location of Windows Build", "", ""); 115 | string[] levels = new[] { "Assets/Scenes/MainMenu.unity", "Assets/Scenes/Desert.unity", "Assets/Scenes/Forrest.unity" }; 116 | 117 | // Build player 118 | BuildPipeline.BuildPlayer(levels, path + "/GameClient.exe", BuildTarget.StandaloneWindows, BuildOptions.None); 119 | } 120 | 121 | [MenuItem("GameLift/BuildLinuxBotClient")] 122 | private static void BuildLinuxBotClient() 123 | { 124 | // Set scripting define symbols 125 | PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, "CLIENT;BOTCLIENT"); 126 | PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.iOS, "CLIENT;BOTCLIENT"); 127 | PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android, "CLIENT;BOTCLIENT"); 128 | 129 | // We cannot set scripting define symbols here because it corrupts the game world, so we need the user to set them beforehand 130 | if (EditorApplication.isCompiling) 131 | { 132 | Debug.LogWarning("Wait for compilation to finish!"); 133 | return; 134 | } 135 | 136 | // We cannot set scripting define symbols here because it corrupts the game world, so we need the user to set them beforehand 137 | if (PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone) != "CLIENT;BOTCLIENT") 138 | { 139 | Debug.LogWarning("Select \"SetAsBotClient\" from the menu before building the server!"); 140 | return; 141 | } 142 | 143 | // Get filename 144 | string path = EditorUtility.SaveFolderPanel("Choose Location of Bot Client Build", "", ""); 145 | 146 | // Define the build settings 147 | BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions(); 148 | buildPlayerOptions.scenes = new[] { "Assets/Scenes/MainMenu.unity", "Assets/Scenes/Desert.unity", "Assets/Scenes/Forrest.unity" }; 149 | buildPlayerOptions.locationPathName = path + "/BotClient.x86_64"; 150 | buildPlayerOptions.target = BuildTarget.StandaloneLinux64; 151 | buildPlayerOptions.options = BuildOptions.EnableHeadlessMode; 152 | 153 | // Build 154 | BuildReport report = BuildPipeline.BuildPlayer(buildPlayerOptions); 155 | 156 | BuildSummary summary = report.summary; 157 | 158 | if (summary.result == BuildResult.Failed) 159 | { 160 | Debug.Log("Build failed"); 161 | } 162 | 163 | if (summary.result == BuildResult.Succeeded) 164 | { 165 | Debug.Log("Build succeeded: " + summary.totalSize + " bytes"); 166 | } 167 | } 168 | } -------------------------------------------------------------------------------- /UnityProject/Assets/Editor/ClientServerConfiguration.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8a4652324509b42da9b88fc925986739 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityProject/Assets/ForrestTerrain.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-solutions-library-samples/guidance-for-persistent-world-game-hosting-on-aws/6af6942f1696296c9b9396eee241be28f72175a7/UnityProject/Assets/ForrestTerrain.asset -------------------------------------------------------------------------------- /UnityProject/Assets/ForrestTerrain.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ff632e01438094710a42994a8f3a146b 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 15600000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityProject/Assets/PrefabsAndMaterials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 42a5e7ffdc17948faab9e590edcde2c9 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityProject/Assets/PrefabsAndMaterials/EnemyCharacter.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &4655882290843831597 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 4655882290843831594} 12 | - component: {fileID: 4655882290843831593} 13 | - component: {fileID: 4655882290843831592} 14 | - component: {fileID: 4655882290843831595} 15 | m_Layer: 0 16 | m_Name: Cylinder 17 | m_TagString: Untagged 18 | m_Icon: {fileID: 0} 19 | m_NavMeshLayer: 0 20 | m_StaticEditorFlags: 0 21 | m_IsActive: 1 22 | --- !u!4 &4655882290843831594 23 | Transform: 24 | m_ObjectHideFlags: 0 25 | m_CorrespondingSourceObject: {fileID: 0} 26 | m_PrefabInstance: {fileID: 0} 27 | m_PrefabAsset: {fileID: 0} 28 | m_GameObject: {fileID: 4655882290843831597} 29 | m_LocalRotation: {x: 0, y: 0, z: 0.7071068, w: 0.7071068} 30 | m_LocalPosition: {x: -0, y: 0.22, z: 0} 31 | m_LocalScale: {x: 0.3, y: 1, z: 0.3} 32 | m_Children: [] 33 | m_Father: {fileID: 4655882291869799818} 34 | m_RootOrder: 0 35 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 90} 36 | --- !u!33 &4655882290843831593 37 | MeshFilter: 38 | m_ObjectHideFlags: 0 39 | m_CorrespondingSourceObject: {fileID: 0} 40 | m_PrefabInstance: {fileID: 0} 41 | m_PrefabAsset: {fileID: 0} 42 | m_GameObject: {fileID: 4655882290843831597} 43 | m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0} 44 | --- !u!23 &4655882290843831592 45 | MeshRenderer: 46 | m_ObjectHideFlags: 0 47 | m_CorrespondingSourceObject: {fileID: 0} 48 | m_PrefabInstance: {fileID: 0} 49 | m_PrefabAsset: {fileID: 0} 50 | m_GameObject: {fileID: 4655882290843831597} 51 | m_Enabled: 1 52 | m_CastShadows: 1 53 | m_ReceiveShadows: 1 54 | m_DynamicOccludee: 1 55 | m_MotionVectors: 1 56 | m_LightProbeUsage: 1 57 | m_ReflectionProbeUsage: 1 58 | m_RayTracingMode: 2 59 | m_RayTraceProcedural: 0 60 | m_RenderingLayerMask: 1 61 | m_RendererPriority: 0 62 | m_Materials: 63 | - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} 64 | m_StaticBatchInfo: 65 | firstSubMesh: 0 66 | subMeshCount: 0 67 | m_StaticBatchRoot: {fileID: 0} 68 | m_ProbeAnchor: {fileID: 0} 69 | m_LightProbeVolumeOverride: {fileID: 0} 70 | m_ScaleInLightmap: 1 71 | m_ReceiveGI: 1 72 | m_PreserveUVs: 0 73 | m_IgnoreNormalsForChartDetection: 0 74 | m_ImportantGI: 0 75 | m_StitchLightmapSeams: 1 76 | m_SelectedEditorRenderState: 3 77 | m_MinimumChartSize: 4 78 | m_AutoUVMaxDistance: 0.5 79 | m_AutoUVMaxAngle: 89 80 | m_LightmapParameters: {fileID: 0} 81 | m_SortingLayerID: 0 82 | m_SortingLayer: 0 83 | m_SortingOrder: 0 84 | m_AdditionalVertexStreams: {fileID: 0} 85 | --- !u!136 &4655882290843831595 86 | CapsuleCollider: 87 | m_ObjectHideFlags: 0 88 | m_CorrespondingSourceObject: {fileID: 0} 89 | m_PrefabInstance: {fileID: 0} 90 | m_PrefabAsset: {fileID: 0} 91 | m_GameObject: {fileID: 4655882290843831597} 92 | m_Material: {fileID: 0} 93 | m_IsTrigger: 0 94 | m_Enabled: 1 95 | m_Radius: 0.5000001 96 | m_Height: 2 97 | m_Direction: 1 98 | m_Center: {x: 0.000000059604645, y: 0, z: -0.00000008940697} 99 | --- !u!1 &4655882291869799809 100 | GameObject: 101 | m_ObjectHideFlags: 0 102 | m_CorrespondingSourceObject: {fileID: 0} 103 | m_PrefabInstance: {fileID: 0} 104 | m_PrefabAsset: {fileID: 0} 105 | serializedVersion: 6 106 | m_Component: 107 | - component: {fileID: 4655882291869799818} 108 | - component: {fileID: 4655882291869799821} 109 | - component: {fileID: 4655882291869799820} 110 | - component: {fileID: 4655882291869799823} 111 | - component: {fileID: 4655882291869799822} 112 | m_Layer: 0 113 | m_Name: EnemyCharacter 114 | m_TagString: Untagged 115 | m_Icon: {fileID: 0} 116 | m_NavMeshLayer: 0 117 | m_StaticEditorFlags: 0 118 | m_IsActive: 1 119 | --- !u!4 &4655882291869799818 120 | Transform: 121 | m_ObjectHideFlags: 0 122 | m_CorrespondingSourceObject: {fileID: 0} 123 | m_PrefabInstance: {fileID: 0} 124 | m_PrefabAsset: {fileID: 0} 125 | m_GameObject: {fileID: 4655882291869799809} 126 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 127 | m_LocalPosition: {x: 0, y: 1.05, z: 0} 128 | m_LocalScale: {x: 1, y: 1, z: 1} 129 | m_Children: 130 | - {fileID: 4655882290843831594} 131 | m_Father: {fileID: 0} 132 | m_RootOrder: 0 133 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 134 | --- !u!33 &4655882291869799821 135 | MeshFilter: 136 | m_ObjectHideFlags: 0 137 | m_CorrespondingSourceObject: {fileID: 0} 138 | m_PrefabInstance: {fileID: 0} 139 | m_PrefabAsset: {fileID: 0} 140 | m_GameObject: {fileID: 4655882291869799809} 141 | m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0} 142 | --- !u!23 &4655882291869799820 143 | MeshRenderer: 144 | m_ObjectHideFlags: 0 145 | m_CorrespondingSourceObject: {fileID: 0} 146 | m_PrefabInstance: {fileID: 0} 147 | m_PrefabAsset: {fileID: 0} 148 | m_GameObject: {fileID: 4655882291869799809} 149 | m_Enabled: 1 150 | m_CastShadows: 1 151 | m_ReceiveShadows: 1 152 | m_DynamicOccludee: 1 153 | m_MotionVectors: 1 154 | m_LightProbeUsage: 1 155 | m_ReflectionProbeUsage: 1 156 | m_RayTracingMode: 2 157 | m_RayTraceProcedural: 0 158 | m_RenderingLayerMask: 1 159 | m_RendererPriority: 0 160 | m_Materials: 161 | - {fileID: 2100000, guid: fe0bb3c23481145ea90674d4fdf47ec3, type: 2} 162 | m_StaticBatchInfo: 163 | firstSubMesh: 0 164 | subMeshCount: 0 165 | m_StaticBatchRoot: {fileID: 0} 166 | m_ProbeAnchor: {fileID: 0} 167 | m_LightProbeVolumeOverride: {fileID: 0} 168 | m_ScaleInLightmap: 1 169 | m_ReceiveGI: 1 170 | m_PreserveUVs: 0 171 | m_IgnoreNormalsForChartDetection: 0 172 | m_ImportantGI: 0 173 | m_StitchLightmapSeams: 1 174 | m_SelectedEditorRenderState: 3 175 | m_MinimumChartSize: 4 176 | m_AutoUVMaxDistance: 0.5 177 | m_AutoUVMaxAngle: 89 178 | m_LightmapParameters: {fileID: 0} 179 | m_SortingLayerID: 0 180 | m_SortingLayer: 0 181 | m_SortingOrder: 0 182 | m_AdditionalVertexStreams: {fileID: 0} 183 | --- !u!136 &4655882291869799823 184 | CapsuleCollider: 185 | m_ObjectHideFlags: 0 186 | m_CorrespondingSourceObject: {fileID: 0} 187 | m_PrefabInstance: {fileID: 0} 188 | m_PrefabAsset: {fileID: 0} 189 | m_GameObject: {fileID: 4655882291869799809} 190 | m_Material: {fileID: 0} 191 | m_IsTrigger: 0 192 | m_Enabled: 1 193 | m_Radius: 0.5 194 | m_Height: 2 195 | m_Direction: 1 196 | m_Center: {x: 0, y: 0, z: 0} 197 | --- !u!143 &4655882291869799822 198 | CharacterController: 199 | m_ObjectHideFlags: 0 200 | m_CorrespondingSourceObject: {fileID: 0} 201 | m_PrefabInstance: {fileID: 0} 202 | m_PrefabAsset: {fileID: 0} 203 | m_GameObject: {fileID: 4655882291869799809} 204 | m_Material: {fileID: 0} 205 | m_IsTrigger: 0 206 | m_Enabled: 1 207 | serializedVersion: 2 208 | m_Height: 2 209 | m_Radius: 0.5 210 | m_SlopeLimit: 80 211 | m_StepOffset: 0.3 212 | m_SkinWidth: 0.08 213 | m_MinMoveDistance: 0.001 214 | m_Center: {x: 0, y: 0, z: 0} 215 | -------------------------------------------------------------------------------- /UnityProject/Assets/PrefabsAndMaterials/EnemyCharacter.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bc28c4239f24a46edb77a2d5dbc3a88d 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /UnityProject/Assets/PrefabsAndMaterials/EnemyMaterial.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: EnemyMaterial 11 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 12 | m_ShaderKeywords: 13 | m_LightmapFlags: 4 14 | m_EnableInstancingVariants: 0 15 | m_DoubleSidedGI: 0 16 | m_CustomRenderQueue: -1 17 | stringTagMap: {} 18 | disabledShaderPasses: [] 19 | m_SavedProperties: 20 | serializedVersion: 3 21 | m_TexEnvs: 22 | - _BumpMap: 23 | m_Texture: {fileID: 0} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _DetailAlbedoMap: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailMask: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailNormalMap: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _EmissionMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _MainTex: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _MetallicGlossMap: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _OcclusionMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _ParallaxMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | m_Floats: 59 | - _BumpScale: 1 60 | - _Cutoff: 0.5 61 | - _DetailNormalMapScale: 1 62 | - _DstBlend: 0 63 | - _GlossMapScale: 1 64 | - _Glossiness: 0.5 65 | - _GlossyReflections: 1 66 | - _Metallic: 0 67 | - _Mode: 0 68 | - _OcclusionStrength: 1 69 | - _Parallax: 0.02 70 | - _SmoothnessTextureChannel: 0 71 | - _SpecularHighlights: 1 72 | - _SrcBlend: 1 73 | - _UVSec: 0 74 | - _ZWrite: 1 75 | m_Colors: 76 | - _Color: {r: 1, g: 0.8235294, b: 0, a: 1} 77 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 78 | m_BuildTextureStacks: [] 79 | -------------------------------------------------------------------------------- /UnityProject/Assets/PrefabsAndMaterials/EnemyMaterial.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fe0bb3c23481145ea90674d4fdf47ec3 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityProject/Assets/PrefabsAndMaterials/PlayerMaterial.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: PlayerMaterial 11 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 12 | m_ShaderKeywords: 13 | m_LightmapFlags: 4 14 | m_EnableInstancingVariants: 0 15 | m_DoubleSidedGI: 0 16 | m_CustomRenderQueue: -1 17 | stringTagMap: {} 18 | disabledShaderPasses: [] 19 | m_SavedProperties: 20 | serializedVersion: 3 21 | m_TexEnvs: 22 | - _BumpMap: 23 | m_Texture: {fileID: 0} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _DetailAlbedoMap: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailMask: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailNormalMap: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _EmissionMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _MainTex: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _MetallicGlossMap: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _OcclusionMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _ParallaxMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | m_Floats: 59 | - _BumpScale: 1 60 | - _Cutoff: 0.5 61 | - _DetailNormalMapScale: 1 62 | - _DstBlend: 0 63 | - _GlossMapScale: 1 64 | - _Glossiness: 0.5 65 | - _GlossyReflections: 1 66 | - _Metallic: 0.856 67 | - _Mode: 0 68 | - _OcclusionStrength: 1 69 | - _Parallax: 0.02 70 | - _SmoothnessTextureChannel: 0 71 | - _SpecularHighlights: 1 72 | - _SrcBlend: 1 73 | - _UVSec: 0 74 | - _ZWrite: 1 75 | m_Colors: 76 | - _Color: {r: 0.17647058, g: 0.3973444, b: 0.8862745, a: 1} 77 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 78 | m_BuildTextureStacks: [] 79 | -------------------------------------------------------------------------------- /UnityProject/Assets/PrefabsAndMaterials/PlayerMaterial.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6ad9e3a7b438f4329bf661e47ec1527a 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityProject/Assets/PrefabsAndMaterials/SimpleCharacter.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &4655882290843831597 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 4655882290843831594} 12 | - component: {fileID: 4655882290843831593} 13 | - component: {fileID: 4655882290843831592} 14 | - component: {fileID: 4655882290843831595} 15 | m_Layer: 0 16 | m_Name: Cylinder 17 | m_TagString: Untagged 18 | m_Icon: {fileID: 0} 19 | m_NavMeshLayer: 0 20 | m_StaticEditorFlags: 0 21 | m_IsActive: 1 22 | --- !u!4 &4655882290843831594 23 | Transform: 24 | m_ObjectHideFlags: 0 25 | m_CorrespondingSourceObject: {fileID: 0} 26 | m_PrefabInstance: {fileID: 0} 27 | m_PrefabAsset: {fileID: 0} 28 | m_GameObject: {fileID: 4655882290843831597} 29 | m_LocalRotation: {x: 0, y: 0, z: 0.7071068, w: 0.7071068} 30 | m_LocalPosition: {x: -0, y: 0.22, z: 0} 31 | m_LocalScale: {x: 0.3, y: 1, z: 0.3} 32 | m_Children: [] 33 | m_Father: {fileID: 4655882291869799818} 34 | m_RootOrder: 0 35 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 90} 36 | --- !u!33 &4655882290843831593 37 | MeshFilter: 38 | m_ObjectHideFlags: 0 39 | m_CorrespondingSourceObject: {fileID: 0} 40 | m_PrefabInstance: {fileID: 0} 41 | m_PrefabAsset: {fileID: 0} 42 | m_GameObject: {fileID: 4655882290843831597} 43 | m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0} 44 | --- !u!23 &4655882290843831592 45 | MeshRenderer: 46 | m_ObjectHideFlags: 0 47 | m_CorrespondingSourceObject: {fileID: 0} 48 | m_PrefabInstance: {fileID: 0} 49 | m_PrefabAsset: {fileID: 0} 50 | m_GameObject: {fileID: 4655882290843831597} 51 | m_Enabled: 1 52 | m_CastShadows: 1 53 | m_ReceiveShadows: 1 54 | m_DynamicOccludee: 1 55 | m_MotionVectors: 1 56 | m_LightProbeUsage: 1 57 | m_ReflectionProbeUsage: 1 58 | m_RayTracingMode: 2 59 | m_RayTraceProcedural: 0 60 | m_RenderingLayerMask: 1 61 | m_RendererPriority: 0 62 | m_Materials: 63 | - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} 64 | m_StaticBatchInfo: 65 | firstSubMesh: 0 66 | subMeshCount: 0 67 | m_StaticBatchRoot: {fileID: 0} 68 | m_ProbeAnchor: {fileID: 0} 69 | m_LightProbeVolumeOverride: {fileID: 0} 70 | m_ScaleInLightmap: 1 71 | m_ReceiveGI: 1 72 | m_PreserveUVs: 0 73 | m_IgnoreNormalsForChartDetection: 0 74 | m_ImportantGI: 0 75 | m_StitchLightmapSeams: 1 76 | m_SelectedEditorRenderState: 3 77 | m_MinimumChartSize: 4 78 | m_AutoUVMaxDistance: 0.5 79 | m_AutoUVMaxAngle: 89 80 | m_LightmapParameters: {fileID: 0} 81 | m_SortingLayerID: 0 82 | m_SortingLayer: 0 83 | m_SortingOrder: 0 84 | m_AdditionalVertexStreams: {fileID: 0} 85 | --- !u!136 &4655882290843831595 86 | CapsuleCollider: 87 | m_ObjectHideFlags: 0 88 | m_CorrespondingSourceObject: {fileID: 0} 89 | m_PrefabInstance: {fileID: 0} 90 | m_PrefabAsset: {fileID: 0} 91 | m_GameObject: {fileID: 4655882290843831597} 92 | m_Material: {fileID: 0} 93 | m_IsTrigger: 0 94 | m_Enabled: 1 95 | m_Radius: 0.5000001 96 | m_Height: 2 97 | m_Direction: 1 98 | m_Center: {x: 0.000000059604645, y: 0, z: -0.00000008940697} 99 | --- !u!1 &4655882291869799809 100 | GameObject: 101 | m_ObjectHideFlags: 0 102 | m_CorrespondingSourceObject: {fileID: 0} 103 | m_PrefabInstance: {fileID: 0} 104 | m_PrefabAsset: {fileID: 0} 105 | serializedVersion: 6 106 | m_Component: 107 | - component: {fileID: 4655882291869799818} 108 | - component: {fileID: 4655882291869799821} 109 | - component: {fileID: 4655882291869799820} 110 | - component: {fileID: 4655882291869799823} 111 | - component: {fileID: 4655882291869799822} 112 | - component: {fileID: 4657585905590680257} 113 | m_Layer: 0 114 | m_Name: SimpleCharacter 115 | m_TagString: Untagged 116 | m_Icon: {fileID: 0} 117 | m_NavMeshLayer: 0 118 | m_StaticEditorFlags: 0 119 | m_IsActive: 1 120 | --- !u!4 &4655882291869799818 121 | Transform: 122 | m_ObjectHideFlags: 0 123 | m_CorrespondingSourceObject: {fileID: 0} 124 | m_PrefabInstance: {fileID: 0} 125 | m_PrefabAsset: {fileID: 0} 126 | m_GameObject: {fileID: 4655882291869799809} 127 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 128 | m_LocalPosition: {x: 0, y: 1.05, z: 0} 129 | m_LocalScale: {x: 1, y: 1, z: 1} 130 | m_Children: 131 | - {fileID: 4655882290843831594} 132 | m_Father: {fileID: 0} 133 | m_RootOrder: 0 134 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 135 | --- !u!33 &4655882291869799821 136 | MeshFilter: 137 | m_ObjectHideFlags: 0 138 | m_CorrespondingSourceObject: {fileID: 0} 139 | m_PrefabInstance: {fileID: 0} 140 | m_PrefabAsset: {fileID: 0} 141 | m_GameObject: {fileID: 4655882291869799809} 142 | m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0} 143 | --- !u!23 &4655882291869799820 144 | MeshRenderer: 145 | m_ObjectHideFlags: 0 146 | m_CorrespondingSourceObject: {fileID: 0} 147 | m_PrefabInstance: {fileID: 0} 148 | m_PrefabAsset: {fileID: 0} 149 | m_GameObject: {fileID: 4655882291869799809} 150 | m_Enabled: 1 151 | m_CastShadows: 1 152 | m_ReceiveShadows: 1 153 | m_DynamicOccludee: 1 154 | m_MotionVectors: 1 155 | m_LightProbeUsage: 1 156 | m_ReflectionProbeUsage: 1 157 | m_RayTracingMode: 2 158 | m_RayTraceProcedural: 0 159 | m_RenderingLayerMask: 1 160 | m_RendererPriority: 0 161 | m_Materials: 162 | - {fileID: 2100000, guid: 6ad9e3a7b438f4329bf661e47ec1527a, type: 2} 163 | m_StaticBatchInfo: 164 | firstSubMesh: 0 165 | subMeshCount: 0 166 | m_StaticBatchRoot: {fileID: 0} 167 | m_ProbeAnchor: {fileID: 0} 168 | m_LightProbeVolumeOverride: {fileID: 0} 169 | m_ScaleInLightmap: 1 170 | m_ReceiveGI: 1 171 | m_PreserveUVs: 0 172 | m_IgnoreNormalsForChartDetection: 0 173 | m_ImportantGI: 0 174 | m_StitchLightmapSeams: 1 175 | m_SelectedEditorRenderState: 3 176 | m_MinimumChartSize: 4 177 | m_AutoUVMaxDistance: 0.5 178 | m_AutoUVMaxAngle: 89 179 | m_LightmapParameters: {fileID: 0} 180 | m_SortingLayerID: 0 181 | m_SortingLayer: 0 182 | m_SortingOrder: 0 183 | m_AdditionalVertexStreams: {fileID: 0} 184 | --- !u!136 &4655882291869799823 185 | CapsuleCollider: 186 | m_ObjectHideFlags: 0 187 | m_CorrespondingSourceObject: {fileID: 0} 188 | m_PrefabInstance: {fileID: 0} 189 | m_PrefabAsset: {fileID: 0} 190 | m_GameObject: {fileID: 4655882291869799809} 191 | m_Material: {fileID: 0} 192 | m_IsTrigger: 0 193 | m_Enabled: 1 194 | m_Radius: 0.5 195 | m_Height: 2 196 | m_Direction: 1 197 | m_Center: {x: 0, y: 0, z: 0} 198 | --- !u!143 &4655882291869799822 199 | CharacterController: 200 | m_ObjectHideFlags: 0 201 | m_CorrespondingSourceObject: {fileID: 0} 202 | m_PrefabInstance: {fileID: 0} 203 | m_PrefabAsset: {fileID: 0} 204 | m_GameObject: {fileID: 4655882291869799809} 205 | m_Material: {fileID: 0} 206 | m_IsTrigger: 0 207 | m_Enabled: 1 208 | serializedVersion: 2 209 | m_Height: 2 210 | m_Radius: 0.5 211 | m_SlopeLimit: 80 212 | m_StepOffset: 0.3 213 | m_SkinWidth: 0.08 214 | m_MinMoveDistance: 0.001 215 | m_Center: {x: 0, y: 0, z: 0} 216 | --- !u!114 &4657585905590680257 217 | MonoBehaviour: 218 | m_ObjectHideFlags: 0 219 | m_CorrespondingSourceObject: {fileID: 0} 220 | m_PrefabInstance: {fileID: 0} 221 | m_PrefabAsset: {fileID: 0} 222 | m_GameObject: {fileID: 4655882291869799809} 223 | m_Enabled: 1 224 | m_EditorHideFlags: 0 225 | m_Script: {fileID: 11500000, guid: 981a8ba6eadc64bd9b96f78320445a9d, type: 3} 226 | m_Name: 227 | m_EditorClassIdentifier: 228 | -------------------------------------------------------------------------------- /UnityProject/Assets/PrefabsAndMaterials/SimpleCharacter.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f8697ba2176fc4bfa995833f566a792d 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /UnityProject/Assets/PrefabsAndMaterials/Terrain.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d75a337ee8ede4ad1adc1d89a5b131d4 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityProject/Assets/PrefabsAndMaterials/Terrain/Desert.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-solutions-library-samples/guidance-for-persistent-world-game-hosting-on-aws/6af6942f1696296c9b9396eee241be28f72175a7/UnityProject/Assets/PrefabsAndMaterials/Terrain/Desert.jpeg -------------------------------------------------------------------------------- /UnityProject/Assets/PrefabsAndMaterials/Terrain/Desert.jpeg.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b66b941e179234864b708dae1bf5e363 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | vTOnly: 0 27 | grayScaleToAlpha: 0 28 | generateCubemap: 6 29 | cubemapConvolution: 0 30 | seamlessCubemap: 0 31 | textureFormat: 1 32 | maxTextureSize: 2048 33 | textureSettings: 34 | serializedVersion: 2 35 | filterMode: 1 36 | aniso: 1 37 | mipBias: 0 38 | wrapU: 0 39 | wrapV: 0 40 | wrapW: 0 41 | nPOTScale: 1 42 | lightmap: 0 43 | compressionQuality: 50 44 | spriteMode: 0 45 | spriteExtrude: 1 46 | spriteMeshType: 1 47 | alignment: 0 48 | spritePivot: {x: 0.5, y: 0.5} 49 | spritePixelsToUnits: 100 50 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 51 | spriteGenerateFallbackPhysicsShape: 1 52 | alphaUsage: 1 53 | alphaIsTransparency: 0 54 | spriteTessellationDetail: -1 55 | textureType: 0 56 | textureShape: 1 57 | singleChannelComponent: 0 58 | flipbookRows: 1 59 | flipbookColumns: 1 60 | maxTextureSizeSet: 0 61 | compressionQualitySet: 0 62 | textureFormatSet: 0 63 | ignorePngGamma: 0 64 | applyGammaDecoding: 0 65 | platformSettings: 66 | - serializedVersion: 3 67 | buildTarget: DefaultTexturePlatform 68 | maxTextureSize: 2048 69 | resizeAlgorithm: 0 70 | textureFormat: -1 71 | textureCompression: 1 72 | compressionQuality: 50 73 | crunchedCompression: 0 74 | allowsAlphaSplitting: 0 75 | overridden: 0 76 | androidETC2FallbackOverride: 0 77 | forceMaximumCompressionQuality_BC6H_BC7: 0 78 | spriteSheet: 79 | serializedVersion: 2 80 | sprites: [] 81 | outline: [] 82 | physicsShape: [] 83 | bones: [] 84 | spriteID: 85 | internalID: 0 86 | vertices: [] 87 | indices: 88 | edges: [] 89 | weights: [] 90 | secondaryTextures: [] 91 | spritePackingTag: 92 | pSDRemoveMatte: 0 93 | pSDShowRemoveMatteOption: 0 94 | userData: 95 | assetBundleName: 96 | assetBundleVariant: 97 | -------------------------------------------------------------------------------- /UnityProject/Assets/PrefabsAndMaterials/Terrain/DesertLayer.terrainlayer: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1953259897 &8574412962073106934 4 | TerrainLayer: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_Name: DesertLayer 10 | m_DiffuseTexture: {fileID: 2800000, guid: b66b941e179234864b708dae1bf5e363, type: 3} 11 | m_NormalMapTexture: {fileID: 0} 12 | m_MaskMapTexture: {fileID: 0} 13 | m_TileSize: {x: 2, y: 2} 14 | m_TileOffset: {x: 0, y: 0} 15 | m_Specular: {r: 0.7830189, g: 0.49506274, b: 0.09972411, a: 0} 16 | m_Metallic: 1 17 | m_Smoothness: 0 18 | m_NormalScale: 1 19 | m_DiffuseRemapMin: {x: 0, y: 0, z: 0, w: 0} 20 | m_DiffuseRemapMax: {x: 1, y: 1, z: 1, w: 1} 21 | m_MaskMapRemapMin: {x: 0, y: 0, z: 0, w: 0} 22 | m_MaskMapRemapMax: {x: 1, y: 1, z: 1, w: 1} 23 | -------------------------------------------------------------------------------- /UnityProject/Assets/PrefabsAndMaterials/Terrain/DesertLayer.terrainlayer.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f3a90a78f9315486cb23828918d32032 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 8574412962073106934 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityProject/Assets/PrefabsAndMaterials/Terrain/Forrest.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-solutions-library-samples/guidance-for-persistent-world-game-hosting-on-aws/6af6942f1696296c9b9396eee241be28f72175a7/UnityProject/Assets/PrefabsAndMaterials/Terrain/Forrest.jpeg -------------------------------------------------------------------------------- /UnityProject/Assets/PrefabsAndMaterials/Terrain/Forrest.jpeg.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c80fa73f842284bd18fc541569dbe446 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | vTOnly: 0 27 | grayScaleToAlpha: 0 28 | generateCubemap: 6 29 | cubemapConvolution: 0 30 | seamlessCubemap: 0 31 | textureFormat: 1 32 | maxTextureSize: 2048 33 | textureSettings: 34 | serializedVersion: 2 35 | filterMode: 1 36 | aniso: 1 37 | mipBias: 0 38 | wrapU: 0 39 | wrapV: 0 40 | wrapW: 0 41 | nPOTScale: 1 42 | lightmap: 0 43 | compressionQuality: 50 44 | spriteMode: 0 45 | spriteExtrude: 1 46 | spriteMeshType: 1 47 | alignment: 0 48 | spritePivot: {x: 0.5, y: 0.5} 49 | spritePixelsToUnits: 100 50 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 51 | spriteGenerateFallbackPhysicsShape: 1 52 | alphaUsage: 1 53 | alphaIsTransparency: 0 54 | spriteTessellationDetail: -1 55 | textureType: 0 56 | textureShape: 1 57 | singleChannelComponent: 0 58 | flipbookRows: 1 59 | flipbookColumns: 1 60 | maxTextureSizeSet: 0 61 | compressionQualitySet: 0 62 | textureFormatSet: 0 63 | ignorePngGamma: 0 64 | applyGammaDecoding: 0 65 | platformSettings: 66 | - serializedVersion: 3 67 | buildTarget: DefaultTexturePlatform 68 | maxTextureSize: 2048 69 | resizeAlgorithm: 0 70 | textureFormat: -1 71 | textureCompression: 1 72 | compressionQuality: 50 73 | crunchedCompression: 0 74 | allowsAlphaSplitting: 0 75 | overridden: 0 76 | androidETC2FallbackOverride: 0 77 | forceMaximumCompressionQuality_BC6H_BC7: 0 78 | spriteSheet: 79 | serializedVersion: 2 80 | sprites: [] 81 | outline: [] 82 | physicsShape: [] 83 | bones: [] 84 | spriteID: 85 | internalID: 0 86 | vertices: [] 87 | indices: 88 | edges: [] 89 | weights: [] 90 | secondaryTextures: [] 91 | spritePackingTag: 92 | pSDRemoveMatte: 0 93 | pSDShowRemoveMatteOption: 0 94 | userData: 95 | assetBundleName: 96 | assetBundleVariant: 97 | -------------------------------------------------------------------------------- /UnityProject/Assets/PrefabsAndMaterials/Terrain/ForrestLayer.terrainlayer: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1953259897 &8574412962073106934 4 | TerrainLayer: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_Name: ForrestLayer 10 | m_DiffuseTexture: {fileID: 2800000, guid: c80fa73f842284bd18fc541569dbe446, type: 3} 11 | m_NormalMapTexture: {fileID: 0} 12 | m_MaskMapTexture: {fileID: 0} 13 | m_TileSize: {x: 2, y: 2} 14 | m_TileOffset: {x: 0, y: 0} 15 | m_Specular: {r: 0.8867924, g: 0.6399965, b: 0.14640439, a: 0} 16 | m_Metallic: 1 17 | m_Smoothness: 0 18 | m_NormalScale: 1 19 | m_DiffuseRemapMin: {x: 0, y: 0, z: 0, w: 0} 20 | m_DiffuseRemapMax: {x: 1, y: 1, z: 1, w: 1} 21 | m_MaskMapRemapMin: {x: 0, y: 0, z: 0, w: 0} 22 | m_MaskMapRemapMax: {x: 1, y: 1, z: 1, w: 1} 23 | -------------------------------------------------------------------------------- /UnityProject/Assets/PrefabsAndMaterials/Terrain/ForrestLayer.terrainlayer.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6c9076e523b3a423296929e5d385027d 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 8574412962073106934 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityProject/Assets/PrefabsAndMaterials/Terrain/TerrainMaterial.physicMaterial: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!134 &13400000 4 | PhysicMaterial: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_Name: TerrainMaterial 10 | dynamicFriction: 0.6 11 | staticFriction: 0.6 12 | bounciness: 0 13 | frictionCombine: 0 14 | bounceCombine: 0 15 | -------------------------------------------------------------------------------- /UnityProject/Assets/PrefabsAndMaterials/Terrain/TerrainMaterial.physicMaterial.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 330c51c889f92400297eae9b14ef7e1a 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 13400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityProject/Assets/PrefabsAndMaterials/UI.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fdf3ba249419b4897aff18e3adbe4603 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityProject/Assets/PrefabsAndMaterials/UI/Item.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &7476018845278345631 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 7476018845278345628} 12 | - component: {fileID: 7476018845278345602} 13 | - component: {fileID: 7476018845278345629} 14 | m_Layer: 5 15 | m_Name: Item 16 | m_TagString: Untagged 17 | m_Icon: {fileID: 0} 18 | m_NavMeshLayer: 0 19 | m_StaticEditorFlags: 0 20 | m_IsActive: 1 21 | --- !u!224 &7476018845278345628 22 | RectTransform: 23 | m_ObjectHideFlags: 0 24 | m_CorrespondingSourceObject: {fileID: 0} 25 | m_PrefabInstance: {fileID: 0} 26 | m_PrefabAsset: {fileID: 0} 27 | m_GameObject: {fileID: 7476018845278345631} 28 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 29 | m_LocalPosition: {x: 0, y: 0, z: 0} 30 | m_LocalScale: {x: 1, y: 1, z: 1} 31 | m_Children: 32 | - {fileID: 7476018845551712663} 33 | m_Father: {fileID: 0} 34 | m_RootOrder: 0 35 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 36 | m_AnchorMin: {x: 0, y: 1} 37 | m_AnchorMax: {x: 0, y: 1} 38 | m_AnchoredPosition: {x: 0, y: 0} 39 | m_SizeDelta: {x: 583.5813, y: 36.6706} 40 | m_Pivot: {x: 0.5, y: 0.5} 41 | --- !u!222 &7476018845278345602 42 | CanvasRenderer: 43 | m_ObjectHideFlags: 0 44 | m_CorrespondingSourceObject: {fileID: 0} 45 | m_PrefabInstance: {fileID: 0} 46 | m_PrefabAsset: {fileID: 0} 47 | m_GameObject: {fileID: 7476018845278345631} 48 | m_CullTransparentMesh: 1 49 | --- !u!114 &7476018845278345629 50 | MonoBehaviour: 51 | m_ObjectHideFlags: 0 52 | m_CorrespondingSourceObject: {fileID: 0} 53 | m_PrefabInstance: {fileID: 0} 54 | m_PrefabAsset: {fileID: 0} 55 | m_GameObject: {fileID: 7476018845278345631} 56 | m_Enabled: 1 57 | m_EditorHideFlags: 0 58 | m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} 59 | m_Name: 60 | m_EditorClassIdentifier: 61 | m_Material: {fileID: 0} 62 | m_Color: {r: 1, g: 1, b: 1, a: 1} 63 | m_RaycastTarget: 1 64 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 65 | m_Maskable: 1 66 | m_OnCullStateChanged: 67 | m_PersistentCalls: 68 | m_Calls: [] 69 | m_FontData: 70 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 71 | m_FontSize: 20 72 | m_FontStyle: 0 73 | m_BestFit: 0 74 | m_MinSize: 0 75 | m_MaxSize: 40 76 | m_Alignment: 3 77 | m_AlignByGeometry: 0 78 | m_RichText: 1 79 | m_HorizontalOverflow: 0 80 | m_VerticalOverflow: 0 81 | m_LineSpacing: 1 82 | m_Text: New Text 83 | --- !u!1 &7476018845551712662 84 | GameObject: 85 | m_ObjectHideFlags: 0 86 | m_CorrespondingSourceObject: {fileID: 0} 87 | m_PrefabInstance: {fileID: 0} 88 | m_PrefabAsset: {fileID: 0} 89 | serializedVersion: 6 90 | m_Component: 91 | - component: {fileID: 7476018845551712663} 92 | - component: {fileID: 7476018845551712666} 93 | - component: {fileID: 7476018845551712661} 94 | - component: {fileID: 7476018845551712660} 95 | m_Layer: 5 96 | m_Name: Button 97 | m_TagString: Untagged 98 | m_Icon: {fileID: 0} 99 | m_NavMeshLayer: 0 100 | m_StaticEditorFlags: 0 101 | m_IsActive: 1 102 | --- !u!224 &7476018845551712663 103 | RectTransform: 104 | m_ObjectHideFlags: 0 105 | m_CorrespondingSourceObject: {fileID: 0} 106 | m_PrefabInstance: {fileID: 0} 107 | m_PrefabAsset: {fileID: 0} 108 | m_GameObject: {fileID: 7476018845551712662} 109 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 110 | m_LocalPosition: {x: 0, y: 0, z: 0} 111 | m_LocalScale: {x: 1, y: 1, z: 1} 112 | m_Children: 113 | - {fileID: 7476018845583518648} 114 | m_Father: {fileID: 7476018845278345628} 115 | m_RootOrder: 0 116 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 117 | m_AnchorMin: {x: 0, y: 1} 118 | m_AnchorMax: {x: 0, y: 1} 119 | m_AnchoredPosition: {x: 628.522, y: -20.837} 120 | m_SizeDelta: {x: 84.9561, y: 31.668} 121 | m_Pivot: {x: 0.5, y: 0.5} 122 | --- !u!222 &7476018845551712666 123 | CanvasRenderer: 124 | m_ObjectHideFlags: 0 125 | m_CorrespondingSourceObject: {fileID: 0} 126 | m_PrefabInstance: {fileID: 0} 127 | m_PrefabAsset: {fileID: 0} 128 | m_GameObject: {fileID: 7476018845551712662} 129 | m_CullTransparentMesh: 1 130 | --- !u!114 &7476018845551712661 131 | MonoBehaviour: 132 | m_ObjectHideFlags: 0 133 | m_CorrespondingSourceObject: {fileID: 0} 134 | m_PrefabInstance: {fileID: 0} 135 | m_PrefabAsset: {fileID: 0} 136 | m_GameObject: {fileID: 7476018845551712662} 137 | m_Enabled: 1 138 | m_EditorHideFlags: 0 139 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 140 | m_Name: 141 | m_EditorClassIdentifier: 142 | m_Material: {fileID: 0} 143 | m_Color: {r: 1, g: 1, b: 1, a: 1} 144 | m_RaycastTarget: 1 145 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 146 | m_Maskable: 1 147 | m_OnCullStateChanged: 148 | m_PersistentCalls: 149 | m_Calls: [] 150 | m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} 151 | m_Type: 1 152 | m_PreserveAspect: 0 153 | m_FillCenter: 1 154 | m_FillMethod: 4 155 | m_FillAmount: 1 156 | m_FillClockwise: 1 157 | m_FillOrigin: 0 158 | m_UseSpriteMesh: 0 159 | m_PixelsPerUnitMultiplier: 1 160 | --- !u!114 &7476018845551712660 161 | MonoBehaviour: 162 | m_ObjectHideFlags: 0 163 | m_CorrespondingSourceObject: {fileID: 0} 164 | m_PrefabInstance: {fileID: 0} 165 | m_PrefabAsset: {fileID: 0} 166 | m_GameObject: {fileID: 7476018845551712662} 167 | m_Enabled: 1 168 | m_EditorHideFlags: 0 169 | m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} 170 | m_Name: 171 | m_EditorClassIdentifier: 172 | m_Navigation: 173 | m_Mode: 3 174 | m_WrapAround: 0 175 | m_SelectOnUp: {fileID: 0} 176 | m_SelectOnDown: {fileID: 0} 177 | m_SelectOnLeft: {fileID: 0} 178 | m_SelectOnRight: {fileID: 0} 179 | m_Transition: 1 180 | m_Colors: 181 | m_NormalColor: {r: 0.15985101, g: 0.8867924, b: 0.10457456, a: 1} 182 | m_HighlightedColor: {r: 1, g: 1, b: 1, a: 1} 183 | m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} 184 | m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} 185 | m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} 186 | m_ColorMultiplier: 1 187 | m_FadeDuration: 0.1 188 | m_SpriteState: 189 | m_HighlightedSprite: {fileID: 0} 190 | m_PressedSprite: {fileID: 0} 191 | m_SelectedSprite: {fileID: 0} 192 | m_DisabledSprite: {fileID: 0} 193 | m_AnimationTriggers: 194 | m_NormalTrigger: Normal 195 | m_HighlightedTrigger: Highlighted 196 | m_PressedTrigger: Pressed 197 | m_SelectedTrigger: Selected 198 | m_DisabledTrigger: Disabled 199 | m_Interactable: 1 200 | m_TargetGraphic: {fileID: 7476018845551712661} 201 | m_OnClick: 202 | m_PersistentCalls: 203 | m_Calls: [] 204 | --- !u!1 &7476018845583518651 205 | GameObject: 206 | m_ObjectHideFlags: 0 207 | m_CorrespondingSourceObject: {fileID: 0} 208 | m_PrefabInstance: {fileID: 0} 209 | m_PrefabAsset: {fileID: 0} 210 | serializedVersion: 6 211 | m_Component: 212 | - component: {fileID: 7476018845583518648} 213 | - component: {fileID: 7476018845583518654} 214 | - component: {fileID: 7476018845583518649} 215 | m_Layer: 5 216 | m_Name: Text 217 | m_TagString: Untagged 218 | m_Icon: {fileID: 0} 219 | m_NavMeshLayer: 0 220 | m_StaticEditorFlags: 0 221 | m_IsActive: 1 222 | --- !u!224 &7476018845583518648 223 | RectTransform: 224 | m_ObjectHideFlags: 0 225 | m_CorrespondingSourceObject: {fileID: 0} 226 | m_PrefabInstance: {fileID: 0} 227 | m_PrefabAsset: {fileID: 0} 228 | m_GameObject: {fileID: 7476018845583518651} 229 | m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 230 | m_LocalPosition: {x: 0, y: 0, z: 0} 231 | m_LocalScale: {x: 1, y: 1, z: 1} 232 | m_Children: [] 233 | m_Father: {fileID: 7476018845551712663} 234 | m_RootOrder: 0 235 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 236 | m_AnchorMin: {x: 0, y: 0} 237 | m_AnchorMax: {x: 1, y: 1} 238 | m_AnchoredPosition: {x: 0, y: 0} 239 | m_SizeDelta: {x: 0, y: 0} 240 | m_Pivot: {x: 0.5, y: 0.5} 241 | --- !u!222 &7476018845583518654 242 | CanvasRenderer: 243 | m_ObjectHideFlags: 0 244 | m_CorrespondingSourceObject: {fileID: 0} 245 | m_PrefabInstance: {fileID: 0} 246 | m_PrefabAsset: {fileID: 0} 247 | m_GameObject: {fileID: 7476018845583518651} 248 | m_CullTransparentMesh: 1 249 | --- !u!114 &7476018845583518649 250 | MonoBehaviour: 251 | m_ObjectHideFlags: 0 252 | m_CorrespondingSourceObject: {fileID: 0} 253 | m_PrefabInstance: {fileID: 0} 254 | m_PrefabAsset: {fileID: 0} 255 | m_GameObject: {fileID: 7476018845583518651} 256 | m_Enabled: 1 257 | m_EditorHideFlags: 0 258 | m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} 259 | m_Name: 260 | m_EditorClassIdentifier: 261 | m_Material: {fileID: 0} 262 | m_Color: {r: 0, g: 0, b: 0, a: 1} 263 | m_RaycastTarget: 1 264 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 265 | m_Maskable: 1 266 | m_OnCullStateChanged: 267 | m_PersistentCalls: 268 | m_Calls: [] 269 | m_FontData: 270 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 271 | m_FontSize: 14 272 | m_FontStyle: 0 273 | m_BestFit: 0 274 | m_MinSize: 10 275 | m_MaxSize: 40 276 | m_Alignment: 4 277 | m_AlignByGeometry: 0 278 | m_RichText: 1 279 | m_HorizontalOverflow: 0 280 | m_VerticalOverflow: 0 281 | m_LineSpacing: 1 282 | m_Text: Join 283 | -------------------------------------------------------------------------------- /UnityProject/Assets/PrefabsAndMaterials/UI/Item.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c7548d15da6e84bf181dda76a8ae361a 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /UnityProject/Assets/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 87aca9e9f0378471cbbb0d1dd3e89a8f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityProject/Assets/Scenes/Desert.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2435c801ffbb14db981cfb7a6df98aa3 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /UnityProject/Assets/Scenes/Forrest.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cf75b0af29d2646be956a47eeaf9c403 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /UnityProject/Assets/Scenes/MainMenu.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9fc0d4010bbf28b4594072e72b8655ab 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /UnityProject/Assets/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 38fca16f674ef4c359180ac45c735bd6 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityProject/Assets/Scripts/Client.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b89beca3de8f7450988d75aef7498009 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityProject/Assets/Scripts/Client/BackendApiAclient.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: MIT-0 3 | 4 | using System; 5 | using UnityEngine; 6 | using System.Threading.Tasks; 7 | using System.Net.Http; 8 | using System.Collections.Generic; 9 | using AWSSignatureV4_S3_Sample.Signers; 10 | 11 | // **** MATCMAKING API CLIENT *** 12 | 13 | public class BackendApiClient 14 | { 15 | #if CLIENT 16 | Client client; //The game client Monobehaviour 17 | 18 | public BackendApiClient() 19 | { 20 | // Find a reference to the client 21 | this.client = GameObject.FindObjectOfType(); 22 | } 23 | 24 | public WorldsData RequestListWorlds(string region) 25 | { 26 | try 27 | { 28 | var response = Task.Run(() => this.SendSignedGetRequest(this.client.apiEndpoint + "listworlds?location=" + region)); 29 | response.Wait(10000); 30 | string jsonResponse = response.Result; 31 | WorldsData worlds = JsonUtility.FromJson(jsonResponse); 32 | return worlds; 33 | } 34 | catch (Exception e) 35 | { 36 | Debug.Log(e.Message); 37 | return null; 38 | } 39 | } 40 | 41 | public GameSessionInfo RequestJoinWorld(string location, string worldId) 42 | { 43 | try 44 | { 45 | var response = Task.Run(() => this.SendSignedGetRequest(this.client.apiEndpoint + "joinworld?location=" + location + "&world_id="+worldId)); 46 | response.Wait(10000); 47 | string jsonResponse = response.Result; 48 | GameSessionInfo sessionInfo = JsonUtility.FromJson(jsonResponse); 49 | return sessionInfo; 50 | } 51 | catch (Exception e) 52 | { 53 | Debug.Log(e.Message); 54 | return null; 55 | } 56 | } 57 | 58 | // Helper function to send and wait for response to a signed request to the API Gateway endpoint 59 | async Task SendSignedGetRequest(string requestUrl) 60 | { 61 | // Sign the request with cognito credentials 62 | var request = this.generateSignedRequest(requestUrl); 63 | 64 | // Execute the signed request 65 | var client = new HttpClient(); 66 | var resp = await client.SendAsync(request); 67 | 68 | // Get the response 69 | var responseStr = await resp.Content.ReadAsStringAsync(); 70 | Debug.Log(responseStr); 71 | 72 | return responseStr; 73 | } 74 | 75 | // Generates a HTTPS requestfor API Gateway signed with the Cognito credentials from a url using the S3 signer tool example 76 | // NOTE: You need to add the floders "Signers" and "Util" to the project from the S3 signer tool example: https://docs.aws.amazon.com/AmazonS3/latest/API/samples/AmazonS3SigV4_Samples_CSharp.zip 77 | HttpRequestMessage generateSignedRequest(string url) 78 | { 79 | var endpointUri = url; 80 | 81 | var uri = new Uri(endpointUri); 82 | 83 | var headers = new Dictionary 84 | { 85 | {AWS4SignerBase.X_Amz_Content_SHA256, AWS4SignerBase.EMPTY_BODY_SHA256}, 86 | }; 87 | 88 | var signer = new AWS4SignerForAuthorizationHeader 89 | { 90 | EndpointUri = uri, 91 | HttpMethod = "GET", 92 | Service = "execute-api", 93 | Region = this.client.regionString 94 | }; 95 | 96 | //Extract the query parameters 97 | var queryParams = ""; 98 | if (url.Split('?').Length > 1) 99 | { 100 | queryParams = url.Split('?')[1]; 101 | } 102 | 103 | var authorization = signer.ComputeSignature(headers, 104 | queryParams, 105 | AWS4SignerBase.EMPTY_BODY_SHA256, 106 | Client.cognitoCredentials.AccessKey, 107 | Client.cognitoCredentials.SecretKey); 108 | 109 | headers.Add("Authorization", authorization); 110 | 111 | var request = new HttpRequestMessage 112 | { 113 | Method = HttpMethod.Get, 114 | RequestUri = new Uri(url), 115 | }; 116 | 117 | // Add the generated headers to the request 118 | foreach (var header in headers) 119 | { 120 | try 121 | { 122 | if (header.Key != null && header.Value != null) 123 | request.Headers.TryAddWithoutValidation(header.Key, header.Value); 124 | } 125 | catch (Exception e) 126 | { 127 | Debug.Log("error: " + e.GetType().ToString()); 128 | } 129 | } 130 | 131 | // Add the IAM authentication token 132 | request.Headers.Add("x-amz-security-token", Client.cognitoCredentials.Token); 133 | 134 | return request; 135 | } 136 | #endif 137 | } 138 | 139 | -------------------------------------------------------------------------------- /UnityProject/Assets/Scripts/Client/BackendApiAclient.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8c107d5644b9f4e15935d1a368b8af1c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityProject/Assets/Scripts/Client/BackendApiSerializationClasses.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: MIT-0 3 | 4 | 5 | //** SERIALIZATION OBJECTS FOR THE BACKEND API *** 6 | [System.Serializable] 7 | public class WorldsData 8 | { 9 | [System.Serializable] 10 | public class WorldData 11 | { 12 | public string GameSessionId; 13 | public string Location; 14 | public int MaxPlayers; 15 | public int CurrentPlayerSessionCount; 16 | public string WorldMap; 17 | public string WorldID; 18 | public string DynamicWorld; 19 | } 20 | 21 | public WorldData[] Worlds; 22 | } 23 | [System.Serializable] 24 | public class GameSessionInfo 25 | { 26 | public string PlayerSessionId; 27 | public string PlayerId; 28 | public string GameSessionId; 29 | public string FleetId; 30 | public string CreationTime; 31 | public string Status; 32 | public string IpAddress; 33 | public int Port; 34 | } -------------------------------------------------------------------------------- /UnityProject/Assets/Scripts/Client/BackendApiSerializationClasses.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f3ce1e0050f614b2a90dcc5eec5ada8b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityProject/Assets/Scripts/Client/Client.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 14d54a9963b984bd8946300a53e112da 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityProject/Assets/Scripts/Client/NetworkClient.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: MIT-0 3 | 4 | using System; 5 | using System.Net.Sockets; 6 | using UnityEngine; 7 | using System.Collections; 8 | using System.Collections.Generic; 9 | 10 | // *** NETWORK CLIENT FOR TCP CONNECTIONS WITH THE SERVER *** 11 | 12 | public class NetworkClient 13 | { 14 | #if CLIENT 15 | private BackendApiClient backendApiClient; 16 | 17 | private TcpClient client = null; 18 | 19 | private bool connectionSucceeded = false; 20 | public bool ConnectionSucceeded() { return connectionSucceeded; } 21 | 22 | public NetworkClient() 23 | { 24 | this.backendApiClient = new BackendApiClient(); 25 | } 26 | 27 | // Called by the client to receive new messages 28 | public void Update() 29 | { 30 | if (client == null) return; 31 | var messages = NetworkProtocol.Receive(client); 32 | if(messages != null) 33 | { 34 | //Debug.Log("Received messages"); 35 | foreach (SimpleMessage msg in messages) 36 | { 37 | HandleMessage(msg); 38 | } 39 | } 40 | } 41 | 42 | private bool TryConnect(GameSessionInfo gameSession) 43 | { 44 | try 45 | { 46 | //Connect with matchmaking info 47 | Debug.Log("Connect.."); 48 | this.client = new TcpClient(); 49 | #if LOCAL_GAME 50 | var result = client.BeginConnect("127.0.0.1", 1935, null, null); 51 | #else 52 | var result = client.BeginConnect(gameSession.IpAddress, gameSession.Port, null, null); 53 | #endif 54 | 55 | var success = result.AsyncWaitHandle.WaitOne(TimeSpan.FromSeconds(2)); 56 | 57 | if (!success) 58 | { 59 | throw new Exception("Failed to connect."); 60 | } 61 | client.NoDelay = true; // Use No Delay to send small messages immediately. UDP should be used for even faster messaging 62 | Debug.Log("Done"); 63 | 64 | // Send the player session ID to server so it can validate the player 65 | SimpleMessage connectMessage = new SimpleMessage(MessageType.Connect, gameSession.PlayerSessionId); 66 | this.SendMessage(connectMessage); 67 | 68 | return true; 69 | } 70 | catch (Exception e) 71 | { 72 | Debug.Log(e.Message); 73 | client = null; 74 | GameObject.FindObjectOfType().SetInfoTextBox("Failed to connect: " + e.Message); 75 | return false; 76 | } 77 | } 78 | 79 | public void Connect(GameSessionInfo gameSession) 80 | { 81 | // try to connect to a local server 82 | if (TryConnect(gameSession) == false) 83 | { 84 | Debug.Log("Failed to connect to server"); 85 | GameObject.FindObjectOfType().SetInfoTextBox("Connection to server failed."); 86 | 87 | // Restart the client 88 | var clientObject = GameObject.FindObjectOfType(); 89 | clientObject.Restart(); 90 | } 91 | else 92 | { 93 | //We're ready to play, let the server know 94 | this.connectionSucceeded = true; 95 | GameObject.FindObjectOfType().SetInfoTextBox("Connected to server"); 96 | } 97 | } 98 | 99 | // Send serialized binary message to server 100 | public void SendMessage(SimpleMessage message) 101 | { 102 | if (client == null) return; 103 | try 104 | { 105 | NetworkProtocol.Send(client, message); 106 | } 107 | catch (SocketException e) 108 | { 109 | HandleDisconnect(); 110 | } 111 | } 112 | 113 | // Send disconnect message to server 114 | public void Disconnect() 115 | { 116 | if (client == null) return; 117 | SimpleMessage message = new SimpleMessage(MessageType.Disconnect); 118 | try 119 | { 120 | NetworkProtocol.Send(client, message); 121 | } 122 | 123 | finally 124 | { 125 | HandleDisconnect(); 126 | } 127 | } 128 | 129 | // Handle a message received from the server 130 | private void HandleMessage(SimpleMessage msg) 131 | { 132 | // parse message and pass json string to relevant handler for deserialization 133 | //Debug.Log("Message received:" + msg.messageType + ":" + msg.message); 134 | if (msg.messageType == MessageType.Reject) 135 | HandleReject(); 136 | else if (msg.messageType == MessageType.Disconnect) 137 | HandleDisconnect(); 138 | else if (msg.messageType == MessageType.Spawn) 139 | HandleOtherPlayerSpawned(msg); 140 | else if (msg.messageType == MessageType.Position) 141 | HandleOtherPlayerPos(msg); 142 | else if (msg.messageType == MessageType.PositionOwn) 143 | HandlePlayerPos(msg); 144 | else if (msg.messageType == MessageType.PlayerLeft) 145 | HandleOtherPlayerLeft(msg); 146 | else if (msg.messageType == MessageType.LastPositionSet) 147 | HandleLastPositionSet(msg); 148 | } 149 | 150 | private void HandleLastPositionSet(SimpleMessage msg) 151 | { 152 | Client.messagesToProcess.Add(msg); 153 | } 154 | 155 | private void HandleReject() 156 | { 157 | NetworkStream stream = client.GetStream(); 158 | stream.Close(); 159 | client.Close(); 160 | client = null; 161 | } 162 | 163 | private void HandleDisconnect() 164 | { 165 | try 166 | { 167 | Debug.Log("Got disconnected by server"); 168 | GameObject.FindObjectOfType().SetInfoTextBox("Got disconnected by server"); 169 | NetworkStream stream = client.GetStream(); 170 | stream.Close(); 171 | client.Close(); 172 | client = null; 173 | } 174 | catch (Exception e) 175 | { 176 | Debug.Log("Error when disconnecting, setting client to null."); 177 | client = null; 178 | } 179 | } 180 | 181 | private void HandleOtherPlayerSpawned(SimpleMessage message) 182 | { 183 | Client.messagesToProcess.Add(message); 184 | } 185 | 186 | private void HandlePlayerPos(SimpleMessage message) 187 | { 188 | Client.messagesToProcess.Add(message); 189 | } 190 | 191 | private void HandleOtherPlayerPos(SimpleMessage message) 192 | { 193 | Client.messagesToProcess.Add(message); 194 | } 195 | 196 | private void HandleOtherPlayerLeft(SimpleMessage message) 197 | { 198 | Client.messagesToProcess.Add(message); 199 | } 200 | #endif 201 | } 202 | 203 | -------------------------------------------------------------------------------- /UnityProject/Assets/Scripts/Client/NetworkClient.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c0f3eac65fb0e44679b52a4ef5e8baca 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityProject/Assets/Scripts/Client/SimpleController.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: MIT-0 3 | 4 | // A simple class for getting player input and moving a character 5 | 6 | using System; 7 | using UnityEngine; 8 | 9 | public class SimpleController : MonoBehaviour 10 | { 11 | float speed = 5.0f; 12 | 13 | float currentMoveZ = 0.0f; 14 | float currentMoveX = 0.0f; 15 | 16 | public float GetCurrentMoveX() { return currentMoveX; } 17 | public float GetCurrentMoveZ() { return currentMoveZ; } 18 | 19 | public void SetMove(float x, float z) { this.currentMoveX = x; this.currentMoveZ = z; } 20 | 21 | #if CLIENT 22 | // Manage player input on a fixed timestep 23 | void FixedUpdate() 24 | { 25 | 26 | currentMoveX = 0.0f; 27 | currentMoveZ = 0.0f; 28 | 29 | // Get the movement input 30 | if (Input.GetKey(KeyCode.UpArrow) || Input.GetKey(KeyCode.W)) 31 | { 32 | //move.z = 1; 33 | currentMoveZ = 1.0f; 34 | } 35 | else if (Input.GetKey(KeyCode.DownArrow) || Input.GetKey(KeyCode.S)) 36 | { 37 | // move.z = -1; 38 | currentMoveZ = -1.0f; 39 | } 40 | if (Input.GetKey(KeyCode.LeftArrow) || Input.GetKey(KeyCode.A)) 41 | { 42 | // move.x = -1; 43 | currentMoveX = -1.0f; 44 | } 45 | else if (Input.GetKey(KeyCode.RightArrow) || Input.GetKey(KeyCode.D)) 46 | { 47 | //move.x = 1; 48 | currentMoveX = 1.0f; 49 | } 50 | } 51 | #endif 52 | 53 | public void Move() 54 | { 55 | Vector3 move = Vector3.zero; 56 | move.x = currentMoveX; 57 | move.z = currentMoveZ; 58 | 59 | // Move the character 60 | move.Normalize(); 61 | this.transform.LookAt(this.transform.position + move); 62 | this.GetComponent().SimpleMove(move * speed); 63 | } 64 | 65 | internal void ForceSetPosition(float x, float y, float z) 66 | { 67 | // To warp the charactercontroller, we need to disable and enable it 68 | this.GetComponent().enabled = false; 69 | this.GetComponent().transform.position = new Vector3(x,y,z); 70 | this.GetComponent().enabled = true; 71 | } 72 | } -------------------------------------------------------------------------------- /UnityProject/Assets/Scripts/Client/SimpleController.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 981a8ba6eadc64bd9b96f78320445a9d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityProject/Assets/Scripts/NetworkingShared.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 130a7976091584d43bb7387ac7ba3d18 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityProject/Assets/Scripts/NetworkingShared/MessageClasses.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: MIT-0 3 | 4 | // Here you would define your message types for the messages between server and client 5 | // NOTE: We are using BinaryFormatter for simplicity to serialize/deserialize binary messages. 6 | // There are more optimal solutions such as Protocol buffer available. 7 | 8 | using System; 9 | 10 | [Serializable] 11 | public enum MessageType 12 | { 13 | Connect, 14 | Disconnect, 15 | Ready, 16 | Reject, 17 | Spawn, 18 | Position, 19 | PlayerLeft, 20 | PositionOwn, 21 | PlayerInput, 22 | LastPositionSet 23 | }; 24 | 25 | // We will use the same message for all requests so it will include a type and optional float values (used for position and orientation) 26 | [Serializable] 27 | public class SimpleMessage 28 | { 29 | public SimpleMessage(MessageType type, string message = "") 30 | { 31 | this.messageType = type; 32 | this.message = message; 33 | } 34 | 35 | public SimpleMessage() 36 | { 37 | } 38 | 39 | public void SetMoveFloats(float float1, float float2) 40 | { 41 | this.float1 = float1; this.float2 = float2; 42 | } 43 | 44 | public void SetFloats(float float1, float float2, float float3, float float4, float float5, float float6, float float7) 45 | { 46 | this.float1 = float1; this.float2 = float2; this.float3 = float3; this.float4 = float4; this.float5 = float5; this.float6 = float6; this.float7 = float7; 47 | } 48 | 49 | 50 | public MessageType messageType { get; set; } 51 | public string message { get; set; } 52 | public int clientId { get; set; } 53 | 54 | // As we are using one generic message for simplicity, we always have all possible data here 55 | // You would likely want to use different classes for different message types 56 | public float float1 { get; set; } 57 | public float float2 { get; set; } 58 | public float float3 { get; set; } 59 | public float float4 { get; set; } 60 | public float float5 { get; set; } 61 | public float float6 { get; set; } 62 | public float float7 { get; set; } 63 | } 64 | -------------------------------------------------------------------------------- /UnityProject/Assets/Scripts/NetworkingShared/MessageClasses.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 13b05c6ab03064ecdabc807c61e05381 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityProject/Assets/Scripts/NetworkingShared/NetworkPlayer.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: MIT-0 3 | 4 | //Encapsulates a GameObject and manages spawning and interpolation of an enemy player 5 | 6 | using System; 7 | using UnityEngine; 8 | 9 | public class NetworkPlayer 10 | { 11 | private GameObject character; 12 | private bool localPlayer; 13 | int playerId; // the rolling socket ID for the player 14 | 15 | private Vector3 previousPos = Vector3.zero; 16 | private Vector3 targetPos = Vector3.zero; 17 | private Quaternion targetOrientation = Quaternion.identity; 18 | 19 | public string playerSessionId; //Stored for correctly terminating player sessions 20 | public string playerCognitoId; //Used to access player data in DynamoDB 21 | 22 | public NetworkPlayer(int playerId) 23 | { 24 | this.playerId = playerId; 25 | } 26 | 27 | public void DeleteGameObject() 28 | { 29 | GameObject.Destroy(this.character); 30 | } 31 | 32 | public void SetPlayerId(int playerId) { this.playerId = playerId; } 33 | 34 | public int GetPlayerId() 35 | { 36 | return playerId; 37 | } 38 | 39 | // This is called for the local player only 40 | public void Initialize(GameObject characterPrefab, Vector3 pos) 41 | { 42 | // Create character 43 | Quaternion rotation = Quaternion.identity; 44 | this.character = GameObject.Instantiate(characterPrefab, pos, rotation); 45 | this.localPlayer = true; 46 | } 47 | 48 | // *** FOR SENDING MESSAGES (LOCAL PLAYER) *** // 49 | 50 | public SimpleMessage GetSpawnMessage() 51 | { 52 | SimpleMessage message = new SimpleMessage(MessageType.Spawn); 53 | Vector3 pos = this.character.transform.position; 54 | Quaternion rotation = this.character.transform.rotation; 55 | message.SetFloats(pos.x, pos.y, pos.z, rotation.x, rotation.y, rotation.z, rotation.w); 56 | return message; 57 | } 58 | 59 | // Resets interpolation target to current pos 60 | public void ResetTarget() 61 | { 62 | this.previousPos = this.character.transform.position; 63 | this.targetPos = this.character.transform.position; 64 | this.targetOrientation = this.character.transform.rotation; 65 | } 66 | 67 | public Transform GetTransform() 68 | { 69 | return this.character.transform; 70 | } 71 | 72 | public SimpleMessage GetPositionMessage(bool overrideChangedCheck = false) 73 | { 74 | Vector3 pos = this.character.transform.position; 75 | if (Vector3.Distance(pos, this.previousPos) > 0.01f || overrideChangedCheck) 76 | { 77 | SimpleMessage message = new SimpleMessage(MessageType.Position); 78 | this.previousPos = pos; 79 | Quaternion rotation = this.character.transform.rotation; 80 | message.SetFloats(pos.x, pos.y, pos.z, rotation.x, rotation.y, rotation.z, rotation.w); 81 | return message; 82 | } 83 | return null; 84 | } 85 | 86 | public SimpleMessage GetMoveMessage() 87 | { 88 | SimpleController controller = this.character.GetComponent(); 89 | if (controller != null) 90 | { 91 | float moveX = controller.GetCurrentMoveX(); 92 | float moveZ = controller.GetCurrentMoveZ(); 93 | SimpleMessage message = new SimpleMessage(MessageType.PlayerInput); 94 | message.SetMoveFloats(moveX, moveZ); 95 | return message; 96 | } 97 | return null; 98 | } 99 | 100 | // *** FOR RECEIVING MESSAGES (REMOTE PLAYERS) *** // 101 | 102 | // This is called for remote players only 103 | public void Spawn(SimpleMessage msg, GameObject characterPrefab) 104 | { 105 | this.localPlayer = false; 106 | 107 | //Position 108 | float x = msg.float1; 109 | float y = msg.float2; 110 | float z = msg.float3; 111 | //Orientation 112 | float qx = msg.float4; 113 | float qy = msg.float5; 114 | float qz = msg.float6; 115 | float qw = msg.float7; 116 | 117 | if (this.character == null) 118 | { 119 | Debug.Log("Enemy not spawned yet, spawn"); 120 | this.character = GameObject.Instantiate(characterPrefab, new Vector3(x, y, z), new Quaternion(qx, qy, qz, qw)); 121 | } 122 | } 123 | 124 | // Moves a single physics tick 125 | public void Move() 126 | { 127 | var controller = this.character.GetComponent(); 128 | controller.Move(); 129 | 130 | // Check if we've dropped off the world from the edge and jump back in 131 | if(this.character.transform.position.y < -5.0f) 132 | { 133 | Debug.Log("Player dropped off the world edge, bringing back."); 134 | this.SetPosition(UnityEngine.Random.Range(50,60), 8, UnityEngine.Random.Range(30, 40)); 135 | } 136 | } 137 | 138 | // Set's the input on server (received from clients) 139 | public void SetInput(SimpleMessage msg) 140 | { 141 | var controller = this.character.GetComponent(); 142 | controller.SetMove(msg.float1, msg.float2); 143 | } 144 | 145 | public void ReceivePosition(SimpleMessage msg, GameObject characterPrefab) 146 | { 147 | //Position 148 | float x = msg.float1; 149 | float y = msg.float2; 150 | float z = msg.float3; 151 | //Orientation 152 | float qx = msg.float4; 153 | float qy = msg.float5; 154 | float qz = msg.float6; 155 | float qw = msg.float7; 156 | 157 | // We spawn here too as it might be the enemy spawned before us 158 | if (this.character == null) 159 | { 160 | Debug.Log("Enemy not spawned yet, spawn"); 161 | this.character = GameObject.Instantiate(characterPrefab, new Vector3(x, y, z), new Quaternion(qx, qy, qz, qw)); 162 | } 163 | 164 | // Set the target position for interpolation which is done in InterpolateToTarget on every frame 165 | this.targetPos = new Vector3(x, y, z); 166 | this.targetOrientation = new Quaternion(qx, qy, qz, qw); 167 | } 168 | 169 | // Interpolate to target 170 | public void InterpolateToTarget() 171 | { 172 | Vector3 move = targetPos - this.character.transform.position; 173 | float distance = move.magnitude; 174 | 175 | // If we're moving more than the length of 3, just warp 176 | if (distance > 3) 177 | { 178 | this.character.transform.SetPositionAndRotation(targetPos, this.targetOrientation); 179 | return; 180 | } 181 | 182 | // Otherwise interpolate 183 | Vector3 positionDifference = this.targetPos - this.character.transform.position; 184 | Vector3 interpolateMove = 0.25f * positionDifference; 185 | this.character.transform.SetPositionAndRotation(this.character.transform.position + interpolateMove, this.targetOrientation); 186 | } 187 | 188 | // Used to set the position from a previous one found in DynamoDB 189 | internal void SetPosition(float x, float y, float z) 190 | { 191 | SimpleController controller = this.character.GetComponent(); 192 | if(controller != null) 193 | { 194 | controller.ForceSetPosition(x, y, z); 195 | } 196 | } 197 | } -------------------------------------------------------------------------------- /UnityProject/Assets/Scripts/NetworkingShared/NetworkPlayer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 19d0e0c70827b4dd4b7752cb28f8cc13 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityProject/Assets/Scripts/NetworkingShared/NetworkProtocol.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: MIT-0 3 | 4 | // Helper class to serialize and deserialize messages to a network stream 5 | 6 | using System; 7 | using System.IO; 8 | using System.Net.Sockets; 9 | using System.Collections.Generic; 10 | using System.Text; 11 | using UnityEngine; 12 | 13 | public class NetworkProtocol 14 | { 15 | public static SimpleMessage[] Receive(TcpClient client) 16 | { 17 | try 18 | { 19 | NetworkStream stream = client.GetStream(); 20 | var messages = new List(); 21 | while (stream.DataAvailable) 22 | { 23 | try 24 | { 25 | using (var reader = new BinaryReader(stream, Encoding.UTF8, true)) 26 | { 27 | // We always expect a SimpleMessage in this sample 28 | SimpleMessage message = new SimpleMessage(); 29 | message.messageType = (MessageType) reader.ReadInt32(); 30 | message.message = reader.ReadString(); 31 | message.clientId = reader.ReadInt32(); 32 | message.float1 = reader.ReadSingle(); 33 | message.float2 = reader.ReadSingle(); 34 | message.float3 = reader.ReadSingle(); 35 | message.float4 = reader.ReadSingle(); 36 | message.float5 = reader.ReadSingle(); 37 | message.float6 = reader.ReadSingle(); 38 | message.float7 = reader.ReadSingle(); 39 | messages.Add(message); 40 | } 41 | } 42 | catch (Exception e) 43 | { 44 | Debug.Log("Error receiving a message: " + e.Message); 45 | Debug.Log("Aborting the rest of the messages"); 46 | return null; 47 | } 48 | } 49 | 50 | return messages.ToArray(); 51 | } 52 | catch (Exception e) 53 | { 54 | System.Console.WriteLine("Error accessing message stream: " + e.Message); 55 | } 56 | 57 | return null; 58 | } 59 | 60 | public static bool Send(TcpClient client, SimpleMessage message) 61 | { 62 | try 63 | { 64 | if (client == null) return false; 65 | NetworkStream stream = client.GetStream(); 66 | using (var writer = new BinaryWriter(stream, Encoding.UTF8, true)) 67 | { 68 | // Write the SimpleMessage contents. You should implement a system for different message types for more complex scenarios 69 | writer.Write((Int32)message.messageType); 70 | writer.Write(message.message); 71 | writer.Write((Int32)message.clientId); 72 | writer.Write(message.float1); 73 | writer.Write(message.float2); 74 | writer.Write(message.float3); 75 | writer.Write(message.float4); 76 | writer.Write(message.float5); 77 | writer.Write(message.float6); 78 | writer.Write(message.float7); 79 | 80 | return true; 81 | } 82 | } 83 | catch (Exception e) 84 | { 85 | Debug.Log("Error sending data: " + e.Message); 86 | return false; 87 | } 88 | 89 | return false; 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /UnityProject/Assets/Scripts/NetworkingShared/NetworkProtocol.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: caa4d694728b34ec3a90899b2a10bbd4 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityProject/Assets/Scripts/Server.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cd373d57b6acc4ff887d331d7b6e0573 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /UnityProject/Assets/Scripts/Server/GameLift.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: MIT-0 3 | 4 | // GameLift server configuration and callbacks 5 | 6 | using System; 7 | using UnityEngine; 8 | using Aws.GameLift.Server; 9 | using System.Collections.Generic; 10 | using Aws.GameLift.Server.Model; 11 | using UnityEngine.SceneManagement; 12 | 13 | public class GameLift : MonoBehaviour 14 | { 15 | #if SERVER 16 | 17 | //Set the port that your game service is listening on for incoming player connections 18 | public int listeningPort = -1; 19 | 20 | // Game preparation state 21 | private bool gameSessionInfoReceived = false; 22 | 23 | // Game state 24 | public GameSession gameSession = null; 25 | private bool startGameSession = false; 26 | private string gameSessionId; 27 | public string GetGameSessionID() { return gameSessionId; } 28 | 29 | // StatsD client for sending custom metrics to CloudWatch through the local StatsD agent 30 | private SimpleStatsdClient statsdClient; 31 | public SimpleStatsdClient GetStatsdClient() { return statsdClient; } 32 | 33 | // Backfill ticket ID (received and updated on game session updates) 34 | string backfillTicketID = null; 35 | 36 | // Game session timer, we don't want to run over 20 minutes 37 | private float gameSessionTimer = 0.0f; 38 | 39 | // Max players 40 | public int maxPlayers; 41 | 42 | // Refresh counter: We refresh the game servers every 24 hours 43 | DateTime launchTime = DateTime.Now; 44 | 45 | // Get the port to host the server from the command line arguments 46 | private int GetPortFromArgs() 47 | { 48 | int defaultPort = 1935; 49 | int port = defaultPort; //Use default is arg not provided 50 | 51 | string[] args = System.Environment.GetCommandLineArgs(); 52 | 53 | for (int i = 0; i < args.Length; i++) 54 | { 55 | Debug.Log("ARG " + i + ": " + args[i]); 56 | if (args[i] == "-port") 57 | { 58 | port = int.Parse(args[i + 1]); 59 | } 60 | } 61 | 62 | return port; 63 | } 64 | 65 | // Called when the monobehaviour is created 66 | public void Awake() 67 | { 68 | //Initiate the simple statsD client 69 | this.statsdClient = new SimpleStatsdClient("localhost", 8125); 70 | 71 | //Get the port from command line args 72 | listeningPort = this.GetPortFromArgs(); 73 | 74 | System.Console.WriteLine("Will be running in port: " + this.listeningPort); 75 | 76 | //InitSDK establishes a local connection with the Amazon GameLift agent to enable 77 | //further communication. 78 | var initSDKOutcome = GameLiftServerAPI.InitSDK(); 79 | if (initSDKOutcome.Success) 80 | { 81 | ProcessParameters processParameters = new ProcessParameters( 82 | (gameSession) => { 83 | //Respond to new game session activation request. GameLift sends activation request 84 | //to the game server along with a game session object containing game properties 85 | //and other settings. 86 | 87 | //We'll do the activation in the next Update to do it from the main thread (required to load the worlds scene 88 | this.gameSession = gameSession; 89 | this.startGameSession = true; 90 | 91 | }, 92 | (gameSession) => { 93 | //Respond to game session updates (We don't get any in this setup) 94 | }, 95 | () => { 96 | //OnProcessTerminate callback. GameLift invokes this callback before shutting down 97 | //an instance hosting this game server. It gives this game server a chance to save 98 | //its state, communicate with services, etc., before being shut down. 99 | //In this case, we simply tell GameLift we are indeed going to shut down. 100 | GameLiftServerAPI.ProcessEnding(); 101 | Application.Quit(); 102 | }, 103 | () => { 104 | //This is the HealthCheck callback. 105 | //GameLift invokes this callback every 60 seconds or so. 106 | return true; 107 | }, 108 | //Here, the game server tells GameLift what port it is listening on for incoming player 109 | //connections. We will use the port received from command line arguments 110 | listeningPort, 111 | new LogParameters(new List() 112 | { 113 | //Let GameLift know where our logs are stored. We are expecting the command line args to specify the server with the port in log file 114 | "/local/game/logs/myserver"+listeningPort+".log" 115 | })); 116 | 117 | //Calling ProcessReady tells GameLift this game server is ready to receive incoming game sessions 118 | var processReadyOutcome = GameLiftServerAPI.ProcessReady(processParameters); 119 | 120 | if (processReadyOutcome.Success) 121 | { 122 | print("ProcessReady success."); 123 | } 124 | else 125 | { 126 | print("ProcessReady failure : " + processReadyOutcome.Error.ToString()); 127 | } 128 | } 129 | else 130 | { 131 | print("InitSDK failure : " + initSDKOutcome.Error.ToString()); 132 | } 133 | } 134 | 135 | // Ends the game session for all and disconnects the players 136 | public void TerminateGameSession() 137 | { 138 | System.Console.WriteLine("Terminating Game Session"); 139 | 140 | //Cleanup (not currently relevant as we just terminate the process) 141 | GameObject.FindObjectOfType().DisconnectAll(); 142 | 143 | // Terminate the process following GameLift best practices. A new one will be started automatically 144 | System.Console.WriteLine("Terminating process"); 145 | GameLiftServerAPI.ProcessEnding(); 146 | Application.Quit(); 147 | } 148 | 149 | private bool CheckForServerRefresh() 150 | { 151 | if((DateTime.Now - this.launchTime).TotalHours >= 24) 152 | return true; 153 | 154 | return false; 155 | } 156 | 157 | // Called by Unity once a frame 158 | public void Update() 159 | { 160 | // We recycle the game server every 24 hours. You might want to do something more sophisticated in your own implementation, but it's recommended to have a mechanism to replace servers. 161 | // Our World Manager will automatically spin up a replacement 162 | if(this.CheckForServerRefresh()) 163 | { 164 | Debug.Log("REFRESH: Time to refresh the session, closing down the world. World Manager will spin up a replacement."); 165 | this.TerminateGameSession(); 166 | return; 167 | } 168 | 169 | //Initialize game session if requested 170 | if (this.startGameSession) 171 | { 172 | this.startGameSession = false; 173 | 174 | // Get the world properties for map loading and DynamoDB access 175 | string worldMap = ""; 176 | foreach(var gameProperty in this.gameSession.GameProperties) 177 | { 178 | if (gameProperty.Key == "WorldMap") 179 | worldMap = gameProperty.Value; 180 | else if(gameProperty.Key == "FleetRoleArn") 181 | Server.fleetRoleArn = gameProperty.Value; 182 | else if(gameProperty.Key == "WorldConfigTable") 183 | Server.worldsConfigTableName = gameProperty.Value; 184 | else if(gameProperty.Key == "WorldPlayerDataTable") 185 | Server.worldPlayerDataTable = gameProperty.Value; 186 | else if(gameProperty.Key == "DynamicWorld") 187 | Server.dynamicWorld = gameProperty.Value; 188 | } 189 | 190 | System.Console.WriteLine("Got Fleet Role Arn: " + Server.fleetRoleArn + " and Table: " + Server.worldsConfigTableName); 191 | 192 | //Additive Load the correct game world based on game properties 193 | Debug.Log("Loading world from game properties: " + this.gameSession.GameProperties[0].Key + ": " + gameSession.GameProperties[0].Value); 194 | SceneManager.LoadScene(worldMap, LoadSceneMode.Additive); 195 | Debug.Log("World loading done!"); 196 | 197 | //Start waiting for players 198 | this.gameSessionInfoReceived = true; 199 | this.gameSessionId = this.gameSession.GameSessionId; 200 | 201 | //Set the max players from the game session attributes 202 | this.maxPlayers = this.gameSession.MaximumPlayerSessionCount; 203 | 204 | //Set the game session tag (CloudWatch dimension) for custom metrics 205 | string justSessionId = this.gameSessionId.Split('/')[2]; 206 | this.statsdClient.SetCommonTagString("#gamesession:" + justSessionId); 207 | 208 | //Send session started to CloudWatch just for testing 209 | this.statsdClient.SendCounter("game.SessionStarted", 1); 210 | 211 | //Log the session ID 212 | System.Console.WriteLine("Game Session ID: " + justSessionId); 213 | 214 | // Activate the session 215 | GameLiftServerAPI.ActivateGameSession(); 216 | } 217 | } 218 | 219 | void OnApplicationQuit() 220 | { 221 | // Terminate GameLift connection properly 222 | GameLiftServerAPI.ProcessEnding(); 223 | GameLiftServerAPI.Destroy(); 224 | } 225 | #endif 226 | } 227 | -------------------------------------------------------------------------------- /UnityProject/Assets/Scripts/Server/GameLift.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e8ff9237ea85c4078b91878b3c8e78eb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityProject/Assets/Scripts/Server/NetworkServer.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: MIT-0 3 | 4 | using System.Net; 5 | using System.Net.Sockets; 6 | using UnityEngine; 7 | using Aws.GameLift.Server; 8 | using System; 9 | using System.Collections.Generic; 10 | 11 | // *** SERVER NETWORK LOGIC *** // 12 | 13 | public class NetworkServer 14 | { 15 | 16 | #if SERVER 17 | private TcpListener listener = null; 18 | // Clients are stored as a dictionary of the TCPCLient and the ClientID 19 | private Dictionary clients = new Dictionary(); 20 | private List clientsToRemove = new List(); 21 | 22 | private GameLift gamelift = null; 23 | private Server server = null; 24 | 25 | private float listenerRefreshCounter = 0.0f; 26 | 27 | public int GetPlayerCount() { return clients.Count; } 28 | 29 | public NetworkServer(GameLift gamelift, Server server) 30 | { 31 | this.server = server; 32 | this.gamelift = gamelift; 33 | this.StartListener(); 34 | } 35 | 36 | private void StartListener() 37 | { 38 | if(listener != null) 39 | listener.Stop(); 40 | //Start the TCP server 41 | int port = this.gamelift.listeningPort; 42 | Debug.Log("Starting server on port " + port); 43 | listener = new TcpListener(IPAddress.Any, this.gamelift.listeningPort); 44 | Debug.Log("Listening at: " + listener.LocalEndpoint.ToString()); 45 | listener.Start(); 46 | } 47 | 48 | // Checks if socket is still connected 49 | private bool IsSocketConnected(TcpClient client) 50 | { 51 | var bClosed = false; 52 | 53 | // Detect if client disconnected 54 | if (client.Client.Poll(0, SelectMode.SelectRead)) 55 | { 56 | byte[] buff = new byte[1]; 57 | if (client.Client.Receive(buff, SocketFlags.Peek) == 0) 58 | { 59 | // Client disconnected 60 | bClosed = true; 61 | } 62 | } 63 | 64 | return !bClosed; 65 | } 66 | 67 | private void CheckForListenerRefresh() 68 | { 69 | // When there are no clients, we refresh the TCPListener every 10 minutes as it has issues when running for hours 70 | if(this.clients.Count <= 0) 71 | { 72 | this.listenerRefreshCounter += Time.deltaTime; 73 | if(this.listenerRefreshCounter > 600) 74 | { 75 | this.StartListener(); 76 | this.listenerRefreshCounter = 0.0f; 77 | } 78 | } 79 | } 80 | 81 | public void Update() 82 | { 83 | this.CheckForListenerRefresh(); 84 | 85 | // Are there any new connections pending? 86 | if (listener.Pending()) 87 | { 88 | System.Console.WriteLine("Client pending.."); 89 | TcpClient client = listener.AcceptTcpClient(); 90 | client.NoDelay = true; // Use No Delay to send small messages immediately. UDP should be used for even faster messaging 91 | System.Console.WriteLine("Client accepted."); 92 | 93 | // Only allow the maximum amount of players defined for this world type 94 | if (this.clients.Count < this.gamelift.maxPlayers) 95 | { 96 | // Add client and give it the Id of the value of rollingPlayerId 97 | this.clients.Add(client, this.server.rollingPlayerId); 98 | this.server.rollingPlayerId++; 99 | return; 100 | } 101 | else 102 | { 103 | // game already full, reject the connection 104 | try 105 | { 106 | SimpleMessage message = new SimpleMessage(MessageType.Reject, "game already full"); 107 | NetworkProtocol.Send(client, message); 108 | } 109 | catch (SocketException) { } 110 | } 111 | 112 | } 113 | 114 | // Iterate through clients and check if they have new messages or are disconnected 115 | foreach (var client in this.clients) 116 | { 117 | var tcpClient = client.Key; 118 | try 119 | { 120 | if (tcpClient == null) continue; 121 | if (this.IsSocketConnected(tcpClient) == false) 122 | { 123 | System.Console.WriteLine("Client not connected anymore"); 124 | this.clientsToRemove.Add(tcpClient); 125 | } 126 | var messages = NetworkProtocol.Receive(tcpClient); 127 | 128 | // If we receive a null response, it means the client sending incorrenct message format and we'll disconnect them immediately 129 | if(messages == null) 130 | { 131 | System.Console.WriteLine("Client sending wrong message format, disconnect immediately."); 132 | this.clientsToRemove.Add(tcpClient); 133 | } 134 | // Otherwise, iterate through messages received 135 | else 136 | { 137 | foreach (SimpleMessage message in messages) 138 | { 139 | //System.Console.WriteLine("Received message: " + message.message + " type: " + message.messageType); 140 | bool disconnect = HandleMessage(tcpClient, message); 141 | if (disconnect) 142 | this.clientsToRemove.Add(tcpClient); 143 | } 144 | } 145 | } 146 | catch (Exception e) 147 | { 148 | System.Console.WriteLine("Error receiving from a client: " + e.Message); 149 | this.clientsToRemove.Add(tcpClient); 150 | } 151 | } 152 | 153 | //Remove dead clients 154 | foreach (var clientToRemove in this.clientsToRemove) 155 | { 156 | try 157 | { 158 | this.RemoveClient(clientToRemove); 159 | } 160 | catch (Exception e) 161 | { 162 | System.Console.WriteLine("Couldn't remove client: " + e.Message); 163 | } 164 | } 165 | this.clientsToRemove.Clear(); 166 | 167 | } 168 | 169 | public void DisconnectAll() 170 | { 171 | // warn clients 172 | SimpleMessage message = new SimpleMessage(MessageType.Disconnect); 173 | TransmitMessage(message); 174 | // disconnect connections 175 | foreach (var client in this.clients) 176 | { 177 | this.clientsToRemove.Add(client.Key); 178 | } 179 | 180 | //Reset the client lists 181 | this.clients = new Dictionary(); 182 | this.server.players = new List(); 183 | } 184 | 185 | public void TransmitMessage(SimpleMessage msg, int excludeClient) 186 | { 187 | // send the same message to all players 188 | foreach (var client in this.clients) 189 | { 190 | //Skip if this is the excluded client 191 | if (client.Value == excludeClient) 192 | { 193 | continue; 194 | } 195 | 196 | try 197 | { 198 | bool sendSucceeded = NetworkProtocol.Send(client.Key, msg); 199 | if(!sendSucceeded) 200 | { 201 | System.Console.WriteLine("Couldn't send to client, terminate session"); 202 | this.clientsToRemove.Add(client.Key); 203 | } 204 | } 205 | catch (Exception e) 206 | { 207 | this.clientsToRemove.Add(client.Key); 208 | } 209 | } 210 | } 211 | 212 | //Transmit message to multiple clients 213 | public void TransmitMessage(SimpleMessage msg, TcpClient excludeClient = null) 214 | { 215 | // send the same message to all players 216 | foreach (var client in this.clients) 217 | { 218 | //Skip if this is the excluded client 219 | if (excludeClient != null && excludeClient == client.Key) 220 | { 221 | continue; 222 | } 223 | 224 | try 225 | { 226 | bool sendSucceeded = NetworkProtocol.Send(client.Key, msg); 227 | if(!sendSucceeded) 228 | { 229 | System.Console.WriteLine("Couldn't send to client, terminate session"); 230 | this.clientsToRemove.Add(client.Key); 231 | } 232 | } 233 | catch (Exception e) 234 | { 235 | this.clientsToRemove.Add(client.Key); 236 | } 237 | } 238 | } 239 | 240 | private TcpClient SearchClient(int clientId) 241 | { 242 | foreach (var client in this.clients) 243 | { 244 | if (client.Value == clientId) 245 | { 246 | return client.Key; 247 | } 248 | } 249 | return null; 250 | } 251 | 252 | public void SendMessage(int clientId, SimpleMessage msg) 253 | { 254 | try 255 | { 256 | TcpClient client = this.SearchClient(clientId); 257 | SendMessage(client, msg); 258 | } 259 | catch (Exception e) 260 | { 261 | Console.WriteLine("Failed to send message to client: " + clientId); 262 | } 263 | } 264 | //Send message to single client 265 | private void SendMessage(TcpClient client, SimpleMessage msg) 266 | { 267 | try 268 | { 269 | bool sendSucceeded = NetworkProtocol.Send(client, msg); 270 | 271 | if(!sendSucceeded) 272 | { 273 | System.Console.WriteLine("Couldn't send to client, terminate session"); 274 | this.clientsToRemove.Add(client); 275 | } 276 | } 277 | catch (Exception e) 278 | { 279 | this.clientsToRemove.Add(client); 280 | } 281 | } 282 | 283 | private bool HandleMessage(TcpClient client, SimpleMessage msg) 284 | { 285 | int clientId = this.clients[client]; 286 | // If we're getting a message other than Connect and the player ID doesn't exist yet, disconnect (not authenticated) 287 | if (msg.messageType != MessageType.Connect && this.server.GetPlayerCognitoId(clientId) == null) 288 | { 289 | System.Console.WriteLine("Client didn't send valid player session ID before other messages, disconnect"); 290 | return true; // disconnect 291 | } 292 | 293 | // Normal message processing 294 | if (msg.messageType == MessageType.Connect) 295 | { 296 | HandleConnect(clientId, msg.message, client); 297 | } 298 | else if (msg.messageType == MessageType.Disconnect) 299 | { 300 | return true; // disconnect 301 | } 302 | else if (msg.messageType == MessageType.Spawn) 303 | HandleSpawn(client, msg); 304 | else if (msg.messageType == MessageType.PlayerInput) 305 | HandleMove(client, msg); 306 | 307 | return false; 308 | } 309 | 310 | private void HandleConnect(int clientId, string playerSessionId, TcpClient client) 311 | { 312 | // respond with the player id and the current state. 313 | //Connect player 314 | var outcome = GameLiftServerAPI.AcceptPlayerSession(playerSessionId); 315 | if (outcome.Success) 316 | { 317 | System.Console.WriteLine("Player session successfully validated."); 318 | this.server.SetPlayerSessionId(clientId, playerSessionId); 319 | 320 | // Get the player ID to retrieve data specific to this player 321 | var playerSessionRequest = new Aws.GameLift.Server.Model.DescribePlayerSessionsRequest(); 322 | playerSessionRequest.PlayerSessionId = playerSessionId; 323 | var describePlayerSesssionResponse = GameLiftServerAPI.DescribePlayerSessions(playerSessionRequest); 324 | if (describePlayerSesssionResponse != null && describePlayerSesssionResponse.Result.PlayerSessions.Count > 0) 325 | { 326 | // Note: You could get any player data you've set to the session here! 327 | string playerId = describePlayerSesssionResponse.Result.PlayerSessions[0].PlayerId; 328 | 329 | System.Console.WriteLine("Got player ID: " + playerId + " for player session: " + playerSessionId); 330 | 331 | // Store the PlayerID/CognitoID for future use to access player specific data 332 | this.server.SetPlayerCognitoId(clientId, playerId); 333 | } 334 | } 335 | else 336 | { 337 | System.Console.WriteLine(":( PLAYER SESSION REJECTED. AcceptPlayerSession() returned " + outcome.Error.ToString()); 338 | // We don't validate sessions in local testing 339 | #if !LOCAL_GAME 340 | this.clientsToRemove.Add(client); 341 | #endif 342 | } 343 | } 344 | 345 | private void HandleSpawn(TcpClient client, SimpleMessage message) 346 | { 347 | // Get client id (this is the value in the dictionary where the TCPClient is the key) 348 | int clientId = this.clients[client]; 349 | 350 | System.Console.WriteLine("Player " + clientId + " spawned with coordinates: " + message.float1 + "," + message.float2 + "," + message.float3); 351 | 352 | // Add client ID 353 | message.clientId = clientId; 354 | 355 | // Add to list to create the gameobject instance on the server 356 | Server.messagesToProcess.Add(message); 357 | 358 | // Just testing the StatsD client 359 | this.gamelift.GetStatsdClient().SendCounter("players.PlayerSpawn", 1); 360 | } 361 | 362 | private void HandleMove(TcpClient client, SimpleMessage message) 363 | { 364 | // Get client id (this is the value in the dictionary where the TCPClient is the key) 365 | int clientId = this.clients[client]; 366 | 367 | //System.Console.WriteLine("Got move from client: " + clientId + " with input: " + message.float1 + "," + message.float2); 368 | 369 | // Add client ID 370 | message.clientId = clientId; 371 | 372 | // Add to list to create the gameobject instance on the server 373 | Server.messagesToProcess.Add(message); 374 | } 375 | 376 | private void RemoveClient(TcpClient client) 377 | { 378 | // TODO: Handle situation where this fails (the client is probably null? Or not added at all? The server still would have the NetworkPlayer which is left hanging) 379 | //Let the other clients know the player was removed 380 | int clientId = this.clients[client]; 381 | 382 | try 383 | { 384 | SimpleMessage message = new SimpleMessage(MessageType.PlayerLeft); 385 | message.clientId = clientId; 386 | TransmitMessage(message, client); 387 | } 388 | catch (Exception e) 389 | { 390 | System.Console.WriteLine("Couldn't inform other players about removing client but removing anyways. exception: " + e.Message); 391 | } 392 | 393 | 394 | // Disconnect and remove 395 | try 396 | { 397 | this.clients.Remove(client); 398 | } 399 | catch (Exception e) 400 | { 401 | System.Console.WriteLine("Error removing client from clients dictionary: " + e.Message); 402 | } 403 | this.DisconnectPlayer(client); 404 | this.server.RemovePlayer(clientId); 405 | } 406 | 407 | private void DisconnectPlayer(TcpClient client) 408 | { 409 | try 410 | { 411 | // remove the client and close the connection 412 | if (client != null) 413 | { 414 | NetworkStream stream = client.GetStream(); 415 | stream.Close(); 416 | client.Close(); 417 | } 418 | } 419 | catch (Exception e) 420 | { 421 | System.Console.WriteLine("Failed to disconnect player: " + e.Message); 422 | } 423 | } 424 | 425 | #endif 426 | } 427 | -------------------------------------------------------------------------------- /UnityProject/Assets/Scripts/Server/NetworkServer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ffb57993bb0294d01b507b65a857840e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityProject/Assets/Scripts/Server/Server.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c7e6931ff73724c35986212b1c064457 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityProject/Assets/Scripts/Server/SimpleStatsdClient.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: MIT-0 3 | 4 | // Very simple StatsD client supporting counter and gauge 5 | // Built for the GameLift Unity Example 6 | 7 | // NOTE: You can use any StatsD client implementation instead which are more full-featured 8 | 9 | using System; 10 | using System.Net.Sockets; 11 | using System.Text; 12 | using UnityEngine; 13 | 14 | public class SimpleStatsdClient 15 | { 16 | private UdpClient udpClient; 17 | private string commonTags = ""; 18 | 19 | public SimpleStatsdClient(string host, int port) 20 | { 21 | try 22 | { 23 | this.udpClient = new UdpClient("localhost", 8125); 24 | } 25 | catch (Exception e) 26 | { 27 | Debug.Log("Failed to connect to statsD: " + e.Message); 28 | } 29 | } 30 | 31 | public void SetCommonTagString(string tagString) 32 | { 33 | this.commonTags = tagString; 34 | } 35 | 36 | public void SendCounter(string name, int value, string tags = null) 37 | { 38 | string data = this.CreateData(name, value.ToString(), "c", tags); 39 | this.SendData(data); 40 | } 41 | 42 | public void SendGauge(string name, int value, string tags = null) 43 | { 44 | string data = this.CreateData(name, value.ToString(), "g", tags); 45 | this.SendData(data); 46 | } 47 | 48 | private string CreateData(string metricName, string metricValue, string metricType, string overrideTags) 49 | { 50 | // Override the tags (CW dimensions) if provided, otherwise use the common tags we have set 51 | if(overrideTags != null) 52 | return metricName + ":" + metricValue + "|" + metricType + "|" + overrideTags; 53 | else 54 | return metricName +":" + metricValue + "|" + metricType + "|" + this.commonTags; 55 | } 56 | 57 | // Sends data to the local StatsD agent which will forward it eventually to CloudWatch 58 | private void SendData(string data) 59 | { 60 | if (this.udpClient != null) 61 | { 62 | try 63 | { 64 | Byte[] sendBytes = Encoding.ASCII.GetBytes(data); 65 | udpClient.Send(sendBytes, sendBytes.Length); 66 | } 67 | catch (Exception e) 68 | { 69 | Debug.Log("Failed to send data with statsD: " + e.Message); 70 | } 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /UnityProject/Assets/Scripts/Server/SimpleStatsdClient.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a72153da42b0c4ad0bab78f65316febc 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityProject/Assets/Scripts/UIManager.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: MIT-0 3 | 4 | using UnityEngine.UI; 5 | using UnityEngine; 6 | using System; 7 | 8 | public class UIManager : MonoBehaviour 9 | { 10 | public UnityEngine.UI.Text statusTextBox; 11 | public UnityEngine.UI.Text statusSubTextBox; 12 | public Button listWorldsButton; 13 | public Dropdown regionDropdown; 14 | public GameObject worldInfoPrefab; 15 | public Transform worldInfoContentContainer; 16 | public Button restartButton; 17 | 18 | public void SetInfoTextBox(string text) 19 | { 20 | this.statusTextBox.text = text; 21 | } 22 | 23 | public void SetInfoSubTextBox(string text) 24 | { 25 | this.statusSubTextBox.text = text; 26 | } 27 | 28 | internal void HideMainMenuUI() 29 | { 30 | this.listWorldsButton.gameObject.SetActive(false); 31 | this.regionDropdown.gameObject.SetActive(false); 32 | this.worldInfoContentContainer.parent.parent.gameObject.SetActive(false); 33 | } 34 | 35 | internal GameObject AddWorldItemToList(WorldsData.WorldData world) 36 | { 37 | var item = Instantiate(this.worldInfoPrefab); 38 | 39 | if(world.DynamicWorld == "YES") 40 | { 41 | // Only show the name of the dynamic world without the extension by splitting with _ 42 | item.GetComponentInChildren().text = "DYNAMIC: " + world.WorldID.Split('_')[0] + " Players: " + world.CurrentPlayerSessionCount + " / " + world.MaxPlayers + " Map: " + world.WorldMap; 43 | item.GetComponentInChildren().color = Color.yellow; 44 | // parent the item to the content container 45 | item.transform.SetParent(this.worldInfoContentContainer); 46 | // reset the scale 47 | transform.transform.localScale = Vector2.one; 48 | } 49 | else 50 | { 51 | item.GetComponentInChildren().text = world.WorldID + " Players: " + world.CurrentPlayerSessionCount + " / " + world.MaxPlayers + " Map: " + world.WorldMap; 52 | // parent the item to the content container 53 | item.transform.SetParent(this.worldInfoContentContainer); 54 | // reset the scale 55 | transform.transform.localScale = Vector2.one; 56 | } 57 | 58 | return item; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /UnityProject/Assets/Scripts/UIManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5557e1e5c65b14db5b0569c1f14d61f7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /UnityProject/Assets/link.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /UnityProject/Assets/link.xml.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 37e692dc9cc93457e9740d795fa72e2b 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /UnityProject/Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.ext.nunit": "1.0.6", 4 | "com.unity.ide.rider": "2.0.7", 5 | "com.unity.ide.visualstudio": "2.0.14", 6 | "com.unity.ide.vscode": "1.2.5", 7 | "com.unity.test-framework": "1.1.31", 8 | "com.unity.textmeshpro": "3.0.6", 9 | "com.unity.timeline": "1.4.8", 10 | "com.unity.ugui": "1.0.0", 11 | "com.unity.modules.ai": "1.0.0", 12 | "com.unity.modules.androidjni": "1.0.0", 13 | "com.unity.modules.animation": "1.0.0", 14 | "com.unity.modules.assetbundle": "1.0.0", 15 | "com.unity.modules.audio": "1.0.0", 16 | "com.unity.modules.cloth": "1.0.0", 17 | "com.unity.modules.director": "1.0.0", 18 | "com.unity.modules.imageconversion": "1.0.0", 19 | "com.unity.modules.imgui": "1.0.0", 20 | "com.unity.modules.jsonserialize": "1.0.0", 21 | "com.unity.modules.particlesystem": "1.0.0", 22 | "com.unity.modules.physics": "1.0.0", 23 | "com.unity.modules.physics2d": "1.0.0", 24 | "com.unity.modules.screencapture": "1.0.0", 25 | "com.unity.modules.terrain": "1.0.0", 26 | "com.unity.modules.terrainphysics": "1.0.0", 27 | "com.unity.modules.tilemap": "1.0.0", 28 | "com.unity.modules.ui": "1.0.0", 29 | "com.unity.modules.uielements": "1.0.0", 30 | "com.unity.modules.umbra": "1.0.0", 31 | "com.unity.modules.unityanalytics": "1.0.0", 32 | "com.unity.modules.unitywebrequest": "1.0.0", 33 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 34 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 35 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 36 | "com.unity.modules.unitywebrequestwww": "1.0.0", 37 | "com.unity.modules.vehicles": "1.0.0", 38 | "com.unity.modules.video": "1.0.0", 39 | "com.unity.modules.vr": "1.0.0", 40 | "com.unity.modules.wind": "1.0.0", 41 | "com.unity.modules.xr": "1.0.0" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /UnityProject/Packages/packages-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.ext.nunit": { 4 | "version": "1.0.6", 5 | "depth": 0, 6 | "source": "registry", 7 | "dependencies": {}, 8 | "url": "https://packages.unity.com" 9 | }, 10 | "com.unity.ide.rider": { 11 | "version": "2.0.7", 12 | "depth": 0, 13 | "source": "registry", 14 | "dependencies": { 15 | "com.unity.test-framework": "1.1.1" 16 | }, 17 | "url": "https://packages.unity.com" 18 | }, 19 | "com.unity.ide.visualstudio": { 20 | "version": "2.0.14", 21 | "depth": 0, 22 | "source": "registry", 23 | "dependencies": { 24 | "com.unity.test-framework": "1.1.9" 25 | }, 26 | "url": "https://packages.unity.com" 27 | }, 28 | "com.unity.ide.vscode": { 29 | "version": "1.2.5", 30 | "depth": 0, 31 | "source": "registry", 32 | "dependencies": {}, 33 | "url": "https://packages.unity.com" 34 | }, 35 | "com.unity.test-framework": { 36 | "version": "1.1.31", 37 | "depth": 0, 38 | "source": "registry", 39 | "dependencies": { 40 | "com.unity.ext.nunit": "1.0.6", 41 | "com.unity.modules.imgui": "1.0.0", 42 | "com.unity.modules.jsonserialize": "1.0.0" 43 | }, 44 | "url": "https://packages.unity.com" 45 | }, 46 | "com.unity.textmeshpro": { 47 | "version": "3.0.6", 48 | "depth": 0, 49 | "source": "registry", 50 | "dependencies": { 51 | "com.unity.ugui": "1.0.0" 52 | }, 53 | "url": "https://packages.unity.com" 54 | }, 55 | "com.unity.timeline": { 56 | "version": "1.4.8", 57 | "depth": 0, 58 | "source": "registry", 59 | "dependencies": { 60 | "com.unity.modules.director": "1.0.0", 61 | "com.unity.modules.animation": "1.0.0", 62 | "com.unity.modules.audio": "1.0.0", 63 | "com.unity.modules.particlesystem": "1.0.0" 64 | }, 65 | "url": "https://packages.unity.com" 66 | }, 67 | "com.unity.ugui": { 68 | "version": "1.0.0", 69 | "depth": 0, 70 | "source": "builtin", 71 | "dependencies": { 72 | "com.unity.modules.ui": "1.0.0", 73 | "com.unity.modules.imgui": "1.0.0" 74 | } 75 | }, 76 | "com.unity.modules.ai": { 77 | "version": "1.0.0", 78 | "depth": 0, 79 | "source": "builtin", 80 | "dependencies": {} 81 | }, 82 | "com.unity.modules.androidjni": { 83 | "version": "1.0.0", 84 | "depth": 0, 85 | "source": "builtin", 86 | "dependencies": {} 87 | }, 88 | "com.unity.modules.animation": { 89 | "version": "1.0.0", 90 | "depth": 0, 91 | "source": "builtin", 92 | "dependencies": {} 93 | }, 94 | "com.unity.modules.assetbundle": { 95 | "version": "1.0.0", 96 | "depth": 0, 97 | "source": "builtin", 98 | "dependencies": {} 99 | }, 100 | "com.unity.modules.audio": { 101 | "version": "1.0.0", 102 | "depth": 0, 103 | "source": "builtin", 104 | "dependencies": {} 105 | }, 106 | "com.unity.modules.cloth": { 107 | "version": "1.0.0", 108 | "depth": 0, 109 | "source": "builtin", 110 | "dependencies": { 111 | "com.unity.modules.physics": "1.0.0" 112 | } 113 | }, 114 | "com.unity.modules.director": { 115 | "version": "1.0.0", 116 | "depth": 0, 117 | "source": "builtin", 118 | "dependencies": { 119 | "com.unity.modules.audio": "1.0.0", 120 | "com.unity.modules.animation": "1.0.0" 121 | } 122 | }, 123 | "com.unity.modules.imageconversion": { 124 | "version": "1.0.0", 125 | "depth": 0, 126 | "source": "builtin", 127 | "dependencies": {} 128 | }, 129 | "com.unity.modules.imgui": { 130 | "version": "1.0.0", 131 | "depth": 0, 132 | "source": "builtin", 133 | "dependencies": {} 134 | }, 135 | "com.unity.modules.jsonserialize": { 136 | "version": "1.0.0", 137 | "depth": 0, 138 | "source": "builtin", 139 | "dependencies": {} 140 | }, 141 | "com.unity.modules.particlesystem": { 142 | "version": "1.0.0", 143 | "depth": 0, 144 | "source": "builtin", 145 | "dependencies": {} 146 | }, 147 | "com.unity.modules.physics": { 148 | "version": "1.0.0", 149 | "depth": 0, 150 | "source": "builtin", 151 | "dependencies": {} 152 | }, 153 | "com.unity.modules.physics2d": { 154 | "version": "1.0.0", 155 | "depth": 0, 156 | "source": "builtin", 157 | "dependencies": {} 158 | }, 159 | "com.unity.modules.screencapture": { 160 | "version": "1.0.0", 161 | "depth": 0, 162 | "source": "builtin", 163 | "dependencies": { 164 | "com.unity.modules.imageconversion": "1.0.0" 165 | } 166 | }, 167 | "com.unity.modules.subsystems": { 168 | "version": "1.0.0", 169 | "depth": 1, 170 | "source": "builtin", 171 | "dependencies": { 172 | "com.unity.modules.jsonserialize": "1.0.0" 173 | } 174 | }, 175 | "com.unity.modules.terrain": { 176 | "version": "1.0.0", 177 | "depth": 0, 178 | "source": "builtin", 179 | "dependencies": {} 180 | }, 181 | "com.unity.modules.terrainphysics": { 182 | "version": "1.0.0", 183 | "depth": 0, 184 | "source": "builtin", 185 | "dependencies": { 186 | "com.unity.modules.physics": "1.0.0", 187 | "com.unity.modules.terrain": "1.0.0" 188 | } 189 | }, 190 | "com.unity.modules.tilemap": { 191 | "version": "1.0.0", 192 | "depth": 0, 193 | "source": "builtin", 194 | "dependencies": { 195 | "com.unity.modules.physics2d": "1.0.0" 196 | } 197 | }, 198 | "com.unity.modules.ui": { 199 | "version": "1.0.0", 200 | "depth": 0, 201 | "source": "builtin", 202 | "dependencies": {} 203 | }, 204 | "com.unity.modules.uielements": { 205 | "version": "1.0.0", 206 | "depth": 0, 207 | "source": "builtin", 208 | "dependencies": { 209 | "com.unity.modules.ui": "1.0.0", 210 | "com.unity.modules.imgui": "1.0.0", 211 | "com.unity.modules.jsonserialize": "1.0.0", 212 | "com.unity.modules.uielementsnative": "1.0.0" 213 | } 214 | }, 215 | "com.unity.modules.uielementsnative": { 216 | "version": "1.0.0", 217 | "depth": 1, 218 | "source": "builtin", 219 | "dependencies": { 220 | "com.unity.modules.ui": "1.0.0", 221 | "com.unity.modules.imgui": "1.0.0", 222 | "com.unity.modules.jsonserialize": "1.0.0" 223 | } 224 | }, 225 | "com.unity.modules.umbra": { 226 | "version": "1.0.0", 227 | "depth": 0, 228 | "source": "builtin", 229 | "dependencies": {} 230 | }, 231 | "com.unity.modules.unityanalytics": { 232 | "version": "1.0.0", 233 | "depth": 0, 234 | "source": "builtin", 235 | "dependencies": { 236 | "com.unity.modules.unitywebrequest": "1.0.0", 237 | "com.unity.modules.jsonserialize": "1.0.0" 238 | } 239 | }, 240 | "com.unity.modules.unitywebrequest": { 241 | "version": "1.0.0", 242 | "depth": 0, 243 | "source": "builtin", 244 | "dependencies": {} 245 | }, 246 | "com.unity.modules.unitywebrequestassetbundle": { 247 | "version": "1.0.0", 248 | "depth": 0, 249 | "source": "builtin", 250 | "dependencies": { 251 | "com.unity.modules.assetbundle": "1.0.0", 252 | "com.unity.modules.unitywebrequest": "1.0.0" 253 | } 254 | }, 255 | "com.unity.modules.unitywebrequestaudio": { 256 | "version": "1.0.0", 257 | "depth": 0, 258 | "source": "builtin", 259 | "dependencies": { 260 | "com.unity.modules.unitywebrequest": "1.0.0", 261 | "com.unity.modules.audio": "1.0.0" 262 | } 263 | }, 264 | "com.unity.modules.unitywebrequesttexture": { 265 | "version": "1.0.0", 266 | "depth": 0, 267 | "source": "builtin", 268 | "dependencies": { 269 | "com.unity.modules.unitywebrequest": "1.0.0", 270 | "com.unity.modules.imageconversion": "1.0.0" 271 | } 272 | }, 273 | "com.unity.modules.unitywebrequestwww": { 274 | "version": "1.0.0", 275 | "depth": 0, 276 | "source": "builtin", 277 | "dependencies": { 278 | "com.unity.modules.unitywebrequest": "1.0.0", 279 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 280 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 281 | "com.unity.modules.audio": "1.0.0", 282 | "com.unity.modules.assetbundle": "1.0.0", 283 | "com.unity.modules.imageconversion": "1.0.0" 284 | } 285 | }, 286 | "com.unity.modules.vehicles": { 287 | "version": "1.0.0", 288 | "depth": 0, 289 | "source": "builtin", 290 | "dependencies": { 291 | "com.unity.modules.physics": "1.0.0" 292 | } 293 | }, 294 | "com.unity.modules.video": { 295 | "version": "1.0.0", 296 | "depth": 0, 297 | "source": "builtin", 298 | "dependencies": { 299 | "com.unity.modules.audio": "1.0.0", 300 | "com.unity.modules.ui": "1.0.0", 301 | "com.unity.modules.unitywebrequest": "1.0.0" 302 | } 303 | }, 304 | "com.unity.modules.vr": { 305 | "version": "1.0.0", 306 | "depth": 0, 307 | "source": "builtin", 308 | "dependencies": { 309 | "com.unity.modules.jsonserialize": "1.0.0", 310 | "com.unity.modules.physics": "1.0.0", 311 | "com.unity.modules.xr": "1.0.0" 312 | } 313 | }, 314 | "com.unity.modules.wind": { 315 | "version": "1.0.0", 316 | "depth": 0, 317 | "source": "builtin", 318 | "dependencies": {} 319 | }, 320 | "com.unity.modules.xr": { 321 | "version": "1.0.0", 322 | "depth": 0, 323 | "source": "builtin", 324 | "dependencies": { 325 | "com.unity.modules.physics": "1.0.0", 326 | "com.unity.modules.jsonserialize": "1.0.0", 327 | "com.unity.modules.subsystems": "1.0.0" 328 | } 329 | } 330 | } 331 | } 332 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Volume: 1 8 | Rolloff Scale: 1 9 | Doppler Factor: 1 10 | Default Speaker Mode: 2 11 | m_SampleRate: 0 12 | m_DSPBufferSize: 1024 13 | m_VirtualVoiceCount: 512 14 | m_RealVoiceCount: 32 15 | m_SpatializerPlugin: 16 | m_AmbisonicDecoderPlugin: 17 | m_DisableAudio: 0 18 | m_VirtualizeEffects: 1 19 | m_RequestedDSPBufferSize: 1024 20 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 11 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_ClothInterCollisionDistance: 0 18 | m_ClothInterCollisionStiffness: 0 19 | m_ContactsGeneration: 1 20 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 21 | m_AutoSimulation: 1 22 | m_AutoSyncTransforms: 0 23 | m_ReuseCollisionCallbacks: 1 24 | m_ClothInterCollisionSettingsToggle: 0 25 | m_ContactPairsMode: 0 26 | m_BroadphaseType: 0 27 | m_WorldBounds: 28 | m_Center: {x: 0, y: 0, z: 0} 29 | m_Extent: {x: 250, y: 250, z: 250} 30 | m_WorldSubdivisions: 8 31 | m_FrictionType: 0 32 | m_EnableEnhancedDeterminism: 0 33 | m_EnableUnifiedHeightmaps: 1 34 | m_DefaultMaxAngluarSpeed: 7 35 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: 8 | - enabled: 1 9 | path: Assets/Scenes/MainMenu.unity 10 | guid: 9fc0d4010bbf28b4594072e72b8655ab 11 | - enabled: 1 12 | path: Assets/Scenes/Desert.unity 13 | guid: 2435c801ffbb14db981cfb7a6df98aa3 14 | - enabled: 1 15 | path: Assets/Scenes/Forrest.unity 16 | guid: cf75b0af29d2646be956a47eeaf9c403 17 | - enabled: 0 18 | path: 19 | guid: 00000000000000000000000000000000 20 | m_configObjects: {} 21 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 9 7 | m_ExternalVersionControlSupport: Hidden Meta Files 8 | m_SerializationMode: 2 9 | m_LineEndingsForNewScripts: 2 10 | m_DefaultBehaviorMode: 0 11 | m_PrefabRegularEnvironment: {fileID: 0} 12 | m_PrefabUIEnvironment: {fileID: 0} 13 | m_SpritePackerMode: 0 14 | m_SpritePackerPaddingPower: 1 15 | m_EtcTextureCompressorBehavior: 1 16 | m_EtcTextureFastCompressor: 1 17 | m_EtcTextureNormalCompressor: 2 18 | m_EtcTextureBestCompressor: 4 19 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;rsp;asmref 20 | m_ProjectGenerationRootNamespace: 21 | m_CollabEditorSettings: 22 | inProgressEnabled: 1 23 | m_EnableTextureStreamingInEditMode: 1 24 | m_EnableTextureStreamingInPlayMode: 1 25 | m_AsyncShaderCompilation: 1 26 | m_EnterPlayModeOptionsEnabled: 0 27 | m_EnterPlayModeOptions: 3 28 | m_ShowLightmapResolutionOverlay: 1 29 | m_UseLegacyProbeSampleCount: 1 30 | m_AssetPipelineMode: 1 31 | m_CacheServerMode: 0 32 | m_CacheServerEndpoint: 33 | m_CacheServerNamespacePrefix: default 34 | m_CacheServerEnableDownload: 1 35 | m_CacheServerEnableUpload: 1 36 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 12 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 38 | - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} 39 | - {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0} 40 | - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0} 41 | - {fileID: 16002, guid: 0000000000000000f000000000000000, type: 0} 42 | m_PreloadedShaders: [] 43 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 44 | type: 0} 45 | m_CustomRenderPipeline: {fileID: 0} 46 | m_TransparencySortMode: 0 47 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 48 | m_DefaultRenderingPath: 1 49 | m_DefaultMobileRenderingPath: 1 50 | m_TierSettings: [] 51 | m_LightmapStripping: 0 52 | m_FogStripping: 0 53 | m_InstancingStripping: 0 54 | m_LightmapKeepPlain: 1 55 | m_LightmapKeepDirCombined: 1 56 | m_LightmapKeepDynamicPlain: 1 57 | m_LightmapKeepDynamicDirCombined: 1 58 | m_LightmapKeepShadowMask: 1 59 | m_LightmapKeepSubtractive: 1 60 | m_FogKeepLinear: 1 61 | m_FogKeepExp: 1 62 | m_FogKeepExp2: 1 63 | m_AlbedoSwatchInfos: [] 64 | m_LightsUseLinearIntensity: 0 65 | m_LightsUseColorTemperature: 0 66 | m_LogWhenShaderIsCompiled: 0 67 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: 0.001 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: 0.001 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: 0.001 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: 0.001 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left shift 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: 0.001 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: 0.001 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: 0.1 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: 0.1 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: 0.1 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: 0.19 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: 0.19 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: 0.001 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: 0.001 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: 0.001 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: 0.001 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: 0.001 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: 0.001 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: 0.001 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | m_LastAgentTypeID: -887442657 73 | m_Settings: 74 | - serializedVersion: 2 75 | agentTypeID: 0 76 | agentRadius: 0.5 77 | agentHeight: 2 78 | agentSlope: 45 79 | agentClimb: 0.75 80 | ledgeDropHeight: 0 81 | maxJumpAcrossDistance: 0 82 | minRegionArea: 2 83 | manualCellSize: 0 84 | cellSize: 0.16666667 85 | manualTileSize: 0 86 | tileSize: 256 87 | accuratePlacement: 0 88 | debug: 89 | m_Flags: 0 90 | m_SettingNames: 91 | - Humanoid 92 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/PackageManagerSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &1 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 61 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0} 13 | m_Name: 14 | m_EditorClassIdentifier: 15 | m_EnablePreviewPackages: 0 16 | m_EnablePackageDependencies: 0 17 | m_AdvancedSettingsExpanded: 1 18 | m_ScopedRegistriesSettingsExpanded: 1 19 | oneTimeWarningShown: 0 20 | m_Registries: 21 | - m_Id: main 22 | m_Name: 23 | m_Url: https://packages.unity.com 24 | m_Scopes: [] 25 | m_IsDefault: 1 26 | m_Capabilities: 7 27 | m_UserSelectedRegistryName: 28 | m_UserAddingNewScopedRegistry: 0 29 | m_RegistryInfoDraft: 30 | m_ErrorMessage: 31 | m_Original: 32 | m_Id: 33 | m_Name: 34 | m_Url: 35 | m_Scopes: [] 36 | m_IsDefault: 0 37 | m_Capabilities: 0 38 | m_Modified: 0 39 | m_Name: 40 | m_Url: 41 | m_Scopes: 42 | - 43 | m_SelectedScopeIndex: 0 44 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 4 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_JobOptions: 23 | serializedVersion: 2 24 | useMultithreading: 0 25 | useConsistencySorting: 0 26 | m_InterpolationPosesPerJob: 100 27 | m_NewContactsPerJob: 30 28 | m_CollideContactsPerJob: 100 29 | m_ClearFlagsPerJob: 200 30 | m_ClearBodyForcesPerJob: 200 31 | m_SyncDiscreteFixturesPerJob: 50 32 | m_SyncContinuousFixturesPerJob: 50 33 | m_FindNearestContactsPerJob: 100 34 | m_UpdateTriggerContactsPerJob: 100 35 | m_IslandSolverCostThreshold: 100 36 | m_IslandSolverBodyCostScale: 1 37 | m_IslandSolverContactCostScale: 10 38 | m_IslandSolverJointCostScale: 10 39 | m_IslandSolverBodiesPerJob: 50 40 | m_IslandSolverContactsPerJob: 50 41 | m_AutoSimulation: 1 42 | m_QueriesHitTriggers: 1 43 | m_QueriesStartInColliders: 1 44 | m_CallbacksOnDisable: 1 45 | m_ReuseCollisionCallbacks: 1 46 | m_AutoSyncTransforms: 0 47 | m_AlwaysShowColliders: 0 48 | m_ShowColliderSleep: 1 49 | m_ShowColliderContacts: 0 50 | m_ShowColliderAABB: 0 51 | m_ContactArrowScale: 0.2 52 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 53 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 54 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 55 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 56 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 57 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | m_DefaultList: [] 7 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2020.3.32f1 2 | m_EditorVersionWithRevision: 2020.3.32f1 (12f8b0834f07) 3 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 5 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Very Low 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 3 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | shadowmaskMode: 0 21 | blendWeights: 1 22 | textureQuality: 1 23 | anisotropicTextures: 0 24 | antiAliasing: 0 25 | softParticles: 0 26 | softVegetation: 0 27 | realtimeReflectionProbes: 0 28 | billboardsFaceCameraPosition: 0 29 | vSyncCount: 0 30 | lodBias: 0.3 31 | maximumLODLevel: 0 32 | streamingMipmapsActive: 0 33 | streamingMipmapsAddAllCameras: 1 34 | streamingMipmapsMemoryBudget: 512 35 | streamingMipmapsRenderersPerFrame: 512 36 | streamingMipmapsMaxLevelReduction: 2 37 | streamingMipmapsMaxFileIORequests: 1024 38 | particleRaycastBudget: 4 39 | asyncUploadTimeSlice: 2 40 | asyncUploadBufferSize: 16 41 | asyncUploadPersistentBuffer: 1 42 | resolutionScalingFixedDPIFactor: 1 43 | excludedTargetPlatforms: [] 44 | - serializedVersion: 2 45 | name: Low 46 | pixelLightCount: 0 47 | shadows: 0 48 | shadowResolution: 0 49 | shadowProjection: 1 50 | shadowCascades: 1 51 | shadowDistance: 20 52 | shadowNearPlaneOffset: 3 53 | shadowCascade2Split: 0.33333334 54 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 55 | shadowmaskMode: 0 56 | blendWeights: 2 57 | textureQuality: 0 58 | anisotropicTextures: 0 59 | antiAliasing: 0 60 | softParticles: 0 61 | softVegetation: 0 62 | realtimeReflectionProbes: 0 63 | billboardsFaceCameraPosition: 0 64 | vSyncCount: 0 65 | lodBias: 0.4 66 | maximumLODLevel: 0 67 | streamingMipmapsActive: 0 68 | streamingMipmapsAddAllCameras: 1 69 | streamingMipmapsMemoryBudget: 512 70 | streamingMipmapsRenderersPerFrame: 512 71 | streamingMipmapsMaxLevelReduction: 2 72 | streamingMipmapsMaxFileIORequests: 1024 73 | particleRaycastBudget: 16 74 | asyncUploadTimeSlice: 2 75 | asyncUploadBufferSize: 16 76 | asyncUploadPersistentBuffer: 1 77 | resolutionScalingFixedDPIFactor: 1 78 | excludedTargetPlatforms: [] 79 | - serializedVersion: 2 80 | name: Medium 81 | pixelLightCount: 1 82 | shadows: 1 83 | shadowResolution: 0 84 | shadowProjection: 1 85 | shadowCascades: 1 86 | shadowDistance: 20 87 | shadowNearPlaneOffset: 3 88 | shadowCascade2Split: 0.33333334 89 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 90 | shadowmaskMode: 0 91 | blendWeights: 2 92 | textureQuality: 0 93 | anisotropicTextures: 1 94 | antiAliasing: 0 95 | softParticles: 0 96 | softVegetation: 0 97 | realtimeReflectionProbes: 0 98 | billboardsFaceCameraPosition: 0 99 | vSyncCount: 1 100 | lodBias: 0.7 101 | maximumLODLevel: 0 102 | streamingMipmapsActive: 0 103 | streamingMipmapsAddAllCameras: 1 104 | streamingMipmapsMemoryBudget: 512 105 | streamingMipmapsRenderersPerFrame: 512 106 | streamingMipmapsMaxLevelReduction: 2 107 | streamingMipmapsMaxFileIORequests: 1024 108 | particleRaycastBudget: 64 109 | asyncUploadTimeSlice: 2 110 | asyncUploadBufferSize: 16 111 | asyncUploadPersistentBuffer: 1 112 | resolutionScalingFixedDPIFactor: 1 113 | excludedTargetPlatforms: [] 114 | - serializedVersion: 2 115 | name: High 116 | pixelLightCount: 2 117 | shadows: 2 118 | shadowResolution: 1 119 | shadowProjection: 1 120 | shadowCascades: 2 121 | shadowDistance: 40 122 | shadowNearPlaneOffset: 3 123 | shadowCascade2Split: 0.33333334 124 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 125 | shadowmaskMode: 1 126 | blendWeights: 2 127 | textureQuality: 0 128 | anisotropicTextures: 1 129 | antiAliasing: 0 130 | softParticles: 0 131 | softVegetation: 1 132 | realtimeReflectionProbes: 1 133 | billboardsFaceCameraPosition: 1 134 | vSyncCount: 1 135 | lodBias: 1 136 | maximumLODLevel: 0 137 | streamingMipmapsActive: 0 138 | streamingMipmapsAddAllCameras: 1 139 | streamingMipmapsMemoryBudget: 512 140 | streamingMipmapsRenderersPerFrame: 512 141 | streamingMipmapsMaxLevelReduction: 2 142 | streamingMipmapsMaxFileIORequests: 1024 143 | particleRaycastBudget: 256 144 | asyncUploadTimeSlice: 2 145 | asyncUploadBufferSize: 16 146 | asyncUploadPersistentBuffer: 1 147 | resolutionScalingFixedDPIFactor: 1 148 | excludedTargetPlatforms: [] 149 | - serializedVersion: 2 150 | name: Very High 151 | pixelLightCount: 3 152 | shadows: 2 153 | shadowResolution: 2 154 | shadowProjection: 1 155 | shadowCascades: 2 156 | shadowDistance: 70 157 | shadowNearPlaneOffset: 3 158 | shadowCascade2Split: 0.33333334 159 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 160 | shadowmaskMode: 1 161 | blendWeights: 4 162 | textureQuality: 0 163 | anisotropicTextures: 2 164 | antiAliasing: 2 165 | softParticles: 1 166 | softVegetation: 1 167 | realtimeReflectionProbes: 1 168 | billboardsFaceCameraPosition: 1 169 | vSyncCount: 1 170 | lodBias: 1.5 171 | maximumLODLevel: 0 172 | streamingMipmapsActive: 0 173 | streamingMipmapsAddAllCameras: 1 174 | streamingMipmapsMemoryBudget: 512 175 | streamingMipmapsRenderersPerFrame: 512 176 | streamingMipmapsMaxLevelReduction: 2 177 | streamingMipmapsMaxFileIORequests: 1024 178 | particleRaycastBudget: 1024 179 | asyncUploadTimeSlice: 2 180 | asyncUploadBufferSize: 16 181 | asyncUploadPersistentBuffer: 1 182 | resolutionScalingFixedDPIFactor: 1 183 | excludedTargetPlatforms: [] 184 | - serializedVersion: 2 185 | name: Ultra 186 | pixelLightCount: 4 187 | shadows: 2 188 | shadowResolution: 2 189 | shadowProjection: 1 190 | shadowCascades: 4 191 | shadowDistance: 150 192 | shadowNearPlaneOffset: 3 193 | shadowCascade2Split: 0.33333334 194 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 195 | shadowmaskMode: 1 196 | blendWeights: 4 197 | textureQuality: 0 198 | anisotropicTextures: 2 199 | antiAliasing: 2 200 | softParticles: 1 201 | softVegetation: 1 202 | realtimeReflectionProbes: 1 203 | billboardsFaceCameraPosition: 1 204 | vSyncCount: 1 205 | lodBias: 2 206 | maximumLODLevel: 0 207 | streamingMipmapsActive: 0 208 | streamingMipmapsAddAllCameras: 1 209 | streamingMipmapsMemoryBudget: 512 210 | streamingMipmapsRenderersPerFrame: 512 211 | streamingMipmapsMaxLevelReduction: 2 212 | streamingMipmapsMaxFileIORequests: 1024 213 | particleRaycastBudget: 4096 214 | asyncUploadTimeSlice: 2 215 | asyncUploadBufferSize: 16 216 | asyncUploadPersistentBuffer: 1 217 | resolutionScalingFixedDPIFactor: 1 218 | excludedTargetPlatforms: [] 219 | m_PerPlatformDefaultQuality: 220 | Android: 2 221 | Lumin: 5 222 | Nintendo 3DS: 5 223 | Nintendo Switch: 5 224 | PS4: 5 225 | PSP2: 2 226 | Standalone: 5 227 | WebGL: 3 228 | Windows Store Apps: 5 229 | XboxOne: 5 230 | iPhone: 2 231 | tvOS: 2 232 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.03333 7 | Maximum Allowed Timestep: 0.33333334 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03333 10 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 1 7 | m_Enabled: 0 8 | m_TestMode: 0 9 | m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events 10 | m_EventUrl: https://cdp.cloud.unity3d.com/v1/events 11 | m_ConfigUrl: https://config.uca.cloud.unity3d.com 12 | m_TestInitMode: 0 13 | CrashReportingSettings: 14 | m_EventUrl: https://perf-events.cloud.unity3d.com 15 | m_Enabled: 0 16 | m_LogBufferSize: 10 17 | m_CaptureEditorExceptions: 1 18 | UnityPurchasingSettings: 19 | m_Enabled: 0 20 | m_TestMode: 0 21 | UnityAnalyticsSettings: 22 | m_Enabled: 0 23 | m_TestMode: 0 24 | m_InitializeOnStartup: 1 25 | UnityAdsSettings: 26 | m_Enabled: 0 27 | m_InitializeOnStartup: 1 28 | m_TestMode: 0 29 | m_IosGameId: 30 | m_AndroidGameId: 31 | m_GameIds: {} 32 | m_GameId: 33 | PerformanceReportingSettings: 34 | m_Enabled: 0 35 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/VFXManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!937362698 &1 4 | VFXManager: 5 | m_ObjectHideFlags: 0 6 | m_IndirectShader: {fileID: 0} 7 | m_CopyBufferShader: {fileID: 0} 8 | m_SortShader: {fileID: 0} 9 | m_RenderPipeSettingsPath: 10 | m_FixedTimeStep: 0.016666668 11 | m_MaxDeltaTime: 0.05 12 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/VersionControlSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!890905787 &1 4 | VersionControlSettings: 5 | m_ObjectHideFlags: 0 6 | m_Mode: Visible Meta Files 7 | m_CollabEditorSettings: 8 | inProgressEnabled: 1 9 | -------------------------------------------------------------------------------- /UnityProject/ProjectSettings/XRSettings.asset: -------------------------------------------------------------------------------- 1 | { 2 | "m_SettingKeys": [ 3 | "VR Device Disabled", 4 | "VR Device User Alert" 5 | ], 6 | "m_SettingValues": [ 7 | "False", 8 | "False" 9 | ] 10 | } -------------------------------------------------------------------------------- /UnityProject/UserSettings/EditorUserSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!162 &1 4 | EditorUserSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 4 7 | m_ConfigSettings: 8 | RecentlyUsedScenePath-0: 9 | value: 22424703114646680e0b0227036c78111b122f253e24227e38271427fb 10 | flags: 0 11 | RecentlyUsedScenePath-1: 12 | value: 22424703114646680e0b0227036c7b1505120a3e623d28393930 13 | flags: 0 14 | RecentlyUsedScenePath-2: 15 | value: 22424703114646680e0b0227036c791f04051d393866333e243d04 16 | flags: 0 17 | RecentlyUsedScenePath-3: 18 | value: 22424703114646680e0b0227036c72111f19352f223d68252320092a 19 | flags: 0 20 | vcSharedLogLevel: 21 | value: 0d5e400f0650 22 | flags: 0 23 | m_VCAutomaticAdd: 1 24 | m_VCDebugCom: 0 25 | m_VCDebugCmd: 0 26 | m_VCDebugOut: 0 27 | m_SemanticMergeMode: 2 28 | m_VCShowFailedCheckout: 1 29 | m_VCOverwriteFailedCheckoutAssets: 1 30 | m_VCProjectOverlayIcons: 1 31 | m_VCHierarchyOverlayIcons: 1 32 | m_VCOtherOverlayIcons: 1 33 | m_VCAllowAsyncUpdate: 1 34 | -------------------------------------------------------------------------------- /VirtualWorldsOnGameLiftReferenceArchitecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-solutions-library-samples/guidance-for-persistent-world-game-hosting-on-aws/6af6942f1696296c9b9396eee241be28f72175a7/VirtualWorldsOnGameLiftReferenceArchitecture.png -------------------------------------------------------------------------------- /WorldConfigExample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-solutions-library-samples/guidance-for-persistent-world-game-hosting-on-aws/6af6942f1696296c9b9396eee241be28f72175a7/WorldConfigExample.png -------------------------------------------------------------------------------- /downloadAndSetupUnityDependencies.ps1: -------------------------------------------------------------------------------- 1 | # 0. Check that we have the tools installed 2 | 3 | if (Get-Command ./nuget) { 4 | Write-Host "Nuget installed" 5 | } 6 | else { 7 | Write-Host "Nuget not installed, exit. Please copy nuget.exe directly to this directory" 8 | exit 9 | } 10 | 11 | if (Get-Command msbuild) { 12 | Write-Host "MsBuild installed" 13 | } 14 | else { 15 | Write-Host "MSBuild not installed, exit." 16 | exit 17 | } 18 | 19 | $ProgressPreference = 'SilentlyContinue' 20 | 21 | ############################ 22 | 23 | # 1. Download and build the GameLift Server SDK. 24 | if (Test-Path("$PsScriptRoot\GameLift_06_03_2021.zip")) { 25 | Write-Host 'Already downloaded GameLift Server SDK' 26 | } 27 | else { 28 | Write-Host 'Downloading GameLift Server SDK...' 29 | Invoke-WebRequest https://gamelift-release.s3-us-west-2.amazonaws.com/GameLift_06_03_2021.zip -OutFile GameLift_06_03_2021.zip 30 | } 31 | 32 | # Unzip, build and copy the files to the correct folder in the Unity project 33 | Write-Host "Unzipping to temporary folder..." 34 | New-Item -Path "./" -Name "glsdk" -ItemType "directory" -Force 35 | Expand-Archive -Path GameLift_06_03_2021.zip -DestinationPath "$PsScriptRoot\glsdk\" -Force 36 | 37 | # Build the SDK in Release 38 | Write-Host "Building the SDK..." 39 | cd glsdk/GameLift-SDK-Release-4.0.2/GameLift-CSharp-ServerSDK-4.0.2/ 40 | 41 | # Retarget to 4.7.2 which is installed with Visual Studio Build Tools 2022 42 | $con = Get-Content ./Net45/GameLiftServerSDKNet45.csproj 43 | $con | % { $_.Replace("v4.5", "v4.7.2") } | Set-Content ./Net45/GameLiftServerSDKNet45.csproj 44 | 45 | # Restore packages and Build the SDK 46 | ../../../nuget restore 47 | msbuild GameLiftServerSDKNet45.sln -property:Configuration=Release 48 | 49 | # Copy the output files to the project 50 | New-Item -Path "$PsScriptRoot/UnityProject/Assets/" -Name "Dependencies" -ItemType "directory" -Force 51 | New-Item -Path "$PsScriptRoot/UnityProject/Assets/Dependencies/" -Name "GameLiftServerSDK" -ItemType "directory" -Force 52 | Write-Host "Copying files.." 53 | Copy-Item "Net45/bin/Release/*" -Destination "$PsScriptRoot/UnityProject/Assets/Dependencies/GameLiftServerSDK" -Force 54 | cd ../../.. 55 | Remove-Item -Recurse -Force glsdk 56 | 57 | # Fix the Newtonsoft JSON dll name because Unity 2020 has overlapping dll 58 | Move-Item -Path "UnityProject/Assets/Dependencies/GameLiftServerSDK/Newtonsoft.Json.dll" -Destination "UnityProject/Assets/Dependencies/GameLiftServerSDK/Newtonsoft.Json.GameLift.dll" -Force 59 | 60 | Write-Host "Done!" 61 | 62 | ############################ 63 | 64 | # 2. Download the AWS .NET SDK for .NET Standard 2.0 (that works with Unity) 65 | if (Test-Path("$PsScriptRoot\aws-sdk-netstandard2.0.zip")) { 66 | Write-Host "AWS .NET SDK for .NET Standard 2.0 already downloaded." 67 | } 68 | else { 69 | Write-Host "Download AWS .NET SDK for .NET Standard 2.0" 70 | Invoke-WebRequest https://sdk-for-net.amazonwebservices.com/latest/v3/aws-sdk-netstandard2.0.zip -OutFile aws-sdk-netstandard2.0.zip 71 | } 72 | 73 | # Unzip and copy the files to the correct folder in the Unity project 74 | Write-Host "Unzipping to temporary folder..." 75 | New-Item -Path "./" -Name "aws-sdk-temp" -ItemType "directory" -Force 76 | Expand-Archive -Path aws-sdk-netstandard2.0.zip -DestinationPath "$PsScriptRoot\aws-sdk-temp\" -Force 77 | 78 | Write-Host "Copying files to the Unity project..." 79 | New-Item -Path "UnityProject/Assets/Dependencies/" -Name "AWSSDK" -ItemType "directory" -Force 80 | Copy-Item "aws-sdk-temp/AWSSDK.CognitoIdentity.dll" -Destination "UnityProject/Assets/Dependencies/AWSSDK/" -Force 81 | Copy-Item "aws-sdk-temp/AWSSDK.CognitoIdentityProvider.dll*" -Destination "UnityProject/Assets/Dependencies/AWSSDK/" -Force 82 | Copy-Item "aws-sdk-temp/AWSSDK.Core.dll" -Destination "UnityProject/Assets/Dependencies/AWSSDK/" -Force 83 | Copy-Item "aws-sdk-temp/AWSSDK.DynamoDBv2.dll" -Destination "UnityProject/Assets/Dependencies/AWSSDK/" -Force 84 | Copy-Item "aws-sdk-temp/AWSSDK.SecurityToken.dll" -Destination "UnityProject/Assets/Dependencies/AWSSDK/" -Force 85 | Copy-Item "aws-sdk-temp/Microsoft.Bcl.AsyncInterfaces.dll" -Destination "UnityProject/Assets/Dependencies/AWSSDK/" -Force 86 | Copy-Item "aws-sdk-temp/System.Threading.Tasks.Extensions.dll" -Destination "UnityProject/Assets/Dependencies/AWSSDK/" -Force 87 | Write-Host "Removing the temporary files..." 88 | Remove-Item -Recurse -Force aws-sdk-temp 89 | 90 | echo "Done!" 91 | 92 | ############################ 93 | 94 | # 3. Download the Signature calculation example from AWS docs for SigV4 API request signing 95 | if (Test-Path("$PsScriptRoot\AmazonS3SigV4_Samples_CSharp.zip")) { 96 | Write-Host "Signature calculation example already downloaded." 97 | } 98 | else { 99 | Write-Host "Download the Signature calculation example from AWS docs" 100 | Invoke-WebRequest https://docs.aws.amazon.com/AmazonS3/latest/API/samples/AmazonS3SigV4_Samples_CSharp.zip -OutFile AmazonS3SigV4_Samples_CSharp.zip 101 | } 102 | 103 | # Unzip and copy the files to the correct folder in the Unity project 104 | Write-Host "Unzipping to temporary folder..." 105 | New-Item -Path "./" -Name "signaturecalculation-temp" -ItemType "directory" -Force 106 | Expand-Archive -Path AmazonS3SigV4_Samples_CSharp.zip -DestinationPath "$PsScriptRoot\signaturecalculation-temp\" -Force 107 | 108 | Write-Host "Copying files to the Unity project..." 109 | New-Item -Path "UnityProject/Assets/Dependencies//" -Name "Signers" -ItemType "directory" -Force 110 | New-Item -Path "UnityProject/Assets/Dependencies/" -Name "Util" -ItemType "directory" -Force 111 | Copy-Item "signaturecalculation-temp/AWSSignatureV4-S3-Sample/Signers/*" -Destination "UnityProject/Assets/Dependencies/Signers/" -Force -Recurse 112 | Copy-Item "signaturecalculation-temp/AWSSignatureV4-S3-Sample/Util/*" -Destination "UnityProject/Assets/Dependencies/Util/" -Force -Recurse 113 | Write-Host "Removing the temporary files..." 114 | Remove-Item -Recurse -Force signaturecalculation-temp 115 | 116 | echo "Done!" -------------------------------------------------------------------------------- /downloadAndSetupUnityDependencies.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 0. Check that we have the tools installed 4 | 5 | if ! [ -x "$(command -v nuget)" ]; then 6 | echo 'Error: nuget is not installed. See README for Mono installation details' 7 | exit 1 8 | fi 9 | 10 | if ! [ -x "$(command -v msbuild)" ]; then 11 | echo 'Error: msbuild is not installed. See README for Mono installation details' 12 | exit 1 13 | fi 14 | 15 | ############################ 16 | 17 | # 1. Download and build the GameLift Server SDK 18 | if [ ! -d "GameLift_06_03_2021.zip" ]; then 19 | # script statements if $DIR doesn't exist. 20 | echo "Download GameLift Server SDK" 21 | curl -O https://gamelift-release.s3-us-west-2.amazonaws.com/GameLift_06_03_2021.zip 22 | else 23 | echo "GameLift Server SDK already downloaded" 24 | fi 25 | 26 | 27 | # Unzip, build and copy the files to the correct folder in the Unity project 28 | echo "Unzipping to temporary folder..." 29 | mkdir aws-gamelift-sdk-temp 30 | unzip GameLift_06_03_2021.zip -d aws-gamelift-sdk-temp 31 | 32 | # Download dependencies and Build the SDK in Release 33 | echo "Building the SDK..." 34 | cd aws-gamelift-sdk-temp/GameLift-SDK-Release-4.0.2/GameLift-CSharp-ServerSDK-4.0.2/ 35 | nuget restore 36 | msbuild GameLiftServerSDKNet45.sln -property:Configuration=Release 37 | 38 | # Copy the output files to the project 39 | mkdir ../../../UnityProject/Assets/Dependencies/GameLiftServerSDK 40 | echo "Copying files.." 41 | cp Net45/bin/Release/* ../../../UnityProject/Assets/Dependencies/GameLiftServerSDK/ 42 | cd ../../.. 43 | rm -rf aws-gamelift-sdk-temp 44 | 45 | # Fix the Newtonsoft JSON dll name because Unity 2020 has overlapping dll 46 | mv UnityProject/Assets/Dependencies/GameLiftServerSDK/Newtonsoft.Json.dll UnityProject/Assets/Dependencies/GameLiftServerSDK/Newtonsoft.Json.GameLift.dll 47 | 48 | echo "Done!" 49 | 50 | ############################ 51 | 52 | # 2. Download the AWS .NET SDK for .NET Standard 2.0 (that works with Unity) 53 | if [ ! -d "aws-sdk-netstandard2.0.zip" ]; then 54 | # script statements if $DIR doesn't exist. 55 | echo "Download and AWS .NET SDK for .NET Standard 2.0" 56 | curl -O https://sdk-for-net.amazonwebservices.com/latest/v3/aws-sdk-netstandard2.0.zip 57 | else 58 | echo "AWS .NET SDK for .NET Standard 2.0 already downloaded." 59 | fi 60 | 61 | # Unzip and copy the files to the correct folder in the Unity project 62 | echo "Unzipping to temporary folder..." 63 | mkdir aws-sdk-temp 64 | unzip aws-sdk-netstandard2.0.zip -d aws-sdk-temp 65 | 66 | echo "Copying files to the Unity project..." 67 | mkdir UnityProject/Assets/Dependencies/AWSSDK 68 | cp aws-sdk-temp/AWSSDK.CognitoIdentity.dll UnityProject/Assets/Dependencies/AWSSDK/ 69 | cp aws-sdk-temp/AWSSDK.CognitoIdentityProvider.dll UnityProject/Assets/Dependencies/AWSSDK/ 70 | cp aws-sdk-temp/AWSSDK.Core.dll UnityProject/Assets/Dependencies/AWSSDK/ 71 | cp aws-sdk-temp/AWSSDK.SecurityToken.dll UnityProject/Assets/Dependencies/AWSSDK/ 72 | cp aws-sdk-temp/AWSSDK.DynamoDBv2.dll UnityProject/Assets/Dependencies/AWSSDK/ 73 | cp aws-sdk-temp/Microsoft.Bcl.AsyncInterfaces.dll UnityProject/Assets/Dependencies/AWSSDK/ 74 | cp aws-sdk-temp/System.Threading.Tasks.Extensions.dll UnityProject/Assets/Dependencies/AWSSDK/ 75 | echo "Removing the temporary files..." 76 | rm -rf aws-sdk-temp 77 | 78 | echo "Done!" 79 | 80 | ############################ 81 | 82 | # 3. Download the Signature calculation example from AWS docs for SigV4 API request signing 83 | if [ ! -d "AmazonS3SigV4_Samples_CSharp.zip" ]; then 84 | # script statements if $DIR doesn't exist. 85 | echo "Download the Signature calculation example from AWS docs" 86 | curl -O https://docs.aws.amazon.com/AmazonS3/latest/API/samples/AmazonS3SigV4_Samples_CSharp.zip 87 | else 88 | echo "Signature calculation example already downloaded." 89 | fi 90 | 91 | # Unzip and copy the files to the correct folder in the Unity project 92 | echo "Unzipping to temporary folder..." 93 | mkdir signaturecalculation-temp 94 | unzip AmazonS3SigV4_Samples_CSharp.zip -d signaturecalculation-temp 95 | 96 | echo "Copying files to the Unity project..." 97 | mkdir UnityProject/Assets/Dependencies/Signers/ 98 | mkdir UnityProject/Assets/Dependencies/Util/ 99 | cp -r signaturecalculation-temp/AWSSignatureV4-S3-Sample/Signers/ UnityProject/Assets/Dependencies/Signers/ 100 | cp -r signaturecalculation-temp/AWSSignatureV4-S3-Sample/Util/ UnityProject/Assets/Dependencies/Util/ 101 | echo "Removing the temporary files..." 102 | rm -rf signaturecalculation-temp 103 | 104 | echo "Done!" -------------------------------------------------------------------------------- /sample_world_item.json: -------------------------------------------------------------------------------- 1 | { 2 | "Location": {"S": "us-east-1"}, 3 | "WorldID": {"S": "TestWorld1"}, 4 | "MaxPlayers": {"N": "150"}, 5 | "WorldMap": {"S": "Desert"}, 6 | "TerminateSession": {"S": "NO"} 7 | } --------------------------------------------------------------------------------