Configure the PgosSDK Plugin
The PgosSDK
has several configuration options that can be set by the game either through Unreal Editor settings or by using code. If the same configuration option is set using both methods, the value set through code will override the value set through the editor.
The following are the explanations for these configuration options:
- title_id: the title id you retrieve from the web portal console.
- log_level: the minimum suppression level of logs from
PgosSDK
. 0 for Info, 1 for Warn; 2 for Error, 3 for No Log. - secret_key: the client secret key retrieve from the web portal console. (CLIENT ONLY)
- account_provider : 0 for FAS, 1 for INTL, 2 for MSDK, 3 for WeGame, 4 for PlayFab, 5 for Steam, 6 for Epic, 7 for XboxLive, 8 for PlayStationNetwork, 9 for Nintendo. (CLIENT ONLY)
- chat_msg_cache_max_bytes: maximum size of the local cache for chat messages. (in bytes). (CLIENT ONLY)
- title_region_config_data_cache_max_bytes: maximum size of the local cache for title region config data. (in bytes). (CLIENT ONLY)
- group_event_msg_filter: configure the event message types supported by the group, empty (default) means all types are supported. Click Event Message Filtering for detail. (CLIENT ONLY)
1. Set up from Editor Setting
In the Unreal Engine Editor, navigate to Settings->Project Settings->Plugins->PgosSDK, and you can see the settings as below:
You need to set your Title ID
and Secret Key
to make PGOS work. DefaultGame.ini
will be updated if you change the default settings.
It is strongly recommended to enable the Encrypt Pak Ini Files
option in the settings panel. This reduces the risk of secret key leakage.
The setting path: Settings->Project Settings -> Project -> Crypto.
2. Set up from Codes
2.1 With C++ Codes:
When using C++, you can use a TMap
to store the configurations and pass it to the InitConfig
function, and the field name can refer to the field explanation
above.
// For client
TMap<FString, FString> ClientConfig;
ClientConfig.Add("title_id", "Your Title ID");
ClientConfig.Add("secret_key", "Your Client Secret Key");
IPgosSDKCpp::Get().GetClientAPI()->InitConfig(ClientConfig);
// For server
// No need to set a secret key for the server, whether it is an online DS or a local DS.
TMap<FString, FString> ServerConfig;
ServerConfig.Add("title_id", "Your Title ID");
IPgosSDKCpp::Get().GetServerAPI()->InitConfig(ClientConfig);
It is recommended not to hardcode the original secret key in the code as it increases the risk of secret key leakage. An alternative approach is to hardcode a secret key encryption string and decrypt it at runtime.
const char* EncryptedSecretKey = "the ciphertext of the original secret key";
auto SecretKey = DecryptString(EncryptedSecretKey);
ServerConfig.Add("secret_key", SecretKey);
2.2 With Blueprint Codes:
You can also setup the configurations from Blueprints. Let's take setup code of the client side as an example:
It is recommended not to hardcode the original secret key in the code as it increases the risk of secret key leakage. An alternative approach is to hardcode a secret key encryption string and decrypt it at runtime.