question

tldQuantic avatar image
tldQuantic asked

Call to ReadyForPlayers function is blocking forever

Hello,

When I test my game server locally within a container, eveything works fine, but when I upload my game server on Playfab, I cannot make it work.
When I launch my game clients, the game server state pass from StandyBy to PendingHearbeat.

I added logs in my game server and find that the call to ReadyForPlayers function is blocking forever and never returns (nor true neither false).

I cannot figured out what is the source of this issue.

Any help will be much appreciated. Thanks :)

Custom Game ServersmultiplayerMatchmaking
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brandon@uprootstudios.com avatar image brandon@uprootstudios.com commented ·

In the latest GSDK, I don't think it's supposed to return a value and you call it like a function, i.e. GSDK.ReadyForPlayers();

0 Likes 0 ·
tldQuantic avatar image tldQuantic brandon@uprootstudios.com commented ·

Copy/paste from: github cppsdk gsdk.h

class GSDK            

{            

public:                

/// <summary>Renamed from WaitForSessionAssignment. Called when the game server is ready to accept clients.  If Start() hasn't been called by this point, it will be called implicitly here.</summary>                

/// <remarks>Required. This is a blocking call and will only return when this server is either allocated (a player is about to connect) or terminated.</remarks>                

/// <returns>True if the server is allocated (will receive players shortly). False if the server is terminated. </returns>                

static bool readyForPlayers();<br>

As you can see, readyForPlayers function return a boolean value in the latest CPP SDK on github. (The url is correct?)

But whatever if it return something or not, the issue is that the call to this function never end and I don't know why.

Thanks for your help.

0 Likes 0 ·
Citrus Yan avatar image
Citrus Yan answered

I believe Brandon is correct, according to the latest SDK, ReadyForPlayer() doesn't return anything:

 public static void ReadyForPlayers()
        {
		...
        }

14 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

tldQuantic avatar image tldQuantic commented ·

Copy/paste from: github cppsdk gsdk.h

class GSDK            

{            

public:                

/// <summary>Renamed from WaitForSessionAssignment. Called when the game server is ready to accept clients.  If Start() hasn't been called by this point, it will be called implicitly here.</summary>                

/// <remarks>Required. This is a blocking call and will only return when this server is either allocated (a player is about to connect) or terminated.</remarks>                

/// <returns>True if the server is allocated (will receive players shortly). False if the server is terminated. </returns>                

static bool readyForPlayers();<br>

As you can see, readyForPlayers function return a boolean value in the latest CPP SDK on github. (The url is correct?)

But whatever if it return something or not, the issue is that the call to this function never end and I don't know why.

Thanks for your help.

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan tldQuantic commented ·

May I have the code snippet of yours that calls readyForPlayers()?

0 Likes 0 ·
tldQuantic avatar image tldQuantic Citrus Yan commented ·
int main()
{
	Microsoft::Azure::Gaming::GSDK::start(true);
	Microsoft::Azure::Gaming::GSDK::registerShutdownCallback(&OnShutdown);
	Microsoft::Azure::Gaming::GSDK::registerHealthCallback(&IsHealthy);
	Microsoft::Azure::Gaming::GSDK::registerMaintenanceCallback(&OnMaintenanceScheduled);


	// Init all the stuff I need to run the game server


	Bool bReady = Microsoft::Azure::Gaming::GSDK::readyForPlayers();
	// This point is never reached.
	// If I call readyForPlayers in another thread, I reach this point but readyForPlayers never end.
	
	// Game server loop
}



0 Likes 0 ·
Show more comments
Benjamin Golinvaux avatar image
Benjamin Golinvaux answered

I am quite late to the party, but I want to mention that I experience the same problem.

In my case, I think I have traced it to the parsing of the heartbeat response failing due to some bogus JSON (in response to the periodic "heartbeat" request that the Game server, through GSDK, is making to the Playfab VM agent)

If you are still stuck on the problem, maybe you should inspect the contents of the C:\gamelogs folder in the container (if you're using the default log location)

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.