- Newest
- Most votes
- Most comments
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
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.
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!
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.
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.
DescribePlayerSessions
seems to work on my end with the new GameLiftServerSDK update.
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
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
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.
Relevant content
- asked a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated a year ago