قالب وردپرس درنا توس
Home / Tips and Tricks / How to get started with AWS GameLift – CloudSavvy IT

How to get started with AWS GameLift – CloudSavvy IT



GameLift Header Image

GameLift is a platform built by AWS specifically created to run video game servers. It is built to save costs by automatically scaling the number of instances based on the fluctuating demand, and it can also handle matchmaking for you.

What is GameLift?

Every match played online must have a server hosting it, which can get expensive very quickly. To make matters worse, the demand for gaming servers usually scales drastically throughout the day, making peak demand much greater than what is required overnight.

GameLift handles the scaling of your server architecture automatically, just like EC2 Autoscaling. It can handle basic matchmaking and sort your players into lobbies based on latency. GameLift also supports custom matchmaking rules, which can sort players by skill level and get rid of the need to build and operate a separate matchmaking system.

GameLift has an SDK and plugins for both Unity and Unreal. You can use this to communicate directly with GameLift and place players in queues or request new sessions from your game.

GameLift has two types of servers: “Realtime”

; server and “Custom” game servers. Real-time servers are designed for games that do not require complex custom servers running a headless copy of the game engine. Think mobile games that really only need a database and some basic logic. You program these with Realtime Script, based on C #.

Although these are interesting, they also seem to be the hassle and really require you to build the whole game around it, but it can be much cheaper if your game can be equipped to run on the platform. With the “Custom” server option, you can upload your own server binary, giving you much more flexibility. With this type of server, GameLift works as a nice version of EC2 autoscaling, which is what this article covers and what most people will probably use anyway.

Alternatives to GameLift

If you do not want to use GameLift, you have some options. First, you can simply run your servers on EC2 and use standard EC2 autoscaling instead. If you do not use GameLift’s custom scaling rules, standard EC2 autoscaling is not much different from GameLift. But there is one major drawback here – with standard EC2 automatic scaling, you want to use location instances to minimize costs, as they are often several times cheaper than renting capacity on demand.

GameLift also uses Spot Instances, but on GameLift there are extra precautions to ensure that your server does not shut down if it is currently being used to host a game. And if it needs to be shut down, GameLift can signal your server to perform the shutdown process gracefully. Statistically, Spot Instance interruptions are quite rare, but they will be handled better on GameLift.

Even so, EC2 Auto-Scaling is probably your best alternative to GameLift on the AWS platform. If you know the basic number of players you will need to support, you can buy reserved instances for much cheaper than On-Demand instances and then use On-Demand instances for scaling during peak hours.

Another option is to simply let the client host the server. Some game types, especially turn-based or casual, unranked games, may have one of the clients in the game act as a listening server, with everyone else connecting to that client. However, this is not good for running ranked games, because if the listener server is closed, it can cut the connection to everyone else. It also opens up the possibility of severe cheating because the client has full control over the server (if they are chosen to host the listening server). But with all this, this type of network can be used for matches between friends or for small indie games without the possibility of hosting dedicated servers for everyone.

Create and upload a building

The first step in using GameLift is build. You must package your server in a single building that can be uploaded to AWS and run on a server fleet. The build contains your binaries, dependencies and installation scripts. It can run on Windows or Linux; usually Linux will be cheaper, as there is less memory and no licensing costs. But many games are not built for Linux, so you may be stuck with Windows. The installation script will be a file in the root directory of your game server building named install.bat or install.sh, depending on the platform. The server itself installs to C:game or /local/game/.

You can only upload builds from AWS CLI. To do so, use gamelift upload-build command:

aws gamelift upload-build --name  --build-version  --build-root  --operating-system WINDOWS_2012 --region us-east-1

The process of building and running depends on the configuration of the game. So if you just want to test GameLift’s features without going through this process yet, AWS provides a trial game server that you can upload with the GameLift Console.

Give your sample build a name and click upload. To be able to use it, you must create a “Fleet” that uses this build. Fleets are like auto-scaling groups – they are configured to run your game server and host sessions in separate instances. You can create a new fleet by clicking build and selecting “Create fleet from build”, or you can create the test fleet from review by clicking “Create fleet.” Both the fleet and the building will appear in your console now, but it will probably take about half an hour to create and validate.

How to distribute a game with a custom game server

If you click on the fleet, you can see information about it, such as the current number of sessions and active players and all the fleet’s life cycle events.

fleet info

You can also edit fleet settings. You will find options for using Spot Instances, changing the instance type and specifying the executable that is started (and the parameters that it starts).

marine settings

From this settings panel, you can also configure your fleet to run multiple game sessions on a single server. If you know how many sessions a given server can support, you can set it up here.

In the EC2 port settings, you can configure the number and frequency of your enabled gaming sessions for each instance.

Once the test fleet has completed the validation, you can download the test game client (built with AWS’s Lumberyard game engine, a fork with CryEngine) and connect to it with the token you provided.

As far as actually using your fleet, you want to create a “queue”, which sorts players into matches based on latency. You can set rules for trying to find low latency matches before trying to match higher latency and select the fleet you want to target users to.

gameliftkö

To provide good matchmaking for everyone, you want servers all over the world. AWS rates in other regions can be expensive, but if you stick to some cheap ones, you can lower your costs.


Source link