# GameLift Example with Serverless Backend: C++ Version Server and Client
This subfolder contains the details for the C++ -based game server and client. See the [main README](../README.md) for details on the backend architecture.
# Key features
* **C++-based Game Server running on Amazon Linux 2**
* Amazon GameLift with a setup for all key aspects of GameLift Server implementation and a simple TCP server to validate player session tokens
* **C++-based Game Client using the AWS C++ SDK**
* Communicates with Amazon Cognito and uses Cognito credentials to sign requests against Amazon API Gateway. Also includes a simple TCP client to connect to the game server
* **Works fully with the whole backend of the main example**
* Including Amazon Cognito authenticated requests to Amazon API Gateway, latency measurements against the different Amazon GameLift Locations, and pushing server logs to CloudWatch Logs
* **Uses all the same CloudFormation templates as the main example**
**Note**: _“The sample code; software libraries; command line tools; proofs of concept; templates; or other related technology (including any of the foregoing that are provided by our personnel) is provided to you as AWS Content under the AWS Customer Agreement, or the relevant written agreement between you and AWS (whichever applies). You should not use this AWS Content in your production accounts, or on production or other critical data. You are responsible for testing, securing, and optimizing the AWS Content, such as sample code, as appropriate for production grade use based on your specific quality control practices and standards. Deploying AWS Content may incur AWS charges for creating or using AWS chargeable resources, such as running Amazon EC2 instances or using Amazon S3 storage.”_
# Architecture Diagram
The architecture diagram introduced here focuses on the GameLift resources.
### GameLift Resources
![Architecture Diagram GameLift Resources](../Architecture_gamelift.png "Architecture Diagram GameLift Resources")
# Preliminary Setup
The easiest way to test the example is to use an **AWS Cloud9** environment. [AWS Cloud9](https://aws.amazon.com/cloud9/) is a cloud-based IDE running on an Amazon Linux 2 instance. It's perfect for GameLift server development as the environment is the same as the final execution environment on GameLift. It's possible to run all the scripts over SSH or Session Manager session to an Amazon Linux 2 instance as well.
1. **Setup Cloud9 Development environment**
* **Create the Cloud9 environment**
* Open the AWS Management Console and select a Region where you want to run the IDE. The best option is one close to your physical location for low latency.
* Open Cloud9 service and select "Create Environment"
* Select a name such as "GameLift Cpp Example" and click "Next Step"
* Leave everything else as it is (you should have Amazon Linux 2 selected for the platform) and **select the m5.large** instance to make sure we have a fast and fluent build experience
* Select "Next Step"
* Select "Create Environment"
* **Resize the Cloud9 environment volume**
* Open Cloud9 management console again in another tab, click on the name of the Cloud9 Environment and select "Go to Instance"
* Click on the Instance ID
* Select "Storage" and click on the volume-id
* Select Actions -> Modify Volume, set the size to 40 and click "Modify" and then "Yes"
* Go back to instances and select the Cloud9 instance checkbox
* Select Instance State -> Reboot Instance and click "Reboot"
* Go Back to the Cloud9 enviroment tab and you should see it connecting back after the reboot. We now have the development environment set up with sufficient disk space for building all the SDKs!
2. **Clone this repository to the Cloud9 instance**
* Select the terminal in the bottom of the editor in Cloud9
* Run `git clone https://github.com/aws-samples/aws-gamelift-and-serverless-backend-sample.git`
* Run `cd aws-gamelift-and-serverless-backend-sample/` to open the folder
# Deployment
The backend deployment steps 1-3 are here for convenience, you might have done them already.
1. **Set up your configuration** (`configuration.sh`)
* Modify the script to set the `region` variable to your selected region for the backend services and GameLift resources
* Modify the script to set the `deploymentbucketname` to a **globally unique** name for the code deployment bucket
* Set the `secondaryregion` variable in the script to your selected secondary location as we're running the Fleet in two different Regions
2. **Deploy the Backend API and PreRequirements stacks** (`deployBackendAndPreRequirements.sh`)
* Make sure you have the SAM CLI installed
* Run the script to deploy the backend API and the PreRequirements Stack (`deployBackendAndPreRequirements.sh`)
* This will run two scripts to deploy both the serverless backend with SAM (GameServiceAPI/deploy.sh) as well as the Cognito and IAM resources we need for configuration with CloudFormation (FleetDeployment/deployPreRequirements.sh).
3. **Set the API endpoint and the Cognito Identity Pool in the Client Project** (`CppServerAndClient/Client/Client.h`)
* Open the file CppServerAndClient/Client/Client.h in the Cloud9 editor
* Set the value of `String backendApiUrl` to the endpoint created by the backend deployment. You can find this endpoint from the `GameLiftExampleServerlessGameBackend` Stack Outputs in CloudFormation, from the SAM CLI stack deployment outputs or from the API Gateway console (make sure to have the `/Prod/` in the url)
* Set the value of `String identityPoolId` to the identity pool created by the Pre-Requirements deployment. You can find the ARN in the CloudFormation stack, in the Amazon Cognito console or as the output of Step 2.
* Set the values of `const char* REGION` and `String regionString` to the applicable values of your selected main region. Set the value of `String secondaryRegionString` to a GameLift supported Location region. These two regions will be used based on the latencies provided by the clients to the matchmaking.
4. **Download, Build and setup the GameLift C++ Server SDK**
* Open the CppServerAndClient folder (`cd CppServerAndClient`) in the Cloud9 terminal
* Run the script `./SetupGameLiftSDK.sh`to download, build and configure the GameLift Server SDK. This script will copy the relevant files under the Server project as well.
* **NOTE**: This will take some time as it downloads a number of dependencies and builds the SDK
* Make sure this completes without errors by checking that the `CppServerAndClient/Server/` folder now has subfolders `include` and `lib`
5. **Download and Build the AWS SDK for C++**
* Run the script `./SetupAWSSDK.sh` to download, build and configure the AWS SDK for C++. This script will make the AWS Core and Amazon Cognito libraries available on this maschine so we don't need to copy them anywhere separately.
* **NOTE**: This will also take some time as it downloads the whole SDK and builds the relevant parts
6. **Build the server and Deploy the build and the GameLift resources** (`CppServerAndClient/BuildAndDeployCppGameServerAndUpdateGameLiftResources.sh`)
* You can test that the server compiles correctly by going to `CppServerAndClient/Server/` in the terminal and running `./build.sh`
* go to `CppServerAndClient` in the Cloud9 terminal and run `./BuildAndDeployCppGameServerAndUpdateGameLiftResources.sh` to Build the server, upload it to GameLift and deploy all the GameLift resources with CloudFormation. This will take time as it will create a GameLift Fleet and deploy game servers to two different Regions. The CloudFormation wait might time out but you can check the progress also in the CloudFormation and GameLift management consoles.
* NOTE: It's likely this step will time out when waitin
没有合适的资源?快使用搜索试试~ 我知道了~
此示例可帮助您开始使用 Amazon GameLift 开发,并利用部署自动化和基础设施即代码_c#_代码_下载
共125个文件
meta:31个
asset:17个
sh:16个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 153 浏览量
2022-06-23
11:45:35
上传
评论
收藏 1.18MB ZIP 举报
温馨提示
此存储库包含在 AWS 上利用 Amazon GameLift(一种完全托管的游戏服务器托管解决方案和无服务器后端服务)的基于多人会话的游戏托管解决方案。该解决方案旨在快速开始在 MacOS 和 Windows 上进行多人游戏开发。它包括作为代码自动化的基础架构,以及用于部署所有必需资源的部署脚本,并支持 Unity 和自定义 C++ 引擎。 本自述文件包括架构概述,以及解决方案的无服务器后端服务的部署说明和文档。然后,您可以根据游戏客户端、游戏服务器设置和 GameLift 资源设置的需要分支到 Unity 和 C++ 特定自述文件 更多详情、使用方法,请下载后阅读README.md文件
资源推荐
资源详情
资源评论
收起资源包目录
此示例可帮助您开始使用 Amazon GameLift 开发,并利用部署自动化和基础设施即代码_c#_代码_下载 (125个子文件)
ADD_GAMELIFT_SDK_DLLS_HERE 0B
ProjectSettings.asset 18KB
QualitySettings.asset 6KB
InputManager.asset 6KB
GraphicsSettings.asset 2KB
Physics2DSettings.asset 2KB
NavMeshAreas.asset 1KB
DynamicsManager.asset 1KB
EditorSettings.asset 1KB
UnityConnectSettings.asset 853B
AudioManager.asset 416B
TagManager.asset 378B
VFXManager.asset 273B
EditorBuildSettings.asset 255B
TimeManager.asset 208B
XRSettings.asset 158B
PresetManager.asset 120B
ClusterInputManager.asset 114B
Client.cpp 9KB
Server.cpp 7KB
Server.cs 17KB
Client.cs 14KB
GameLift.cs 9KB
NetworkClient.cs 7KB
ClientServerConfiguration.cs 7KB
NetworkPlayer.cs 5KB
MatchmakingClient.cs 5KB
SimpleStatsdClient.cs 2KB
MessageClasses.cs 2KB
NetworkProtocol.cs 2KB
SimpleController.cs 2KB
MatchmakingSerializationClasses.cs 875B
UIManager.cs 709B
Dockerfile 135B
.gitattributes 34B
.gitignore 2KB
.gitignore 1KB
.gitignore 107B
Client.h 640B
Server.h 593B
requestmatchmaking.js 3KB
processmatchmakingevents.js 2KB
requestmatchstatus.js 2KB
test-handler.js 651B
amazon-cloudwatch-agent.json 2KB
manifest.json 2KB
amazon-cloudwatch-agent.json 2KB
package.json 469B
LICENSE 10KB
GroundMaterial.mat 2KB
PlayerMaterial.mat 2KB
EnemyMaterial.mat 2KB
README_UnityClientServer.md 21KB
README.md 17KB
README.md 12KB
CONTRIBUTING.md 3KB
README.md 2KB
CODE_OF_CONDUCT.md 309B
ClientServerConfiguration.cs.meta 243B
Client.cs.meta 243B
NetworkClient.cs.meta 243B
SimpleController.cs.meta 243B
MatchmakingSerializationClasses.cs.meta 243B
MatchmakingClient.cs.meta 243B
UIManager.cs.meta 243B
Server.cs.meta 243B
GameLift.cs.meta 243B
SimpleStatsdClient.cs.meta 243B
NetworkProtocol.cs.meta 243B
MessageClasses.cs.meta 243B
NetworkPlayer.cs.meta 243B
PlayerMaterial.mat.meta 188B
GroundMaterial.mat.meta 188B
EnemyMaterial.mat.meta 188B
Scenes.meta 172B
Scripts.meta 172B
Dependencies.meta 172B
PrefabsAndMaterials.meta 172B
Client.meta 172B
Server.meta 172B
NetworkingShared.meta 172B
SignersAndUtilsFromS3SigningExample.meta 172B
GameLiftServerSDK.meta 172B
AWSSDK.meta 172B
link.xml.meta 158B
GameWorld.unity.meta 155B
ADD_GAMELIFT_SDK_DLLS_HERE.meta 155B
SimpleCharacter.prefab.meta 154B
EnemyCharacter.prefab.meta 154B
NOTICE 118B
.npmignore 8B
Architecture_diagram.png 557KB
Architecture_gamelift.png 362KB
Architecture_small.png 222KB
SimpleCharacter.prefab 6KB
EnemyCharacter.prefab 6KB
downloadAndSetupUnityDependencies.ps1 5KB
deployBuildAndUpdateGameLiftResources.ps1 4KB
deployPreRequirements.ps1 2KB
deploy.ps1 1KB
共 125 条
- 1
- 2
资源评论
快撑死的鱼
- 粉丝: 2w+
- 资源: 9157
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 房屋建筑和市政基础设施工程招标投标统计报表.docx
- 放射诊疗许可申请表( X射线影像诊断、介入放射学、 核医学、放射治疗).doc
- 各级卫生计生行政部门调查表.docx
- Java+Servlet+Jsp+Mysql实现Web新闻发布系统.zip
- 集中医学隔离点及住宿费项目绩效评价指标体系及分值设定.docx
- 基美电容规格对照表.docx
- 街道(乡镇)基层人社经办机构基本信息表.xls
- 结婚函调报告表.docx
- 考核合格以下及受处分人员情况报表.doc
- 考入高等院校贫困新生政府资助申请表.docx
- 考入高等院校贫困新生政府资助申请表.xls
- 劳动保障监察书面材料审查表.doc
- 劳务派遣单位申请一次性扩岗补助资金使用协商证明、人员信息统计表.docx
- 劳务派遣岗位经费绩效目标申报表.docx
- 林业有害生物损害赔付认定标准表.docx
- 领取一次性工伤医疗补助金权利义务告知书.docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功