AcceptPlayerSession() accepts existing active player session

0

So I have encountered a weird issue with AcceptPlayerSession(); It fails only if a player session is not found, but if a player session is either RESERVED or ACTIVE for a current game session it will always return IsSuccess()==true. This allows me to join the server with several clients using the same player session, and the game session will think there's only 1 player session in the game.

Not sure if this is a bug or a feature.... I'm currently not using flexmatch, you using create-game-session and create-player-session commands from CLI.

note: This happens on live gamelift as well as gamelift local.

This screenshot shows that the Game Session still thinks there's only 1 player session joined.

REMOVEDUPLOAD

asked 4 years ago512 views
9 Answers
0

Adding on to this to get some clarification on the documentation of the AcceptPlayerSession method found here,

Notifies the Amazon GameLift service that a player with the specified player session ID has connected to the server process and needs validation. Amazon GameLift verifies that the player session ID is valid—that is, that the player ID has reserved a player slot in the game session. Once validated, Amazon GameLift changes the status of the player slot from RESERVED to ACTIVE.

Does this mean that AcceptPlayerSession will return true for a player session ID that is in the RESERVED state or that it will return true for any player session ID that has ever been reserved for that particular game session that the method is being called from? It if is the latter then I find that quite confusing since the method would then be changing the status of the player slot from ACTIVE to ACTIVE or doing nothing.

Sorry to tag you again @REDACTEDUSER

answered 4 years ago
0

This sounds like a bug. AFAIK you can only accept a player session once ie its in the Reserved state. The main session checks prevent accepting anything thats not in Reserved state.

Which Server SDK version are you using? I believe one of the older SDKs did require a bug fix to the error response handling to ensure the server saw the failure when trying to accept a player session that was already ACTIVE. If you are not on latest, you may need to update the SDK.

If you are still having trouble can you provide playersession ids and fleet ids and I can get the GameLift Service team to check this out.

answered 4 years ago
0

hi @REDACTEDUSER Not sure if this is the latest or do you guys have repository somewhere with frequently updated versions? I have implemented a fix in my server code by checking if requested player session is reserved even though the AcceptPlayerSession(...) still succeed for active player sessions.

Currently I'm running tests so there are no active game sessions nomally, you can test by firing up some game sessions in this fleet: fleet-******

Any help/clarification on this is appreciated!

answered 4 years ago
0

For the SDK, latest should be posted at that link, but you can confirm by looking at GameLiftServerAPI.cs/cpp files for the defined sdkVersion const. Should be 3.4.0

I've created an issue with the GameLift support team. Hopefully they can look into what is happening. I'll let you know when they respond.

answered 4 years ago
0

To clarify the behavior of AcceptPlayerSession:

  • If the PlayerSession is in RESERVED and AcceptPlayerSession is called, the PlayerSession will go to ACTIVE
  • If the PlayerSession is in ACTIVE and AcceptPlayerSession is called, the PlayerSession will remain in ACTIVE and a successful response will be returned.

Bullet 2 matches the behavior you are currently seeing. I'd recommend creating a PlayerSession per client and/or checking if the PlayerSession is ACTIVE before trying to AcceptPlayerSession on a new client connection.

answered 4 years ago
0

DescribePlayerSessions seems to work on my end with the new GameLiftServerSDK update.

answered 4 years ago
0

Thanks, I did exactly this by checking status of player session. But since the update this seems to have been broken... Specifically either Aws::GameLift::Server::DescribePlayerSessions(...) always returns .IsSuccess()==false or the successive call of the outcome .GetPlayerSessions(numSessions) always return numSessions==0. My code worked before the update, but not anymore. Strangely it still works on Gamelift Local.

Edit: I did further digging and found the error type returned from Aws::GameLift::Server::DescribePlayerSessions(...) to be a BAD_REQUEST_EXCEPTION. Is this a bug in the SDK?

Edit: For more information I do pass in both a Player Session ID as well as a Game Session Id into the DescribePlayerSessionsRequest structure.

@REDACTEDUSER

answered 4 years ago
0

I have now solved this by sending in only the Player Session ID to the DescribePlayerSessions(…) call. Seems like if I also send in Game Session ID it fails on live gamelift but still works on Local Gamelift

answered 4 years ago
0

Docs (for reference): https://docs.aws.amazon.com/gamelift/latest/apireference/API_DescribePlayerSessions.html

DescribePlayerSessions should take only one of Player Session ID, Game Session ID or Player ID. You will get a BadRequestException if you pass in multiple.

answered 4 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions