When a GameSession Created, how can I get all players playersessionid in my server

Hi, I’m trying to integrating UE4 with GameLift.

If i call the below functions, what can i get? syntax or json format i want to know.

Aws::GameLift::Server::Model::GameSession gameSession

  1. gameSession.GetGameSessionData();

  2. gameSession.GetMatchmakerData();

actually, i’m looking for the information about all matched player’s “PlayerSessionId”.

when a game session created, GameLiftSDK calls a callback of “onGameSession”.

at that point, i’d like to register PlayerSessionIds to my map or set container for validating players later.

with flexmatch, i can’t test locally so i have no idea about the data from “GameSession::GetMatchmakerData” and “GameSession::GetGameSessionData”.

My Game Client can connect to dedicated server on my game session using flexmatch, but I’m stucked in validating players. the status of my playersessions turned into timed out in 60sec.

in my guess, flexmatch create a game session with playersessions including all matched players. at that time flexmatch will give a unique player session id. how can i get that on my dedicated server???

Hey @gawoon!

The information that you are looking for is in the MatchmakerData. You can find out more about the structure of that data type here:

http://docs.aws.amazon.com/gamelift/latest/developerguide/match-server.html

Also, you need to be on server 3.1.7 to see the MatchmakerData and GameSessionData in the callback. You can verify your version of the SDK in the following source file:

/gamelift-server-sdk/source/aws/gamelift/server/GameLiftServerAPI.cpp

static const std::string sdkVersion = “3.1.7”

It also looks like you are using GameLift Local, and the SDK version is in the connection output information. Unfortunately, there is not a local version of FlexMatch available at this time.

Let me know if you have any additional questions!

oh yes, that’s what i looking for

thank you!

oops, your link don’t have player’s session id.

i need not only player’s id but also session id.

and it’s quite difficulty for check a value, matchmakerdata when using UE4.

According to documentation here: http://docs.aws.amazon.com/gamelift/latest/apireference/API_CreatePlayerSession.html, player sessions can’t be created until you activate a game session. So GameSessionData and MatchmakerData can’t contain player session ids.
We also thought to use player session id for validation but decided that it is not that important :slight_smile: Player should know server’s ip and port and it’s player id to login to game server and perhaps it’s already quite a lot for your use case too.
But if you really want to check player_session_id you should send it to your game server some way (for example we use SQS to send from our metaserver some info to gameserver).

Hey @gawoon and @Hinidu!

You do use the playerSessionId for validation on the server, actually. Here is the flow:

  1. When the player connects to the game server, the player needs to have the GameSessionConnectionInfo data that contains the port, IP, and playerSessionId. This data object is available in both the SNS Notification and in the result of DescribeMatchmaking.
  2. The server calls AcceptPlayerSession with the playerSessionId to authenticate the player. Note this link is the link to our Unreal engine support page for this server API.
    Let me know if you have any more questions!

oh now i get your speech.

i thought a wrong way before you said to me.

A server would have prepared Players’s SessionId, and validated them but that job is on GameLiftSDK not my server.

A Client send player session id directly, and the only thing i need to do is calling “AcceptPlayerSession” GameLiftSDK provided. this is my understanding now.

I’ll try this way. thank you.

Thanks @gawoon! Let me know if you have any additional questions.

thank you , it works well now

one more thing i want to know, there is an curious message on Events Tab.

“SERVER_PROCESS_FORCE_TERMINATED
Server process did not cleanly exit within 30 seconds of OnProcessTerminate(), exitCode(-1), launchPath(C:\game\SampleWithG…”

my server do call TerminateGameSession() when a game finished.

and the purpose is i want to make my EC2 instance available and a new match use it again.

do i miss sth for reusing my instance? any help plz

Hey @gawoon, I wasn’t able to reply directly to your SERVER_PROCESS_FORCE_TERMINATED question so I’m replying here.

Are you exiting your process after TerminateGameSession() by calling exit(0)?

If you are, can you try ending a game while using GameLiftLocal to observe the behavior of your OnProcessTerminate() callback?

Hope this helps!

Ben

oh my bad. it seems i do sth wrong again.

i think it’s my problem i gonna fix it in my self.

i do call ProcessEnding when my game mode is done, not when quit process. maybe this is problem i guess. i’ll fix this code from ProcessEnding to TerminateGameSession.

here’re some code about my project before fixing.


1. when a process initiate my game mode, bind function
params->OnTerminate.BindLambda([=]() {GameLiftSDKModule->ProcessEnding(); });
2. when a game finished, kick out all players
GameLiftSDKModule->RemovePlayerSession(PlayerSessionId);
3. when my gamemode is finished ( at this point, reset all game states and my server process would be ready for reuse in my intention but i got the error msg "SERVER_PROCESS_FORCE_TERMINATED " )
GameLiftSDKModule->ProcessEnding();

thank you very much.

@gawoon @Ben @Matchmaker

How does the client send the playersessionid (it gets from a match) to the prelogin function on the server?
At the moment I am only calling ClientTravel with the returned ip and port and not sure how to transmit the playerSessionId also