Skip to content

Commit

Permalink
Updated from pipeline, Version : 25.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
wijanarko-ab committed Mar 24, 2024
1 parent 8fe2040 commit b47f02f
Show file tree
Hide file tree
Showing 20 changed files with 394 additions and 89 deletions.
4 changes: 2 additions & 2 deletions AccelByteUe4Sdk.uplugin
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"FileVersion": 3,
"Version": 58,
"VersionName": "25.0.0",
"Version": 59,
"VersionName": "25.1.0",
"FriendlyName": "AccelByte Unreal Engine SDK",
"Description": "Official AccelByte SDK for Unreal Engine 4",
"Category": "Online Platform",
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [25.1.0](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/branches/compare/25.1.0%0D25.0.0) (2024-03-24)


### Features

* **mpv2:** add support for friends only joinability in game and party session ([d29e8c6](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/d29e8c6b006d3ce51cdf77c3237e988d7be6f81e))
* **ttl:** expose ttl config on cloud save api ([7395030](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/73950303f60825a68da12ec203615e1e8a8ddd0a))


### Bug Fixes

* **chore:** change DefaultSection name to DefaultSectionPath to prevent linux shadow declaration error ([6a42e22](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/6a42e226c846f973b04fd3e043feca0b86dabe2a))
* **launcher:** get the exchange code and call generate game token if using exchange code. ([92076d0](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/92076d03d1983098a0b345d92dd72aa8e0793082))
* **MessagingSystem:** fix issue when messageSystem is not the same for api and registry when create a default apiClient ([2a38e87](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/2a38e87df2b131b248acf0317b87ab7eafc796a9))
* **setting:** update override setting using AccelByte config injection ([751459c](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/commits/751459ca210cdc274a6deccb992ce4fe93d011b7))

## [25.0.0](https://bitbucket.org/accelbyte/justice-unreal-sdk-plugin/branches/compare/25.0.0%0D24.11.0) (2024-03-08)


Expand Down
18 changes: 16 additions & 2 deletions Source/AccelByteUe4Sdk/Private/Api/AccelByteUserApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,13 @@ void User::LoginWithLauncher(const FVoidHandler& OnSuccess

FinalPreLoginEvents(); // Clears CredentialsRef post-auth info, inits schedulers

Oauth2::GetTokenWithAuthorizationCode(UserCredentialsRef.GetOAuthClientId()
if (FAccelByteUtilities::IsUsingExchangeCode())
{
GenerateGameToken(AuthorizationCode, OnSuccess, OnError);
}
else
{
Oauth2::GetTokenWithAuthorizationCode(UserCredentialsRef.GetOAuthClientId()
, UserCredentialsRef.GetOAuthClientSecret()
, AuthorizationCode
, SettingsRef.RedirectURI
Expand All @@ -664,6 +670,7 @@ void User::LoginWithLauncher(const FVoidHandler& OnSuccess
})
, OnError
, SettingsRef.IamServerUrl);
}

UserCredentialsRef.SetBearerAuthRejectedHandler(HttpRef);
}
Expand All @@ -682,7 +689,13 @@ void User::LoginWithLauncherV4(const THandler<FAccelByteModelsLoginQueueTicketIn

FinalPreLoginEvents(); // Clears CredentialsRef post-auth info, inits schedulers

Oauth2::GetTokenWithAuthorizationCodeV4(UserCredentialsRef.GetOAuthClientId()
if (FAccelByteUtilities::IsUsingExchangeCode())
{
GenerateGameTokenV4(AuthorizationCode, OnSuccess, OnError);
}
else
{
Oauth2::GetTokenWithAuthorizationCodeV4(UserCredentialsRef.GetOAuthClientId()
, UserCredentialsRef.GetOAuthClientSecret()
, AuthorizationCode
, SettingsRef.RedirectURI
Expand All @@ -703,6 +716,7 @@ void User::LoginWithLauncherV4(const THandler<FAccelByteModelsLoginQueueTicketIn
})
, OnError
, SettingsRef.IamServerUrl);
}

UserCredentialsRef.SetBearerAuthRejectedHandler(HttpRef);
}
Expand Down
6 changes: 4 additions & 2 deletions Source/AccelByteUe4Sdk/Private/Core/AccelByteApiClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ namespace AccelByte

FApiClient::FApiClient()
: bUseSharedCredentials(false)
, CredentialsRef(MakeShared<AccelByte::Credentials, ESPMode::ThreadSafe>(MessagingSystem))
, MessagingSystem(MakeShared<FAccelByteMessagingSystem>())
, CredentialsRef(MakeShared<AccelByte::Credentials, ESPMode::ThreadSafe>(*MessagingSystem.Get()))
, HttpRef(MakeShared<AccelByte::FHttpRetryScheduler, ESPMode::ThreadSafe>())
{
HttpRef->Startup();
Expand All @@ -20,8 +21,9 @@ FApiClient::FApiClient()
PresenceBroadcastEvent.Startup();
}

FApiClient::FApiClient(AccelByte::Credentials& Credentials, AccelByte::FHttpRetryScheduler& Http)
FApiClient::FApiClient(AccelByte::Credentials& Credentials, AccelByte::FHttpRetryScheduler& Http, TSharedPtr<AccelByte::FAccelByteMessagingSystem> MessagingRef)
: bUseSharedCredentials(true)
, MessagingSystem(MessagingRef == nullptr ? MakeShared<FAccelByteMessagingSystem>() : MessagingRef)
, CredentialsRef(MakeShareable<AccelByte::Credentials>(&Credentials,
[](AccelByte::Credentials*) {}))
, HttpRef(MakeShareable<AccelByte::FHttpRetryScheduler>(&Http,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ FApiClientPtr AccelByte::FMultiRegistry::GetApiClient(const FString &Key, bool b

if (Key.Compare(TEXT("default")) == 0)
{
NewClient = MakeShared<FApiClient, ESPMode::ThreadSafe>(FRegistry::Credentials, FRegistry::HttpRetryScheduler);
NewClient = MakeShared<FApiClient, ESPMode::ThreadSafe>(FRegistry::Credentials, FRegistry::HttpRetryScheduler, FRegistry::MessagingSystem);
}
else
{
Expand Down
12 changes: 6 additions & 6 deletions Source/AccelByteUe4Sdk/Private/Core/AccelByteRegistry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ using namespace AccelByte;

#pragma region Core
FHttpRetryScheduler FRegistry::HttpRetryScheduler;
FAccelByteMessagingSystem FRegistry::MessagingSystem;
TSharedPtr<FAccelByteMessagingSystem> FRegistry::MessagingSystem = MakeShared<FAccelByteMessagingSystem>();
Settings FRegistry::Settings;
Credentials FRegistry::Credentials {MessagingSystem};
Credentials FRegistry::Credentials {*MessagingSystem.Get()};
ServerSettings FRegistry::ServerSettings;
ServerCredentials FRegistry::ServerCredentials;
FAccelByteTimeManager FRegistry::TimeManager{ FRegistry::HttpRetryScheduler };
FAccelByteNetworkConditioner FRegistry::NetworkConditioner;
FAccelByteNotificationSender FRegistry::NotificationSender{MessagingSystem};
FAccelByteNotificationSender FRegistry::NotificationSender{*MessagingSystem.Get()};
#pragma endregion

#pragma region Game Client Access
Expand Down Expand Up @@ -122,9 +122,9 @@ Api::Group FRegistry::Group{ FRegistry::Credentials, FRegistry::Settings, FRegis

#pragma region Game Client Multiplayer
Api::QosManager FRegistry::QosManager{ FRegistry::Credentials, FRegistry::Settings, FRegistry::HttpRetryScheduler };
Api::Qos FRegistry::Qos{ FRegistry::Credentials, FRegistry::Settings, FRegistry::MessagingSystem };
Api::Lobby FRegistry::Lobby{ FRegistry::Credentials, FRegistry::Settings, FRegistry::HttpRetryScheduler,FRegistry::MessagingSystem, FRegistry::NetworkConditioner};
Api::Chat FRegistry::Chat{ FRegistry::Credentials, FRegistry::Settings, FRegistry::HttpRetryScheduler, FRegistry::MessagingSystem, FRegistry::NetworkConditioner};
Api::Qos FRegistry::Qos{ FRegistry::Credentials, FRegistry::Settings, *FRegistry::MessagingSystem.Get() };
Api::Lobby FRegistry::Lobby{ FRegistry::Credentials, FRegistry::Settings, FRegistry::HttpRetryScheduler, *FRegistry::MessagingSystem.Get(), FRegistry::NetworkConditioner};
Api::Chat FRegistry::Chat{ FRegistry::Credentials, FRegistry::Settings, FRegistry::HttpRetryScheduler, *FRegistry::MessagingSystem.Get(), FRegistry::NetworkConditioner};
Api::SessionBrowser FRegistry::SessionBrowser{ FRegistry::Credentials, FRegistry::Settings, FRegistry::HttpRetryScheduler };
Api::TurnManager FRegistry::TurnManager{ FRegistry::Credentials, FRegistry::Settings, HttpRetryScheduler };
Api::Session FRegistry::Session{ FRegistry::Credentials, FRegistry::Settings, FRegistry::HttpRetryScheduler };
Expand Down
66 changes: 45 additions & 21 deletions Source/AccelByteUe4Sdk/Private/Core/AccelByteServerSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,34 @@ FString GetServerConfigUrlValue(const FString& SectionPath, const FString& Key,
{
FString Value;

if (GConfig->GetString(*SectionPath, *Key, Value, GEngineIni)) return Value;
// Check AccelByte command line if exist. For example "GameExecutable -abKey=Value" and fetch the ab value of the key
if (!FAccelByteUtilities::GetAccelByteConfigFromCommandLineSwitch(Key, Value))
{
// If not exist, then fetch from the game default engine ini section
if (GConfig->GetString(*SectionPath, *Key, Value, GEngineIni)) return Value;

return FString::Printf(TEXT("%s/%s"), *BaseUrl, *DefaultPrefix);
}

return FString::Printf(TEXT("%s/%s"), *BaseUrl, *DefaultPrefix);
return Value;
}

void ServerSettings::LoadSettings(const FString& SectionPath)
{
#if WITH_EDITOR || UE_SERVER || UE_BUILD_DEVELOPMENT
if (GConfig->GetString(*SectionPath, TEXT("ClientId"), ClientId, GEngineIni))
if (!FAccelByteUtilities::LoadABConfigFallback(SectionPath, TEXT("ClientId"), ClientId, DefaultServerSection))
{
GConfig->GetString(*SectionPath, TEXT("ClientSecret"), ClientSecret, GEngineIni);
ClientId = TEXT("");
}
else
if (!FAccelByteUtilities::LoadABConfigFallback(SectionPath, TEXT("ClientSecret"), ClientSecret, DefaultServerSection))
{
GConfig->GetString(*DefaultServerSection, TEXT("ClientId"), ClientId, GEngineIni);
GConfig->GetString(*DefaultServerSection, TEXT("ClientSecret"), ClientSecret, GEngineIni);
ClientSecret = TEXT("");
}
LoadFallback(SectionPath, TEXT("BaseUrl"), BaseUrl);
LoadFallback(SectionPath, TEXT("Namespace"), Namespace);
LoadFallback(SectionPath, TEXT("PublisherNamespace"), PublisherNamespace);
LoadFallback(SectionPath, TEXT("RedirectURI"), RedirectURI);

FAccelByteUtilities::LoadABConfigFallback(SectionPath, TEXT("BaseUrl"), BaseUrl, DefaultServerSection);
FAccelByteUtilities::LoadABConfigFallback(SectionPath, TEXT("Namespace"), Namespace, DefaultServerSection);
FAccelByteUtilities::LoadABConfigFallback(SectionPath, TEXT("PublisherNamespace"), PublisherNamespace, DefaultServerSection);
FAccelByteUtilities::LoadABConfigFallback(SectionPath, TEXT("RedirectURI"), RedirectURI, DefaultServerSection);

IamServerUrl = GetServerConfigUrlValue(SectionPath, TEXT("IamServerUrl"), BaseUrl, TEXT("iam"));

Expand Down Expand Up @@ -88,7 +95,7 @@ void ServerSettings::LoadSettings(const FString& SectionPath)
MatchmakingV2ServerUrl = GetServerConfigUrlValue(SectionPath, TEXT("MatchmakingV2ServerUrl"), BaseUrl, TEXT("match2"));

FString QosPingTimeoutString;
LoadFallback(SectionPath, TEXT("QosPingTimeout"), QosPingTimeoutString);
FAccelByteUtilities::LoadABConfigFallback(SectionPath, TEXT("QosPingTimeout"), QosPingTimeoutString, DefaultServerSection);
if (QosPingTimeoutString.IsNumeric())
{
QosPingTimeout = FCString::Atof(*QosPingTimeoutString);
Expand All @@ -100,9 +107,9 @@ void ServerSettings::LoadSettings(const FString& SectionPath)

LoadAMSSettings();

LoadFallback(SectionPath, TEXT("StatsDUrl"), StatsDServerUrl);
FAccelByteUtilities::LoadABConfigFallback(SectionPath, TEXT("StatsDUrl"), StatsDServerUrl, DefaultServerSection);
FString StatsDPortString;
LoadFallback(SectionPath, TEXT("StatsDPort"), StatsDPortString);
FAccelByteUtilities::LoadABConfigFallback(SectionPath, TEXT("StatsDPort"), StatsDPortString, DefaultServerSection);
if (StatsDPortString.IsNumeric())
{
StatsDServerPort = FCString::Atoi(*StatsDPortString);
Expand All @@ -112,7 +119,7 @@ void ServerSettings::LoadSettings(const FString& SectionPath)
StatsDServerPort = 8125;
}
FString StatsDMetricIntervalString;
LoadFallback(SectionPath, TEXT("StatsDMetricInterval"), StatsDMetricIntervalString);
FAccelByteUtilities::LoadABConfigFallback(SectionPath, TEXT("StatsDMetricInterval"), StatsDMetricIntervalString, DefaultServerSection);
if (StatsDMetricIntervalString.IsNumeric())
{
StatsDMetricInterval = FCString::Atoi(*StatsDMetricIntervalString);
Expand All @@ -123,7 +130,7 @@ void ServerSettings::LoadSettings(const FString& SectionPath)
}

FString SendPredefinedEventString;
LoadFallback(SectionPath, TEXT("SendPredefinedEvent"), SendPredefinedEventString);
FAccelByteUtilities::LoadABConfigFallback(SectionPath, TEXT("SendPredefinedEvent"), SendPredefinedEventString, DefaultServerSection);
//Disabling PredefinedEventApi for the time being
//this->bSendPredefinedEvent = SendPredefinedEventString.IsEmpty() ? false : SendPredefinedEventString.ToBool();
this->bSendPredefinedEvent = false;
Expand Down Expand Up @@ -172,17 +179,34 @@ void ServerSettings::Reset(ESettingsEnvironment const Environment)

bool AccelByte::ServerSettings::LoadAMSSettings()
{
if (!FAccelByteUtilities::GetValueFromCommandLineSwitch(TEXT("watchdog_url"), AMSServerWatchdogUrl))
// Check if the key exist in the commandline of AccelByte format. For example "GameExecutable -abKey=Value"
if (!FAccelByteUtilities::GetAccelByteConfigFromCommandLineSwitch(TEXT("watchdog_url"), AMSServerWatchdogUrl))
{
if (!FAccelByteUtilities::GetAccelByteConfigFromCommandLineSwitch(TEXT("WatchdogUrl"), AMSServerWatchdogUrl))
{
// If not exist, then check without AccelByte format. For example "GameExecutable -Key=Value"
if (!FAccelByteUtilities::GetValueFromCommandLineSwitch(TEXT("watchdog_url"), AMSServerWatchdogUrl))
{
// If not exist, then fetch the setting from game default engine ini file
GConfig->GetString(*DefaultServerSection, TEXT("WatchdogUrl"), AMSServerWatchdogUrl, GEngineIni);
}
}
}

if (!FAccelByteUtilities::GetAccelByteConfigFromCommandLineSwitch(TEXT("heartbeat"), AMSHeartbeatInterval))
{
GConfig->GetString(*DefaultServerSection, TEXT("WatchdogUrl"), AMSServerWatchdogUrl, GEngineIni);
if (!FAccelByteUtilities::GetValueFromCommandLineSwitch(TEXT("heartbeat"), AMSHeartbeatInterval))
{
GConfig->GetInt(*DefaultServerSection, TEXT("AMSHeartbeatInterval"), AMSHeartbeatInterval, GEngineIni);
}
}

if (!FAccelByteUtilities::GetValueFromCommandLineSwitch(TEXT("heartbeat"), AMSHeartbeatInterval))
if (!FAccelByteUtilities::GetAccelByteConfigFromCommandLineSwitch(TEXT("dsid"), DSId))
{
GConfig->GetInt(*DefaultServerSection, TEXT("AMSHeartbeatInterval"), AMSHeartbeatInterval, GEngineIni);
FAccelByteUtilities::GetValueFromCommandLineSwitch(TEXT("dsid"), DSId);
}

return FAccelByteUtilities::GetValueFromCommandLineSwitch(TEXT("dsid"), DSId);
return true;
}

FString UAccelByteBlueprintsServerSettings::GetClientId()
Expand Down
Loading

0 comments on commit b47f02f

Please sign in to comment.