Create client in Unity

Hello, I am trying to integrate GameLift into my Unity game, and I have gotten the server to start through GameLift, but can’t seem to find the methods to call in Unity to connect from a client. I have “using Aws.GameLift.Server;”, which gives me access to all the methods for setting up a server, but there doesn’t seem to be a namespace for the client side methods. Thanks for any help!

It seems that although there is Unity support in the GameLift Server SDK, the AWS .NET SDK, as indicated at here, does not yet include GameLift in its list of supported modules.

Not sure if this is an oversight at the moment given this is all very newly announced. I suspect we will see support for GameLift get included in the Unity SDK shortly.

Hi.

My company is looking for a network solution for a Unity game.

We looked for the GameLift service and it seem interesting, but we’re not sure to correctly understand what the service can provide us.

We tried the sample app and followed the “get started” section but without being able to go further.

The documentation indicated that the cpp-aws-sdk must be used for unity client integration, but it appears that the Unity-Net-sdk must be used and the gameLift service is missing in this sdk.

We understand that the GameLift service is for create gameSessions and scale game servers, but what about the client-server communication? Can we use the Unity multiplayer functionalities? Can we use GameLift for all platforms in unity (iOS, Android, WebGL).

Thanks for clarifications.

I think at this point you will have to manage the GameLift sessions outside of the Unity client attempting to connect to them.

A solution might be to use the the .NET Core SDK through an AWS Lambda service that the client can communicate with either directly or through an AWS API Gateway. The Lambda service, with the GameLift api available to it, can then initialize and manage game sessions and pass this information back to the Unity client.

I think ultimately this is how you would may want to structure your network backend, as you might not want to give the client direct access to the GameLift resources. It is a bit cumbersome for testing purposes though.

I’m in the process of trying to put something like this together for my own understanding and will share it here if I make any decent head way.

Thanks for the reply. Hopefully they add it to the Unity SDK soon, would really like to switch over to GameLift from our current hosting solution.

Could you expand a bit more on why structuring it this way may be better than integrating GameLift directly into the Unity client?

@MisterGameLift might be able to provide some more clarity for you.

Hi @mcguinnessdr,

You are right, the GameLift Server SDK does not have client side methods. However, you can still include them by building the AWS .NET SDK [1]. Build the Net35 project and move the DLLs to your Plugins folder in Unity. This is very similar to how you imported the server DLLs [2]. The client DLLs you are interested in are AWSSDK.GameLift.dll, AWSSDK.Core.dll, AWSSDK.CognitoIdentity.dll, and AWSSDK.SecurityToken.dll.

Hope that helps, let us know if you have more questions! We will definitely look into ways to make this process more user friendly.

[1] https://aws.amazon.com/sdk-for-net/
[2] http://docs.aws.amazon.com/gamelift/latest/developerguide/integration-engines-unity-using.html

Sorry for the late reply.

I think depending on the auxiliary services around your game you may want to restrict session creation and initialization to control of an authoritative server.

This would let you modify game initialization behaviour without issuing updates to the client.

Your service would also be a little more secure against potential attacks that might abuse open access to your GameLift resources.

Thanks Andrew, I really appreciate it!

I think AWSSDK.GameLift.dll, AWSSDK.Core.dll is enough for client side.

Hi @Brendon, I’d like to jump in here since I’m also interested in this topic.

I have read a lot of posts saying how using another service on top of the GameLift service would make it more secure, but I just don’t see how.

Since you can give IAM users access only to certain actions, that means that a malicious user could only spam the CreateGameSession or StartMatchmaking calls, which is bad, sure. But what’s stopping that user from spamming your intermediate service with those same requests ?

How could the intermediate service can be made more “DDOS-proof” ?

What am I missing ?

Bump. This never got any clarification and it still isn’t clear what the intended approach is when it comes to Unity and Gamelift Client.

Hey there - apologies for the delay getting back to you. We do not recommend game clients connect directly to GameLift. Brendon above has a lot of the main points covered - lack of control over how often game clients call CreateGameSession or StartMatchmaking means your game can “fill up” quickly if even one client starts to misbehave. Instead our recommended approach is to proxy client-side requests through something that can authenticate your player connections - AWS Lambda is a good choice here coupled with Cognito.

Here’s a high-level diagram from our documentation that shows our best-practice deployment for GameLift servers in relation to your game client:

https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-architecture.html

Hi @hoover_song , I have the same problem here. I am trying to integrate client DLL into a Unity3d project, and I put prebuilt AWSSDK.Core.dll(3.3.29.12 .net35) into the Assets/Plugin directory. However, I failed to create AmazonGameLiftClient. It seems the reason is that Unity3d project is lack of app.config.

I have asked a question about the error but get no answer.

Had you find a way to integrate GameLift client into Unity3d, or you used the separate game service approach?

Thank you very much.

Hi @Andrew , I am trying to use AWS .NET SDK in a Unity3d project, but it seems not to work properly, I have posted the detail on StackOverflow, is there any step I have missed? Thank you very much.

Hi! Sorry to bump this after this time… But Here’s the only place for this topic.
When you say(And the diagram) “Client Service”, I don’t know what you want us to do.
I can explain: In the API, only a client can request to create a session. You want us to make a “Fake client” (That is the service) to request this type of things and connects the “Real” Clients with the info from the service, without be a GameLift Client?

Thanks in advance

@Hukha - Note this is the suggested design but not required. You basically have two options

  1. Your clients request actions in AWS services directly - Means your clients have to know about and have permissions to call and take action on AWS resources directly. This could work for your game but if clients are compromised, have bugs or you need to make changes to your backend you have fewer options to control. Basically it would be fine for development where your client base is limited.

  2. You clients request actions via a proxy service - You know have a trusted place to make requests, its easier to make changes to the backend and it gives you a place to build game service logic to support FlexMatch etc. However this is more complex and something you could build later esp as your game needs to expand its testing base or is getting ready for release.

@chrisgong has a set of interesting videos that cover some of this (his video series is for Unreal + GameLift but much of is interesting regardless of engine). He covers his take on a ‘proxy’ service here: https://www.youtube.com/watch?v=TJjn9xcm3Gs&feature=youtu.be

2 Likes

Hello!
The doubt is: I can make a “Fake client” (Instance of GameLiftClient) and send requests from a trusted place then send the “real clients” to connect to the session created from the “Fake Client”?