Help or issue with GameLiftServerAPI.AcceptPlayerSession

Hi - having problems with getting Linux server to accept players.

Have followed all the help provided:

On Server, initialise and set ProcessReady.

On Client,

  1. Connect to endpoint using credentials with allowances to setup games etc. All good.

  2. Create a game session, max players 16, valid fleet name, name set to TestGame and creatorId set to generated player ID. Works fine. Player Acceptance ploicy is set to allow all by default.

  3. Using returned game session ID, create a player Session using gamesessionID and same randomly generated player ID. Get successful response, and psess ID set up in the game session, with the correct player ID etc, in state reserved.

  4. Using returned player sessions details, use IP address and port to connect to server. Server accepts incoming port, upon connection client sends the pSess ID to the server. Server then uses the client psess ID to AcceptPlayerSession. This always fails on the gamelift servers, although I have set up a receipt system to ensure that the correct pSess ID is being passed to the server.

This works fine in the local jar test harness, the same process and call to AcceptPlayerSession provides success result and I can add and remove players as necessary. Am wondering if this is to do with an endpoint specification or permission, however I have set everything up as open as possible now.

Any help appreciated.

Two quick questions:

  • What is the response from AcceptPlayerSession?
    • What do your logs show?
  • On the fleet console what state do your player sessions show when they fail?
    • You only have 60s to accept the player session
    • Player session can only be accepted by the server that owns the game session they were created for.

Hi Pip,

Thanks for this - yes I just checked the error response (should have thought of that before!) and it says

GameSession id is not set.
No game sessions are bound to this process.

I have set up a game session and player session successfully so am not sure why the above is.

It may be because I am connecting to the IP address and port returned, which appears to work, but I can start multiple servers on a single IP address which seems odd.

I have been able to get into the server using ssh but cannot find the logs anywhere. I have tried specifying in the command line options when starting the game, but I think as the game does not finish, it does not push out logs. I will get the server to finish the process after 5 minutes and see what it says.

Yes definitely connecting within 60 seconds, there’s very little delay.


Indicates that one of these scenarios is happening:

  • Your server is terminating/crashing between hosting the game session and the player session arriving. Check your fleet events
  • Or you are doing multi-process and you have multiples servers listening on the same port. 1 servers has the game session, but another server is receiving the player sessions. Check what you are reporting in ProcessReady for your servers, ensure your servers are listening on different ports (if using multi-process) and/or consider scaling down just to 1 server per instance to troubleshoot.

Basically your player session is ending up on a server that has no/or no longer has a game session.

OK great - will check the termination / crashing, however I don’t think this is the case as the game is running quite happily after making the call.

When I specifiy a fleet I actually am specifying 3 concurrent processes, although have just noticed it says it will fail to activate if using an early version of SDK. I believe I’m using the latest for Unity, but am not using Lumberyard. I will set to 1 and see how it works.

This raises a separate question, if I did want to use multiple servers / ports on a single machine, I can see that I can get my server code to tell GameLift which port I would like to use in the ProcessParameters passed into ProcessReady, but I don’t understand how multiple servers on a single machine would know fo the existence of each other or decide upon a port. Does GameLift server decide this at some point and let each server process know the port, or should I communicate between the servers with another service somewhere?

Thanks for your help so far.

Success! I modified a few things, will go back and find out which ones caused a problem, if it’s something outside of your recommendations will let you know. many thanks