# 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

# 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 下载量 199 浏览量
2022-06-23
11:45:35
上传
评论
收藏 1.18MB ZIP 举报
温馨提示
此存储库包含在 AWS 上利用 Amazon GameLift(一种完全托管的游戏服务器托管解决方案和无服务器后端服务)的基于多人会话的游戏托管解决方案。该解决方案旨在快速开始在 MacOS 和 Windows 上进行多人游戏开发。它包括作为代码自动化的基础架构,以及用于部署所有必需资源的部署脚本,并支持 Unity 和自定义 C++ 引擎。 本自述文件包括架构概述,以及解决方案的无服务器后端服务的部署说明和文档。然后,您可以根据游戏客户端、游戏服务器设置和 GameLift 资源设置的需要分支到 Unity 和 C++ 特定自述文件 更多详情、使用方法,请下载后阅读README.md文件
资源推荐
资源详情
资源评论




























收起资源包目录





































































































共 125 条
- 1
- 2
资源评论


快撑死的鱼
- 粉丝: 2w+
- 资源: 9155

下载权益

C知道特权

VIP文章

课程特权

开通VIP
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- 84105929555134世界网络收音机 .apk
- 【毕业设计】基于Python的Django-html人脸表情的分类算法的设计源码(完整前后端+mysql+说明文档+LW+PPT).zip
- 中移铁通操作手册.docx
- 【毕业设计】基于Python的Django-html人信息管理系统及安全策略分析系统源码(完整前后端+mysql+说明文档+LW+PPT).zip
- 狮子座12025年一定要.txt
- 【毕业设计】基于Python的Django-html深度学习文本相似度检测系统(bert)源码(完整前后端+mysql+说明文档+LW+PPT).zip
- 【毕业设计】基于Python的Django-html深度学习的web端多格式纠错系统源码(完整前后端+mysql+说明文档+LW+PPT).zip
- 【毕业设计】基于Python的Django-html图像取证技术研究与实现系统源码(完整前后端+mysql+说明文档+LW+PPT).zip
- 【毕业设计】基于Python的Django-html手写数字识别系统源码(完整前后端+mysql+说明文档+LW+PPT).zip
- 2025误差理论作业参考.zip
- 【毕业设计】基于Python的Django-html图像去雾算法研究系统源码(完整前后端+mysql+说明文档+LW+PPT).zip
- 【毕业设计】基于Python的Django-html图像信息隐藏技术设计源码(完整前后端+mysql+说明文档+LW+PPT).zip
- esp32配置 light-sleep 和 adc button 运行一段时间后系统重启
- 龙岩市乡镇边界,shp格式
- 宁德市乡镇边界,shp格式
- 景德镇市乡镇边界,shp格式
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
