Skip to content

Commit

Permalink
https://docs.microsoft.com/en-us/gaming/playfab/release-notes/#201119
Browse files Browse the repository at this point in the history
  • Loading branch information
PlayFabJenkinsBot committed Nov 20, 2020
2 parents 441ca64 + dbaafe5 commit 4945264
Show file tree
Hide file tree
Showing 10 changed files with 85 additions and 39 deletions.
2 changes: 2 additions & 0 deletions build/Windows/TestClientApp.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
<ClInclude Include="$(TestSourceDir)\TestApp\TestReport.h" />
<ClInclude Include="$(TestSourceDir)\TestApp\TestRunner.h" />
<ClInclude Include="$(TestSourceDir)\TestApp\TestUtils.h" />
<ClInclude Include="$(TestSourceDir\TestApp\PlayFabQoSTest.h" />
<ClInclude Include="$(SdkSourceDir)\include\playfab\PlayFabApiSettings.h" />
<ClInclude Include="$(SdkSourceDir)\include\playfab\PlayFabAuthenticationContext.h" />
</ItemGroup>
Expand All @@ -138,6 +139,7 @@
<ClCompile Include="$(TestSourceDir)\TestApp\TestReport.cpp" />
<ClCompile Include="$(TestSourceDir)\TestApp\TestRunner.cpp" />
<ClCompile Include="$(TestSourceDir)\TestApp\TestUtils.cpp" />
<ClCompile Include="$(TestSourceDir)\TestApp\PlayFabQoSTest.cpp" />
<ClCompile Include="MainWin32.cpp" />
<ClCompile Include="TestAppWin32.cpp" />
</ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions build/Xbox/TestXboxApp/TestXboxApp.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@
<ClInclude Include="$(TestSourceDir)\TestApp\TestReport.h" />
<ClInclude Include="$(TestSourceDir)\TestApp\TestRunner.h" />
<ClInclude Include="$(TestSourceDir)\TestApp\TestUtils.h" />
<ClInclude Include="$(TestSourceDir)\TestApp\PlayFabQoSTest.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="$(TestSourceDir)\TestApp\PlayFabApiTest.cpp" />
Expand All @@ -226,6 +227,7 @@
<ClCompile Include="$(TestSourceDir)\TestApp\TestReport.cpp" />
<ClCompile Include="$(TestSourceDir)\TestApp\TestRunner.cpp" />
<ClCompile Include="$(TestSourceDir)\TestApp\TestUtils.cpp" />
<ClCompile Include="$(TestSourceDir)\TestApp\PlayFabQoSTest.cpp" />
<ClCompile Include="MainXBO.cpp" />
<ClCompile Include="TestAppXBO.cpp" />
</ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions code/source/playfab/PlayFabSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ namespace PlayFab
// Control whether all callbacks are threaded or whether the user manually controls callback timing from their main-thread
// Note ANY api call may synchronously throw an exception if the title id is not set
bool PlayFabSettings::threadedCallbacks = false;
const std::string PlayFabSettings::sdkVersion = "3.41.201027";
const std::string PlayFabSettings::buildIdentifier = "jbuild_xplatcppsdk__sdk-genericslave-2_1";
const std::string PlayFabSettings::versionString = "XPlatCppSdk-3.41.201027";
const std::string PlayFabSettings::sdkVersion = "3.42.201119";
const std::string PlayFabSettings::buildIdentifier = "jbuild_xplatcppsdk__sdk-genericslave-3_1";
const std::string PlayFabSettings::versionString = "XPlatCppSdk-3.42.201119";
std::string PlayFabSettings::productionEnvironmentURL = ".playfabapi.com";
ErrorCallback PlayFabSettings::globalErrorHandler = nullptr;

Expand Down
24 changes: 21 additions & 3 deletions code/source/playfab/QoS/PlayFabQoSApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,23 @@ namespace PlayFab
result.regionResults.push_back(RegionResult(it->first, latency, it->second.errorCode));
}

bool allTimedOut = true;
for(auto& regionRes: result.regionResults)
{
if(regionRes.latencyMs != timeoutMs)
{
allTimedOut = false;
break;
}
}

if(allTimedOut)
{
result.errorCode = static_cast<int>(QoSErrorCode::Timeout);;
}

std::sort(result.regionResults.begin(), result.regionResults.end(), [](const RegionResult& first, const RegionResult& second) -> bool {return first.latencyMs < second.latencyMs; });

return result;
}

Expand Down Expand Up @@ -289,8 +305,12 @@ namespace PlayFab
for (size_t i = 0; i < numThreads && pingItr < numPings; ++i)
{
// NOTE: the very first ping result might be a fake future
for (size_t futuresCount = 0; futuresCount < MaxWaitForFuturesLoopCounts || asyncPingResults[i].valid(); ++futuresCount)
for (size_t futuresCount = 0; futuresCount < MaxWaitForFuturesLoopCounts; ++futuresCount)
{
if(!asyncPingResults[i].valid())
{
continue;
}
future_status status = asyncPingResults[i].wait_for(threadWaitTimespan);
if (status == future_status::ready)
{
Expand Down Expand Up @@ -370,8 +390,6 @@ namespace PlayFab
accumulatedPingResults[region].latencyMs += result.latencyMs;
++accumulatedPingResults[region].pingCount;
}

// if a ping took longer than TIMEOUT value it will be ignored (by design)
}

// Ping one data center and return the address.
Expand Down
4 changes: 2 additions & 2 deletions com.playfab.xplatcppsdk.v141.autopkg
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ configurations {
nuget {
nuspec {
id = "com.playfab.xplatcppsdk.v141";
version : 3.41.201027;
version : 3.42.201119;
title: "PlayFab Cross Platform C++ Sdk for Visual Studio 2017";
summary: "PlayFab is the unified backend platform for games and everything you need to build and operate your game, all in one place, so you can focus on creating and delivering a great player experience.";
authors: "PlayFab";
Expand All @@ -18,7 +18,7 @@ nuget {
iconUrl: "https://playfab.com/assets/img/playfab-mark.png";
requireLicenseAcceptance: false;
description: "Authentication, in-game commerce, player data, title data, inventory, characters, statistics, leaderboards, analytics and reporting, friends, multiplayer, matchmaking, tournaments, cloud script, trading, real-time event handling, player management, live ops, and server hosting for all major platforms/devices and games of any scale. This sdk gives your game the ability log into PlayFab and access cloud data and services.";
releaseNotes: "https://api.playfab.com/releaseNotes/#201027";
releaseNotes: "https://api.playfab.com/releaseNotes/#201119";
copyright: "Copyright 2020";
language: "C++";
tags: { PlayFab, Baas, Paas, JSON, REST, HTTP, SSL, API, cloud, liveops, game, gamedev, native };
Expand Down
2 changes: 1 addition & 1 deletion com.playfab.xplatcppsdk.v141.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>com.playfab.xplatcppsdk.v141</id>
<version>3.41.201027</version>
<version>3.42.201119</version>
<authors>Microsoft</authors>
<owners>pgilmore, toddbellMSFT</owners>
<projectUrl>http://github.com/PlayFab/XPlatCppSdk</projectUrl>
Expand Down
4 changes: 2 additions & 2 deletions com.playfab.xplatxboxsdk.v141.autopkg
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ configurations {
nuget {
nuspec {
id = "com.playfab.xplatxboxsdk.v141";
version : 3.41.201027;
version : 3.42.201119;
title: "PlayFab Xbox Platform C++ Sdk for Visual Studio 2017";
summary: "PlayFab is the unified backend platform for games and everything you need to build and operate your game, all in one place, so you can focus on creating and delivering a great player experience.";
authors: "PlayFab";
Expand All @@ -28,7 +28,7 @@ nuget {
iconUrl: "https://playfab.com/assets/img/playfab-mark.png";
requireLicenseAcceptance: false;
description: "Authentication, in-game commerce, player data, title data, inventory, characters, statistics, leaderboards, analytics and reporting, friends, multiplayer, matchmaking, tournaments, cloud script, trading, real-time event handling, player management, live ops, and server hosting for all major platforms/devices and games of any scale. This sdk gives your game the ability log into PlayFab and access cloud data and services.";
releaseNotes: "https://api.playfab.com/releaseNotes/#201027";
releaseNotes: "https://api.playfab.com/releaseNotes/#201119";
copyright: "Copyright 2020";
language: "C++";
tags: { PlayFab, Baas, Paas, JSON, REST, HTTP, SSL, API, cloud, liveops, game, gamedev, native, xbox };
Expand Down
44 changes: 33 additions & 11 deletions test/TestApp/PlayFabQoSTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <thread>
#include <chrono>
#include <playfab/PlayFabClientApi.h>
#include <playfab/PlayFabClientDataModels.h>
#include <playfab/PlayFabClientInstanceApi.h>
#include <playfab/PlayFabEventsDataModels.h>
Expand All @@ -24,11 +25,32 @@ namespace PlayFabUnit
{
#if (!UNITY_IOS && !UNITY_ANDROID) && (!defined(PLAYFAB_PLATFORM_IOS) && !defined(PLAYFAB_PLATFORM_ANDROID) && !defined(PLAYFAB_PLATFORM_SWITCH))
/// QoS API
void PlayFabQoSTest::QosResultApi(TestContext& testContext)
void PlayFabQoSTest::QoSResultApi(TestContext& testContext)
{
LoginWithCustomIDRequest request;
request.CustomId = PlayFabSettings::buildIdentifier;
request.CreateAccount = true;

std::atomic_bool isLoggedIn = false;

PlayFabClientAPI::LoginWithCustomID(request,
[&isLoggedIn](const LoginResult& loginResult, void*) {
PlayFabSettings::staticPlayer->clientSessionTicket = loginResult.SessionTicket;
isLoggedIn.exchange(true);
},
[&isLoggedIn](const PlayFabError&, void*) {
isLoggedIn.exchange(true);
},
&testContext);

while (!isLoggedIn)
{
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}

QoS::PlayFabQoSApi api;

QoS::QoSResult result = api.GetQoSResult(5, 200);
QoS::QoSResult result = api.GetQoSResult(5);

if (result.errorCode == 0)
{
Expand All @@ -41,36 +63,36 @@ namespace PlayFabUnit
}
#endif

void PlayFabEventTest::AddTests()
void PlayFabQoSTest::AddTests()
{
// It is not appropriate for this test to block infinitely until the QoS result is returned
// Not the least of which is because it frequently blocks forever
// This needs to switch to the async mechanism, and allow the test to time out if QoS never completes
// AddTest("QosResultApi", &PlayFabEventTest::QosResultApi);
// Not the least of which is because it frequently blocks forever if called within a callback.
// TODO: This test cannot switch to an async mechanism until QoS is re-architected to allow such a calling scheme.
AddTest("QosResultApi", &PlayFabQoSTest::QoSResultApi);
}

void PlayFabEventTest::ClassSetUp()
void PlayFabQoSTest::ClassSetUp()
{
// Make sure PlayFab state is clean.
PlayFabSettings::ForgetAllCredentials();
}

void PlayFabEventTest::SetUp(TestContext& /*testContext*/)
void PlayFabQoSTest::SetUp(TestContext& /*testContext*/)
{
PlayFabSettings::staticSettings->titleId = testTitleData.titleId;
}

void PlayFabEventTest::Tick(TestContext& /*testContext*/)
void PlayFabQoSTest::Tick(TestContext& /*testContext*/)
{
// No work needed, async tests will end themselves
}

void PlayFabEventTest::TearDown(TestContext& /*testContext*/)
void PlayFabQoSTest::TearDown(TestContext& /*testContext*/)
{
// nothing to tear down
}

void PlayFabEventTest::ClassTearDown()
void PlayFabQoSTest::ClassTearDown()
{
// Clean up any PlayFab state for next TestCase.
PlayFabSettings::ForgetAllCredentials();
Expand Down
10 changes: 1 addition & 9 deletions test/TestApp/PlayFabQoSTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,10 @@ namespace PlayFabUnit
{
struct TestContext;

// A wrapper around TestEvents, so we can track it back to the test that launched the event
class TestEvent : public PlayFab::PlayFabEvent
{
public:
TestContext* testContext;
};

class PlayFabQoSTest : public PlayFabApiTestCase
{
private:

void QosResultApi(TestContext& testContext);
void QoSResultApi(TestContext& testContext);

protected:
void AddTests() override;
Expand Down
26 changes: 18 additions & 8 deletions test/TestApp/TestApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
#include "PlayFabTestMultiUserInstance.h"
#endif

// possible disable qos thing
#include "PlayFabQoSTest.h"

#include <playfab/PlayFabJsonHeaders.h>

#include "PlayFabTestAlloc.h"
Expand All @@ -29,7 +32,7 @@ namespace PlayFabUnit
#if !defined(DISABLE_PLAYFABCLIENT_API)
// Time out if waiting for the final cloudscript submission longer than this
constexpr int CLOUDSCRIPT_TIMEOUT_MS = 30000;
#endif
#endif // !defined(DISABLE_PLAYFABCLIENT_API)

void TestApp::Log(const char* format, ...)
{
Expand All @@ -43,7 +46,7 @@ namespace PlayFabUnit
vsnprintf(message, sizeof(message), format, args);
#else
_vsnprintf_s(message, sizeof(message), format, args);
#endif
#endif // defined(PLAYFAB_PLATFORM_PLAYSTATION)
va_end(args);

// Output the message in a platform-dependent way.
Expand Down Expand Up @@ -82,7 +85,7 @@ namespace PlayFabUnit
PlatformLoginTest loginTest;
loginTest.SetTitleInfo(testTitleData);
testRunner.Add(loginTest);
#endif
#endif // !defined(PLAYFAB_PLATFORM_IOS)

// Add PlayFab API tests.
PlayFabApiTest pfApiTest;
Expand All @@ -93,7 +96,7 @@ namespace PlayFabUnit
PlayFabEventTest pfEventTest;
pfEventTest.SetTitleInfo(testTitleData);
testRunner.Add(pfEventTest);
#endif
#endif // false, tests are too unstable

PlayFabTestMultiUserStatic pfMultiUserStaticTest;
pfMultiUserStaticTest.SetTitleInfo(testTitleData);
Expand All @@ -102,7 +105,14 @@ namespace PlayFabUnit
PlayFabTestMultiUserInstance pfMultiUserInstanceTest;
pfMultiUserInstanceTest.SetTitleInfo(testTitleData);
testRunner.Add(pfMultiUserInstanceTest);
#endif

#if defined(PLAYFAB_PLATFORM_WINDOWS) || defined(PLAYFAB_PLATFORM_XBOX)
PlayFabQoSTest pfQosTest;
pfQosTest.SetTitleInfo(testTitleData);
testRunner.Add(pfQosTest);
#endif //defined(PLAYFAB_PLATFORM_WINDOWS) || defined(PLAYFAB_PLATFORM_XBOX)

#endif // !defined(DISABLE_PLAYFABCLIENT_API)

// Run the tests (blocks until all tests have finished).
testRunner.Run();
Expand Down Expand Up @@ -131,13 +141,13 @@ namespace PlayFabUnit

// Publish the cloud script response to STDOUT.
Log("Cloud Response: %s\n", cloudResponse.c_str());
#endif
#endif //!defined(DISABLE_PLAYFABCLIENT_API)

// Return 0 (success) if all tests passed. Otherwise, return 1 (error).
return testRunner.AllTestsPassed()
#if !defined(DISABLE_PLAYFABCLIENT_API)
&& !cloudResponse.empty() ? 0 : 1
#endif
#endif // !defined(DISABLE_PLAYFABCLIENT_API)
;
}

Expand Down Expand Up @@ -214,5 +224,5 @@ namespace PlayFabUnit
cloudResponse = "Failed to report results via cloud script: " + error.GenerateErrorReport();
cloudResponseConditionVar.notify_one();
}
#endif
#endif // !defined(DISABLE_PLAYFABCLIENT_API)
}

0 comments on commit 4945264

Please sign in to comment.