question

Nicolas Abreu avatar image
Nicolas Abreu asked

PlayFab GSDK Settings,Playfab GSDK settings values

Hey, I am currently in the process of uploading my Java 8 server to Playfab. This server was previously a Google Cloud server using App Engine, but that has been stripped out and is now a Java Application.


I have included the GSDK and now I am in the step where I need to fill out the "settings" json but I am unsure of how to fill it out.

Can someone help guide me what kind of values it is looking for in the following fields:

"heartbeatEndpoint": "",
"sessionHostId": "",
"logFolder": "",
"sharedContentFolder": "",
"certificateFolder": "",
"buildMetadata": { "":"" },
"gamePorts": { "":"" },
"vmId":""

,

Hey, I am currently in the process of uploading my Java 8 server to Playfab. This server was previously a Google Cloud server using App Engine, but that has been stripped out and is now a Java Application.

I have included the GSDK and now I am in the step where I need to fill out the "settings" json but I am unsure of how to fill it out.

Can someone help guide me what kind of values it is looking for in the following fields:

"heartbeatEndpoint": "",
"sessionHostId": "",
"logFolder": "",
"sharedContentFolder": "",
"certificateFolder": "",
"buildMetadata": { "":"" },
"gamePorts": { "":"" },
"vmId":""

10 |1200

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

1 Answer

·
Sarah Zhang avatar image
Sarah Zhang answered

You needn’t fill out these fields manually. To integrate your severs with PlayFab GSDK, you just need to follow this documentation -- https://docs.microsoft.com/en-us/gaming/playfab/features/multiplayer/servers/integrating-game-servers-with-gsdk to implement the corresponding methods in your server. The fields in the settings file would be programmatically filled out by PlayFab. You can also check our Java GSDK sample -- https://github.com/PlayFab/gsdk/tree/master/java for the reference.

3 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.

Nicolas Abreu avatar image Nicolas Abreu commented ·
public static void main (String[] args) {
		 // Call this while your game is initializing; it will start sending a heartbeat to our agent and put the game server in an Initializing state
	    GameserverSDK.start();
	    GameserverSDK.registerShutdownCallback(RageMain::onShutdown);
	    GameserverSDK.registerMaintenanceCallback(RageMain::onMaintenanceScheduled);
	    GameserverSDK.registerHealthCallback(RageMain::getGameHealth);


	}


This is currently my main function, and below is the error I am currently receiving:

Exception in thread "main" java.lang.ExceptionInInitializerError
	at RageMain.main(RageMain.java:42)
Caused by: com.microsoft.azure.gaming.GameserverSDKInitializationException: Config file must include values for the heartbeatEndpoint and the sessionHostId.
	at com.microsoft.azure.gaming.JsonFileConfiguration.validate(JsonFileConfiguration.java:71)
	at com.microsoft.azure.gaming.HeartbeatThread.<init>(HeartbeatThread.java:71)
	at com.microsoft.azure.gaming.GameserverSDK.start(GameserverSDK.java:126)
	at com.microsoft.azure.gaming.GameserverSDK.<clinit>(GameserverSDK.java:83)
	... 1 more
0 Likes 0 ·
Nicolas Abreu avatar image Nicolas Abreu commented ·

This is GameserverSDK.java (part of the previous comment, but I ran out of characters)

I have cut and enumerated the 2 important lines (83 and 126) so they are easier to find.I would paste the whole thing but the character limit doesn't allow me to. Should I try inserting an image of it?

    static {
        gsdkConfiguration = new JsonFileConfiguration();
        Logger.SetLogFolder(gsdkConfiguration.getLogFolder());
83->        start();
    }


public static synchronized void start() { if (!isInitialized) { 126-> heartbeatThread = new HeartbeatThread(SessionHostStatus.Initializing, gsdkConfiguration); Thread heartbeat = new Thread(heartbeatThread); heartbeat.setDaemon(true); heartbeat.start(); isInitialized = true; } }
0 Likes 0 ·
Sarah Zhang avatar image Sarah Zhang Nicolas Abreu commented ·

If you want to debug the server integrated with GSDK, the MockVmAgent tool is required. If you run the server executable without using MockVmAgent, you would get this error. It's by design. Please follow this documentation -- https://docs.microsoft.com/en-us/gaming/playfab/features/multiplayer/servers/locally-debugging-game-servers-and-integration-with-playfab to locally debug your server.

-1 Like -1 ·

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.