GameLift and UE4, how do ya do it?

So I’m trying to implement Amazon GameLift into my UE4 project, I’m using the client API plugin made by Yetti Studio’s (found here: GitHub - YetiTech-Studios/UE4GameLiftClientSDK: Gamelift Client SDK for Unreal Engine 4. ) and the official GameLift server api found on the UE4 marketplace. I’ve been looking around and I’m still not sure how exactly GameLift passes UE4’s session data across a network. Does anyone have insight into this?

Also the way we currently have our dedicated server set up is that when you run the server executable it creates a game session, then the client searches for any open server session and joins one if found. But most of the examples I’ve been seeing for Gamelift is that the client has to create a game session to ‘activate’ a server. Can someone explain whats happening here and if I’m able to bend Gamelift to what is already set up in my project?

I’ve created a custom OSS and I basically want to replace the session interface with a GameLift session interface. I would like to do this purely in my custom OSS, so I don’t have to add custom GameLift code to my GameSession/GameInstance classes. If you have any tips on this please let me know!

I know this is a lot, but any info that you can give will help!

Thanks,
Londo

Also I’m wondering if GameLift runs concurrently with UE4’s Online Subsystems or totally subverts them. I would imagine it has to talk to them in some way, but I’m not seeing that anywhere. Please HELP!!!

Its hard… but it can be done. I’ll probably make a blog post on it or something. But there are youtube videos and stuff on it now, I think, that will give you a basic implementation.

It’s been a while since this question has been posted but I thought would chime in. With regards to UE4 session data, there can be a lot that goes into this. Local data will exist on the instance of a running server application for as long as it runs, whether the server is hosted on AWS GameLift or not. Certain information can be replicated from your server to the clients depending on your game logic. If you want data to persist outside of the server executable’s lifetime, then you need an external database to store that information. For instance, AWS offers a NOSQL database service known as DynamoDb that can be used for this. In addition, for data about specific players/clients, the same argument applies. Data about players as they leave and join a game can be stored either locally in the running server process or in an external database.

As for your second question, the GameLift class in the AWS SDK has a lot of functions, one of them being the ability to create game sessions. The GameLiftClientSDK is essentially a wrapper around the AWS SDK so that functions from that SDK can be called using blueprints. But what happens when a client creates a game session is that GameLift is notified that there has been a request to create a game session, and in response, GameLift will try to find a server process that is available for hosting a game session running in the fleet specified in the arguments passed in. Since this takes time, a game session may not be fully activated right away. That’s why you have to later search for active game sessions within that same fleet and later choose one for the client to connect to.

As for your third question, if you created a custom OSS, then there’s a lot of flexibility when it comes to which GameLift features you want to use. For example, you can just upload a server build to GameLift, make a fleet for that build that runs a few ec2 instances, each running multiple copies of the server processes and theoretically not care about anything else. You would have the ip addresses and ports of the server applications running in AWS cloud, which is all you need to have clients connect to and be in the same server technically. Also note that when you quit server applications hosted on GameLift, they restart automatically so this could be useful information for someone reading. In my opinion that seems to be the bare minimum with the only gamelift code that has to be added being the call to the ProcessReady function. From there, you can build up to include more GameLift features if you want.

At first, I also used the GameLiftClient SDK on Github directly in an Unreal Engine game client so that the client could make game and player sessions on GameLift and connect to the Unreal Engine game server hosted on GameLift. And that lead to my first couple of tutorial videos on the topic. Part 1 of that tutorial can be found here.

However, I ultimately realized that this approach goes against AWS’ recommended practices in that you shouldn’t directly embed long-term AWS credentials associated with an AWS account (access key and secret access key) into a UE4 client. So I decided to move away from the client sdk to a client service, which is in the form of API Gateway and AWS Lambda. Then, the client, instead of using the client sdk, would make http requests to this client service in order to communicate with GameLift and other AWS services. This also makes it easier to have the same project on different platforms (Windows, Android, Linux, MacOS, etc.) since for http requests, the native UE4 HTTP and JSON libraries are being used. In the end, I also delved into more features that AWS has to offer within and outside of GameLift and how to incorporate them into an Unreal Engine project while following recommended practices. I cover a lot of those concepts in depth in my new tutorial series. Part 1 of those updated tutorials can be found here.

Lastly, I just want to point out the client sdk is still a good plugin for getting setup quickly with GameLift and testing with small controlled groups.

I know this was a long post, but I just want to help clarify as much as I can anything related to GameLift and multiplayer development in UE4.

Hey thanks. I haven’t touched this stuff in a long time but it seems like you know what your talking about and probably came up with a better solution than me lol. While I was working on it I did always worry about our credentials being found, but I was too focused on trying to get it to work to fix that problem. Plus back then documentation for AWS & AWS in UE4 was really bad. In the future when I need to re-implement Gamelift, I’ll be sure to check out your tutorial.