Skip to main content

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. (GAME 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. (GAME CLIENT ONLY)
  • chat_msg_cache_max_bytes: The maximum size of the local cache for chat messages. (in bytes). (GAME CLIENT ONLY)
  • title_region_config_data_cache_max_bytes: The maximum size of the local cache for title region config data. (in bytes). (GAME 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. (GAME CLIENT ONLY)
  • title_region_id: Specify the title region that the server should access. This configuration is only applicable to servers that do not use the PGOS DS Hosting service, while both online DS (deployed in the PGOS cloud environment) and local DS (configured with a local placer ID) that utilize the PGOS DS Hosting service do not require this configuration. (DEDICATED SERVER ONLY)
  • ds_hosting_feature_enable: Enable the PGOS DS Hosting feature or not. If this feature is not being used, disabling it can speed up SDK initialization. "true" for enable, "false" for disable. (DEDICATED SERVER 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:

image-20250526214655079

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.

tip

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.

image-20211125150202668

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);
tip

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:

image-20210415153405505

tip

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.