hathora-unreal-sdk
HathoraGameServerProviderPlugin
ExtAllocateGameServer
File to update:/platform/5-ext/ext-protos/src/main/proto/shared/gameInstanceExt.proto
Required parameter: desiredRegion
/**
* Allocation payload for a game server. Populated in any method of the [GameInstancePlugin] and used in the
* [GameServerProviderPlugin.startAllocationForGameInstance].
*/
message ExtAllocateGameServer {
string desired_region = 1;
}
Can also easily extend ExtAllocateGameServer
to include any other custom fields
roomConfig
object to pass customer metadata to your game servers.Relevant Pragma docs: https://pragma.gg/docs/0.2.0/concepts/multiplayer/gameinstance/game-instance-tasks#allocate-a-dedicated-game-server
Alternatively, you can also use gameServerZone
instead of ExtAllocateGameServer
HathoraGameServerProviderPlugin
plugin
Download Plugin code here
Add plugin file to project
Add maven dependency for Hathora Java SDK to 5-ext/ext/pom.xml
<dependency>
<groupId>dev.hathora</groupId>
<artifactId>cloud-sdk</artifactId>
<version>2.11.3</version>
</dependency>
Setup config values for Hathora AppId and DevToken
hathoraAppId
hathoraDevToken
(encrypted) - this should be your Hathora API token
pluginConfigs:
GameInstanceService.gameServerProviderPlugin:
class: "demo.gameinstance.HathoraGameServerProviderPlugin"
config:
hathoraAppId: ""
hathoraDevToken: ""
With this step, servers should be spun up for matches
HathoraGameServerProviderPlugin
There are multiple ways to integrate with Hathora APIs:
Add init script or game server logic to request info from Hathora API and callback to Pragma
host:port
) for your server process
HATHORA_HOSTNAME
and HATHORA_DEFAULT_PORT
.
host:port
) as well as other server detailsroomId
and roomConfig
)
HATHORA_INITIAL_ROOM_CONFIG
.
roomId
and roomConfig
)roomConfig
data to callback to PragmaHathoraGameServerProviderPlugin.kt
added to path: platform/5-ext/ext/src/main/kotlin/demo/gameinstance/
platform/5-ext/ext/pom.xml
/5-ext/config/local-dev.yml