Integrating GSDK with C++/C#/Java/Go
You can find the GSDK libraries for each language here:
- C# GSDK. You can find it on C# GSDK Nuget package page
- C++ GSDK. You can find it on C++ GSDK Nuget package page
- Java GSDK. You can find it on Java GSDK Maven package page
- Go GSDK
Usage
In all these programming languages, you need to include the GSDK libraries in your project and call the Start()
and ReadyForPlayers()
methods. Start
will signal to Thundernetes that the game server is initializing whereas ReadyForPlayers
will signal that the game server is ready for players to connect.
Testing with LocalMultiplayerAgent
You can use LocalMultiplayerAgent to test your GSDK integration of your game server before uploading to Thundernetes.
Other GSDK methods and callbacks
There are some other GSDK methods you can use from your game server process:
GetGameServerConnectionInfo
: Returns the connection information for the GameServer. Usually, it should be the port that you have already defined in your Pod specification. It is required use this method if you want to use the hostNetwork option.GetInitialPlayers
: Returns the IDs of the players that are expected to connect to the GameServer when it starts. It is set during the call to the allocation service API.UpdateConnectedPlayers
: It updates the currently connected players to the GameServer. On the backend, Thundernetes updates theGameServerDetail
Custom Resource with the new number and IDs of connected players.GetConfigSettings
: Returns the current configuration settings for the GameServer. You can retrieve the associated GameServerBuild metadata with this method.GetLogsDirectory
: Returns the path to the directory for the GameServer logs. It is recommended to just send the logs to standard output/standard error streams, where you can use a Kubernetes-native logging solution to grab them.LogMessage
: Writes an entry to the log file. As mentioned, it is recommended to send your logs to standard output/standard error streamsGetSharedContentDirectory
: Not used in ThundernetesRegisterMaintenanceCallback
(name might be slightly different depending on your environment): Used to determine theHealth
status of the GameServerRegisterMaintenanceCallback
(name might be slightly different depending on your environment): Not used in ThundernetesRegisterShutdownCallback
(name might be slightly different depending on your environment): Not used in Thundernetes