GameLift with unity

Hi, I'm using gamelift realtime server and I have a problem:

The clients are in the same gamesession and they can send messages each other but no one appear on the windows of the other. I mean, I can just see the client player and not the player of the another client. But If I "shoot" I see a message on screen about someone shoot. So, it's connected but I can't see the other players.

I don't know how integrate gamelift with unity and if I have to use unity network manager to connect each other and show my player on the another client.

If someone could explain me how it work and show me a piece of code to know what I have to do to see the players on my window and that the other players see me too.

Thank you, I'll hope your help

Saw your message in the other thread, glad to help if I can.

If all users are able to connect and network message are being sent I would lean towards this being a unity issue. It sounds like maybe the remote client isn't being instantiated / created correctly. Especially If you can see your own character but not your opponent. Do you have logic there related to "isLocalPlayer" that could be disabling the other players character?

Are you able to run and host a version locally without gamelift involved? I have my gamelift logic isolated as much as possible so I can disable it's component and set a debug flag. This way I can run my build 3 times with the network manager hud enabled to start a server and 2 clients on my local machine. I would definitely recommend something similar. Building multiple versions, one for linux on gamelift, and another for mobile, then going through the whole upload and fleet setup on AWS is just a pain to verify minor code changes. It's also really nice to be able to run the server in the editor and see the debug.log() statements in realtime.

Ooh, I didn't make the networkmanager configuration because I thougth that it was not necessary with gamelift.

How can I make that my networkmanager connect with gamelift?
Because I tried to make that but I didn't know how connect network manager with and external server and less with gamelift realtime server that look like have not an endpoint.

So, like I thought that network manager isn't necessary or can't be used with gamelift realtime server I removed it all

Have you some resource that I can check to use network manager and gamelift together to connect to the same server (the fleet) and not local?

Keep in mind GameLift is only one piece of the puzzle. It is just a means to host and scale dedicated servers. Everything beyond that has to be solved unfortunately. It is definitely not an all in one solution and being part of AWS, follows the same piece meal approach as their other cloud tools.

What is needed:
1.) Unity networking solution. I use the Network Manager and the HLAPI. But there shouldn't be any reason you can't use an alternative like Mirror or Photon, the LLAPI, or the new networking solution etc. This is responsible for all the gameplay networking logic and connecting / disconnecting to the server.

2.) GameLift to host and run the server version of your game. For me this is all the same code base as the client version. It only requires me to disable a couple components and scenes, then build to linux.

3) Player account or communication system. You'll need a way to trigger GameLift to start servers using their matchmaker (FlexMatch) or by doing it manually. Once players have been matched together and a server has been started you will also need a way to send each player the IP and Port information for the server. Generally the advice is not to do this with non authenticated clients to prevent abuse. There are a bunch of different solutions for this: GameSparks, PlayFab, ChilliConnect, Firebase, AWS Cognito, or your own solution etc. The user logs in and then runs a cloud / server side script to trigger the matchmaker.

What the flow looks like for my project:
1.) User starts the game on their mobile device.
2.) Users clicks "Login button" that logs them into their Firebase account.
3.) User clicks "Play Now".
4.) Play Now runs a Firebase Function that makes an AWS request to GameLift Flex Match to Start Matchmaking.
5.) Flex Match adds the user to the matchmaking queue.
6.) User is matched against an opponent and FlexMatch reports a match has been found.
7.) GameLift Server is started for the corresponding users.
8.) GameLift triggers an AWS Lamba function that sends IP and Port information of the server back to Firebase.
9.) Firebase updates the players account data with the IP and Port information.
10.) The player data from Firebase is synced to the user.
11.) The network manager component IP and Port information is filled in and connect is triggered.
12.) User joins the match and plays happily.

What do you actually need to implement to get this to work?
1.) Make a multiplayer game using the Network Manager / HLAPI or alternative.
2.) Create a component in Unity that uses the GameLift Server SDK and build to linux (or windows if you prefer). Link to docs.
3.) Write an AWS Lambda function that can be triggered by GameLift/FlexMatch to communicate to which ever player account system you use.
4.) Add a player account SDK to your game.
5.) Write a cloud function for your player account system that can make requests to AWS to start matchmaking.

Is this the right approach for you?
Highly debatable. This took a lot of work and learning on my part even though it's stuff I wanted to learn anyways. But... their was definitely some hiccups along the way (Finding an alternative to GameSparks caused lots of wasted time). It's probably worth investigating alternatives.

To answer your specific questions:
How can I make that my networkmanager connect with gamelift?"
Set the IP and Port fields and run StartClient(); Easiest way to test is to use the network mananger hud component. It'll give you UI in your game to do this manually.

network manager isn't necessary or can't be used with gamelift realtime server I removed it all
I use the network manager class. You don't have to use the network manager class or component, but you have to use something as a replacement. GameLift is just a means to get AWS to run an executable and give it an IP and Port. No connecting / disconnecting or gameplay networking logic.

Have you some resource that I can check to use network manager and gamelift together to connect to the same server (the fleet) and not local?
If you choose to go this route the best way would be to get your game working locally with the Network Manager and Network Manager Hud. You should be able to run your game executable 3 times, start 1 server, and 2 clients. If it all works as anticipated then that piece of the puzzle is solved. Then move onto the GameLift portion and get that working on AWS. Then once that's done you should be able to just manually enter the gamelift ip and port info into the hud and connect to the gamelift version.

If you are just starting with the network manager though I would give some serious consideration to looking for long term alternatives first. Unet is marked as deprecated at this point, I'm still using it cause I don't want to re-do everything this late in the game. I would suggest checking out the deprecation thread or googling for alternatives, it's a problem everyone is struggling with at the moment.


I'm using Gamelift realtime server, not a gamelift server on a built of my game. So, that is useful to make a gamelift with a server made with unity, but my server is a nodejs script

My apologies, I didn't realize their was an alternative solution included under the GameLift name.

Looking at the docs though it seems you are correct to assume it handles messaging logic. My assumption skimming this is you don't need the Unity networking manager or Unity's networking API's as the Client SDK for realtime servers appears to be responsible for the same logic.

It looks like all client gameplay logic would need to be keyed off the OnDataReceived() callback and then digested based on the opCode.

         *  Handle data received from the Realtime server
        public virtual void OnDataReceived(object sender, DataReceivedEventArgs e)
            switch (e.OpCode)
                // handle message based on OpCode

Looks like it would be up to you to update all aspects of the client based on these events sent from the server. If OpCode equals Attack then play the attack animation etc.

Additionally if Connect() is triggered you'd have to send a connect event to the other client, and manually instantiate the object/prefab that represents them. The parallel to the HLAPI would be calling NetworkServer.Spawn(). Which does this for you behind the scenes, but with this SDK you would be responsible for manually implementing this.

Okay, thanks. I'll try to figured out of how I can make manually a NetworkServer.Spawn() on gamelift realtime.

OTOH definitely when I get it, I'll make an asset for unity to help the other users avoid all this problematics stuffs

@Tholem did you find answer to your problem?