Skip to content

Commit 6df288c

Browse files
authored
add details about configuring the sdk properly to the readme (#27)
1 parent 1b8699e commit 6df288c

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

Images/ProjectSettings.png

63.4 KB
Loading

README.md

+36
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,40 @@ Here is an example of using that node:
4343

4444
![image](https://github.com/hathora/hathora-unreal-sdk/assets/549323/e27ec908-d5a1-400d-89fc-ab0282387be8)
4545

46+
### Authentication Configuration
47+
48+
When you call `CreateHathoraSDK` in either BP or C++, it will automatically determine the authentication configuration for the API calls based on the available configuration.
49+
50+
#### In Editor
51+
52+
While you're in the editor, it'll read from `Config/DefaultGame.ini` (see [Client Builds](#client-builds) below) by default, but you can specify both the App ID and Dev Token to be only used when in editor for testing purposes.
53+
54+
Go to **Edit > Project Settings > Plugins > Hathora SDK** and specify both your App ID and Dev Token here:
55+
56+
![image](./Images/ProjectSettings.png)
57+
58+
It's **not recommended** to press the `Set as Default` button here for security reasons, and instead manually modify the INI config files.
59+
60+
#### Client Builds
61+
62+
For the settings to be packaged in a build, you must specify them in one of the `Config/*.ini` files. Both clients and servers need the App ID so you can specify this in `Config/DefaultGame.ini`:
63+
64+
``` ini
65+
[/Script/HathoraSDK.HathoraSDKConfig]
66+
AppId=app-***********************
67+
```
68+
69+
**DO NOT** specify the Dev Token in this file or it will be packaged with client builds and with enough reverse engineering, you would leak a secret that can manage your whole Hathora account. We're working on a better method for this to prevent accidental credential leaks, but in the meantime, follow the [Server Builds](#server-builds) section below for the Dev Token.
70+
71+
#### Server Builds
72+
73+
The Dev Token needs to be packaged for your dedicated server to be able to make authorized calls like Get Process Info or Get Room Info. You can safely configure to package this in only the server builds by specifying it in `Config/DedicatedServerGame.ini` which is only used by unreal for the `Server` target type:
74+
75+
``` ini
76+
[/Script/HathoraSDK.HathoraSDKConfig]
77+
DevToken=Ga__*********
78+
```
79+
4680
### Manually calling API endpoints
4781

4882
The SDK provides functions that provide access to the Hathora Cloud API endpoints. You can find a list of the supported endpoints [below](#supported-cloud-api-endpoints).
@@ -171,6 +205,8 @@ The Client build will open the `Game Default Map` option.
171205

172206
### Packaging the Builds
173207

208+
Before you can package a build, make sure you have [properly set up your `Config/*.ini` files](#authentication-configuration) to ensure the App ID and Dev Token get packaged correctly and safely. The linked section goes into more detail, but you **need to make sure that Dev Token isn't specified in `Config/DefaultGame.ini`!**
209+
174210
Now that you have Linux cross-compilation set up on a source build of Unreal with Server and Client targets opening the correct maps on startup, you're ready to package the builds. While you can create scripts to do automate this process, you can easily build the two targets under the Platforms menu in the Editor. Once you have selected the correct target and build configuration, you can select `Package Project`. In the below images, you'll see we're packaging a Linux Server (Development) and a Windows Client (Development):
175211

176212
![Image showing packaging a Linux Server](./Images/Server_PackageLinux.png)

0 commit comments

Comments
 (0)