├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── documentation-improvements.md │ └── feature_request.md ├── PULL_REQUEST_TEMPLATE.md ├── auto_assign-issues.yml ├── dependabot.yml ├── release-drafter.yml ├── semantic.yml ├── stale.yml └── workflows │ ├── build.yml │ ├── docs.yml │ ├── post_release.js │ ├── release-drafter.yml │ └── release-prep.yml ├── .gitignore ├── AmazonGameliftTestingToolkit.sln ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── ManagementConsole ├── Backend │ ├── AssemblyInfo.cs │ ├── Common │ │ ├── BaseEvent.cs │ │ ├── FlexMatchEvent.cs │ │ ├── QueuePlacementEvent.cs │ │ └── Utils.cs │ ├── ManagementConsoleBackend.csproj │ ├── ManagementService │ │ ├── Data │ │ │ ├── CfnRequest.cs │ │ │ ├── ClientMessage.cs │ │ │ ├── GameLiftStateEvent.cs │ │ │ ├── LatencyProfile.cs │ │ │ ├── LocationsList.cs │ │ │ ├── MatchmakingSimulation.cs │ │ │ ├── MultipartMessage.cs │ │ │ ├── PlayerProfile.cs │ │ │ ├── PlayerProfileAttributeConverter.cs │ │ │ ├── ServerMessage.cs │ │ │ └── VirtualPlayers.cs │ │ ├── EventHandlers.cs │ │ ├── FlexMatchSimulator.cs │ │ ├── Lib │ │ │ ├── CloudWatchRequestHandler.cs │ │ │ ├── DynamoDbRequestHandler.cs │ │ │ ├── GameLiftRequestHandler.cs │ │ │ ├── GameLiftStateHandler.cs │ │ │ ├── SchedulerHandler.cs │ │ │ └── VirtualPlayersHandler.cs │ │ ├── ManagementService.cs │ │ ├── PurgeData.cs │ │ ├── StepFunctions.cs │ │ └── VirtualPlayerTaskScheduledAction.cs │ └── aws-lambda-tools-defaults.json ├── Infra │ ├── README.md │ ├── cdk.context.json │ ├── cdk.json │ └── src │ │ ├── Constructs │ │ ├── FleetIqAmiBuild.cs │ │ ├── FleetIqGameServerGroup.cs │ │ └── GameLiftBuildAsset.cs │ │ ├── GlobalSuppressions.cs │ │ ├── Lib │ │ ├── ApiGwLogsStack.cs │ │ ├── BackendStack.cs │ │ ├── DataStack.cs │ │ ├── InfraStage.cs │ │ ├── SecurityStack.cs │ │ └── WebStack.cs │ │ ├── ManagementConsoleInfra.csproj │ │ └── Program.cs └── UI │ ├── .gitignore │ ├── index.html │ ├── package.json │ ├── src │ ├── Config │ │ └── Config.ts │ ├── Data │ │ ├── DataTypes.d.ts │ │ ├── FlexMatchEventType.ts │ │ ├── Locations.ts │ │ ├── QueuePlacementEventType.ts │ │ └── ScreenResolution.ts │ ├── Elements │ │ ├── Abstract │ │ │ ├── BaseContainer.ts │ │ │ ├── Page.ts │ │ │ ├── Popup.ts │ │ │ ├── SimpleButton.ts │ │ │ ├── SimpleMenu.ts │ │ │ ├── SubPopup.ts │ │ │ └── ToggleButton.ts │ │ ├── Buttons │ │ │ ├── FleetLocationButton.ts │ │ │ ├── FleetMenuButton.ts │ │ │ ├── MatchmakingConfigMenuButton.ts │ │ │ ├── QueueMenuButton.ts │ │ │ ├── SettingsButton.ts │ │ │ └── ToggleAnimationButton.ts │ │ ├── Fleet.ts │ │ ├── Fleets.ts │ │ ├── GameSession.ts │ │ ├── GameSessionQueue.ts │ │ ├── GameSessionQueues.ts │ │ ├── Instance.ts │ │ ├── MatchmakingConfig.ts │ │ ├── MatchmakingConfigs.ts │ │ ├── Menus │ │ │ ├── FleetMenu.ts │ │ │ ├── LocationPopover.ts │ │ │ ├── MatchmakingConfigMenu.ts │ │ │ └── QueueMenu.ts │ │ ├── Pages │ │ │ ├── PageManager.ts │ │ │ ├── Pages.ts │ │ │ ├── SimulateMatchmakingFailedTicketsPage.ts │ │ │ ├── SimulateMatchmakingFormPage.ts │ │ │ ├── SimulateMatchmakingMatchInfoPage.ts │ │ │ ├── SimulateMatchmakingOutputPage.ts │ │ │ ├── SimulateMatchmakingResultsPage.ts │ │ │ ├── SimulateMatchmakingSimulationsPage.ts │ │ │ ├── SimulateMatchmakingTicketsPage.ts │ │ │ ├── VirtualPlayerLaunchRequestTaskLogsPage.ts │ │ │ ├── VirtualPlayerLaunchRequestTasksPage.ts │ │ │ ├── VirtualPlayerLaunchRequestsPage.ts │ │ │ ├── VirtualPlayerTaskScheduleViewPage.ts │ │ │ ├── VirtualPlayerTaskSchedulesFormPage.ts │ │ │ ├── VirtualPlayerTaskSchedulesTablePage.ts │ │ │ ├── VirtualPlayerTasksLaunchPage.ts │ │ │ └── VirtualPlayerTasksOverviewPage.ts │ │ ├── Player.ts │ │ ├── PlayerMatch.ts │ │ ├── PlayerSprite.ts │ │ ├── Popups │ │ │ ├── FleetEventsPopup.ts │ │ │ ├── FleetGraphPopup.ts │ │ │ ├── FleetLocationsPopup.ts │ │ │ ├── FleetScalingPopup.ts │ │ │ ├── FlexMatchSimulatorPopup.ts │ │ │ ├── GameSessionsTablePopup.ts │ │ │ ├── MatchmakingConfigPopup.ts │ │ │ ├── MatchmakingGraphPopup.ts │ │ │ ├── MatchmakingRuleSetsPopup.ts │ │ │ ├── MatchmakingTicketsPopup.ts │ │ │ ├── PopupHandler.ts │ │ │ ├── PurgeDataPopup.ts │ │ │ ├── QueueEventsPopup.ts │ │ │ ├── QueueGraphPopup.ts │ │ │ ├── QueueSettingsPopup.ts │ │ │ ├── SimpleJsonPopup.ts │ │ │ └── VirtualPlayerTasksPopup.ts │ │ ├── RoundedRectangle.ts │ │ ├── Settings │ │ │ ├── SettingsForm.ts │ │ │ └── SettingsPanel.ts │ │ ├── SubPopups │ │ │ ├── LatencyProfilesSubPopup.ts │ │ │ ├── ManageRuleSetsSubPopup.ts │ │ │ ├── PlayerProfilesSubPopup.ts │ │ │ ├── QueueDestinationOrderSubPopup.ts │ │ │ ├── QueuePlacementPrioritySubPopup.ts │ │ │ ├── QueueSettingsSubPopup.ts │ │ │ ├── RuleSetBuilderSubPopup.ts │ │ │ ├── SimulateMatchmakingSubPopup.ts │ │ │ ├── SubPopups.ts │ │ │ ├── VirtualPlayerLaunchRequestsSubPopup.ts │ │ │ ├── VirtualPlayerTasksLaunchSubPopup.ts │ │ │ ├── VirtualPlayerTasksOverviewSubPopup.ts │ │ │ ├── VirtualPlayerTasksRunningSubPopup.ts │ │ │ └── VirtualPlayerTasksSchedulesSubPopup.ts │ │ └── WebFontFile.ts │ ├── Events │ │ ├── DummyEventHandler.ts │ │ ├── EventDispatcher.ts │ │ ├── Events.ts │ │ ├── GameLiftEventHandler.ts │ │ └── PopupClickEvent.ts │ ├── Game.ts │ ├── Managers │ │ ├── MatchManager.ts │ │ └── PlayerManager.ts │ ├── Network │ │ ├── MessageHandler.ts │ │ ├── MultipartMessageHandler.ts │ │ └── Network.ts │ ├── Scenes │ │ ├── BootScene.ts │ │ ├── ConsoleScene.ts │ │ ├── LoginScene.ts │ │ └── PreloaderScene.ts │ └── Utils │ │ └── Utils.ts │ ├── static │ ├── assets │ │ ├── animationoff.png │ │ ├── animationon.png │ │ ├── backbutton.png │ │ ├── characters │ │ │ ├── 1.png │ │ │ ├── 10.png │ │ │ ├── 11.png │ │ │ ├── 12.png │ │ │ ├── 13.png │ │ │ ├── 14.png │ │ │ ├── 15.png │ │ │ ├── 16.png │ │ │ ├── 2.png │ │ │ ├── 3.png │ │ │ ├── 4.png │ │ │ ├── 5.png │ │ │ ├── 6.png │ │ │ ├── 7.png │ │ │ ├── 8.png │ │ │ └── 9.png │ │ ├── closebutton.png │ │ ├── cog.png │ │ ├── gtlogo.png │ │ ├── html │ │ │ ├── fragments │ │ │ │ ├── playerAttributeTemplate.html │ │ │ │ ├── playerLatencyPolicyTemplate.html │ │ │ │ ├── playerProfileTemplate.html │ │ │ │ ├── regionLatencyTemplate.html │ │ │ │ └── scheduleProgress.html │ │ │ ├── pages │ │ │ │ ├── simulateMatchmakingFailedTicketsPage.html │ │ │ │ ├── simulateMatchmakingFormPage.html │ │ │ │ ├── simulateMatchmakingMatchInfoPage.html │ │ │ │ ├── simulateMatchmakingOutputPage.html │ │ │ │ ├── simulateMatchmakingResultsPage.html │ │ │ │ ├── simulateMatchmakingSimulationsPage.html │ │ │ │ ├── simulateMatchmakingTicketsPage.html │ │ │ │ ├── virtualPlayerLaunchRequestTaskLogsPage.html │ │ │ │ ├── virtualPlayerLaunchRequestTasksPage.html │ │ │ │ ├── virtualPlayerLaunchRequestsPage.html │ │ │ │ ├── virtualPlayerTaskScheduleViewPage.html │ │ │ │ ├── virtualPlayerTaskSchedulesFormPage.html │ │ │ │ ├── virtualPlayerTaskSchedulesTablePage.html │ │ │ │ ├── virtualPlayerTasksLaunchPage.html │ │ │ │ └── virtualPlayerTasksOverviewPage.html │ │ │ ├── popups │ │ │ │ ├── fleetEventsPopup.html │ │ │ │ ├── fleetLocationsPopup.html │ │ │ │ ├── fleetScalingPopup.html │ │ │ │ ├── flexMatchSimulatorPopup.html │ │ │ │ ├── gameSessionsTablePopup.html │ │ │ │ ├── matchmakingConfigPopup.html │ │ │ │ ├── matchmakingTicketHeadersTablePopup.html │ │ │ │ ├── purgeDataPopup.html │ │ │ │ ├── queueEventsPopup.html │ │ │ │ ├── queueSettingsPopup.html │ │ │ │ ├── ruleSetsPopup.html │ │ │ │ ├── simpleGraphPopup.html │ │ │ │ ├── simpleJsonPopup.html │ │ │ │ └── virtualPlayerTasksPopup.html │ │ │ ├── settings.html │ │ │ ├── subpopups │ │ │ │ ├── configureLatencyProfilesSubPopup.html │ │ │ │ ├── configurePlayerProfilesSubPopup.html │ │ │ │ ├── manageRuleSetsSubPopup.html │ │ │ │ ├── queueDestinationOrderSubPopup.html │ │ │ │ ├── queuePlacementPrioritySubPopup.html │ │ │ │ ├── queueSettingsSubPopup.html │ │ │ │ ├── ruleSetBuilderSubPopup.html │ │ │ │ ├── simulateMatchmakingSubPopup.html │ │ │ │ ├── virtualPlayerTaskLaunchRequestsSubPopup.html │ │ │ │ ├── virtualPlayerTasksLaunchSubPopup.html │ │ │ │ ├── virtualPlayerTasksOverviewSubPopup.html │ │ │ │ ├── virtualPlayerTasksRunningSubPopup.html │ │ │ │ ├── virtualPlayerTasksScheduleLaunchSubPopup.html │ │ │ │ └── virtualPlayerTasksSchedulesSubPopup.html │ │ │ └── tokenForm.html │ │ ├── instance.png │ │ ├── location.png │ │ ├── refresh.png │ │ ├── textures.json │ │ ├── textures.png │ │ └── webfonts │ │ │ ├── Noto Sans.fnt │ │ │ └── Noto Sans.png │ ├── package.json │ ├── styles.css │ └── yarn.lock │ ├── texturepacker │ ├── assets │ │ ├── animationoff.png │ │ ├── animationon.png │ │ ├── characters │ │ │ ├── 1.png │ │ │ ├── 10.png │ │ │ ├── 11.png │ │ │ ├── 12.png │ │ │ ├── 13.png │ │ │ ├── 14.png │ │ │ ├── 15.png │ │ │ ├── 16.png │ │ │ ├── 2.png │ │ │ ├── 3.png │ │ │ ├── 4.png │ │ │ ├── 5.png │ │ │ ├── 6.png │ │ │ ├── 7.png │ │ │ ├── 8.png │ │ │ └── 9.png │ │ ├── cog.png │ │ ├── gtlogo.png │ │ ├── instance.png │ │ ├── location.png │ │ └── refresh.png │ └── textures.tps │ ├── tsconfig.json │ ├── webpack │ ├── base.js │ └── prod.js │ └── yarn.lock ├── NOTICE ├── README.md ├── SampleGame ├── Backend │ ├── AssemblyInfo.cs │ ├── Common │ │ ├── BaseEvent.cs │ │ ├── FlexMatchEvent.cs │ │ ├── QueuePlacementEvent.cs │ │ └── Utils.cs │ ├── GameClientService │ │ ├── Data │ │ │ ├── ClientMessage.cs │ │ │ └── ServerMessage.cs │ │ └── GameClientService.cs │ ├── SampleGameBackend.csproj │ └── aws-lambda-tools-defaults.json ├── Game │ ├── ArgumentHandler.cs │ ├── Dockerfile │ ├── Game.cs │ ├── GameLiftIntegration │ │ ├── Client │ │ │ ├── WSClient.cs │ │ │ ├── WSMessageFromClient.cs │ │ │ └── WSMessageFromServer.cs │ │ └── Server │ │ │ ├── GameLiftHandler.cs │ │ │ ├── GameLiftMetadata.cs │ │ │ └── IGameLiftServer.cs │ ├── Network │ │ ├── Client │ │ │ ├── Client.cs │ │ │ ├── IClient.cs │ │ │ └── IGameClient.cs │ │ ├── NetworkProtocol.cs │ │ └── Server │ │ │ ├── IGameServer.cs │ │ │ └── Server.cs │ ├── NumbersQuiz │ │ ├── Client │ │ │ ├── APIGatewayRequestSigner.cs │ │ │ ├── QuizClient.cs │ │ │ ├── Signers │ │ │ │ ├── AWS4SignerBase.cs │ │ │ │ ├── AWS4SignerForAuthorizationHeader.cs │ │ │ │ ├── AWS4SignerForPOST.cs │ │ │ │ └── AWS4SignerForQueryParameterAuth.cs │ │ │ └── Util │ │ │ │ └── HttpHelpers.cs │ │ ├── Data │ │ │ ├── AnswerResult.cs │ │ │ ├── GameResult.cs │ │ │ ├── MessageFromClient.cs │ │ │ ├── MessageFromClientType.cs │ │ │ ├── MessageFromServer.cs │ │ │ ├── MessageFromServerType.cs │ │ │ ├── Question.cs │ │ │ ├── QuizConfig.cs │ │ │ ├── ScheduleEntry.cs │ │ │ └── ScheduleEntryType.cs │ │ └── Server │ │ │ ├── AwsHandler.cs │ │ │ ├── GameLogger.cs │ │ │ ├── GameState.cs │ │ │ ├── Player.cs │ │ │ ├── Players.cs │ │ │ └── QuizServer.cs │ ├── Program.cs │ ├── QuizConfig.json │ ├── SampleGameBuild.csproj │ ├── install.bat │ ├── install.ps1 │ ├── install.sh │ └── log4net.config └── Infra │ ├── Infra.sln │ ├── README.md │ ├── cdk.context.json │ ├── cdk.json │ └── src │ ├── Constructs │ ├── GameLiftBuild.cs │ └── GameLiftBuildAsset.cs │ ├── GlobalSuppressions.cs │ ├── Lib │ ├── ApiGwLogsStack.cs │ ├── BackendStack.cs │ ├── InfraStage.cs │ └── VirtualPlayersStack.cs │ ├── Program.cs │ └── SampleGameInfra.csproj ├── THIRD_PARTY_LICENSES.md ├── VERSION ├── cdk.context.json ├── docs ├── docs │ ├── Dockerfile │ ├── additional_resources.md │ ├── aws_services.md │ ├── img │ │ └── amazon_gamelift_testing_toolkit.png │ ├── index.md │ ├── quick_start.md │ ├── removing_the_toolkit.md │ ├── security.md │ ├── testing_your_game.md │ ├── toolkit_design.md │ └── using_the_toolkit.md └── mkdocs.yml ├── package.json └── yarn.lock /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug, triage 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | 12 | 13 | **What were you trying to accomplish?** 14 | 15 | ## Expected Behavior 16 | 17 | 18 | 19 | ## Current Behavior 20 | 21 | 22 | 23 | ## Possible Solution 24 | 25 | 26 | 27 | ## Steps to Reproduce (for bugs) 28 | 29 | 30 | 1. 31 | 2. 32 | 3. 33 | 4. 34 | 35 | ## Environment 36 | 37 | * **Amazon GameLift Testing Toolkit version used**: 38 | * **Game server stack**: 39 | * **Debugging logs** 40 | 41 | ```text 42 | # paste logs here 43 | ``` 44 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/documentation-improvements.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Documentation improvements 3 | about: Suggest a documentation update 4 | title: '' 5 | labels: documentation 6 | assignees: '' 7 | 8 | --- 9 | 10 | **What were you initially searching for in the docs?** 11 | 12 | 13 | **Is this related to an existing part of the documentation? Please share a link** 14 | 15 | **Describe how we could make it clearer** 16 | 17 | **If you have a proposed update, please share it here** 18 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: feature-request, triage 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | 12 | 13 | **Describe the solution you'd like** 14 | 15 | 16 | **Describe alternatives you've considered** 17 | 18 | 19 | **Additional context** 20 | 21 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | **Issue #, if available:** 2 | 3 | ## Description of changes: 4 | 5 | 6 | 7 | **Checklist** 8 | 9 | 10 | 11 | * [ ] Update tests 12 | * [ ] Update docs 13 | * [ ] PR title follows [conventional commit semantics]() 14 | 15 | ## Breaking change checklist 16 | 17 | 18 | 19 | **RFC issue #**: 20 | 21 | * [ ] Migration process documented 22 | * [ ] Implement warnings (if it can live side by side) 23 | 24 | By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. 25 | -------------------------------------------------------------------------------- /.github/auto_assign-issues.yml: -------------------------------------------------------------------------------- 1 | addAssignees: true 2 | 3 | # The list of users to assign to new issues. 4 | # If empty or not provided, the repository owner is assigned 5 | assignees: 6 | - joep1978 7 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "nuget" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | labels: 8 | - "nuget" 9 | - "dependencies" 10 | - package-ecosystem: "npm" 11 | directory: "/" 12 | schedule: 13 | interval: "weekly" 14 | labels: 15 | - "nuget" 16 | - "dependencies" 17 | -------------------------------------------------------------------------------- /.github/release-drafter.yml: -------------------------------------------------------------------------------- 1 | change-template: "* $TITLE (#$NUMBER) by @$AUTHOR" 2 | categories: 3 | - title: '⚡ Breaking Changes' 4 | labels: 5 | - 'breaking-change' 6 | - title: '🌟New features and non-breaking changes' 7 | labels: 8 | - 'major' 9 | - 'feature' 10 | - title: '🌟 Minor Changes' 11 | labels: 12 | - 'enhancement' 13 | - title: '📜 Documentation updates' 14 | labels: 15 | - 'documentation' 16 | - title: '🐛 Bug and hot fixes' 17 | labels: 18 | - 'bug' 19 | - 'fix' 20 | - title: '🚒 Deprecations' 21 | labels: 22 | - 'deprecated' 23 | exclude-labels: 24 | - 'skip-changelog' 25 | tag-template: 'v$NEXT_PATCH_VERSION' 26 | template: | 27 | ## Changes 28 | 29 | **[Human readable summary of changes]** 30 | 31 | $CHANGES 32 | 33 | ## This release was made possible by the following contributors: 34 | 35 | $CONTRIBUTORS 36 | -------------------------------------------------------------------------------- /.github/semantic.yml: -------------------------------------------------------------------------------- 1 | # conventional commit types: https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json 2 | types: 3 | - feat 4 | - fix 5 | - docs 6 | - style 7 | - refactor 8 | - perf 9 | - test 10 | - build 11 | - ci 12 | - chore 13 | - revert 14 | - improv 15 | 16 | # Always validate the PR title 17 | # and ignore the commits to lower the entry bar for contribution 18 | # while titles make up the Release notes to ease maintenance overhead 19 | titleOnly: true 20 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | only: issues 2 | daysUntilStale: 30 3 | daysUntilClose: 7 4 | exemptLabels: 5 | - bug 6 | - documentation 7 | - enhancement 8 | - feature-request 9 | - RFC 10 | staleLabel: pending-close-response-required 11 | markComment: > 12 | This issue has been automatically marked as stale because it has not had 13 | recent activity. It will be closed if no further activity occurs. Thank you 14 | for your contributions. 15 | closeComment: > 16 | This issue has been automatically closed because of inactivity. 17 | Please open a new issue if you are still encountering problems. 18 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - main 7 | paths: 8 | - 'ManagementConsole/**' 9 | - 'SampleGame/**' 10 | - '.github/workflows/**' 11 | push: 12 | branches: 13 | - main 14 | paths: 15 | - 'ManagementConsole/**' 16 | - 'SampleGame/**' 17 | - '.github/workflows/**' 18 | jobs: 19 | build: 20 | runs-on: ubuntu-latest 21 | strategy: 22 | max-parallel: 4 23 | matrix: 24 | # test against latest update of each major .Net version, as well as specific updates of LTS versions: 25 | net: [ '6.0.x' ] 26 | name: .Net ${{ matrix.net }} 27 | env: 28 | DOTNET: ${{ matrix.net-version }} 29 | OS: ${{ matrix.os }} 30 | AWS_REGION: eu-west-1 31 | steps: 32 | - uses: actions/checkout@v3 33 | - name: Setup .NET Core 34 | uses: actions/setup-dotnet@v3 35 | with: 36 | dotnet-version: ${{ matrix.net }} 37 | - name: Install Lambda dependencies 38 | run: | 39 | dotnet tool install -g Amazon.Lambda.Tools 40 | yarn 41 | - name: Build Management console 42 | run: yarn build-toolkit 43 | - name: Build Sample Game 44 | run: yarn build-sample-game 45 | savepr: 46 | runs-on: ubuntu-latest 47 | name: Save PR number if running on PR by dependabot 48 | if: github.actor == 'dependabot[bot]' 49 | steps: 50 | - name: Create Directory and save issue 51 | run: | 52 | mkdir -p ./pr 53 | echo ${{ github.event.number }} 54 | echo ${{ github.event.number }} > ./pr/NR 55 | - uses: actions/upload-artifact@v2 56 | name: Updload artifact 57 | with: 58 | name: pr 59 | path: pr/ 60 | -------------------------------------------------------------------------------- /.github/workflows/docs.yml: -------------------------------------------------------------------------------- 1 | name: Build Docs 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - main 7 | paths: 8 | - 'docs/**' 9 | - '.github/workflows/docs.yml' 10 | push: 11 | branches: 12 | - main 13 | paths: 14 | - 'docs/**' 15 | - '.github/workflows/docs.yml' 16 | 17 | jobs: 18 | docs: 19 | runs-on: ubuntu-latest 20 | steps: 21 | - uses: actions/checkout@v2 22 | - uses: actions/setup-python@v2 23 | with: 24 | python-version: 3.x 25 | - run: pip install mkdocs-material 26 | - run: cd docs && mkdocs gh-deploy --force -------------------------------------------------------------------------------- /.github/workflows/release-drafter.yml: -------------------------------------------------------------------------------- 1 | name: Release Drafter 2 | 3 | on: 4 | push: 5 | # branches to consider in the event; optional, defaults to all 6 | branches: 7 | - main 8 | 9 | jobs: 10 | update_release_draft: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: release-drafter/release-drafter@v5 14 | env: 15 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 16 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | This project follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format for changes and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 6 | 7 | ## [Unreleased] -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ManagementConsole/Backend/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | 5 | // Assembly attribute to enable the Lambda function's JSON input to be converted into a .NET class. 6 | 7 | using Amazon.Lambda.Core; 8 | 9 | [assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))] 10 | -------------------------------------------------------------------------------- /ManagementConsole/Backend/Common/BaseEvent.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | using System; 5 | using Newtonsoft.Json; 6 | 7 | namespace ManagementConsoleBackend.Common 8 | { 9 | public class BaseEvent 10 | { 11 | [JsonProperty("version")] 12 | public string Version { get; set; } 13 | 14 | [JsonProperty("id")] 15 | public Guid Id { get; set; } 16 | 17 | [JsonProperty("detail-type")] 18 | public string DetailType { get; set; } 19 | 20 | [JsonProperty("source")] 21 | public string Source { get; set; } 22 | 23 | [JsonProperty("account")] 24 | public string Account { get; set; } 25 | 26 | [JsonProperty("time")] 27 | public DateTimeOffset Time { get; set; } 28 | 29 | [JsonProperty("region")] 30 | public string Region { get; set; } 31 | 32 | [JsonProperty("resources")] 33 | public string[] Resources { get; set; } 34 | } 35 | } -------------------------------------------------------------------------------- /ManagementConsole/Backend/Common/QueuePlacementEvent.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | using System.Collections.Generic; 5 | using Newtonsoft.Json; 6 | 7 | namespace ManagementConsoleBackend.Common 8 | { 9 | public class QueuePlacementEvent : BaseEvent 10 | { 11 | [JsonProperty(Required = Required.Default, PropertyName = "detail")] 12 | public QueuePlacementEventDetail Detail { get; set; } 13 | } 14 | 15 | public class QueuePlacementEventDetail 16 | { 17 | [JsonProperty(Required = Required.Always, PropertyName = "type")] 18 | public string Type { get; set; } 19 | 20 | [JsonProperty(Required = Required.Always, PropertyName = "placementId")] 21 | public string PlacementId { get; set; } 22 | 23 | [JsonProperty(Required = Required.Default, PropertyName = "port")] 24 | public string Port { get; set; } 25 | 26 | [JsonProperty(Required = Required.Default, PropertyName = "gameSessionArn")] 27 | public string GameSessionArn { get; set; } 28 | 29 | [JsonProperty(Required = Required.Default, PropertyName = "ipAddress")] 30 | public string IpAddress { get; set; } 31 | 32 | [JsonProperty(Required = Required.Default, PropertyName = "dnsName")] 33 | public string DnsName { get; set; } 34 | 35 | [JsonProperty(Required = Required.Default, PropertyName = "gameSessionRegion")] 36 | public string GameSessionRegion { get; set; } 37 | 38 | [JsonProperty(Required = Required.Always, PropertyName = "startTime")] 39 | public string StartTime { get; set; } 40 | 41 | [JsonProperty(Required = Required.Always, PropertyName = "endTime")] 42 | public string EndTime { get; set; } 43 | 44 | [JsonProperty(Required = Required.Default, PropertyName = "placedPlayerSessions")] 45 | public List PlacedPlayerSessions { get; set; } 46 | } 47 | 48 | public class QueuePlacementEventPlacedPlayerSession 49 | { 50 | [JsonProperty(Required = Required.Always, PropertyName = "playerId")] 51 | public string PlayerId { get; set; } 52 | 53 | [JsonProperty(Required = Required.Always, PropertyName = "playerSessionId")] 54 | public string PlayerSessionId { get; set; } 55 | } 56 | } -------------------------------------------------------------------------------- /ManagementConsole/Backend/ManagementConsoleBackend.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | true 4 | false 5 | Lambda 6 | 7 | 8 | true 9 | net6.0 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /ManagementConsole/Backend/ManagementService/Data/CfnRequest.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | namespace ManagementConsoleBackend.ManagementService.Data 5 | { 6 | public class CfnRequest 7 | { 8 | public string RequestType { get; set; } 9 | public string ResponseURL { get; set; } 10 | public string StackId { get; set; } 11 | public string RequestId { get; set; } 12 | public string ResourceType { get; set; } 13 | public string LogicalResourceId { get; set; } 14 | public ResourceProperties ResourceProperties { get; set; } 15 | public ResourceProperties OldResourceProperties { get; set; } 16 | } 17 | 18 | public class ResourceProperties 19 | { 20 | public string ServiceToken { get; set; } 21 | } 22 | 23 | public class CfnResponse 24 | { 25 | public string Status { get; set; } 26 | public string Reason { get; set; } 27 | public string PhysicalResourceId { get; set; } 28 | public string StackId { get; set; } 29 | public string RequestId { get; set; } 30 | public string LogicalResourceId { get; set; } 31 | public bool NoEcho { get; set; } 32 | public object Data; 33 | } 34 | 35 | public class AuthenticationTokenResponse 36 | { 37 | public string Token; 38 | } 39 | } -------------------------------------------------------------------------------- /ManagementConsole/Backend/ManagementService/Data/GameLiftStateEvent.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using Amazon.GameLift.Model; 7 | using KellermanSoftware.CompareNetObjects; 8 | using ManagementConsoleBackend.Common; 9 | using Newtonsoft.Json; 10 | 11 | namespace ManagementConsoleBackend.ManagementService.Data 12 | { 13 | public class GameLiftStateEvent : BaseEvent 14 | { 15 | [JsonProperty("detail")] 16 | public GameLiftStateEventDetail Detail { get; set; } 17 | } 18 | 19 | public class GameLiftStateDatabaseItem 20 | { 21 | public DateTime Date { get; set; } 22 | 23 | public DateTime Time { get; set; } 24 | 25 | public GameLiftStateEventDetail State; 26 | 27 | public List Differences; 28 | 29 | public long TimeToLive; 30 | } 31 | 32 | public class GameLiftStateEventDetail 33 | { 34 | public List FleetData = new List(); 35 | public List MatchmakingConfigurations = new List(); 36 | public MatchmakingConfiguration MatchmakingSimulator = new MatchmakingConfiguration(); 37 | public List GameSessionQueues = new List(); 38 | public List Aliases = new List(); 39 | } 40 | 41 | public class FleetData 42 | { 43 | public string FleetId; 44 | public FleetCapacity FleetCapacity; 45 | public FleetUtilization FleetUtilization; 46 | public FleetAttributes FleetAttributes; 47 | public List LocationAttributes; 48 | public List LocationCapacities; 49 | public List ScalingPolicies = new List(); 50 | public RuntimeConfiguration RuntimeConfiguration; 51 | public List FleetEvents = new List(); 52 | public List GameSessions = new List(); 53 | public List Instances = new List(); 54 | public Dictionary Metrics = new Dictionary(); 55 | } 56 | } -------------------------------------------------------------------------------- /ManagementConsole/Backend/ManagementService/Data/LatencyProfile.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | using System.Collections.Generic; 5 | using Amazon.DynamoDBv2.DataModel; 6 | 7 | namespace ManagementConsoleBackend.ManagementService.Data 8 | { 9 | public class LatencyProfile 10 | { 11 | [DynamoDBHashKey] 12 | public string ProfileId; 13 | 14 | [DynamoDBProperty("ProfileName")] 15 | public string Name; 16 | 17 | [DynamoDBProperty("Attributes")] 18 | public List LatencyData; 19 | } 20 | 21 | public class RegionLatency 22 | { 23 | public string Region; 24 | public int MinLatency; 25 | public int MaxLatency; 26 | } 27 | } -------------------------------------------------------------------------------- /ManagementConsole/Backend/ManagementService/Data/LocationsList.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | using System.Collections.Generic; 5 | 6 | namespace ManagementConsoleBackend.ManagementService.Data 7 | { 8 | public class LocationsList 9 | { 10 | public static List GameLiftLocations = new List() 11 | { 12 | Amazon.RegionEndpoint.USEast1, 13 | Amazon.RegionEndpoint.USEast2, 14 | Amazon.RegionEndpoint.USWest1, 15 | Amazon.RegionEndpoint.USWest2, 16 | Amazon.RegionEndpoint.AFSouth1, 17 | Amazon.RegionEndpoint.APSouth1, 18 | Amazon.RegionEndpoint.APEast1, 19 | Amazon.RegionEndpoint.APNortheast1, 20 | Amazon.RegionEndpoint.APNortheast2, 21 | Amazon.RegionEndpoint.APNortheast3, 22 | Amazon.RegionEndpoint.APSoutheast1, 23 | Amazon.RegionEndpoint.APSoutheast2, 24 | Amazon.RegionEndpoint.CACentral1, 25 | Amazon.RegionEndpoint.EUWest1, 26 | Amazon.RegionEndpoint.EUWest2, 27 | Amazon.RegionEndpoint.EUWest3, 28 | Amazon.RegionEndpoint.EUSouth1, 29 | Amazon.RegionEndpoint.EUNorth1, 30 | Amazon.RegionEndpoint.EUCentral1, 31 | Amazon.RegionEndpoint.MESouth1, 32 | Amazon.RegionEndpoint.SAEast1, 33 | }; 34 | 35 | public static List GameLiftHomeLocations = new List() 36 | { 37 | Amazon.RegionEndpoint.USEast1, 38 | Amazon.RegionEndpoint.USEast2, 39 | Amazon.RegionEndpoint.USWest1, 40 | Amazon.RegionEndpoint.USWest2, 41 | Amazon.RegionEndpoint.APSouth1, 42 | Amazon.RegionEndpoint.APNortheast1, 43 | Amazon.RegionEndpoint.APNortheast2, 44 | Amazon.RegionEndpoint.APSoutheast1, 45 | Amazon.RegionEndpoint.APSoutheast2, 46 | Amazon.RegionEndpoint.CACentral1, 47 | Amazon.RegionEndpoint.EUWest1, 48 | Amazon.RegionEndpoint.EUWest2, 49 | Amazon.RegionEndpoint.EUCentral1, 50 | Amazon.RegionEndpoint.SAEast1, 51 | }; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /ManagementConsole/Backend/ManagementService/Data/MultipartMessage.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ManagementConsoleBackend.ManagementService.Data 8 | { 9 | public static class Extensions 10 | { 11 | public static List Split(this string str, int n) 12 | { 13 | var parts = new List(); 14 | for (int i = 0; i < str.Length; i += n) 15 | parts.Add(str.Substring(i, Math.Min(n, str.Length-i))); 16 | 17 | return parts; 18 | } 19 | 20 | public static List MakeMultipartMessage(this string str, int n) 21 | { 22 | var messages = new List(); 23 | var payloads = str.Split(n); 24 | var messageId = Guid.NewGuid().ToString(); 25 | var i = 1; 26 | foreach (var payload in payloads) 27 | { 28 | messages.Add(new MultipartMessage 29 | { 30 | MessageId = messageId, 31 | TotalParts = payloads.Count, 32 | PartNumber = i, 33 | Payload = payload 34 | }); 35 | 36 | i++; 37 | } 38 | 39 | return messages; 40 | } 41 | } 42 | 43 | public class MultipartMessage 44 | { 45 | public string Type = "MultipartMessage"; 46 | public string MessageId; 47 | public int TotalParts; 48 | public int PartNumber; 49 | public string Payload; 50 | 51 | } 52 | } -------------------------------------------------------------------------------- /ManagementConsole/Backend/ManagementService/Data/PlayerProfile.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | using System.Collections.Generic; 5 | using Amazon.DynamoDBv2.DataModel; 6 | using Newtonsoft.Json; 7 | 8 | namespace ManagementConsoleBackend.ManagementService.Data 9 | { 10 | public class PlayerProfile 11 | { 12 | [DynamoDBHashKey] 13 | public string ProfileId; 14 | 15 | [DynamoDBProperty("ProfileName")] 16 | public string Name; 17 | 18 | [DynamoDBProperty("Team")] 19 | public string Team; 20 | 21 | [DynamoDBProperty("Attributes")] 22 | public List Attributes; 23 | } 24 | 25 | [JsonConverter(typeof(PlayerProfileAttributeConverter))] 26 | public abstract class PlayerProfileAttribute 27 | { 28 | public string AttributeName; 29 | public string AttributeType; 30 | public string ValueType; 31 | } 32 | 33 | public class PlayerStringAttribute : PlayerProfileAttribute 34 | { 35 | public string Value; 36 | } 37 | 38 | public class PlayerNumberAttribute : PlayerProfileAttribute 39 | { 40 | public double Value; 41 | } 42 | 43 | public class PlayerDoubleMapAttribute : PlayerProfileAttribute 44 | { 45 | public Dictionary ValueMap; 46 | } 47 | 48 | public class PlayerRandIntegerAttribute : PlayerProfileAttribute 49 | { 50 | public int Min; 51 | public int Max; 52 | } 53 | 54 | public class PlayerRandDoubleAttribute : PlayerProfileAttribute 55 | { 56 | public double Min; 57 | public double Max; 58 | } 59 | 60 | public class PlayerStringListAttribute : PlayerProfileAttribute 61 | { 62 | public string[] Value; 63 | } 64 | 65 | public class PlayerRandStringListAttribute : PlayerProfileAttribute 66 | { 67 | public int Min; 68 | public int Max; 69 | public string[] Value; 70 | } 71 | } -------------------------------------------------------------------------------- /ManagementConsole/Backend/aws-lambda-tools-defaults.json: -------------------------------------------------------------------------------- 1 | { 2 | "Information": [ 3 | "This file provides default values for the deployment wizard inside Visual Studio and the AWS Lambda commands added to the .NET Core CLI.", 4 | "To learn more about the Lambda commands with the .NET Core CLI execute the following command at the command line in the project root directory.", 5 | "dotnet lambda help", 6 | "All the command line options for the Lambda command can be specified in this file." 7 | ], 8 | "profile": "", 9 | "region": "", 10 | "configuration": "Release", 11 | "framework": "net6.0", 12 | "function-runtime": "dotnetcore3.1", 13 | "function-memory-size": 256, 14 | "function-timeout": 30, 15 | "function-handler": "Lambda::Lambda.GameClientServiceFunction::Handler" 16 | } 17 | -------------------------------------------------------------------------------- /ManagementConsole/Infra/README.md: -------------------------------------------------------------------------------- 1 | # Welcome to your CDK C# project! 2 | 3 | This is a blank project for C# development with CDK. 4 | 5 | The `cdk.json` file tells the CDK Toolkit how to execute your app. 6 | 7 | It uses the [.NET Core CLI](https://docs.microsoft.com/dotnet/articles/core/) to compile and execute your project. 8 | 9 | ## Useful commands 10 | 11 | * `dotnet build src` compile this app 12 | * `cdk deploy` deploy this stack to your default AWS account/region 13 | * `cdk diff` compare deployed stack with current state 14 | * `cdk synth` emits the synthesized CloudFormation template -------------------------------------------------------------------------------- /ManagementConsole/Infra/cdk.context.json: -------------------------------------------------------------------------------- 1 | { 2 | "acknowledged-issue-numbers": [ 3 | 19836, 4 | 19836, 5 | 19836, 6 | 19836, 7 | 19836 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /ManagementConsole/Infra/cdk.json: -------------------------------------------------------------------------------- 1 | { 2 | "app": "dotnet run --project src/ManagementConsoleInfra.csproj", 3 | "watch": { 4 | "include": [ 5 | "**" 6 | ], 7 | "exclude": [ 8 | "README.md", 9 | "cdk*.json", 10 | "src/*/obj", 11 | "src/*/bin", 12 | "src/*.sln", 13 | "src/*/GlobalSuppressions.cs", 14 | "src/*/*.csproj" 15 | ] 16 | }, 17 | "context": { 18 | "@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId": true, 19 | "@aws-cdk/core:stackRelativeExports": true, 20 | "@aws-cdk/aws-rds:lowercaseDbIdentifier": true, 21 | "@aws-cdk/aws-lambda:recognizeVersionProps": true, 22 | "@aws-cdk/aws-lambda:recognizeLayerVersion": true, 23 | "@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2_2021": true, 24 | "@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true, 25 | "@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": true, 26 | "@aws-cdk/core:checkSecretUsage": true, 27 | "@aws-cdk/aws-iam:minimizePolicies": true, 28 | "@aws-cdk/aws-ecs:arnFormatIncludesClusterName": true, 29 | "@aws-cdk/core:validateSnapshotRemovalPolicy": true, 30 | "@aws-cdk/customresources:installLatestAwsSdkDefault": false, 31 | "@aws-cdk/aws-codepipeline:crossAccountKeyAliasStackSafeResourceName": true, 32 | "@aws-cdk/aws-s3:createDefaultLoggingPolicy": true, 33 | "@aws-cdk/aws-sns-subscriptions:restrictSqsDescryption": true, 34 | "@aws-cdk/aws-apigateway:disableCloudWatchRole": true, 35 | "@aws-cdk/core:enablePartitionLiterals": true, 36 | "@aws-cdk/core:target-partitions": [ 37 | "aws", 38 | "aws-cn" 39 | ] 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /ManagementConsole/Infra/src/Constructs/GameLiftBuildAsset.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | using Amazon.CDK.AWS.IAM; 5 | using Amazon.CDK.AWS.S3.Assets; 6 | using Constructs; 7 | 8 | namespace CDK.Constructs 9 | { 10 | public struct GameLiftAssetProps 11 | { 12 | public string AssetPath; 13 | } 14 | 15 | public class GameLiftBuildAsset : Construct 16 | { 17 | public Role Role; 18 | public Asset Asset; 19 | 20 | internal GameLiftBuildAsset(Construct scope, string id, GameLiftAssetProps props) : base(scope, id) 21 | { 22 | Role = new Role(this, "GameLiftBuildRole", new RoleProps 23 | { 24 | AssumedBy = new ServicePrincipal("gamelift.amazonaws.com"), // required 25 | }); 26 | 27 | Asset = new Asset(this, "BuildAsset", new AssetProps 28 | { 29 | Path = props.AssetPath, 30 | }); 31 | 32 | Asset.Bucket.GrantRead(Role, "assets/*"); 33 | 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /ManagementConsole/Infra/src/GlobalSuppressions.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Potential Code Quality Issues", "RECS0026:Possible unassigned object created by 'new'", Justification = "Constructs add themselves to the scope in which they are created")] 5 | -------------------------------------------------------------------------------- /ManagementConsole/Infra/src/Lib/ApiGwLogsStack.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | using Amazon.CDK; 5 | using Amazon.CDK.AWS.APIGateway; 6 | using Amazon.CDK.AWS.IAM; 7 | using Amazon.CDK.AWS.Ecr.Assets; 8 | using Amazon.CDK.AWS.ECS; 9 | using Amazon.CDK.AWS.Events.Targets; 10 | using Amazon.CDK.AWS.Logs; 11 | using Cdklabs.CdkNag; 12 | using Constructs; 13 | 14 | namespace ManagementConsoleInfra.Lib 15 | { 16 | public class ApiGwLogsStack : Stack 17 | { 18 | internal ApiGwLogsStack(Construct scope, string id) : base(scope, id) 19 | { 20 | // Configure Log role for ApiGateway 21 | var apigwLogRole = new Role(this, "apigwLogRole", new RoleProps 22 | { 23 | AssumedBy = new ServicePrincipal("apigateway.amazonaws.com") 24 | }); 25 | apigwLogRole.AddManagedPolicy(ManagedPolicy.FromManagedPolicyArn(this, "ApiGwLogPolicy", "arn:aws:iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs")); 26 | 27 | NagSuppressions.AddResourceSuppressions(apigwLogRole, new INagPackSuppression[] 28 | { 29 | new NagPackSuppression 30 | { 31 | Id = "AwsSolutions-IAM4", 32 | Reason = "Suppress finding for APIGW Log Policy used to create this stack" 33 | }, 34 | }, true); 35 | 36 | var cfnAccount = new CfnAccount(this, "APIGWAccount", new CfnAccountProps 37 | { 38 | CloudWatchRoleArn = apigwLogRole.RoleArn 39 | }); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /ManagementConsole/Infra/src/Lib/SecurityStack.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | using Amazon.CDK; 5 | using Amazon.CDK.AWS.IAM; 6 | using Amazon.CDK.AWS.KMS; 7 | using Constructs; 8 | 9 | namespace ManagementConsoleInfra.Lib 10 | { 11 | public class SecurityProps : StackProps 12 | { 13 | 14 | } 15 | public class SecurityStack : Stack 16 | { 17 | public Key EncryptionKey; 18 | internal SecurityStack(Construct scope, string id, SecurityProps props = null) : base(scope, id, props) 19 | { 20 | EncryptionKey = new Key(this, "AGTTCMK", new KeyProps 21 | { 22 | EnableKeyRotation = true, 23 | }); 24 | EncryptionKey.AddToResourcePolicy(new PolicyStatement(new PolicyStatementProps 25 | { 26 | Effect = Effect.ALLOW, 27 | Resources = new[] {"*"}, 28 | Principals = new [] 29 | { 30 | new ServicePrincipal("logs." + Fn.Ref("AWS::Region") + ".amazonaws.com"), 31 | new ServicePrincipal("apigateway.amazonaws.com"), 32 | }, 33 | Actions = new[] 34 | { 35 | "kms:Encrypt*", 36 | "kms:Decrypt*", 37 | "kms:ReEncrypt*", 38 | "kms:GenerateDataKey*", 39 | "kms:Describe*" 40 | } 41 | })); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /ManagementConsole/Infra/src/ManagementConsoleInfra.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6.0 6 | 7 | Major 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /ManagementConsole/UI/.gitignore: -------------------------------------------------------------------------------- 1 | # System and IDE files 2 | dist/ 3 | Thumbs.db 4 | .DS_Store 5 | .idea 6 | *.suo 7 | *.sublime-project 8 | *.sublime-workspace 9 | static/Config.json 10 | 11 | # Vendors 12 | node_modules 13 | 14 | # Build 15 | /npm-debug.log 16 | -------------------------------------------------------------------------------- /ManagementConsole/UI/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | -------------------------------------------------------------------------------- /ManagementConsole/UI/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "amazon-gamelift-testing-toolkit-management-console", 3 | "version": "1.0.2", 4 | "description": "The Web Management Console for Amazon GameLift Testing Toolkit", 5 | "main": "src/Game.ts", 6 | "scripts": { 7 | "build": "webpack --config webpack/prod.js --output-path ./dist/", 8 | "watch": "webpack serve --config webpack/base.js --output-path ./dist/ --open", 9 | "test-prod": "webpack serve --config webpack/prod.js --output-path ./dist/ --open" 10 | }, 11 | "author": "aws-solution-builders", 12 | "license": "Apache-2.0", 13 | "devDependencies": { 14 | "@aws-amplify/auth": "^4.6.4", 15 | "@babel/core": "^7.7.2", 16 | "@babel/preset-env": "^7.7.1", 17 | "@types/file-saver": "^2.0.5", 18 | "@types/jquery": "^3.5.13", 19 | "@types/jsoneditor": "^9.5.1", 20 | "@types/node": "^14.14.41", 21 | "@types/websocket": "^1.0.2", 22 | "aws-arn-parser": "^1.0.1", 23 | "aws-sdk-js-v3": "aws/aws-sdk-js-v3", 24 | "babel-loader": "^8.2.2", 25 | "clean-webpack-plugin": "^4.0.0-alpha.0", 26 | "copy-webpack-plugin": "^9.0.1", 27 | "datatables.net-bs4": "^1.12.1", 28 | "datatables.net-buttons-bs4": "^2.2.3", 29 | "datatables.net-responsive-bs4": "^2.3.0", 30 | "datatables.net-rowreorder-bs4": "^1.3.1", 31 | "file-loader": "^6.2.0", 32 | "file-saver": "^2.0.5", 33 | "html-webpack-plugin": "^5.3.2", 34 | "jquery": "^3.6.1", 35 | "jsoneditor": "^9.9.0", 36 | "jsonpath": "^1.1.1", 37 | "phaser": "3.55.2", 38 | "phaser3-rex-plugins": "^1.1.66", 39 | "progress-webpack-plugin": "^1.0.16", 40 | "raw-loader": "^4.0.2", 41 | "terser-webpack-plugin": "^5.3.6", 42 | "ts-loader": "^9.2.5", 43 | "typescript": "^4.1.3", 44 | "webfontloader": "^1.6.28", 45 | "webpack": "^5.76.0", 46 | "webpack-cli": "^4.7.2", 47 | "webpack-dev-server": "^4.9.0", 48 | "webpack-merge": "^5.8.0", 49 | "write-file-webpack-plugin": "^4.5.1" 50 | }, 51 | "resolutions": { 52 | "**/escodegen": "^2.1.0" 53 | }, 54 | "engines": { 55 | "node": ">=14" 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /ManagementConsole/UI/src/Config/Config.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'phaser'; 5 | import RoundRectanglePlugin from 'phaser3-rex-plugins/dist/rexroundrectangle.min.js' 6 | 7 | export default { 8 | type: Phaser.AUTO, 9 | backgroundColor: '#ffffff', 10 | scale: { 11 | mode: Phaser.Scale.RESIZE, 12 | parent: 'phaser-example', 13 | width: '100%', 14 | height: '100%' 15 | }, 16 | antialias: true, 17 | dom: { 18 | createContainer: true, 19 | }, 20 | plugins: { 21 | global: [ RoundRectanglePlugin ], 22 | }, 23 | }; -------------------------------------------------------------------------------- /ManagementConsole/UI/src/Data/FlexMatchEventType.ts: -------------------------------------------------------------------------------- 1 | export class FlexMatchEventType 2 | { 3 | public static MATCHMAKING_SEARCHING:string = "MatchmakingSearching"; 4 | public static POTENTIAL_MATCH_CREATED:string = "PotentialMatchCreated"; 5 | public static MATCHMAKING_SUCCEEDED:string = "MatchmakingSucceeded"; 6 | public static MATCHMAKING_TIMED_OUT:string = "MatchmakingTimedOut"; 7 | public static MATCHMAKING_CANCELLED:string = "MatchmakingCancelled"; 8 | public static MATCHMAKING_FAILED:string = "MatchmakingFailed"; 9 | public static ACCEPT_MATCH:string = "AcceptMatch"; 10 | public static ACCEPT_MATCH_COMPLETED:string = "AcceptMatchCompleted"; 11 | 12 | public static failureEvents:string[] = [FlexMatchEventType.MATCHMAKING_CANCELLED, FlexMatchEventType.MATCHMAKING_FAILED, FlexMatchEventType.MATCHMAKING_TIMED_OUT]; 13 | 14 | public static isFailureEvent(eventType:string) 15 | { 16 | return FlexMatchEventType.failureEvents.includes(eventType); 17 | } 18 | } -------------------------------------------------------------------------------- /ManagementConsole/UI/src/Data/QueuePlacementEventType.ts: -------------------------------------------------------------------------------- 1 | export class QueuePlacementEventType 2 | { 3 | public static PLACEMENT_FULFILLED:string = "PlacementFulfilled"; 4 | public static PLACEMENT_CANCELLED:string = "PlacementCancelled"; 5 | public static PLACEMENT_TIMED_OUT:string = "PlacementTimedOut"; 6 | public static PLACEMENT_FAILED:string = "PlacementFailed"; 7 | 8 | public static failureEvents:string[] = [ 9 | QueuePlacementEventType.PLACEMENT_CANCELLED, QueuePlacementEventType.PLACEMENT_TIMED_OUT, QueuePlacementEventType.PLACEMENT_FAILED, 10 | ]; 11 | 12 | public static isFailureEvent(eventType:string) 13 | { 14 | return QueuePlacementEventType.failureEvents.includes(eventType); 15 | } 16 | } -------------------------------------------------------------------------------- /ManagementConsole/UI/src/Data/ScreenResolution.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export class ScreenResolution 5 | { 6 | public static RES_1080P : string = "1080P"; 7 | public static RES_720P : string = "720P"; 8 | 9 | private static _width: number = 1920; 10 | private static _height: number = 1080; 11 | private static _displayResolution: string = "1080P"; 12 | 13 | public static get displayResolution():string 14 | { 15 | return this._displayResolution; 16 | } 17 | 18 | public static get width():number 19 | { 20 | return this._width; 21 | } 22 | 23 | public static get height():number 24 | { 25 | return this._height; 26 | } 27 | 28 | public static set displayResolution (resolution:string) 29 | { 30 | this._displayResolution = resolution; 31 | if (this._displayResolution=="720P") 32 | { 33 | this._width = 1280; 34 | this._height = 720; 35 | } 36 | else 37 | { 38 | this._width = 1920; 39 | this._height = 1080; 40 | } 41 | } 42 | 43 | public static updateUserResolution(width, height) 44 | { 45 | if (width < 1920 || height < 1080) 46 | { 47 | this.displayResolution = ScreenResolution.RES_720P; 48 | } 49 | else 50 | { 51 | this.displayResolution = ScreenResolution.RES_1080P; 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /ManagementConsole/UI/src/Elements/Abstract/SimpleButton.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import "phaser"; 5 | import {EventDispatcher} from "../../Events/EventDispatcher"; 6 | import {Events} from "../../Events/Events"; 7 | import Image = Phaser.GameObjects.Image; 8 | import EventEmitter = Phaser.Events.EventEmitter; 9 | 10 | export abstract class SimpleButton extends Phaser.GameObjects.Container 11 | { 12 | protected _globalEmitter: EventDispatcher; 13 | protected _buttonEmitter: EventEmitter; 14 | public _buttonImage: Image; 15 | protected _over:boolean; 16 | 17 | constructor(scene:Phaser.Scene, x:number, y:number, texture:string) { 18 | super(scene, x, y); 19 | this._globalEmitter = EventDispatcher.getInstance(); 20 | this._buttonImage = this.scene.add.sprite(0,0, "toolkit", texture); 21 | this._buttonImage.setOrigin(0.5, 0.5); 22 | this.add(this._buttonImage); 23 | this.setSize(this._buttonImage.displayWidth, this._buttonImage.displayHeight); 24 | this.onClick = this.onClick.bind(this); 25 | this.onOver = this.onOver.bind(this); 26 | this.onOut = this.onOut.bind(this); 27 | this._buttonImage.setInteractive({ cursor: 'pointer' }).on('pointerdown', this.onClick); 28 | this._buttonImage.setInteractive({ cursor: 'pointer' }).on('pointerover', this.onOver); 29 | this._buttonImage.setInteractive({ cursor: 'pointer' }).on('pointerout', this.onOut); 30 | this._buttonEmitter = new EventEmitter(); 31 | this._over=false; 32 | } 33 | 34 | public get buttonEmitter():EventEmitter 35 | { 36 | return this._buttonEmitter; 37 | } 38 | 39 | public enable() 40 | { 41 | this._buttonImage.input.enabled=true; 42 | } 43 | 44 | public disable() 45 | { 46 | this._buttonImage.input.enabled=false; 47 | } 48 | 49 | public onClick (pointer, localX, localY, event) 50 | { 51 | event.stopPropagation(); 52 | this._globalEmitter.emit(Events.CLOSE_MENUS); 53 | this._buttonEmitter.emit(Events.CLICK); 54 | } 55 | 56 | public onOver(pointer, localX, localY, event) 57 | { 58 | if (this._over==false) 59 | { 60 | this._over=true; 61 | this._buttonEmitter.emit(Events.OVER); 62 | } 63 | } 64 | 65 | public onOut(pointer, localX, localY, event) 66 | { 67 | this._over=false; 68 | this._buttonEmitter.emit(Events.OUT); 69 | } 70 | 71 | 72 | } -------------------------------------------------------------------------------- /ManagementConsole/UI/src/Elements/Buttons/FleetLocationButton.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import "phaser"; 5 | import {SimpleButton} from "../Abstract/SimpleButton"; 6 | 7 | export class FleetLocationButton extends SimpleButton 8 | { 9 | constructor(scene:Phaser.Scene, x:number, y:number) { 10 | super(scene, x, y, "location.png"); 11 | } 12 | 13 | public onClick (pointer, localX, localY, event) 14 | { 15 | event.stopPropagation(); 16 | } 17 | } -------------------------------------------------------------------------------- /ManagementConsole/UI/src/Elements/Buttons/FleetMenuButton.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import "phaser"; 5 | import {Events} from "../../Events/Events"; 6 | import {SimpleButton} from "../Abstract/SimpleButton"; 7 | 8 | export class FleetMenuButton extends SimpleButton 9 | { 10 | constructor(scene:Phaser.Scene, x:number, y:number) { 11 | super(scene, x, y, "cog.png"); 12 | } 13 | 14 | public onClick (pointer, localX, localY, event) 15 | { 16 | event.stopPropagation(); 17 | this._globalEmitter.emit(Events.CLOSE_MENUS); 18 | this._globalEmitter.emit(Events.CLOSE_POPUP); 19 | this._buttonEmitter.emit(Events.CLICK); 20 | } 21 | } -------------------------------------------------------------------------------- /ManagementConsole/UI/src/Elements/Buttons/MatchmakingConfigMenuButton.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import "phaser"; 5 | import {Events} from "../../Events/Events"; 6 | import {SimpleButton} from "../Abstract/SimpleButton"; 7 | 8 | export class MatchmakingConfigMenuButton extends SimpleButton 9 | { 10 | constructor(scene:Phaser.Scene, x:number, y:number) { 11 | super(scene, x, y, "cog.png"); 12 | } 13 | 14 | public onClick (pointer, localX, localY, event) 15 | { 16 | event.stopPropagation(); 17 | this._globalEmitter.emit(Events.CLOSE_MENUS); 18 | this._globalEmitter.emit(Events.CLOSE_POPUP); 19 | this._buttonEmitter.emit(Events.CLICK); 20 | } 21 | } -------------------------------------------------------------------------------- /ManagementConsole/UI/src/Elements/Buttons/QueueMenuButton.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import "phaser"; 5 | import {Events} from "../../Events/Events"; 6 | import {SimpleButton} from "../Abstract/SimpleButton"; 7 | 8 | export class QueueMenuButton extends SimpleButton 9 | { 10 | constructor(scene:Phaser.Scene, x:number, y:number) { 11 | super(scene, x, y, "cog.png"); 12 | } 13 | 14 | public onClick (pointer, localX, localY, event) 15 | { 16 | event.stopPropagation(); 17 | this._globalEmitter.emit(Events.CLOSE_MENUS); 18 | this._globalEmitter.emit(Events.CLOSE_POPUP); 19 | this._buttonEmitter.emit(Events.CLICK); 20 | } 21 | } -------------------------------------------------------------------------------- /ManagementConsole/UI/src/Elements/Buttons/SettingsButton.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import "phaser"; 5 | import {Events} from "../../Events/Events"; 6 | import {SimpleButton} from "../Abstract/SimpleButton"; 7 | 8 | export class SettingsButton extends SimpleButton 9 | { 10 | constructor(scene:Phaser.Scene, x:number, y:number) { 11 | super(scene, x, y, "cog.png"); 12 | } 13 | 14 | public onClick (pointer, localX, localY, event) 15 | { 16 | event.stopPropagation(); 17 | this._globalEmitter.emit(Events.OPEN_SETTINGS); 18 | } 19 | } -------------------------------------------------------------------------------- /ManagementConsole/UI/src/Elements/Buttons/ToggleAnimationButton.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import "phaser"; 5 | import {Events} from "../../Events/Events"; 6 | import {ToggleButton} from "../Abstract/ToggleButton"; 7 | 8 | export class ToggleAnimationButton extends ToggleButton 9 | { 10 | constructor(scene:Phaser.Scene, x:number, y:number, animationsEnabled:boolean) { 11 | super(scene, x, y, "animationon.png", "animationoff.png", !animationsEnabled); 12 | } 13 | 14 | public onClick (pointer, localX, localY, event) 15 | { 16 | super.onClick(pointer, localX, localY, event); 17 | event.stopPropagation(); 18 | if (this._toggled) 19 | { 20 | this._globalEmitter.emit(Events.DISABLE_ANIMATIONS); 21 | } 22 | else 23 | { 24 | this._globalEmitter.emit(Events.ENABLE_ANIMATIONS); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /ManagementConsole/UI/src/Elements/Menus/LocationPopover.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import {SimpleMenu} from "../Abstract/SimpleMenu"; 5 | import {FleetLocationButton} from "../Buttons/FleetLocationButton"; 6 | import {Events} from "../../Events/Events"; 7 | import {Fleet} from "../Fleet"; 8 | 9 | export class LocationPopover extends SimpleMenu { 10 | 11 | protected _fleet:Fleet; 12 | protected _html:string = '
'; 13 | 14 | constructor(scene:Phaser.Scene, x:number, y:number, fleet:Fleet) { 15 | super(scene, x, y); 16 | 17 | this._fleet = fleet; 18 | let button = new FleetLocationButton(scene, 0, 0); 19 | button.scale=0.35 20 | this.setButton(button); 21 | this.setSize(button.displayWidth, button.displayHeight); 22 | 23 | this.onMenuButtonClick = this.onMenuButtonClick.bind(this); 24 | this.showPopover = this.showPopover.bind(this); 25 | this.hideMenu = this.hideMenu.bind(this); 26 | this._button.buttonEmitter.on(Events.OVER, this.showPopover); 27 | this._button.buttonEmitter.on(Events.OUT, this.hideMenu); 28 | 29 | 30 | this._globalEmitter.on(Events.CLOSE_MENUS, this.hideMenu); 31 | 32 | this.handleClick = this.handleClick.bind(this); 33 | } 34 | 35 | showPopover() 36 | { 37 | this.showMenu("right"); 38 | } 39 | 40 | buildMenu() 41 | { 42 | const locations=[]; 43 | this._fleet.Data.LocationAttributes.map((locationAttribute)=> 44 | { 45 | locations.push(locationAttribute.LocationState.Location + " (" + locationAttribute.LocationState.Status.Value + ")"); 46 | }) 47 | 48 | this.element.find('.locationPopover').append('

' + locations.join('
') + '

'); 49 | } 50 | 51 | handleClick(className: string) { 52 | switch (className) 53 | { 54 | default: 55 | this.menuEmitter.emit(className, this._fleet); 56 | break; 57 | } 58 | 59 | this.hideMenu(); 60 | } 61 | } -------------------------------------------------------------------------------- /ManagementConsole/UI/src/Elements/Pages/PageManager.ts: -------------------------------------------------------------------------------- 1 | import {Popup} from "../Abstract/Popup"; 2 | import {Page} from "../Abstract/Page"; 3 | 4 | export class PageManager 5 | { 6 | protected static _pages: Record={}; 7 | protected static _currentPageName: string=null; 8 | 9 | public static resetPages() 10 | { 11 | Object.values(this._pages).map(page=>page.hidePage()); 12 | this._pages = {}; 13 | } 14 | 15 | public static get pageNames() 16 | { 17 | return Object.keys(this._pages); 18 | } 19 | 20 | public static get pages() 21 | { 22 | return Object.values(this._pages); 23 | } 24 | 25 | public static registerPage(page:Page) 26 | { 27 | if (page!=null) 28 | { 29 | this._pages[page.domId] = page; 30 | } 31 | 32 | return page; 33 | } 34 | 35 | public static getCurrentPage() 36 | { 37 | return this._pages[this._currentPageName]; 38 | } 39 | 40 | public static switchPage(pageName:string, pageData:any=null) 41 | { 42 | if (this._pages[pageName]!=null) 43 | { 44 | this.pages.map(page=>page.hidePage()); 45 | this._pages[pageName].setPageData(pageData); 46 | this._pages[pageName].showPage(); 47 | this._currentPageName = pageName; 48 | } 49 | } 50 | 51 | public static showPage() 52 | { 53 | 54 | } 55 | 56 | } -------------------------------------------------------------------------------- /ManagementConsole/UI/src/Elements/Pages/Pages.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export class Pages 5 | { 6 | public static SIMULATE_MATCHMAKING_SIMULATIONS: string = "simulateMatchmakingSimulationsPage"; 7 | public static SIMULATE_MATCHMAKING_FORM: string = "simulateMatchmakingFormPage"; 8 | public static SIMULATE_MATCHMAKING_OUTPUT: string = "simulateMatchmakingOutputPage"; 9 | public static SIMULATE_MATCHMAKING_RESULTS: string = "simulateMatchmakingResultsPage"; 10 | public static SIMULATE_MATCHMAKING_TICKETS: string = "simulateMatchmakingTicketsPage"; 11 | public static SIMULATE_MATCHMAKING_FAILED_TICKETS: string = "simulateMatchmakingFailedTicketsPage"; 12 | public static SIMULATE_MATCHMAKING_MATCH_INFO: string = "simulateMatchmakingMatchInfoPage"; 13 | 14 | public static VIRTUAL_PLAYER_LAUNCH_REQUESTS: string = "virtualPlayerLaunchRequestsPage"; 15 | public static VIRTUAL_PLAYER_LAUNCH_REQUEST_TASKS: string = "virtualPlayerLaunchRequestTasksPage"; 16 | public static VIRTUAL_PLAYER_LAUNCH_REQUEST_TASK_LOGS: string = "virtualPlayerLaunchRequestTaskLogsPage"; 17 | 18 | public static VIRTUAL_PLAYER_TASK_SCHEDULES_TABLE: string = "virtualPlayerTaskSchedulesTablePage"; 19 | public static VIRTUAL_PLAYER_TASK_SCHEDULE_VIEW: string = "virtualPlayerTaskScheduleViewPage"; 20 | public static VIRTUAL_PLAYER_TASK_SCHEDULES_FORM: string = "virtualPlayerTaskSchedulesFormPage"; 21 | public static VIRTUAL_PLAYER_TASKS_OVERVIEW: string = "virtualPlayerTasksOverviewPage"; 22 | public static VIRTUAL_PLAYER_TASKS_LAUNCH: string = "virtualPlayerTasksLaunchPage"; 23 | } -------------------------------------------------------------------------------- /ManagementConsole/UI/src/Elements/Popups/SimpleJsonPopup.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'phaser'; 5 | import {Popup} from "../Abstract/Popup"; 6 | import JSONEditor, {JSONEditorOptions} from "jsoneditor"; 7 | 8 | export class SimpleJsonPopup extends Popup 9 | { 10 | protected _title : string; 11 | 12 | constructor (scene:Phaser.Scene, x:number, y:number, title:string="") 13 | { 14 | super(scene, x, y); 15 | this._htmlName="simpleJsonPopup"; 16 | this._title = title; 17 | this.setupEventListeners(); 18 | } 19 | 20 | setPopupData(data:any) 21 | { 22 | const container = $("#simpleJson")[0]; 23 | $(".title").html(this._title); 24 | 25 | const options:JSONEditorOptions = {mode:"view"} 26 | const editor = new JSONEditor(container, options); 27 | 28 | editor.set(data); 29 | editor.expandAll(); 30 | } 31 | 32 | resetJson() 33 | { 34 | this.element.find("#simpleJson").html(""); 35 | } 36 | } -------------------------------------------------------------------------------- /ManagementConsole/UI/src/Elements/RoundedRectangle.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import "phaser"; 5 | import RoundRectangle from "phaser3-rex-plugins/plugins/gameobjects/shape/roundrectangle/RoundRectangle"; 6 | 7 | export class RoundedRectangle extends RoundRectangle 8 | { 9 | protected _color:number = 0; 10 | protected _radius:number; 11 | 12 | constructor(scene, x, y, width, height, color:number, radius:number=8) { 13 | super(scene, x, y, width, height, radius, color); 14 | 15 | this._color = color; 16 | this._radius = radius; 17 | } 18 | 19 | updateColor(color:number) 20 | { 21 | this.fillColor = color; 22 | } 23 | 24 | drawRectangle(width:number, height:number, color:number=null) 25 | { 26 | this.width = width; 27 | this.height = height; 28 | if (color!=null) 29 | { 30 | this.fillColor = color; 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /ManagementConsole/UI/src/Elements/Settings/SettingsForm.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import {EventDispatcher} from "../../Events/EventDispatcher"; 5 | import DOMElement = Phaser.GameObjects.DOMElement; 6 | 7 | export abstract class SettingsForm extends Phaser.GameObjects.Container 8 | { 9 | protected _element: DOMElement; 10 | protected _emitter: EventDispatcher; 11 | 12 | constructor (scene:Phaser.Scene, x:number, y:number, htmlName:string) 13 | { 14 | super(scene, x, y); 15 | this._emitter = EventDispatcher.getInstance(); 16 | 17 | this._element = this.scene.add.dom(0, 0).createFromCache(htmlName); 18 | this.add(this._element); 19 | this._element.setOrigin(0,0); 20 | this._element.y=5; 21 | this._element.setPerspective(800); 22 | 23 | this.setVisible(false); 24 | } 25 | 26 | public show() 27 | { 28 | this._element.setInteractive(); 29 | this._element.addListener("click"); 30 | this._element.on('click', this.onClick); 31 | this.setVisible(true); 32 | } 33 | 34 | public hide() 35 | { 36 | this.setVisible(false); 37 | } 38 | 39 | protected onClick = (event) => 40 | { 41 | event.stopPropagation(); 42 | }; 43 | } -------------------------------------------------------------------------------- /ManagementConsole/UI/src/Elements/SubPopups/SimulateMatchmakingSubPopup.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'phaser'; 5 | import {DataTypes} from "../../Data/DataTypes"; 6 | import {SubPopup} from "../Abstract/SubPopup"; 7 | import {PageManager} from "../Pages/PageManager"; 8 | import {SimulateMatchmakingOutputPage} from "../Pages/SimulateMatchmakingOutputPage"; 9 | import {SimulateMatchmakingFormPage} from "../Pages/SimulateMatchmakingFormPage"; 10 | import {SimulateMatchmakingSimulationsPage} from "../Pages/SimulateMatchmakingSimulationsPage"; 11 | import {SimulateMatchmakingTicketsPage} from "../Pages/SimulateMatchmakingTicketsPage"; 12 | import {SimulateMatchmakingResultsPage} from "../Pages/SimulateMatchmakingResultsPage"; 13 | import {SimulateMatchmakingMatchInfoPage} from "../Pages/SimulateMatchmakingMatchInfoPage"; 14 | import {SimulateMatchmakingFailedTicketsPage} from "../Pages/SimulateMatchmakingFailedTicketsPage"; 15 | import {SubPopups} from "./SubPopups"; 16 | 17 | export class SimulateMatchmakingSubPopup extends SubPopup 18 | { 19 | public static id = SubPopups.SIMULATE_MATCHMAKING_SUB_POPUP; 20 | public static cacheKey = this.id; 21 | 22 | public constructor () 23 | { 24 | super(SimulateMatchmakingSubPopup.cacheKey, SimulateMatchmakingSubPopup.id); 25 | } 26 | 27 | refresh = ()=> 28 | { 29 | PageManager.resetPages(); 30 | 31 | let simulationsPage = PageManager.registerPage(new SimulateMatchmakingSimulationsPage()); 32 | PageManager.registerPage(new SimulateMatchmakingFormPage(simulationsPage)); 33 | 34 | let outputPage = PageManager.registerPage(new SimulateMatchmakingOutputPage(simulationsPage)); 35 | PageManager.registerPage(new SimulateMatchmakingTicketsPage(outputPage)); 36 | 37 | let resultsPage = PageManager.registerPage(new SimulateMatchmakingResultsPage(outputPage)); 38 | PageManager.registerPage(new SimulateMatchmakingMatchInfoPage(resultsPage)); 39 | PageManager.registerPage(new SimulateMatchmakingFailedTicketsPage(resultsPage)); 40 | 41 | PageManager.switchPage(SimulateMatchmakingSimulationsPage.id); 42 | 43 | this.hideStatusAlert(); 44 | } 45 | 46 | resetTable() 47 | { 48 | this.resetElement(".simulateMatchmakingTableContainer"); 49 | } 50 | 51 | onPopupClick = async (event) => { 52 | event.stopPropagation(); 53 | let el = $(event.target); 54 | PageManager.getCurrentPage().onPopupClick(event); 55 | } 56 | } -------------------------------------------------------------------------------- /ManagementConsole/UI/src/Elements/SubPopups/SubPopups.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export class SubPopups 5 | { 6 | public static SIMULATE_MATCHMAKING_SUB_POPUP: string = "simulateMatchmakingSubPopup"; 7 | public static PLAYER_PROFILES_SUB_POPUP: string = "configurePlayerProfilesSubPopup"; 8 | public static LATENCY_PROFILES_SUB_POPUP: string = "configureLatencyProfilesSubPopup"; 9 | public static MANAGE_RULE_SETS_SUB_POPUP: string = "manageRuleSetsSubPopup"; 10 | 11 | public static QUEUE_SETTINGS_SUB_POPUP: string = "queueSettingsSubPopup"; 12 | public static QUEUE_PLACEMENT_PRIORITY_SUB_POPUP: string = "queuePlacementPrioritySubPopup"; 13 | public static QUEUE_DESTINATION_ORDER_SUB_POPUP: string = "queueDestinationOrderSubPopup"; 14 | public static RULE_SET_BUILDER_SUB_POPUP: string = "ruleSetBuilderSubPopup"; 15 | 16 | public static VIRTUAL_PLAYER_TASKS_OVERVIEW_SUB_POPUP: string = "virtualPlayerTasksOverviewSubPopup"; 17 | public static VIRTUAL_PLAYER_TASKS_LAUNCH_SUB_POPUP: string = "virtualPlayerTasksLaunchSubPopup"; 18 | public static VIRTUAL_PLAYER_TASKS_RUNNING_SUB_POPUP: string = "virtualPlayerTasksRunningSubPopup"; 19 | public static VIRTUAL_PLAYER_TASKS_SCHEDULES_SUB_POPUP: string = "virtualPlayerTasksSchedulesSubPopup"; 20 | public static VIRTUAL_PLAYER_TASKS_LAUNCH_REQUESTS_SUB_POPUP: string = "virtualPlayerTaskLaunchRequestsSubPopup"; 21 | } -------------------------------------------------------------------------------- /ManagementConsole/UI/src/Elements/SubPopups/VirtualPlayerLaunchRequestsSubPopup.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'phaser'; 5 | import {SubPopup} from "../Abstract/SubPopup"; 6 | import {PageManager} from "../Pages/PageManager"; 7 | import {VirtualPlayerLaunchRequestsPage} from "../Pages/VirtualPlayerLaunchRequestsPage"; 8 | import {VirtualPlayerLaunchRequestTasksPage} from "../Pages/VirtualPlayerLaunchRequestTasksPage"; 9 | import {VirtualPlayerLaunchRequestTaskLogsPage} from "../Pages/VirtualPlayerLaunchRequestTaskLogsPage"; 10 | import {SubPopups} from "./SubPopups"; 11 | 12 | export class VirtualPlayerLaunchRequestsSubPopup extends SubPopup 13 | { 14 | public static id = SubPopups.VIRTUAL_PLAYER_TASKS_LAUNCH_REQUESTS_SUB_POPUP; 15 | public static cacheKey = this.id; 16 | 17 | public constructor () 18 | { 19 | super(VirtualPlayerLaunchRequestsSubPopup.cacheKey, VirtualPlayerLaunchRequestsSubPopup.id); 20 | } 21 | 22 | refresh = ()=> 23 | { 24 | PageManager.resetPages(); 25 | 26 | let launchRequestsPage = PageManager.registerPage(new VirtualPlayerLaunchRequestsPage()); 27 | let launchRequestTasksPage = PageManager.registerPage(new VirtualPlayerLaunchRequestTasksPage(launchRequestsPage)); 28 | PageManager.registerPage(new VirtualPlayerLaunchRequestTaskLogsPage(launchRequestTasksPage)); 29 | 30 | PageManager.switchPage(VirtualPlayerLaunchRequestsPage.id); 31 | 32 | this.hideStatusAlert(); 33 | } 34 | 35 | onPopupClick = async (event) => { 36 | event.stopPropagation(); 37 | let el = $(event.target); 38 | PageManager.getCurrentPage().onPopupClick(event); 39 | } 40 | } -------------------------------------------------------------------------------- /ManagementConsole/UI/src/Elements/SubPopups/VirtualPlayerTasksLaunchSubPopup.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'phaser'; 5 | import {SubPopup} from "../Abstract/SubPopup"; 6 | import {PageManager} from "../Pages/PageManager"; 7 | import {VirtualPlayerTasksLaunchPage} from "../Pages/VirtualPlayerTasksLaunchPage"; 8 | import {SubPopups} from "./SubPopups"; 9 | 10 | export class VirtualPlayerTasksLaunchSubPopup extends SubPopup 11 | { 12 | public static id = SubPopups.VIRTUAL_PLAYER_TASKS_LAUNCH_SUB_POPUP; 13 | public static cacheKey = this.id; 14 | 15 | public constructor () 16 | { 17 | super(VirtualPlayerTasksLaunchSubPopup.cacheKey, VirtualPlayerTasksLaunchSubPopup.id); 18 | } 19 | 20 | refresh = ()=> 21 | { 22 | PageManager.resetPages(); 23 | PageManager.registerPage(new VirtualPlayerTasksLaunchPage()); 24 | 25 | PageManager.switchPage(VirtualPlayerTasksLaunchPage.id); 26 | this.hideStatusAlert(); 27 | } 28 | 29 | onPopupClick = async (event) => { 30 | event.stopPropagation(); 31 | let el = $(event.target); 32 | PageManager.getCurrentPage().onPopupClick(event); 33 | } 34 | } -------------------------------------------------------------------------------- /ManagementConsole/UI/src/Elements/SubPopups/VirtualPlayerTasksOverviewSubPopup.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'phaser'; 5 | import {SubPopup} from "../Abstract/SubPopup"; 6 | import {PageManager} from "../Pages/PageManager"; 7 | import {VirtualPlayerTasksOverviewPage} from "../Pages/VirtualPlayerTasksOverviewPage"; 8 | import {SubPopups} from "./SubPopups"; 9 | 10 | export class VirtualPlayerTasksOverviewSubPopup extends SubPopup 11 | { 12 | public static id = SubPopups.VIRTUAL_PLAYER_TASKS_OVERVIEW_SUB_POPUP; 13 | public static cacheKey = this.id; 14 | 15 | public constructor () 16 | { 17 | super(VirtualPlayerTasksOverviewSubPopup.cacheKey, VirtualPlayerTasksOverviewSubPopup.id); 18 | } 19 | 20 | refresh = ()=> 21 | { 22 | PageManager.resetPages(); 23 | 24 | let overviewPage = PageManager.registerPage(new VirtualPlayerTasksOverviewPage()); 25 | 26 | PageManager.switchPage(VirtualPlayerTasksOverviewPage.id); 27 | 28 | this.hideStatusAlert(); 29 | } 30 | 31 | onPopupClick = async (event) => { 32 | event.stopPropagation(); 33 | let el = $(event.target); 34 | PageManager.getCurrentPage().onPopupClick(event); 35 | } 36 | } -------------------------------------------------------------------------------- /ManagementConsole/UI/src/Elements/SubPopups/VirtualPlayerTasksSchedulesSubPopup.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'phaser'; 5 | import {SubPopup} from "../Abstract/SubPopup"; 6 | import {PageManager} from "../Pages/PageManager"; 7 | import {VirtualPlayerTaskSchedulesTablePage} from "../Pages/VirtualPlayerTaskSchedulesTablePage"; 8 | import {VirtualPlayerTaskSchedulesFormPage} from "../Pages/VirtualPlayerTaskSchedulesFormPage"; 9 | import {SubPopups} from "./SubPopups"; 10 | import {VirtualPlayerTaskScheduleViewPage} from "../Pages/VirtualPlayerTaskScheduleViewPage"; 11 | 12 | export class VirtualPlayerTasksSchedulesSubPopup extends SubPopup 13 | { 14 | public static id = SubPopups.VIRTUAL_PLAYER_TASKS_SCHEDULES_SUB_POPUP; 15 | public static cacheKey = this.id; 16 | 17 | public constructor () 18 | { 19 | super(VirtualPlayerTasksSchedulesSubPopup.cacheKey, VirtualPlayerTasksSchedulesSubPopup.id); 20 | } 21 | 22 | 23 | refresh = ()=> 24 | { 25 | PageManager.resetPages(); 26 | 27 | let schedulesTablePage = PageManager.registerPage(new VirtualPlayerTaskSchedulesTablePage()); 28 | PageManager.registerPage(new VirtualPlayerTaskSchedulesFormPage(schedulesTablePage)); 29 | PageManager.registerPage(new VirtualPlayerTaskScheduleViewPage(schedulesTablePage)); 30 | 31 | PageManager.switchPage(VirtualPlayerTaskSchedulesTablePage.id); 32 | 33 | this.hideStatusAlert(); 34 | } 35 | 36 | onPopupClick = async (event) => { 37 | event.stopPropagation(); 38 | let el = $(event.target); 39 | PageManager.getCurrentPage().onPopupClick(event); 40 | } 41 | } -------------------------------------------------------------------------------- /ManagementConsole/UI/src/Events/EventDispatcher.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export class EventDispatcher extends Phaser.Events.EventEmitter 5 | { 6 | protected static instance:EventDispatcher = null; 7 | 8 | constructor() { 9 | super(); 10 | } 11 | 12 | static getInstance() { 13 | if (EventDispatcher.instance == null) { 14 | EventDispatcher.instance = new EventDispatcher(); 15 | } 16 | return EventDispatcher.instance; 17 | } 18 | } -------------------------------------------------------------------------------- /ManagementConsole/UI/src/Events/PopupClickEvent.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export class PopupClickEvent 5 | { 6 | public gameObject:any; 7 | public localX:any; 8 | public localY:any; 9 | 10 | constructor (gameObject:any, localX:any=null, localY:any=null) 11 | { 12 | this.gameObject = gameObject; 13 | this.localX = localX; 14 | this.localY = localY; 15 | } 16 | } -------------------------------------------------------------------------------- /ManagementConsole/UI/src/Game.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import jQuery from 'jquery'; 5 | // export for others scripts to use 6 | window.$ = window.jQuery = jQuery; 7 | 8 | import 'phaser'; 9 | import {ConsoleScene} from './Scenes/ConsoleScene' 10 | import {LoginScene} from './Scenes/LoginScene' 11 | import {Network} from './Network/Network' 12 | import config from './Config/Config' 13 | import {BootScene} from "./Scenes/BootScene"; 14 | import {PreloaderScene} from "./Scenes/PreloaderScene"; 15 | 16 | var dt = require( 'datatables.net' ); 17 | require( 'datatables.net-buttons-bs4' ); 18 | require( 'datatables.net-buttons/js/buttons.colVis.js' ); 19 | require( 'datatables.net-buttons/js/buttons.html5.js' ); 20 | require( 'datatables.net-responsive-bs4' ); 21 | require( 'datatables.net-rowreorder-bs4' ); 22 | 23 | declare const window: any; 24 | 25 | export class Game extends Phaser.Game { 26 | 27 | public network : Network; 28 | public static debugMode: boolean = false; 29 | public static game:Phaser.Game; 30 | 31 | constructor () { 32 | super(config); 33 | 34 | Game.game = this; 35 | 36 | this.network = new Network(); 37 | 38 | this.scene.add('Boot', BootScene); 39 | this.scene.add('Preloader', PreloaderScene); 40 | this.scene.add('Login', LoginScene); 41 | this.scene.add('Console', ConsoleScene.getInstance()); 42 | this.scene.start('Boot'); 43 | 44 | document.onkeydown = this.handleKeyboard; 45 | } 46 | 47 | handleKeyboard = (keyEvent) => { 48 | if (keyEvent.altKey && keyEvent.code=="KeyD") 49 | { 50 | if (Game.debugMode) 51 | { 52 | console.log("-- DISABLING DEBUG MODE --"); 53 | } 54 | Game.debugMode = !Game.debugMode; 55 | if (Game.debugMode) 56 | { 57 | console.log("-- ENABLING DEBUG MODE --"); 58 | } 59 | } 60 | } 61 | } 62 | 63 | (function(){ 64 | var realConsoleLog = console.log; 65 | console.log = function() { 66 | if (Game.debugMode) 67 | { 68 | realConsoleLog.apply(console, arguments); 69 | } 70 | } 71 | })(); 72 | 73 | window.game = new Game(); 74 | -------------------------------------------------------------------------------- /ManagementConsole/UI/src/Network/MultipartMessageHandler.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'phaser'; 5 | import {EventDispatcher} from '../Events/EventDispatcher'; 6 | import {Events} from '../Events/Events'; 7 | import {DataTypes} from "../Data/DataTypes"; 8 | import MultipartMessage = DataTypes.MultipartMessage; 9 | 10 | export class MultipartMessageHandler 11 | { 12 | protected messages:Record; 13 | protected emitter:EventDispatcher; 14 | 15 | constructor() { 16 | this.emitter = EventDispatcher.getInstance(); 17 | this.messages = {}; 18 | } 19 | 20 | public addMessage(msg:MultipartMessage) 21 | { 22 | if (this.messages[msg.MessageId]==null) 23 | { 24 | this.messages[msg.MessageId] = []; 25 | } 26 | 27 | this.messages[msg.MessageId].push(msg); 28 | 29 | if (msg.TotalParts==this.messages[msg.MessageId].length) 30 | { 31 | this.messages[msg.MessageId].sort((a, b) => a.PartNumber < b.PartNumber ? -1 : a.PartNumber > b.PartNumber ? 1 : 0); 32 | let fullJson=""; 33 | this.messages[msg.MessageId].map((message)=> 34 | { 35 | fullJson += message.Payload; 36 | }) 37 | 38 | let obj = JSON.parse(fullJson); 39 | this.emitter.emit(Events.SOCKET_MESSAGE, obj); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /ManagementConsole/UI/src/Scenes/BootScene.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import 'phaser'; 5 | import {Utils} from "../Utils/Utils"; 6 | import { Auth } from '@aws-amplify/auth'; 7 | import Amplify from '@aws-amplify/core'; 8 | 9 | export class BootScene extends Phaser.Scene { 10 | constructor () { 11 | super('Boot'); 12 | } 13 | 14 | preload () { 15 | this.load.json('configJson', 'Config.json'); 16 | 17 | } 18 | 19 | async create () { 20 | let configObj = this.game.cache.json.get("configJson"); 21 | 22 | Amplify.configure({ 23 | Auth: { 24 | 25 | // REQUIRED - Amazon Cognito Region 26 | region: configObj["Region"], 27 | 28 | // OPTIONAL - Amazon Cognito User Pool ID 29 | userPoolId: configObj["UserPoolId"], 30 | 31 | // OPTIONAL - Amazon Cognito Web Client ID (26-char alphanumeric string) 32 | userPoolWebClientId: configObj["AppClientId"], 33 | 34 | // REQUIRED only for Federated Authentication - Amazon Cognito Identity Pool ID 35 | identityPoolId: configObj["IdentityPoolId"], 36 | 37 | // OPTIONAL - Manually set the authentication flow type. Default is 'USER_SRP_AUTH' 38 | //authenticationFlowType: 'USER_PASSWORD_AUTH', 39 | 40 | // OPTIONAL - Hosted UI configuration 41 | oauth: { 42 | domain: configObj["CognitoDomain"], 43 | scope: ['phone', 'email', 'profile', 'openid', 'aws.cognito.signin.user.admin'], 44 | redirectSignIn: window.location.protocol + "//" + window.location.host, 45 | redirectSignOut: window.location.protocol + "//" + window.location.host, 46 | responseType: 'code' // or 'token', note that REFRESH token will only be generated when the responseType is code 47 | } 48 | } 49 | }); 50 | 51 | const code = Utils.getParameterByName("code"); 52 | if (code==null) 53 | { 54 | Auth.federatedSignIn(); 55 | return; 56 | } 57 | else 58 | { 59 | await Auth.currentAuthenticatedUser(); 60 | this.scene.start('Preloader'); 61 | } 62 | } 63 | } -------------------------------------------------------------------------------- /ManagementConsole/UI/src/Utils/Utils.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export class Utils 5 | { 6 | public static secondsToDuration = function (durationSeconds:number):string 7 | { 8 | const hours = Math.floor(durationSeconds / 3600); 9 | const minutes = Math.floor((durationSeconds - (hours * 3600)) / 60); 10 | const seconds = durationSeconds - (hours * 3600) - (minutes * 60); 11 | 12 | let result=""; 13 | if (hours > 0) 14 | { 15 | result += hours + " hours, "; 16 | } 17 | if (minutes > 0) { 18 | result += minutes + " mins, "; 19 | } 20 | 21 | result += seconds + " seconds"; 22 | return result; 23 | } 24 | 25 | public static formatMinutes(minutes) 26 | { 27 | const hrs = Math.floor(minutes / 60); 28 | const mins = (minutes % 60); 29 | 30 | const hourStr = (hrs<10) ? "0" + hrs : hrs; 31 | const minStr = (mins<10) ? "0" + mins : mins; 32 | 33 | return hourStr + ":" + minStr; 34 | } 35 | 36 | public static getParameterByName(name, url = window.location.href) { 37 | name = name.replace(/[\[\]]/g, '\\$&'); 38 | var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'), 39 | results = regex.exec(url); 40 | if (!results) return null; 41 | if (!results[2]) return ''; 42 | return decodeURIComponent(results[2].replace(/\+/g, ' ')); 43 | } 44 | 45 | public static getPlayerAttributeText(playerAttribute) 46 | { 47 | if (playerAttribute==undefined) 48 | { 49 | return "-"; 50 | } 51 | if (playerAttribute["S"]!=null) 52 | { 53 | return playerAttribute["S"]; 54 | } 55 | 56 | if (playerAttribute["SL"].length>0) 57 | { 58 | return playerAttribute["SL"].join(", "); 59 | } 60 | 61 | if (Object.keys(playerAttribute["SDM"]).length) 62 | { 63 | let mapText=""; 64 | Object.keys(playerAttribute["SDM"]).map(key=> 65 | { 66 | mapText+=key + ":" + playerAttribute["SDM"][key] + ", "; 67 | }); 68 | 69 | mapText = mapText.slice(0,mapText.length-2); 70 | return mapText; 71 | } 72 | 73 | return playerAttribute["N"]; 74 | 75 | } 76 | } 77 | 78 | -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/animationoff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/static/assets/animationoff.png -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/animationon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/static/assets/animationon.png -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/backbutton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/static/assets/backbutton.png -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/characters/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/static/assets/characters/1.png -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/characters/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/static/assets/characters/10.png -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/characters/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/static/assets/characters/11.png -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/characters/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/static/assets/characters/12.png -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/characters/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/static/assets/characters/13.png -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/characters/14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/static/assets/characters/14.png -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/characters/15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/static/assets/characters/15.png -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/characters/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/static/assets/characters/16.png -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/characters/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/static/assets/characters/2.png -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/characters/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/static/assets/characters/3.png -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/characters/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/static/assets/characters/4.png -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/characters/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/static/assets/characters/5.png -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/characters/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/static/assets/characters/6.png -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/characters/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/static/assets/characters/7.png -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/characters/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/static/assets/characters/8.png -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/characters/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/static/assets/characters/9.png -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/closebutton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/static/assets/closebutton.png -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/cog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/static/assets/cog.png -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/gtlogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/static/assets/gtlogo.png -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/fragments/playerLatencyPolicyTemplate.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Period Start

4 | seconds 5 |
6 |
7 |

Period End

8 | seconds 9 |
10 |
11 |

Max player latency

12 | milliseconds 13 |
14 |
15 | Remove 16 |
17 |
-------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/fragments/playerProfileTemplate.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Remove

4 | delete profile 5 |
6 |
7 |

Profile

8 | 10 |
11 |
12 |

Latency Profile

13 | 16 |
17 |
18 |

Num Players

19 | 20 |
21 |
22 |

Start Matching

23 | 45 |
46 | 47 |
-------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/fragments/regionLatencyTemplate.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Remove

4 | delete latency 5 |
6 |
7 |

Region

8 | 9 |
10 |
11 |

Min Latency MS

12 | 13 |
14 |
15 |

Max Latency MS

16 | 17 |
18 |
-------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/fragments/scheduleProgress.html: -------------------------------------------------------------------------------- 1 |
TEST TEST TEST
2 | -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/pages/simulateMatchmakingFailedTicketsPage.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |

Events

4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Event DateTypeView Detail
15 |
16 | 17 |
18 | 19 |
20 | 21 |
22 |
-------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/pages/simulateMatchmakingFormPage.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |
5 |
6 |

Step 1 - Select the rule set to simulate:

7 | 8 |
9 |
10 |

Step 2 - Select the number of players for each player profiles to simulate:

11 |
12 |
13 |
14 |
15 | 16 | 17 |
18 |
19 |
-------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/pages/simulateMatchmakingOutputPage.html: -------------------------------------------------------------------------------- 1 |
2 |

3 |

Simulation Date: -


4 |

Total Players: -

5 |

Total Events: -

6 |

Players Matched Successfully: -

7 |

Players Failed To Match: -


8 |

Game sessions attempted: -

9 |

Game sessions matched: -


10 |

MatchmakingSearching Events: -

11 |

PotentialMatchCreated Events: -

12 |

MatchmakingSucceeded Events: -

13 |

MatchmakingTimedOut Events: -

14 |

MatchmakingFailed Events: -

15 |

MatchmakingCancelled Events: -



16 |

Status: -



17 |

18 | 19 | 20 |
21 | -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/pages/simulateMatchmakingResultsPage.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 |

Successful Matches

5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
DatePlayersLatency ProfilesAverage TimeMatch Info
19 |
20 |
21 |
22 |

Unmatched Players

23 |
24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 |
ProfilePlayer IDTicket StatusMatch Time
37 |
38 |
39 |
40 |
-------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/pages/simulateMatchmakingSimulationsPage.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
DateRule SetPlayers MatchedGame Sessions MatchedTotal EventsView
18 |
-------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/pages/simulateMatchmakingTicketsPage.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |

4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
DateTicket IDFinal StatusEventsView
17 |
18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 |
Event DateTypeView Detail
31 |
32 | 33 |
34 | 35 |
36 | 37 |
38 |
-------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/pages/virtualPlayerLaunchRequestTaskLogsPage.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
DateMessage
15 |
16 | -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/pages/virtualPlayerLaunchRequestTasksPage.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | 5 |
6 |

Loading...

7 |
8 |

9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
LaunchedArnProviderCpuMemoryLogs
24 |
25 |
-------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/pages/virtualPlayerLaunchRequestsPage.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |

Loading...

6 |
7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
LaunchedSchedule# TasksView Tasks
20 |
21 |
-------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/pages/virtualPlayerTaskScheduleViewPage.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |

4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
TimeActionNum TasksTotal Running
16 |
-------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/pages/virtualPlayerTaskSchedulesTablePage.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
Schedule NameTotal Tasks To LaunchTotal Schedule DurationViewDelete
16 |
-------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/pages/virtualPlayerTasksOverviewPage.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Overview

4 | 5 |
6 |

Loading...

7 |
8 | 9 |
10 |
11 |

12 | The testing toolkit provides two ways to launch virtual player tasks: 13 |

14 |
    15 |
  • you can launch some tasks to run immediately
  • 16 |
  • you can create a schedule and use it to launch tasks over a period of time
  • 17 |
18 |
19 |
20 |

There are - tasks running currently.

21 |
22 |
23 |

24 |

25 |
26 | 27 |
28 |
29 |

30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 |
ScheduledActionNum TasksStatusExecuted
43 |
44 | 45 |

46 |
47 |
48 |

The schedule is now complete

49 |
50 |
51 | 52 |
53 |
-------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/popups/fleetEventsPopup.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |

Loading...

5 |
6 |

7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
TimeCodeMessageLogs
20 |
21 |
22 | -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/popups/fleetLocationsPopup.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |

4 | 5 |
6 |
7 | 8 | 9 |
10 | 11 |
12 | -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/popups/fleetScalingPopup.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |

4 | 5 |
6 |
7 | 8 | 9 |
10 | 11 | 12 |
13 |
14 | 15 | 16 |
17 |
18 | -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/popups/flexMatchSimulatorPopup.html: -------------------------------------------------------------------------------- 1 | 7 | 8 |
9 | 10 |
11 | 12 |
13 | 20 |
21 | 22 |
23 |
2
24 |
25 |
26 |
2
27 |
28 |
29 |
30 | 31 |
32 |
33 | -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/popups/gameSessionsTablePopup.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |

6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
Creation DateSession DurationStatusIP AddressView DetailPlayer SessionsLogs
21 |
22 |
23 | 24 |
25 |
26 |
27 |
28 |
29 | 30 |
31 |
32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 |
Message
42 |
43 |
44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 |
DatePlayer IdStatusGame Session IDTermination Time
58 |
59 | 60 |
61 | -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/popups/matchmakingConfigPopup.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |

Modify Matchmaking Config

5 |
6 |
Please select the rule set for this matchmaking config:
7 | 9 |
10 | 11 |
12 | 13 |
-------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/popups/matchmakingTicketHeadersTablePopup.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |

6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
DateTicket IDFinal StatusView
18 |
19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 |
Event DateDetail TypeTypeView DetailReplay
34 |
35 | 36 |
37 | 38 |
39 | 40 |
41 |
42 | 43 |
44 | -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/popups/purgeDataPopup.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |

Purge Data

5 |
6 |
Choose which data you want to purge
7 |
8 |
9 |

FlexMatch event history

10 |
11 | 12 |
13 |

Game Session history

14 |
15 | 16 |
17 |
18 |
19 |
20 | 21 |
-------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/popups/queueSettingsPopup.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | 5 |

6 |
7 | 12 |
13 | 14 |
15 |
2
16 |
17 |
18 |
19 |
20 |
21 | -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/popups/ruleSetsPopup.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 |
5 |
6 |
7 |
8 | 9 |
10 |
11 | Ruleset Name: 12 |
13 | 14 | 15 |
16 |
17 |
18 | 19 |
20 |
21 |
22 | -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/popups/simpleGraphPopup.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |

5 |
6 |
7 | 10 | 18 |
19 |
20 | 21 |
22 |
23 |
-------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/popups/simpleJsonPopup.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |

4 |
5 | 6 |
7 |
-------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/popups/virtualPlayerTasksPopup.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 |

5 |
6 | 13 |
14 | 15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | 23 |
24 |
25 | -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/settings.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/subpopups/configureLatencyProfilesSubPopup.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 | 5 |
6 |
Please enter a name for your latency profile:
7 |
8 |
9 | 10 |
11 |
12 | 13 | 14 |
15 |
16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
Name# RegionsEditDelete
30 |
31 |
-------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/subpopups/configurePlayerProfilesSubPopup.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 | 5 |
6 |
Please enter a unique name for your player profile:
7 |
8 |
Optionally, also enter a team name to assign these players to a specific team:
9 |
10 |
11 | 12 |
13 |
14 | 15 | 16 |
17 |
18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
Name# AttributesEditDelete
32 |
33 |
-------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/subpopups/manageRuleSetsSubPopup.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
NameViewCreate CopyDelete Rule Set
17 |
18 |
19 | 20 |
21 |
22 | Rule Set Name: 23 |
24 | 25 | 26 | 27 |
28 |
29 |
30 |
31 |
32 |
33 | -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/subpopups/queueDestinationOrderSubPopup.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
Destinations
4 | 7 | 12 | 14 | 15 |

An ordered list of fleets and aliases that the queue can use for game session placement. Click and drag the Order column to modify the destination order.

16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 |
OrderRegionNameTypeARNRemove
33 |
34 |
35 | 36 |
37 |
-------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/subpopups/queuePlacementPrioritySubPopup.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
Game Session Placement Priority
4 |

Click and drag the Order column to modify the game session placement priority. The default order is latency, cost, destination and location.

5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
OrderNamePriority
17 |
18 |
Location Order
19 | 21 | 22 |

An ordered list of locations that the queue can use for game session placement. Click and drag the Order column to modify the location order.

23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 |
OrderNameRemove
36 |
37 |
38 | 39 |
40 |
-------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/subpopups/queueSettingsSubPopup.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
Queue Placement Timeout
5 |

Specify how long GameLift tries to place a game session before stopping.

6 | seconds
7 |

Must be 10-600 seconds

8 | 9 |
10 |
Player Latency Policies - Optional
11 | 12 |

Add policies to help place players into games with lower latency. Use multiple policies to reduce latency requirements per policy so that each player eventually finds a match.

13 |
14 |
15 |
16 |
17 | 18 |
19 |
20 |
-------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/subpopups/ruleSetBuilderSubPopup.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | RULESET BUILDER UNDER CONSTRUCTION! 4 |
5 | -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/subpopups/simulateMatchmakingSubPopup.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/subpopups/virtualPlayerTaskLaunchRequestsSubPopup.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 |
-------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/subpopups/virtualPlayerTasksLaunchSubPopup.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 | -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/subpopups/virtualPlayerTasksOverviewSubPopup.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
-------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/subpopups/virtualPlayerTasksRunningSubPopup.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Loading...

4 |
5 |
6 |
7 |
8 | Terminate All Virtual Player Tasks 9 |

10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 |
LaunchedArnProviderStatusCpuMemoryTerminateLogs
27 |
28 |
29 | 30 |
31 | 32 |
33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 |
DateMessage
43 |
44 |
-------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/subpopups/virtualPlayerTasksScheduleLaunchSubPopup.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Launch Virtual Player Schedule

4 | 5 |
6 |
Please select a Fargate Task definition for your virtual players:
7 | 9 | 10 |
Choose a Fargate Capacity Provider:
11 | 12 | 13 | 14 | 15 | 16 |
17 |
Select a schedule
18 | 20 |
21 | 22 |
23 |
-------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/subpopups/virtualPlayerTasksSchedulesSubPopup.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |
5 |
6 |
-------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/html/tokenForm.html: -------------------------------------------------------------------------------- 1 | 12 | -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/instance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/static/assets/instance.png -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/location.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/static/assets/location.png -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/static/assets/refresh.png -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/textures.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/static/assets/textures.png -------------------------------------------------------------------------------- /ManagementConsole/UI/static/assets/webfonts/Noto Sans.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/static/assets/webfonts/Noto Sans.png -------------------------------------------------------------------------------- /ManagementConsole/UI/static/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dist", 3 | "version": "1.0.0", 4 | "main": "index.js", 5 | "license": "Apache-2.0", 6 | "dependencies": { 7 | "datatables.net-buttons-bs4": "^2.2.3", 8 | "datatables.net-rowreorder-bs4": "^1.3.1", 9 | "install": "^0.13.0", 10 | "jsoneditor": "^9.9.0", 11 | "mdbootstrap": "^4.19.2", 12 | "npm": "^9.1.2" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /ManagementConsole/UI/texturepacker/assets/animationoff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/texturepacker/assets/animationoff.png -------------------------------------------------------------------------------- /ManagementConsole/UI/texturepacker/assets/animationon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/texturepacker/assets/animationon.png -------------------------------------------------------------------------------- /ManagementConsole/UI/texturepacker/assets/characters/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/texturepacker/assets/characters/1.png -------------------------------------------------------------------------------- /ManagementConsole/UI/texturepacker/assets/characters/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/texturepacker/assets/characters/10.png -------------------------------------------------------------------------------- /ManagementConsole/UI/texturepacker/assets/characters/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/texturepacker/assets/characters/11.png -------------------------------------------------------------------------------- /ManagementConsole/UI/texturepacker/assets/characters/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/texturepacker/assets/characters/12.png -------------------------------------------------------------------------------- /ManagementConsole/UI/texturepacker/assets/characters/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/texturepacker/assets/characters/13.png -------------------------------------------------------------------------------- /ManagementConsole/UI/texturepacker/assets/characters/14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/texturepacker/assets/characters/14.png -------------------------------------------------------------------------------- /ManagementConsole/UI/texturepacker/assets/characters/15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/texturepacker/assets/characters/15.png -------------------------------------------------------------------------------- /ManagementConsole/UI/texturepacker/assets/characters/16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/texturepacker/assets/characters/16.png -------------------------------------------------------------------------------- /ManagementConsole/UI/texturepacker/assets/characters/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/texturepacker/assets/characters/2.png -------------------------------------------------------------------------------- /ManagementConsole/UI/texturepacker/assets/characters/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/texturepacker/assets/characters/3.png -------------------------------------------------------------------------------- /ManagementConsole/UI/texturepacker/assets/characters/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/texturepacker/assets/characters/4.png -------------------------------------------------------------------------------- /ManagementConsole/UI/texturepacker/assets/characters/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/texturepacker/assets/characters/5.png -------------------------------------------------------------------------------- /ManagementConsole/UI/texturepacker/assets/characters/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/texturepacker/assets/characters/6.png -------------------------------------------------------------------------------- /ManagementConsole/UI/texturepacker/assets/characters/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/texturepacker/assets/characters/7.png -------------------------------------------------------------------------------- /ManagementConsole/UI/texturepacker/assets/characters/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/texturepacker/assets/characters/8.png -------------------------------------------------------------------------------- /ManagementConsole/UI/texturepacker/assets/characters/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/texturepacker/assets/characters/9.png -------------------------------------------------------------------------------- /ManagementConsole/UI/texturepacker/assets/cog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/texturepacker/assets/cog.png -------------------------------------------------------------------------------- /ManagementConsole/UI/texturepacker/assets/gtlogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/texturepacker/assets/gtlogo.png -------------------------------------------------------------------------------- /ManagementConsole/UI/texturepacker/assets/instance.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/texturepacker/assets/instance.png -------------------------------------------------------------------------------- /ManagementConsole/UI/texturepacker/assets/location.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/texturepacker/assets/location.png -------------------------------------------------------------------------------- /ManagementConsole/UI/texturepacker/assets/refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/ManagementConsole/UI/texturepacker/assets/refresh.png -------------------------------------------------------------------------------- /ManagementConsole/UI/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "moduleResolution": "node", 5 | "sourceMap": true, 6 | "allowSyntheticDefaultImports": true, 7 | }, 8 | "include": [ 9 | "./src/**/*", 10 | "./node_modules/phaser3-rex-plugins-types" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /ManagementConsole/UI/webpack/base.js: -------------------------------------------------------------------------------- 1 | const webpack = require("webpack"); 2 | const path = require("path"); 3 | const HtmlWebpackPlugin = require("html-webpack-plugin"); 4 | const { CleanWebpackPlugin } = require("clean-webpack-plugin"); 5 | const CopyWebpackPlugin = require('copy-webpack-plugin'); 6 | const ProgressPlugin = require('progress-webpack-plugin'); 7 | 8 | module.exports = { 9 | mode: "development", 10 | devtool: "eval-source-map", 11 | output: { 12 | path: __dirname + '/dist/', 13 | filename: 'bundle.js' 14 | }, 15 | devServer: { 16 | static: path.join(__dirname, '../dist/'), 17 | devMiddleware: { 18 | writeToDisk: true, 19 | }, 20 | }, 21 | entry: path.resolve(__dirname, '../src') + '/Game.ts', 22 | module: { 23 | rules: [ 24 | { 25 | test: /\.js$/, 26 | exclude: /node_modules/, 27 | use: { 28 | loader: "babel-loader" 29 | } 30 | }, 31 | { 32 | test: [/\.vert$/, /\.frag$/], 33 | use: "raw-loader" 34 | }, 35 | { 36 | test: /\.(gif|png|jpe?g|svg|xml)$/i, 37 | use: "file-loader" 38 | }, 39 | { 40 | test: /\.tsx?$/, 41 | use: 'ts-loader', 42 | exclude: /node_modules/, 43 | }, 44 | ] 45 | }, 46 | resolve: { 47 | extensions: ['.tsx', '.ts', '.js'], 48 | mainFields: ['browser', 'main', 'module'], 49 | }, 50 | plugins: [ 51 | new CopyWebpackPlugin({ 52 | patterns: [ 53 | { from: 'static' }, 54 | ] 55 | }), 56 | new webpack.DefinePlugin({ 57 | CANVAS_RENDERER: JSON.stringify(true), 58 | WEBGL_RENDERER: JSON.stringify(true) 59 | }), 60 | new CleanWebpackPlugin({ 61 | root: path.resolve(__dirname, "../") 62 | }), 63 | new HtmlWebpackPlugin({ 64 | template: "./index.html" 65 | }), 66 | new ProgressPlugin({ 67 | activeModules: false, 68 | entries: true, 69 | handler(percentage, message, ...args) { 70 | // custom logic 71 | }, 72 | modules: true, 73 | modulesCount: 5000, 74 | profile: false, 75 | dependencies: true, 76 | dependenciesCount: 10000, 77 | percentBy: null, 78 | }) 79 | ] 80 | }; 81 | -------------------------------------------------------------------------------- /ManagementConsole/UI/webpack/prod.js: -------------------------------------------------------------------------------- 1 | const { merge } = require('webpack-merge'); 2 | const base = require("./base"); 3 | const TerserPlugin = require("terser-webpack-plugin"); 4 | 5 | module.exports = merge(base, { 6 | mode: "production", 7 | output: { 8 | filename: "bundle.min.js" 9 | }, 10 | performance: { 11 | hints: false, 12 | maxEntrypointSize: 3512000, 13 | maxAssetSize: 512000 14 | }, 15 | devtool: false, 16 | optimization: { 17 | minimize: true, 18 | minimizer: [ 19 | new TerserPlugin({ 20 | exclude: /node_modules/, 21 | terserOptions: { 22 | output: { 23 | comments:false, 24 | } 25 | } 26 | }) 27 | ] 28 | } 29 | }); 30 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | -------------------------------------------------------------------------------- /SampleGame/Backend/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | 5 | // Assembly attribute to enable the Lambda function's JSON input to be converted into a .NET class. 6 | 7 | using Amazon.Lambda.Core; 8 | 9 | [assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.SystemTextJson.DefaultLambdaJsonSerializer))] 10 | -------------------------------------------------------------------------------- /SampleGame/Backend/Common/BaseEvent.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | using System; 5 | using Newtonsoft.Json; 6 | 7 | namespace SampleGameBackend.Common 8 | { 9 | public class BaseEvent 10 | { 11 | [JsonProperty("version")] 12 | public string Version { get; set; } 13 | 14 | [JsonProperty("id")] 15 | public Guid Id { get; set; } 16 | 17 | [JsonProperty("detail-type")] 18 | public string DetailType { get; set; } 19 | 20 | [JsonProperty("source")] 21 | public string Source { get; set; } 22 | 23 | [JsonProperty("account")] 24 | public string Account { get; set; } 25 | 26 | [JsonProperty("time")] 27 | public DateTimeOffset Time { get; set; } 28 | 29 | [JsonProperty("region")] 30 | public string Region { get; set; } 31 | 32 | [JsonProperty("resources")] 33 | public string[] Resources { get; set; } 34 | } 35 | } -------------------------------------------------------------------------------- /SampleGame/Backend/Common/QueuePlacementEvent.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | using System.Collections.Generic; 5 | using Newtonsoft.Json; 6 | 7 | namespace SampleGameBackend.Common 8 | { 9 | public class QueuePlacementEvent : BaseEvent 10 | { 11 | [JsonProperty(Required = Required.Always, PropertyName = "detail")] 12 | public QueuePlacementEventDetail Detail { get; set; } 13 | } 14 | 15 | public class QueuePlacementEventDetail 16 | { 17 | [JsonProperty(Required = Required.Always, PropertyName = "type")] 18 | public string Type { get; set; } 19 | 20 | [JsonProperty(Required = Required.Always, PropertyName = "placementId")] 21 | public string PlacementId { get; set; } 22 | 23 | [JsonProperty(Required = Required.Default, PropertyName = "port")] 24 | public string Port { get; set; } 25 | 26 | [JsonProperty(Required = Required.Default, PropertyName = "gameSessionArn")] 27 | public string GameSessionArn { get; set; } 28 | 29 | [JsonProperty(Required = Required.Default, PropertyName = "ipAddress")] 30 | public string IpAddress { get; set; } 31 | 32 | [JsonProperty(Required = Required.Default, PropertyName = "dnsName")] 33 | public string DnsName { get; set; } 34 | 35 | [JsonProperty(Required = Required.Default, PropertyName = "gameSessionRegion")] 36 | public string GameSessionRegion { get; set; } 37 | 38 | [JsonProperty(Required = Required.Always, PropertyName = "startTime")] 39 | public string StartTime { get; set; } 40 | 41 | [JsonProperty(Required = Required.Always, PropertyName = "endTime")] 42 | public string EndTime { get; set; } 43 | 44 | [JsonProperty(Required = Required.Default, PropertyName = "placedPlayerSessions")] 45 | public List PlacedPlayerSessions { get; set; } 46 | } 47 | 48 | public class QueuePlacementEventPlacedPlayerSession 49 | { 50 | [JsonProperty(Required = Required.Always, PropertyName = "playerId")] 51 | public string PlayerId { get; set; } 52 | 53 | [JsonProperty(Required = Required.Always, PropertyName = "playerSessionId")] 54 | public string PlayerSessionId { get; set; } 55 | } 56 | } -------------------------------------------------------------------------------- /SampleGame/Backend/GameClientService/Data/ClientMessage.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | using Newtonsoft.Json; 5 | 6 | namespace SampleGameBackend.GameClientService.Data 7 | { 8 | public class ClientMessage 9 | { 10 | [JsonProperty(Required = Required.Always)] public string Type; 11 | [JsonProperty(Required = Required.Default)] public string PlayerId; 12 | } 13 | } -------------------------------------------------------------------------------- /SampleGame/Backend/GameClientService/Data/ServerMessage.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | using Newtonsoft.Json; 5 | 6 | namespace SampleGameBackend.GameClientService.Data 7 | { 8 | public class ServerMessage 9 | { 10 | [JsonProperty("Type")] 11 | public string Type { get; set; } 12 | 13 | [JsonProperty("PlayerId")] 14 | public string PlayerId { get; set; } 15 | 16 | [JsonProperty("SessionId", NullValueHandling = NullValueHandling.Ignore)] 17 | public string SessionId { get; set; } 18 | 19 | [JsonProperty("IpAddress", NullValueHandling = NullValueHandling.Ignore)] 20 | public string IpAddress { get; set; } 21 | 22 | [JsonProperty("Port", NullValueHandling = NullValueHandling.Ignore)] 23 | public long? Port { get; set; } 24 | 25 | [JsonProperty("Message", NullValueHandling = NullValueHandling.Ignore)] 26 | public string Message { get; set; } 27 | } 28 | } -------------------------------------------------------------------------------- /SampleGame/Backend/SampleGameBackend.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | true 4 | false 5 | Lambda 6 | 7 | 8 | true 9 | net6.0 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /SampleGame/Backend/aws-lambda-tools-defaults.json: -------------------------------------------------------------------------------- 1 | { 2 | "Information": [ 3 | "This file provides default values for the deployment wizard inside Visual Studio and the AWS Lambda commands added to the .NET Core CLI.", 4 | "To learn more about the Lambda commands with the .NET Core CLI execute the following command at the command line in the project root directory.", 5 | "dotnet lambda help", 6 | "All the command line options for the Lambda command can be specified in this file." 7 | ], 8 | "profile": "", 9 | "region": "", 10 | "configuration": "Release", 11 | "framework": "net6.0", 12 | "function-runtime": "dotnetcore3.1", 13 | "function-memory-size": 256, 14 | "function-timeout": 30, 15 | "function-handler": "Lambda::TestGame.Lambdas.GameClientService::GameClientServiceHandler" 16 | } 17 | -------------------------------------------------------------------------------- /SampleGame/Game/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM amazonlinux:2023 2 | RUN dnf install -y 'dnf-command(config-manager)' 3 | RUN mkdir /local/game 4 | WORKDIR /local/game/ 5 | RUN dnf config-manager --add-repo https://download.mono-project.com/repo/centos8-stable.repo 6 | RUN dnf install -y mono-complete nuget mono-devel 7 | RUN rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm ; 8 | RUN awk ' \ 9 | /^\[amazonlinux\]/ {in_section=1} \ 10 | /^$/ && in_section {print "excludepkgs=dotnet*,aspnet*,netstandard*"; in_section=0} \ 11 | {print} \ 12 | ' /etc/yum.repos.d/amazonlinux.repo > /tmp/temp.repo && \ 13 | mv /tmp/temp.repo /etc/yum.repos.d/amazonlinux.repo 14 | RUN dnf install -y dotnet-sdk-7.0 openssl-libs unzip 15 | RUN curl -O https://gamelift-server-sdk-release.s3.us-west-2.amazonaws.com/csharp/GameLift-CSharp-ServerSDK-5.1.1.zip ;\ 16 | mkdir aws-gamelift-sdk-temp ;\ 17 | unzip GameLift-CSharp-ServerSDK-5.1.1.zip -d aws-gamelift-sdk-temp ;\ 18 | rm GameLift-CSharp-ServerSDK-5.1.1.zip 19 | RUN mkdir -p DLL ;\ 20 | cd aws-gamelift-sdk-temp/src ;\ 21 | nuget restore GameLiftServerSDK.sln ;\ 22 | msbuild GameLiftServerSDK.sln -property:Configuration=Release -property:TargetFrameworkVersion=v4.6.2 ;\ 23 | cp src/GameLiftServerSDK/bin/x64/Release/net6.0/* ../../DLL/ ;\ 24 | cd ../.. ;\ 25 | rm -rf aws-gamelift-sdk-temp 26 | COPY . /local/game/ 27 | RUN /bin/dotnet publish -c SampleGameBuild.csproj -r linux-x64 --self-contained true ;\ 28 | cp /local/game/log4net.config /local/game/bin/SampleGameBuild.csproj/net6.0/linux-x64/ ;\ 29 | cp /local/game/QuizConfig.json /local/game/bin/SampleGameBuild.csproj/net6.0/linux-x64/ 30 | CMD tail -f 31 | -------------------------------------------------------------------------------- /SampleGame/Game/GameLiftIntegration/Client/WSMessageFromClient.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | using Newtonsoft.Json; 5 | 6 | namespace SampleGameBuild.GameLiftIntegration.Client 7 | { 8 | public class WSMessageFromClient 9 | { 10 | [JsonProperty(Required = Required.Always)] public string Type; 11 | [JsonProperty(Required = Required.Always)] public string PlayerId; 12 | } 13 | } -------------------------------------------------------------------------------- /SampleGame/Game/GameLiftIntegration/Client/WSMessageFromServer.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | using JetBrains.Annotations; 5 | using Newtonsoft.Json; 6 | 7 | namespace SampleGameBuild.GameLiftIntegration.Client 8 | { 9 | public class WSMessageFromServer 10 | { 11 | [JsonProperty("Type")] 12 | public string Type { get; set; } 13 | 14 | [JsonProperty("PlayerId")] 15 | public string PlayerId { get; set; } 16 | 17 | [JsonProperty("SessionId", NullValueHandling = NullValueHandling.Ignore)] 18 | public string SessionId { get; set; } 19 | 20 | [JsonProperty("IpAddress", NullValueHandling = NullValueHandling.Ignore)] 21 | public string IpAddress { get; set; } 22 | 23 | [JsonProperty("Port", NullValueHandling = NullValueHandling.Ignore)] 24 | public long? Port { get; set; } 25 | 26 | [JsonProperty("Message", NullValueHandling = NullValueHandling.Ignore)] 27 | public string Message { get; set; } 28 | } 29 | } -------------------------------------------------------------------------------- /SampleGame/Game/GameLiftIntegration/Server/GameLiftMetadata.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | using Newtonsoft.Json; 5 | 6 | namespace SampleGameBuild.GameLiftIntegration.Server 7 | { 8 | public class GameLiftMetadata 9 | { 10 | [JsonProperty("buildArn")] 11 | public string BuildArn { get; set; } 12 | 13 | [JsonProperty("buildId")] 14 | public string BuildId { get; set; } 15 | 16 | [JsonProperty("fleetArn")] 17 | public string FleetArn { get; set; } 18 | 19 | [JsonProperty("fleetDescription")] 20 | public string FleetDescription { get; set; } 21 | 22 | [JsonProperty("fleetId")] 23 | public string FleetId { get; set; } 24 | 25 | [JsonProperty("fleetName")] 26 | public string FleetName { get; set; } 27 | 28 | [JsonProperty("fleetType")] 29 | public string FleetType { get; set; } 30 | 31 | [JsonProperty("instanceRoleArn")] 32 | public string InstanceRoleArn { get; set; } 33 | 34 | [JsonProperty("instanceType")] 35 | public string InstanceType { get; set; } 36 | 37 | [JsonProperty("serverLaunchPath")] 38 | public string ServerLaunchPath { get; set; } 39 | 40 | } 41 | } -------------------------------------------------------------------------------- /SampleGame/Game/GameLiftIntegration/Server/IGameLiftServer.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | using System; 5 | using Aws.GameLift; 6 | using Aws.GameLift.Server.Model; 7 | 8 | namespace SampleGameBuild.GameLiftIntegration.Server 9 | { 10 | public interface IGameLiftServer 11 | { 12 | int Port 13 | { 14 | get; 15 | } 16 | 17 | string LogFilePath 18 | { 19 | get; 20 | } 21 | 22 | public void OnGameLiftSDKActivationSuccess(GenericOutcome outcome); 23 | public void OnGameLiftSDKActivationFailure(GenericOutcome outcome); 24 | public void OnGameLiftSDKActivationException(Exception e); 25 | 26 | public void OnGameLiftMetadataLoaded(GameLiftMetadata metadata); 27 | public void OnGameLiftGameSessionRequested(GameSession gameSession); 28 | public void OnGameLiftGameSessionActivationSuccess(GameSession gameSession, GenericOutcome outcome); 29 | public void OnGameLiftGameSessionActivationFailure(GameSession gameSession, GenericOutcome outcome); 30 | public void OnGameLiftGameSessionActivationException(Exception e); 31 | 32 | public void OnGameLiftProcessReadySuccess(GenericOutcome outcome); 33 | public void OnGameLiftProcessReadyFailure(GenericOutcome outcome); 34 | public void OnGameLiftProcessReadyException(Exception e); 35 | public void OnGameLiftProcessTerminate(); 36 | 37 | public void OnGameLiftProcessEndingSuccess(GenericOutcome outcome); 38 | public void OnGameLiftProcessEndingFailure(GenericOutcome outcome); 39 | public void OnGameLiftProcessEndingException(Exception e); 40 | 41 | public bool OnGameLiftHealthCheck(); 42 | } 43 | } -------------------------------------------------------------------------------- /SampleGame/Game/Network/Client/IClient.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | namespace SampleGameBuild.Network.Client 5 | { 6 | public interface IClient 7 | { 8 | bool Running { get; } 9 | void OnLoop(); 10 | bool IsActive(); 11 | } 12 | } -------------------------------------------------------------------------------- /SampleGame/Game/Network/Client/IGameClient.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | using System.Net.Sockets; 5 | 6 | namespace SampleGameBuild.Network.Client 7 | { 8 | public interface IGameClient 9 | { 10 | void OnConnect(TcpClient client); 11 | void OnMessage(string message); 12 | 13 | void OnDisconnect(); 14 | 15 | bool IsActive(); 16 | 17 | } 18 | } -------------------------------------------------------------------------------- /SampleGame/Game/Network/NetworkProtocol.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | using System; 5 | using System.Net.Sockets; 6 | using System.Collections.Generic; 7 | 8 | namespace SampleGameBuild.Network 9 | { 10 | public static class NetworkProtocol 11 | { 12 | public static string[] Receive(TcpClient client) 13 | { 14 | var stream = client.GetStream(); 15 | var messages = new List(); 16 | 17 | while (stream.DataAvailable) 18 | { 19 | int msgSize = 4096; 20 | byte[] readBuffer = new Byte[msgSize]; 21 | stream.Read(readBuffer, 0, readBuffer.Length); 22 | string msgStr = System.Text.Encoding.ASCII.GetString(readBuffer, 0, readBuffer.Length); 23 | 24 | char[] delims = { '\r', '\n' }; 25 | string[] splitMessages = msgStr.Split(delims, StringSplitOptions.RemoveEmptyEntries); 26 | 27 | foreach (string splitMessage in splitMessages) 28 | { 29 | if (splitMessage.Trim('\0').Length > 0) 30 | { 31 | messages.Add(splitMessage); 32 | } 33 | } 34 | } 35 | 36 | return messages.ToArray(); 37 | } 38 | 39 | public static void Send(TcpClient client, string msgStr) 40 | { 41 | if (client == null) 42 | { 43 | return; 44 | } 45 | 46 | var stream = client.GetStream(); 47 | byte[] writeBuffer = System.Text.Encoding.ASCII.GetBytes(msgStr); 48 | int msgSize = writeBuffer.Length; 49 | stream.Write(writeBuffer, 0, msgSize); 50 | } 51 | 52 | public static void DisconnectClient(TcpClient client) 53 | { 54 | if (client == null) 55 | { 56 | return; 57 | } 58 | 59 | var stream = client.GetStream(); 60 | stream?.Close(); 61 | client.Close(); 62 | client = null; 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /SampleGame/Game/Network/Server/IGameServer.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | using System.Net.Sockets; 5 | 6 | namespace SampleGameBuild.Network.Server 7 | { 8 | public interface IGameServer 9 | { 10 | int Port { get; } 11 | bool Running { get; } 12 | 13 | void OnReady(); 14 | void OnConnection(TcpClient client); 15 | void OnMessage(TcpClient client, string message); 16 | void OnDisconnection(TcpClient client); 17 | void OnLoop(); 18 | void OnAllClientsDisconnected(); 19 | void OnShutdown(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SampleGame/Game/NumbersQuiz/Client/Util/HttpHelpers.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | using System; 5 | using System.Text; 6 | 7 | namespace AWSSignatureV4_S3_Sample.Util 8 | { 9 | // Various Http helper routines 10 | public static class HttpHelpers 11 | { 12 | // Helper routine to url encode canonicalized header names and values for safe inclusion in presigned urls 13 | public static string UrlEncode(string data, bool isPath = false) 14 | { 15 | // Set of accepted and valid Url characters per RFC3986. 16 | const string validUrlCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.~"; 17 | 18 | var encoded = new StringBuilder(data.Length * 2); 19 | string unreservedChars = String.Concat(validUrlCharacters, (isPath ? "/:" : "")); 20 | 21 | foreach (char symbol in System.Text.Encoding.UTF8.GetBytes(data)) 22 | { 23 | if (unreservedChars.IndexOf(symbol) != -1) 24 | { 25 | encoded.Append(symbol); 26 | } 27 | else 28 | { 29 | encoded.Append("%").Append(String.Format("{0:X2}", (int)symbol)); 30 | } 31 | } 32 | 33 | return encoded.ToString(); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /SampleGame/Game/NumbersQuiz/Data/AnswerResult.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | namespace SampleGameBuild.NumbersQuiz.Data 5 | { 6 | public enum AnswerResult 7 | { 8 | Waiting = -1, 9 | Wrong = 0, 10 | Correct = 1 11 | } 12 | } -------------------------------------------------------------------------------- /SampleGame/Game/NumbersQuiz/Data/GameResult.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | namespace SampleGameBuild.NumbersQuiz.Data 5 | { 6 | public class GameResult 7 | { 8 | public AnswerResult Result; 9 | public int TotalCorrect; 10 | public int TotalWrong; 11 | public string Name; 12 | } 13 | } -------------------------------------------------------------------------------- /SampleGame/Game/NumbersQuiz/Data/MessageFromClient.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | using JetBrains.Annotations; 5 | using Newtonsoft.Json; 6 | 7 | namespace SampleGameBuild.NumbersQuiz.Data 8 | { 9 | public class MessageFromClient 10 | { 11 | [JsonProperty(Required = Required.Always)] public string Type; 12 | [JsonProperty(Required = Required.Always)] public string PlayerId; 13 | [JsonProperty("SessionId", NullValueHandling = NullValueHandling.Ignore)] public string SessionId; 14 | [JsonProperty("Name", NullValueHandling = NullValueHandling.Ignore)] public string Name; 15 | public int? Answer; 16 | } 17 | } -------------------------------------------------------------------------------- /SampleGame/Game/NumbersQuiz/Data/MessageFromClientType.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | namespace SampleGameBuild.NumbersQuiz.Data 5 | { 6 | public class MessageFromClientType 7 | { 8 | public const string Login = "Login"; 9 | public const string Answer = "Answer"; 10 | public const string Quit = "Quit"; 11 | } 12 | } -------------------------------------------------------------------------------- /SampleGame/Game/NumbersQuiz/Data/MessageFromServer.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | using System.Collections.Generic; 5 | using JetBrains.Annotations; 6 | 7 | namespace SampleGameBuild.NumbersQuiz.Data 8 | { 9 | public class MessageFromServer 10 | { 11 | public string Text { get; set; } 12 | public Question Question { get; set; } 13 | public List Results { get; set; } 14 | public string Type { get; set; } 15 | public AnswerResult? AnswerResult { get; set; } 16 | } 17 | } -------------------------------------------------------------------------------- /SampleGame/Game/NumbersQuiz/Data/MessageFromServerType.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | namespace SampleGameBuild.NumbersQuiz.Data 5 | { 6 | public class MessageFromServerType 7 | { 8 | public const string Question = "Question"; 9 | public const string Result = "Result"; 10 | public const string Results = "Results"; 11 | } 12 | } -------------------------------------------------------------------------------- /SampleGame/Game/NumbersQuiz/Data/Question.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | using System; 5 | 6 | namespace SampleGameBuild.NumbersQuiz.Data 7 | { 8 | public class Question 9 | { 10 | public int Number1 = 0; 11 | public int Number2 = 0; 12 | public string Operand = "+"; 13 | public string Text=""; 14 | } 15 | } -------------------------------------------------------------------------------- /SampleGame/Game/NumbersQuiz/Data/QuizConfig.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | using System.Collections.Generic; 5 | 6 | namespace SampleGameBuild.NumbersQuiz.Data 7 | { 8 | public class QuizConfig 9 | { 10 | public int MinPlayers { get; set; } 11 | public int MaxPlayers { get; set; } 12 | public List Schedule { get; set; } 13 | } 14 | } -------------------------------------------------------------------------------- /SampleGame/Game/NumbersQuiz/Data/ScheduleEntry.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | namespace SampleGameBuild.NumbersQuiz.Data 5 | { 6 | public struct ScheduleEntry 7 | { 8 | public string Type; 9 | public int? Time; 10 | } 11 | } -------------------------------------------------------------------------------- /SampleGame/Game/NumbersQuiz/Data/ScheduleEntryType.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | namespace SampleGameBuild.NumbersQuiz.Data 5 | { 6 | public class ScheduleEntryType 7 | { 8 | public const string WaitingForPlayers = "WAITING_FOR_PLAYERS"; 9 | public const string WaitingToStart = "WAITING_TO_START"; 10 | public const string AskQuestion = "ASK_QUESTION"; 11 | public const string WaitingForAnswers = "WAITING_FOR_ANSWERS"; 12 | public const string ShowResults = "SHOW_RESULTS"; 13 | public const string WaitingForNextGame = "WAITING_FOR_NEXT_GAME"; 14 | } 15 | } -------------------------------------------------------------------------------- /SampleGame/Game/NumbersQuiz/Server/Player.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | using System.Collections; 5 | using System.Collections.Generic; 6 | using System.Net; 7 | using System.Net.Sockets; 8 | using Newtonsoft.Json; 9 | using SampleGameBuild.Network; 10 | using SampleGameBuild.NumbersQuiz.Data; 11 | 12 | namespace SampleGameBuild.NumbersQuiz.Server 13 | { 14 | public class Player 15 | { 16 | private TcpClient _client; 17 | public readonly string Name; 18 | public readonly string PlayerId; 19 | public string SessionId; 20 | public int Correct = 0; 21 | public int Wrong = 0; 22 | public int CurrentAnswer = 0; 23 | public AnswerResult AnswerStatus = AnswerResult.Waiting; 24 | public bool WaitingForNextSession = true; 25 | private bool _connected = true; 26 | 27 | public Player(TcpClient client, string playerId, string sessionId, string name) 28 | { 29 | PlayerId = playerId; 30 | SessionId = sessionId; 31 | _client = client; 32 | Name = name; 33 | } 34 | 35 | public void SendMessage(string msg) 36 | { 37 | NetworkProtocol.Send(_client, msg); 38 | } 39 | 40 | public void SendObject(MessageFromServer obj) 41 | { 42 | GameLogger.Log("MESSAGE SENT:" + JsonConvert.SerializeObject(obj)); 43 | SendMessage(JsonConvert.SerializeObject(obj, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }) + "\n"); 44 | } 45 | 46 | public TcpClient GetClient() 47 | { 48 | return _client; 49 | } 50 | 51 | public void Reconnect(TcpClient client, string sessionId) 52 | { 53 | _client = client; 54 | SessionId = sessionId; 55 | _connected = true; 56 | } 57 | 58 | public bool IsConnected() 59 | { 60 | return _connected; 61 | } 62 | 63 | public void Disconnect() 64 | { 65 | _connected = false; 66 | WaitingForNextSession = true; 67 | } 68 | } 69 | } -------------------------------------------------------------------------------- /SampleGame/Game/Program.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | using System; 5 | 6 | namespace SampleGameBuild 7 | { 8 | class Program 9 | { 10 | static void Main(string[] args) 11 | { 12 | //Console.SetOut(new StreamWriter("/tmp/serverOut.txt")); 13 | //Console.SetError(new StreamWriter("/tmp/serverErr.txt")); 14 | ArgumentHandler.ProcessArgs(System.Environment.GetCommandLineArgs(), Launch); 15 | } 16 | 17 | static void Launch(Options options) 18 | { 19 | Console.WriteLine("Starting up"); 20 | var game = new Game(options); 21 | game.StartLoop(); 22 | 23 | Console.WriteLine("done"); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /SampleGame/Game/QuizConfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "MinPlayers": 2, 3 | "MaxPlayers": 10, 4 | "Schedule": [ 5 | { 6 | "Type": "WAITING_FOR_PLAYERS" 7 | }, 8 | { 9 | "Type": "WAITING_TO_START", 10 | "Time": 5000 11 | }, 12 | { 13 | "Type": "ASK_QUESTION" 14 | }, 15 | { 16 | "Type": "WAITING_FOR_ANSWERS", 17 | "Time": 60000 18 | }, 19 | { 20 | "Type": "SHOW_RESULTS" 21 | }, 22 | { 23 | "Type": "WAITING_FOR_NEXT_GAME", 24 | "Time": 10000 25 | } 26 | ] 27 | } -------------------------------------------------------------------------------- /SampleGame/Game/SampleGameBuild.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | DLL\GameLiftServerSDK.dll 27 | 28 | 29 | DLL\System.Net.WebSockets.Client.dll 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /SampleGame/Game/install.bat: -------------------------------------------------------------------------------- 1 | powershell.exe "& 'C:\Game\install.ps1'" 2 | 3 | -------------------------------------------------------------------------------- /SampleGame/Game/install.ps1: -------------------------------------------------------------------------------- 1 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls, [Net.SecurityProtocolType]::Tls11, [Net.SecurityProtocolType]::Tls12, [Net.SecurityProtocolType]::Ssl3 2 | [Net.ServicePointManager]::SecurityProtocol = "Tls, Tls11, Tls12, Ssl3" 3 | Invoke-WebRequest -Uri https://dot.net/v1/dotnet-install.ps1 -UseBasicParsing -OutFile dotnet-install.ps1 4 | ./dotnet-install.ps1 -Channel LTS 5 | Invoke-WebRequest -Uri https://gamelift-server-sdk-release.s3.us-west-2.amazonaws.com/csharp/GameLift-CSharp-ServerSDK-5.1.1.zip -OutFile GameLift-CSharp-ServerSDK-5.1.1.zip 6 | Expand-Archive GameLift-CSharp-ServerSDK-5.1.1.zip 7 | mkdir DLL 8 | cd .\GameLift-CSharp-ServerSDK-5.1.1\src\ 9 | dotnet restore .\GameLiftServerSDK.sln 10 | dotnet msbuild .\GameLiftServerSDK.sln -property:Configuration=Release -property:TargetFrameworkVersion=v4.6.2 11 | cp .\src\GameLiftServerSDK\bin\x64\Release\net462\* ..\..\DLL\ 12 | cd ..\..\ 13 | rm -r -fo .\GameLift-CSharp-ServerSDK-5.1.1\ 14 | dotnet publish -c SampleGameBuild.csproj -r win-x64 --self-contained true 15 | -------------------------------------------------------------------------------- /SampleGame/Game/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | sudo dnf install -y 'dnf-command(config-manager)' 3 | 4 | sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm 5 | 6 | sudo awk ' 7 | /^\[amazonlinux\]/ {in_section=1} 8 | /^$/ && in_section {print "excludepkgs=dotnet*,aspnet*,netstandard*"; in_section=0} 9 | {print} 10 | ' /etc/yum.repos.d/amazonlinux.repo > temp && sudo mv temp /etc/yum.repos.d/amazonlinux.repo 11 | 12 | sudo dnf install -y dotnet-sdk-7.0 openssl-libs unzip 13 | 14 | sudo dnf config-manager --add-repo https://download.mono-project.com/repo/centos8-stable.repo 15 | sudo dnf install -y mono-complete nuget mono-devel 16 | 17 | sudo curl -O https://gamelift-server-sdk-release.s3.us-west-2.amazonaws.com/csharp/GameLift-CSharp-ServerSDK-5.1.1.zip 18 | sudo mkdir DLL 19 | sudo mkdir aws-gamelift-sdk-temp 20 | sudo unzip GameLift-CSharp-ServerSDK-5.1.1.zip -d aws-gamelift-sdk-temp 21 | sudo rm GameLift-CSharp-ServerSDK-5.1.1.zip 22 | 23 | cd aws-gamelift-sdk-temp/src/ 24 | sudo nuget restore GameLiftServerSDK.sln 25 | sudo msbuild GameLiftServerSDK.sln -property:Configuration=Release -property:TargetFrameworkVersion=v4.6.2 26 | sudo cp src/GameLiftServerSDK/bin/x64/Release/net6.0/* ../../DLL/ 27 | cd ../../ 28 | sudo rm -rf aws-gamelift-sdk-temp 29 | 30 | sudo dotnet publish -c SampleGameBuild.csproj -r linux-x64 --self-contained true 31 | sudo cp ./log4net.config ./bin/SampleGameBuild.csproj/net6.0/linux-x64/ 32 | sudo cp ./QuizConfig.json ./bin/SampleGameBuild.csproj/net6.0/linux-x64/ 33 | -------------------------------------------------------------------------------- /SampleGame/Game/log4net.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /SampleGame/Infra/Infra.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.26124.0 5 | MinimumVisualStudioVersion = 15.0.26124.0 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Infra", "Infra\Infra.csproj", "{7E9E2517-9B9E-4499-BAA7-5CE0A3005643}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x64 = Debug|x64 12 | Debug|x86 = Debug|x86 13 | Release|Any CPU = Release|Any CPU 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 21 | {7E9E2517-9B9E-4499-BAA7-5CE0A3005643}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 22 | {7E9E2517-9B9E-4499-BAA7-5CE0A3005643}.Debug|Any CPU.Build.0 = Debug|Any CPU 23 | {7E9E2517-9B9E-4499-BAA7-5CE0A3005643}.Debug|x64.ActiveCfg = Debug|Any CPU 24 | {7E9E2517-9B9E-4499-BAA7-5CE0A3005643}.Debug|x64.Build.0 = Debug|Any CPU 25 | {7E9E2517-9B9E-4499-BAA7-5CE0A3005643}.Debug|x86.ActiveCfg = Debug|Any CPU 26 | {7E9E2517-9B9E-4499-BAA7-5CE0A3005643}.Debug|x86.Build.0 = Debug|Any CPU 27 | {7E9E2517-9B9E-4499-BAA7-5CE0A3005643}.Release|Any CPU.ActiveCfg = Release|Any CPU 28 | {7E9E2517-9B9E-4499-BAA7-5CE0A3005643}.Release|Any CPU.Build.0 = Release|Any CPU 29 | {7E9E2517-9B9E-4499-BAA7-5CE0A3005643}.Release|x64.ActiveCfg = Release|Any CPU 30 | {7E9E2517-9B9E-4499-BAA7-5CE0A3005643}.Release|x64.Build.0 = Release|Any CPU 31 | {7E9E2517-9B9E-4499-BAA7-5CE0A3005643}.Release|x86.ActiveCfg = Release|Any CPU 32 | {7E9E2517-9B9E-4499-BAA7-5CE0A3005643}.Release|x86.Build.0 = Release|Any CPU 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /SampleGame/Infra/README.md: -------------------------------------------------------------------------------- 1 | # Welcome to your CDK C# project! 2 | 3 | This is a blank project for C# development with CDK. 4 | 5 | The `cdk.json` file tells the CDK Toolkit how to execute your app. 6 | 7 | It uses the [.NET Core CLI](https://docs.microsoft.com/dotnet/articles/core/) to compile and execute your project. 8 | 9 | ## Useful commands 10 | 11 | * `dotnet build src` compile this app 12 | * `cdk deploy` deploy this stack to your default AWS account/region 13 | * `cdk diff` compare deployed stack with current state 14 | * `cdk synth` emits the synthesized CloudFormation template -------------------------------------------------------------------------------- /SampleGame/Infra/cdk.context.json: -------------------------------------------------------------------------------- 1 | { 2 | "acknowledged-issue-numbers": [ 3 | 19836 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /SampleGame/Infra/cdk.json: -------------------------------------------------------------------------------- 1 | { 2 | "app": "dotnet run --project src/SampleGameInfra.csproj", 3 | "watch": { 4 | "include": [ 5 | "**" 6 | ], 7 | "exclude": [ 8 | "README.md", 9 | "cdk*.json", 10 | "src/*/obj", 11 | "src/*/bin", 12 | "src/*.sln", 13 | "src/*/GlobalSuppressions.cs", 14 | "src/*/*.csproj" 15 | ] 16 | }, 17 | "context": { 18 | "@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId": true, 19 | "@aws-cdk/core:stackRelativeExports": true, 20 | "@aws-cdk/aws-rds:lowercaseDbIdentifier": true, 21 | "@aws-cdk/aws-lambda:recognizeVersionProps": true, 22 | "@aws-cdk/aws-lambda:recognizeLayerVersion": true, 23 | "@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2_2021": true, 24 | "@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true, 25 | "@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": true, 26 | "@aws-cdk/core:checkSecretUsage": true, 27 | "@aws-cdk/aws-iam:minimizePolicies": true, 28 | "@aws-cdk/aws-ecs:arnFormatIncludesClusterName": true, 29 | "@aws-cdk/core:validateSnapshotRemovalPolicy": true, 30 | "@aws-cdk/aws-codepipeline:crossAccountKeyAliasStackSafeResourceName": true, 31 | "@aws-cdk/aws-s3:createDefaultLoggingPolicy": true, 32 | "@aws-cdk/aws-sns-subscriptions:restrictSqsDescryption": true, 33 | "@aws-cdk/aws-apigateway:disableCloudWatchRole": true, 34 | "@aws-cdk/core:enablePartitionLiterals": true, 35 | "@aws-cdk/core:target-partitions": [ 36 | "aws", 37 | "aws-cn" 38 | ] 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /SampleGame/Infra/src/Constructs/GameLiftBuild.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | using Amazon.CDK; 5 | using Amazon.CDK.AWS.GameLift; 6 | using Constructs; 7 | 8 | namespace TestGame.CDK.Constructs 9 | { 10 | public struct GameLiftBuildProps 11 | { 12 | public string AssetPath; 13 | public string Name; 14 | public string Version; 15 | public string OperatingSystem; 16 | public string ServerSdkVersion; 17 | } 18 | 19 | public struct GameLiftBuildOs 20 | { 21 | public static string AmazonLinux2 = "AMAZON_LINUX_2"; 22 | public static string Windows2016 = "WINDOWS_2016"; 23 | public static string AmazonLinux2023 = "AMAZON_LINUX_2023"; 24 | } 25 | 26 | public class GameLiftBuild : Construct 27 | { 28 | public readonly GameLiftBuildAsset BuildAsset; 29 | public readonly string BuildId; 30 | public readonly CfnBuild CfnBuild; 31 | 32 | internal GameLiftBuild(Construct scope, string id, GameLiftBuildProps props) : base(scope, id) 33 | { 34 | BuildAsset = new GameLiftBuildAsset(scope, "GameLiftBuildAsset", new GameLiftAssetProps 35 | { 36 | AssetPath = props.AssetPath, 37 | }); 38 | 39 | CfnBuild = new CfnBuild(this, "Build", new CfnBuildProps 40 | { 41 | Name = props.Name, 42 | OperatingSystem = props.OperatingSystem, 43 | StorageLocation = new CfnBuild.StorageLocationProperty 44 | { 45 | Bucket = BuildAsset.Asset.S3BucketName, 46 | Key = BuildAsset.Asset.S3ObjectKey, 47 | RoleArn = BuildAsset.Role.RoleArn 48 | }, 49 | Version = props.Version, 50 | ServerSdkVersion = props.ServerSdkVersion, 51 | }); 52 | 53 | CfnBuild.Node.AddDependency(BuildAsset); 54 | BuildId = Fn.Ref(CfnBuild.LogicalId); 55 | } 56 | } 57 | } -------------------------------------------------------------------------------- /SampleGame/Infra/src/Constructs/GameLiftBuildAsset.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | using Amazon.CDK.AWS.IAM; 5 | using Amazon.CDK.AWS.S3.Assets; 6 | using Cdklabs.CdkNag; 7 | using Constructs; 8 | 9 | namespace TestGame.CDK.Constructs 10 | { 11 | public struct GameLiftAssetProps 12 | { 13 | public string AssetPath; 14 | } 15 | 16 | public class GameLiftBuildAsset : Construct 17 | { 18 | public Role Role; 19 | public Asset Asset; 20 | 21 | internal GameLiftBuildAsset(Construct scope, string id, GameLiftAssetProps props) : base(scope, id) 22 | { 23 | Role = new Role(this, "GameLiftBuildRole", new RoleProps 24 | { 25 | AssumedBy = new ServicePrincipal("gamelift.amazonaws.com"), // required 26 | }); 27 | 28 | Asset = new Asset(this, "BuildAsset", new AssetProps 29 | { 30 | Path = props.AssetPath, 31 | }); 32 | 33 | Role.AddToPrincipalPolicy(new PolicyStatement(new PolicyStatementProps 34 | { 35 | Effect = Effect.ALLOW, 36 | Resources = new[] 37 | { 38 | Asset.Bucket.BucketArn, 39 | Asset.Bucket.BucketArn + "/*" 40 | }, 41 | Actions = new[] 42 | { 43 | "s3:*", 44 | } 45 | })); 46 | 47 | // Adding specific CDK-Nag Suppressions 48 | NagSuppressions.AddResourceSuppressions(Role, new INagPackSuppression[] 49 | { 50 | new NagPackSuppression 51 | { 52 | Id = "AwsSolutions-IAM5", 53 | Reason = "Suppress wildcard finding to give permission to access S3 asset folder" 54 | } 55 | }, true); 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /SampleGame/Infra/src/GlobalSuppressions.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Potential Code Quality Issues", "RECS0026:Possible unassigned object created by 'new'", Justification = "Constructs add themselves to the scope in which they are created")] 5 | -------------------------------------------------------------------------------- /SampleGame/Infra/src/Lib/ApiGwLogsStack.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | using Amazon.CDK; 5 | using Amazon.CDK.AWS.APIGateway; 6 | using Amazon.CDK.AWS.IAM; 7 | using Amazon.CDK.AWS.Ecr.Assets; 8 | using Amazon.CDK.AWS.ECS; 9 | using Amazon.CDK.AWS.Events.Targets; 10 | using Amazon.CDK.AWS.Logs; 11 | using Cdklabs.CdkNag; 12 | using Constructs; 13 | 14 | namespace SampleGameInfra.Lib 15 | { 16 | public class ApiGwLogsStack : Stack 17 | { 18 | internal ApiGwLogsStack(Construct scope, string id) : base(scope, id) 19 | { 20 | // Configure Log role for ApiGateway 21 | var apigwLogRole = new Role(this, "apigwLogRole", new RoleProps 22 | { 23 | AssumedBy = new ServicePrincipal("apigateway.amazonaws.com") 24 | }); 25 | apigwLogRole.AddManagedPolicy(ManagedPolicy.FromManagedPolicyArn(this, "ApiGwLogPolicy", "arn:aws:iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs")); 26 | 27 | NagSuppressions.AddResourceSuppressions(apigwLogRole, new INagPackSuppression[] 28 | { 29 | new NagPackSuppression 30 | { 31 | Id = "AwsSolutions-IAM4", 32 | Reason = "Suppress finding for APIGW Log Policy used to create this stack" 33 | }, 34 | }, true); 35 | 36 | var cfnAccount = new CfnAccount(this, "APIGWAccount", new CfnAccountProps 37 | { 38 | CloudWatchRoleArn = apigwLogRole.RoleArn 39 | }); 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /SampleGame/Infra/src/Program.cs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | using Amazon.CDK; 5 | using Amazon.CDK.AWS.Lambda; 6 | using Cdklabs.CdkNag; 7 | using Constructs; 8 | using SampleGameInfra.Lib; 9 | 10 | namespace SampleGameInfra 11 | { 12 | sealed class Program 13 | { 14 | private const string StackName = "AGTT-SampleGameStack"; 15 | 16 | internal static readonly Runtime DotNetRuntime = Runtime.DOTNET_6; 17 | 18 | public static void Main(string[] args) 19 | { 20 | var app = new App(); 21 | var infra = new InfraStage(app, StackName, new InfraStageProps()); 22 | 23 | CheckCdkNag(infra); 24 | app.Synth(); 25 | } 26 | 27 | private static void CheckCdkNag(IConstruct scope) 28 | { 29 | // Check against standard cdk nag rules 30 | var nagProps = new NagPackProps() { Verbose = false }; 31 | var check = new AwsSolutionsChecks(nagProps); 32 | NagSuppressions.AddResourceSuppressions(scope, BuildSuppressions(), true); 33 | Aspects.Of(scope).Add(check); 34 | } 35 | 36 | private static NagPackSuppression[] BuildSuppressions() 37 | { 38 | return new NagPackSuppression[] 39 | { 40 | BuildSuppressions("AwsSolutions-APIG4", "API Gateway WebSocket $default route does not support authorization."), 41 | BuildSuppressions("AwsSolutions-ECS7", "Container logging not required for sample game virtual players."), 42 | BuildSuppressions("AwsSolutions-COG7", "Sample game doesn't require players to have a user account."), 43 | }; 44 | } 45 | 46 | private static NagPackSuppression BuildSuppressions(string id, string reason) 47 | { 48 | return new NagPackSuppression() 49 | { 50 | Id = id, 51 | Reason = reason 52 | }; 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /SampleGame/Infra/src/SampleGameInfra.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | net6.0 6 | 7 | Major 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 22 | 23 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 1.0.0 -------------------------------------------------------------------------------- /cdk.context.json: -------------------------------------------------------------------------------- 1 | { 2 | "acknowledged-issue-numbers": [ 3 | 19836 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /docs/docs/aws_services.md: -------------------------------------------------------------------------------- 1 | # AWS services 2 | 3 | Deploying this solution with the default parameters creates various infrastructure and resources on AWS, which are shown below on the left-hand side as the Testing Toolkit. 4 | 5 | However, the toolkit also requires a game to test, as shown below on the right-hand side as the Test Game. If you chose to deploy the test game when deploying the toolkit then the toolkit's SampleGame will also be installed, otherwise you'll need to deploy your own game integrated with GameLift. 6 | 7 | ![Amazon GameLift Testing Toolkit architecture on AWS](img/amazon_gamelift_testing_toolkit.png) **Figure 1: Amazon GameLift Testing Toolkit architecture on AWS** 8 | 9 | Once the toolkit has been deployed with a game, the key interactions with the toolkit and the game are as follows: 10 | 11 | 1. The UI provides the toolkit's management interface, which is hosted as a static website on [Amazon Simple Storage Service](https://aws.amazon.com/s3/) (Amazon S3) and distributed by [Amazon CloudFront](https://aws.amazon.com/cloudfront/). Users are authenticated via [Amazon Cognito](https://aws.amazon.com/cognito/). 12 | 2. The management services provide dynamic features for the web console, which are accessed through [Amazon API Gateway](https://aws.amazon.com/api-gateway/) endpoints that call [AWS Lambda](https://aws.amazon.com/lambda/), and use [Amazon DynamoDB](https://aws.amazon.com/dynamodb/) for storage. API calls are authenticated using Amazon Cognito. 13 | 3. Game servers and configuration in [Amazon GameLift](https://aws.amazon.com/gamelift/) are queried and updated by the management services. 14 | 4. Virtual players are controlled by the management services and run test game clients as [AWS Fargate](https://aws.amazon.com/fargate/) tasks in [Amazon Elastic Container Service](https://aws.amazon.com/ecs/) (Amazon ECS). 15 | 5. Test game clients make calls to game client service API Gateway endpoints, which use Lambda functions to request matchmaking. 16 | 6. Matchmaking requests are sent to GameLift to match virtual players in game server sessions. 17 | 7. Test game clients connect directly to game servers to play games. 18 | 8. GameLift listener listens for GameLift notifications and sends updates using [Amazon EventBridge](https://aws.amazon.com/eventbridge/), and is controlled by [AWS Step Functions](https://aws.amazon.com/step-functions/). 19 | 9. GameLift listener forwards notifications to the management services by updating DynamoDB. -------------------------------------------------------------------------------- /docs/docs/img/amazon_gamelift_testing_toolkit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-samples/amazon-gamelift-testing-toolkit/b31255ac6811ffc3e41e889f12fd487845f38422/docs/docs/img/amazon_gamelift_testing_toolkit.png -------------------------------------------------------------------------------- /docs/docs/index.md: -------------------------------------------------------------------------------- 1 | When developing multiplayer games with [Amazon GameLift](https://aws.amazon.com/gamelift/), games developers usually integrate their games with Amazon GameLift before deciding how to test the more complex features such as matchmaking, and server scaling. Since testing game servers across fleets of elastic instances requires complex orchestration of virtual players, it’s often hard to understand how best to configure Amazon GameLift, meaning its often left until late in the game development cycle. 2 | 3 | The Amazon GameLift Testing Toolkit helps games developers to quickly test, visualize, and optimize their multiplayer games. 4 | 5 | It automatically detects GameLift deployments, and provides a real-time view of player activity, letting users trial different designs, and quickly identify bugs and inefficiencies. This makes it easier to troubleshoot, debug, and tune your Amazon GameLift infrastructure. 6 | 7 | Coupled with the optional capability to launch virtual players running the same game code as real players, the Amazon GameLift Testing Toolkit gives game developers certainty their launch will be successful. -------------------------------------------------------------------------------- /docs/docs/security.md: -------------------------------------------------------------------------------- 1 | # Security 2 | 3 | When you build systems on AWS infrastructure, security responsibilities are shared between you and AWS. This [shared responsibility model](https://aws.amazon.com/compliance/shared-responsibility-model/) reduces your operational burden because AWS operates, manages, and controls the components including the host operating system, the virtualization layer, and the physical security of the facilities in which the services operate. For more information about AWS security, visit [AWS Cloud Security](http://aws.amazon.com/security/). 4 | 5 | ## Amazon CloudFront 6 | 7 | This solution deploys a web console [hosted](https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html) in an Amazon S3 bucket. To help reduce latency and improve security, this solution includes an Amazon CloudFront distribution with an origin access identity, which is a CloudFront user that provides public access to the solution's website bucket contents. For more information, refer to [Restricting Access to Amazon S3 Content by Using an Origin Access Identity](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-restricting-access-to-s3.html) in the _Amazon CloudFront Developer Guide_. 8 | 9 | ## Amazon Cognito 10 | 11 | An Amazon Cognito user pool is used to authenticate users of the web console. It is configured as a provider for a Cognito identity pool that uses an IAM role to authorize access to the management services API Gateway. 12 | 13 | ## IAM roles 14 | 15 | AWS Identity and Access Management (IAM) roles allow customers to assign granular access policies and permissions to services and users on the AWS Cloud. 16 | 17 | This solution creates a number of IAM roles that grant the solution's Lambda functions, Step Functions, and ECS tasks access to the resources they depend on. 18 | 19 | ## Amazon Virtual Private Cloud 20 | 21 | An Amazon VPC is used to create a virtual network for the virtual players. The virtual players' ECS tasks run in private subnets, and access the GameLift servers and the game client services over the public Internet via [NAT gateways](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html). -------------------------------------------------------------------------------- /docs/mkdocs.yml: -------------------------------------------------------------------------------- 1 | copyright: Copyright (c) 2023 by Amazon.com, Inc. or its affiliates. 2 | 3 | site_author: Amazon Web Services 4 | 5 | site_name: Amazon GameLift Testing Toolkit 6 | 7 | site_description: Documentation for the Amazon GameLift Testing Toolkit 8 | 9 | site_url: https://awslabs.github.io/amazon-gamelift-testing-toolkit/ 10 | 11 | repo_name: GitHub 12 | 13 | repo_url: https://github.com/aws-samples/amazon-gamelift-testing-toolkit 14 | 15 | theme: 16 | name: material 17 | 18 | nav: 19 | - 'index.md' 20 | - "Quick start" : 'quick_start.md' 21 | - "Using the toolkit" : 'using_the_toolkit.md' 22 | - "Testing your game" : 'testing_your_game.md' 23 | - "AWS services" : 'aws_services.md' 24 | - "Toolkit design" : 'toolkit_design.md' 25 | - "Security" : 'security.md' 26 | - "Removing the toolkit" : 'removing_the_toolkit.md' 27 | - "Additional resources" : 'additional_resources.md' -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "amazon-gamelift-testing-toolkit", 3 | "version": "1.0.0", 4 | "description": "A tool for deploying, testing and visualising Amazon GameLift", 5 | "main": "index.js", 6 | "author": "aws-solution-builders", 7 | "license": "Apache-2.0", 8 | "scripts": { 9 | "build-toolkit": "yarn pack-management-console && yarn build-web", 10 | "build-sample-game": "yarn pack-sample-game", 11 | "bootstrap": "cd ManagementConsole/Infra && npx cdk bootstrap", 12 | "deploy-toolkit": "cd ManagementConsole/Infra && npx cdk synth && npx cdk -a cdk.out/assembly-AGTT-ManagementConsoleStack deploy --all", 13 | "deploy-sample-game": "yarn pack-sample-game && cd SampleGame/Infra && npx cdk synth -c os=al2023 && npx cdk -a cdk.out/assembly-AGTT-SampleGameStack deploy --all", 14 | "deploy-sample-game-windows": "yarn pack-sample-game && cd SampleGame/Infra && npx cdk synth -c os=windows2016 && npx cdk -a cdk.out/assembly-AGTT-SampleGameStack deploy --all", 15 | "delete-toolkit": "cd ManagementConsole/Infra && npx cdk -a cdk.out/assembly-AGTT-ManagementConsoleStack destroy --all", 16 | "delete-sample-game": "cd SampleGame/Infra && npx cdk -a cdk.out/assembly-AGTT-SampleGameStack destroy --all", 17 | "pack-management-console": "cd ManagementConsole/Backend && dotnet pack --configuration Release", 18 | "pack-sample-game": "cd SampleGame/Backend && dotnet pack --configuration Release", 19 | "build-web": "yarn install-web && yarn install-static && cd ManagementConsole/UI && yarn build", 20 | "install-web": "cd ManagementConsole/UI && yarn install", 21 | "install-static": "cd ManagementConsole/UI/static && yarn install", 22 | "host-docs-website-local": "docker run --rm -it -p 8000:8000 -v ${PWD}/docs:/docs squidfunk/mkdocs-material" 23 | }, 24 | "devDependencies": { 25 | "aws-cdk": "2.124.0" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | aws-cdk@2.124.0: 6 | version "2.124.0" 7 | resolved "https://registry.yarnpkg.com/aws-cdk/-/aws-cdk-2.124.0.tgz#b07bbdb03a8b585dad85702295d234d782067e17" 8 | integrity sha512-kUOfqwIAaTEx4ZozojZEhWa8G+O9KU+P0tERtDVmTw9ip4QXNMwTTkjj/IPtoH8qfXGdeibTQ9MJwRvHOR8kXQ== 9 | optionalDependencies: 10 | fsevents "2.3.2" 11 | 12 | fsevents@2.3.2: 13 | version "2.3.2" 14 | resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" 15 | integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== 16 | --------------------------------------------------------------------------------