How do you set-up and use a SearchGameSessionsRequest in C++?

Hi all,

So I’m trying to call SearchGameSessions() from my client so I can connect to an active game server. But the client isn’t finding anything. So here’s some info on whats happening. Also this is all in UE4 and C++.

This is what my request looks like (basically):

Aws::GameLift::Model::SearchGameSessionsRequest Request;
FString AliasID = FString("alias-xxxxx-xxxx-xxxx-xxxx-xxxxxxx");
FString FilterExp = FString("hasAvailablePlayerSessions=true");
Request.SetAliasId(TCHAR_TO_UTF8(*AliasID));
Request.SetFilterExpression(TCHAR_TO_UTF8(*FilterExp));
LOG_NORMAL("Requesting to search for game sessions");
Aws::GameLift::SearchGameSessionsResponseReceivedHandler Handler;
Handler = std::bind(&UGameLiftSearchGameSessions::OnSearchGameSessions, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4);
GameLiftClient->SearchGameSessionsAsync(Request, Handler);
return EActivateStatus::ACTIVATE_Success;

Then once the request is completed or done, OnSearchGameSessions() gets called and I can check the ‘const Aws::GameLift::Model::SearchGameSessionsOutcome& Outcome’. And right now the Outcome is successful, but zero sessions are found and I when I look at ‘Outcome.error.m_errorType’ it equals ‘INCOMPLETE_SIGNATURE’. I looked it up and that means I’m requesting the search incorrectly, I think.

Some other things to note are that I’m trying to make my dedicated servers use CreateSession() on themselves so the client doesn’t have to do that, they just have to search and join. (The server also has the GameLiftClientSDK). But I’m not sure if that’s actually working, it worked locally but this is what I’m seeing on the Amazon GameLift Console.

8157-gameliftserverstuff.pnggameliftserverstuff.pn

But on the metrics graph it says I have a few “healthy” and “Active” server processes and “Available” & “Active game sessions”. So that sounds like the client should be able to find a server. But I’m not sure.

So does anyone know what I’ve done wrong? Are my servers not “Active”? Or am setting up and sending a bad SearchGameSessionRequest? If the servers aren’t active, should I use DescribeGameSessionDetails?

Any help would be greatly appreciated!

I believe you get an INCOMPLETE_SIGNATURE if theres something wrong with your credentials used to sign the request.

Is the response coming back as OK/200? I would expect an INVALID_REQUEST error if its a problem with your actual request.

It does look like from your metrics, that instances are launching but server process aren’t marked as healthy and no game sessions are active. See

https://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-console-fleets-metrics.html

for details of what the metrics mean.

Are you seeing OnStartGameSession calls to your server?

What response do the servers when calling CreateGameSessionCall / DescribeGameSession?

If you are still having issues with your game sessions going active, please provide either a fleet-id or game session id (and the region) and we can try to troubleshoot.

Hey @Pip thanks for replying.

So i’m not sure what OK/200, the callback funciton I use for the SearchGameSession request looks like this.

UGameLiftSearchGameSessions::OnSearchGameSessions(constAws::GameLift::GameLiftClient*Client,constAws::GameLift::Model::SearchGameSessionsRequest&Request,constAws::GameLift::Model::SearchGameSessionsOutcome&Outcome,const std::shared_ptr<constAws::Client::AsyncCallerContext>&Context)

And, through visual studio debugging, I didn’t find any info except in “Outcome” which had “success=true” and the error type that I previously stated.

Regarding the server “health” when I run my server for GameLiftLocal it reports back as healthy and allows the server to call “OnCreateGameSession” on itself. So I’d hope that that would transfer over to the uploaded build. Here’s are some pictures:

gameliftserverlocal2.png

gameliftserverlocal1.png

gameliftserverlocal3.png

But I’m not able to test the client’s SearchGameSession because GameLiftLocal says that its not implemented.

So I can’t tell if any OnStartGameSession calls are coming into the server. But there aren’t any Game Sessions under the Game Sessions tab in the online console. So I would think not. I just spent most of my day trying to get the remote access working on windows but I was unable to connect to my fleet. Through window’s Remote Desktop Connection I tried accessing the server through the IP I got from calling “get-instance-access” on my fleet and instance id. And basically trying to follow this tutorial: https://docs.aws.amazon.com/gamelift/latest/developerguide/fleets-remote-access.html. But it didn’t work, I kept getting this error:

8234-remoteaccessconnectionerror.pngremoteaccessconnectionerror.png

I also opened up a bunch of ports, including the recommended windows port UDP and TCP. I kept on getting that error, even though the fleet was active with one active instance.

I did a CreateGameSession from CLI and a game session started then crashed after two seconds. But I haven’t tried DescribeGameSession yet.

I can give you the fleet ID but I usually turn it off after work because I’m using the free version right now and its has that monthly time limit. But if you guys have some records of it maybe you can look through it. Here’s my info:

Region: us-west-2

Fleet-ID: fleet-0ac09608-f29f-4b6d-b4aa-53f756dd86a4

Oh also I’m using the same access & secret keys for CLI, online console, server, and the client. Its all part of a GameLift Admin user account I created, that allows for all GameLift privileges. So hopefully that’s alright, but I do plan to change that in the future.

Yeah here’s the error. I kept on trying to connect but I think it might be a problem with my firewall. So I’m trying to fix that now. Here’s the error:

8234-remoteaccessconnectionerror.pngremoteaccessconnectionerror.png

So I’m not doing anything fancy with the server implementation. I’m just using the UE4 C++ example you guys have shown here:

https://docs.aws.amazon.com/gamelift/latest/developerguide/integration-engines-setup-unreal.html

And I’m calling that when my application starts up. I thought since I saw 1 active instance on the online console that that meant there was a healthy server. I did see those terminate events but the graphs and stuff made it seem like the server instance was up the whole time. But thanks for clarifying.

Also this is what I’m seeing through GameLiftLocal (I left it running for around 10 minutes and kept getting this):

0:25:36,766 INFO || - [SDKVersionResolver] nioEventLoopGroup-3-1 - Resolved 3.3.0 for client /127.0.0.1:XXXXX
10:26:13,134 INFO || - [SDKListenerImpl] nioEventLoopGroup-3-1 - onReportHealth received from /127.0.0.1:XXXXX with health status: healthy
10:26:13,135 INFO || - [SDKVersionResolver] nioEventLoopGroup-3-1 - Resolved 3.3.0 for client /127.0.0.1:XXXXX
10:27:13,142 INFO || - [SDKListenerImpl] nioEventLoopGroup-3-1 - onReportHealth received from /127.0.0.1:XXXXX with health status: healthy
10:27:13,143 INFO || - [SDKVersionResolver] nioEventLoopGroup-3-1 - Resolved 3.3.0 for client /127.0.0.1:XXXXX
10:28:13,151 INFO || - [SDKListenerImpl] nioEventLoopGroup-3-1 - onReportHealth received from /127.0.0.1:62512 with health status: healthy
10:28:13,152 INFO || - [SDKVersionResolver] nioEventLoopGroup-3-1 - Resolved 3.3.0 for client /127.0.0.1:XXXXX
10:29:13,157 INFO || - [SDKListenerImpl] nioEventLoopGroup-3-1 - onReportHealth received from /127.0.0.1:XXXXX with health status: healthy

Isn’t this saying that the server is healthy? Do I need to do more for the server implementation than the link above?

Took a quick look at your fleet and am seeing that your processes never succeed in starting up, they constantly getting terminated due to “PROCESS_UNHEALTHY” so it seems like theres something wrong with the way your process is either being launched or its integration with the SDK. It appears to be due SDK disconnected events, where the game server has terminated the connection.

“The Amazon GameLift service invokes the server
process’s onProcessTerminate callback. This call is used to shut down a
server process that has reported unhealthy or not responded with health status for
three consecutive minutes.”

I would double check your integration to see if your server stops being healthy after a few mins using GameLiftLocal

See:

@Pip Can you send me the fleet log, I’m uploading my server and I keep getting the process terminated event. I’ve now got my server and client working almost perfectly using GameLiftLocal, the server runs fine, it creates a game session, then the client searches for it using DescribeGameSessions, then joins it. Moving between maps and everything works fine. But I’m still getting that termination error when I upload my server, so I’m thinking there’s a dependency that’s not included or something. Because of where I work I cant easily remote access the fleet instance to look at whats happening to it, so its pretty hard for me to figure this out. Assuming there is a log file associated to an overall fleet or just the start up of the server, could you send me the log file?

fleet ID: fleet-4ddbcf8a-6539-44b0-bd5c-3141747dbbb3

Region: us-west-2

Yeah, my server was crashing. I didn’t realize it was until I remotly accessed it and looked through its logs.