Announcement

Collapse
No announcement yet.

Unreal Engine 4 is available for Win10 UWP app dev now

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    Originally posted by Sparkash View Post
    [MENTION=494622]jsyarrow[/MENTION]
    Thanks for clearing it up. Unfortunately I get the same errors when attempting to build UWP.Automation within Visual Studio.
    When I manage NuGet packages, I can see that 'WindowsDevicePortalWrapper' is installed. It was originally on the 0.9.4 (beta) version, so I updated to 0.9.5, but that didn't seem to make a difference.
    That's odd. Can you see where WindowsDevicePortalWrapper.dll lands after the NuGet install? The project expects to be able to locate it in [Enlistment_Root]/Packages/WindowsDevicePortalWrapper.0.9.4.1-beta/lib/net452/ which should have been the default location for the 0.9.4 (beta) version.

    Leave a comment:


  • replied
    [MENTION=494622]jsyarrow[/MENTION]
    Thanks for clearing it up. Unfortunately I get the same errors when attempting to build UWP.Automation within Visual Studio.
    When I manage NuGet packages, I can see that 'WindowsDevicePortalWrapper' is installed. It was originally on the 0.9.4 (beta) version, so I updated to 0.9.5, but that didn't seem to make a difference.

    Leave a comment:


  • replied
    [MENTION=494622]jsyarrow[/MENTION] - I modified the above code some and discovered that the statName is NULL:

    Code:
    LeaderboardResultEventArgs^ LbResultEventArgs = safe_cast<LeaderboardResultEventArgs^>(Event->EventArgs);
    LeaderboardResult^ LbResult = LbResultEventArgs->Result;
    
    for (LeaderboardRow^ Row : LbResult->Rows)
    {
        FString RowText = FString::Printf(TEXT("Leaderboard row: User %s, Stats "), Row->Gamertag->Data());
        for (unsigned int i = 0; i < Row->Values->Size; ++i)
       {
            LeaderboardColumn^ statCol = LbResult->Columns->GetAt(i);
            Platform::String^ statName = LbResult->Columns->GetAt(i)->DisplayName;
    
             RowText.Append(FString::Printf(TEXT("(%s : %s) "), LbResult->Columns->GetAt(i)->DisplayName->Data(), Row->Values->GetAt(i)->Data()));
        }
    }

    Click image for larger version

Name:	NullStatName.jpg
Views:	1
Size:	149.9 KB
ID:	1131010


    And yes, the score is correct: 932
    Last edited by Jerry.Richards; 07-12-2017, 02:01 PM.

    Leave a comment:


  • replied
    Originally posted by jsyarrow View Post
    The event you get back from DoWork carries the leaderboard data. So it should be something like
    Code:
    using namespace Microsoft::Xbox::Services::Statistic::Manager;
    using namespace Microsoft::Xbox::Services::Leaderboard;
    
    LeaderboardResultEventArgs^ LbResultEventArgs = safe_cast<LeaderboardResultEventArgs^>(Event->EventArgs);
    LeaderboardResult^ LbResult = LbResultEventArgs->Result;
    
    for (LeaderboardRow^ Row : LbResult->Rows)
    {
    	FString RowText = FString::Printf(TEXT("Leaderboard row: User %s, Stats "), Row->Gamertag->Data());
    	for (unsigned int i = 0; i < Row->Values->Size; ++i)
    	{
    		RowText.Append(FString::Printf(TEXT("(%s : %s) "), LbResult->Columns->GetAt(i)->DisplayName->Data(), Row->Values->GetAt(i)->Data()));
    	}
    
    	UE_LOG_ONLINE(Warning, *RowText);
    }
    Well that helped quite a bit. . .and seems to show an update problem:

    Click image for larger version

Name:	MissingKeyValuePair.jpg
Views:	1
Size:	128.6 KB
ID:	1131009


    Is the Key ("HighScore") missing then?

    Leave a comment:


  • replied
    Originally posted by Jerry.Richards View Post
    How do I go about getting the Leaderboard stats after GetLeaderboardComplete is returned?
    The event you get back from DoWork carries the leaderboard data. So it should be something like
    Code:
    using namespace Microsoft::Xbox::Services::Statistic::Manager;
    using namespace Microsoft::Xbox::Services::Leaderboard;
    
    LeaderboardResultEventArgs^ LbResultEventArgs = safe_cast<LeaderboardResultEventArgs^>(Event->EventArgs);
    LeaderboardResult^ LbResult = LbResultEventArgs->Result;
    
    for (LeaderboardRow^ Row : LbResult->Rows)
    {
    	FString RowText = FString::Printf(TEXT("Leaderboard row: User %s, Stats "), Row->Gamertag->Data());
    	for (int32 i = 0; i < Row->Values->Size; ++i)
    	{
    		RowText.Append(FString::Printf(TEXT("(%s : %s) "), LbResult->Columns->GetAt(i)->DisplayName->Data(), Row->Values->GetAt(i)->Data()));
    	}
    
    	UE_LOG_ONLINE(Warning, *RowText);
    }
    ...though once again that's code that has never been anywhere near a compiler.

    Source for the types in the Microsoft::Xbox::Services::Leaderboard namespace is here.

    Originally posted by Jerry.Richards View Post
    Finally, is there a way to determine if a User has already been added to the StatisticManager::AddLocalUser(LiveContext->User)?
    Other than catching the exception for a double add, no. You should consider tracking this in your own code.

    Leave a comment:


  • replied
    Originally posted by Sparkash View Post
    I grabbed that project, and built both the 'WindowDevicePortalWrapper' and the 'WindowDevicePortalWrapper.UniversalWindows' projects in it (in both debug and release), but I'm still getting the error.
    Any other ideas?
    I realize my original advice was very poorly worded

    What I meant to say was that you should manually build the UWP.Automation.csproj within the Visual Studio solution for UE4. With default settings that will pull down the NuGet package for the device portal, which should resolve your error.

    Alternatively, again within the Visual Studio UE4 solution, you can right-click the solution root and hit 'Restore NuGet packages'.

    The link to the device portal source was really just in case you were interested in what this thing we needed actually was. You shouldn't ever need to clone it if you don't want to.

    Leave a comment:


  • replied
    [MENTION=494622]jsyarrow[/MENTION] - It does appear that WindowsExports.TryGetVSInstallDir did fix my packaging problem. Thank you for that.

    Secondly, as expected, I am able to instantiate the LeaderboardQuery and the call to StatisticsManager::GetLeaderboard does return with an StatisticEventType::GetLeaderboardComplete:

    Code:
    LeaderboardQuery^ Query = ref new LeaderboardQuery();
    Query->SkipResultToMe = true;
    Query->MaxItems = 100;
    Query->Order = SortOrder::Descending;
    mgr->GetLeaderboard(LiveContext->User, StatName, Query);
    How do I go about getting the Leaderboard stats after GetLeaderboardComplete is returned?

    Code:
    void FOnlineLeaderboardsLive::Tick(float DeltaTime)
    {
        StatisticManager^ mgr = Microsoft::Xbox::Services::Statistics::Manager::StatisticManager::SingletonInstance;
        if (mgr != nullptr)
        {
            auto EventList = mgr->DoWork();
            for (StatisticEvent^ Event : EventList)
            {
                if (Event->ErrorCode != 0)
                {
                    UE_LOG_ONLINE(Warning, TEXT("DoWork error: %s"), Event->ErrorMessage->Data());
                }
    
                StatisticEventArgs^ args;
    
                switch (Event->EventType)
                {
                    case StatisticEventType::LocalUserAdded:
                        UE_LOG_ONLINE(Warning, TEXT("DoWork LocalUserAdded: %s"), Event->User->Gamertag->ToString());
                        break;
    
                    case StatisticEventType::LocalUserRemoved:
                        UE_LOG_ONLINE(Warning, TEXT("DoWork LocalUserRemoved: %s"), Event->User->Gamertag->ToString());
                        break;
    
                    case StatisticEventType::GetLeaderboardComplete:
                        UE_LOG_ONLINE(Warning, TEXT("DoWork GetLeaderboardComplete: %s"), Event->User->Gamertag->ToString());
                        args = Event->EventArgs;
    
                        IVectorView<Platform::String^>^ stats = mgr->GetStatisticNames(Event->User);
                        for (Platform::String^ stat : stats)
                        {
                            UE_LOG_ONLINE(Warning, TEXT("DoWork Stat: %s"), stat->ToString());
                        }
                        break;
    
                    case StatisticEventType::StatisticUpdateComplete:
                        UE_LOG_ONLINE(Warning, TEXT("DoWork StatisticUpdateComplete: %s"), Event->User->Gamertag->ToString());
                        args = Event->EventArgs;
                        break;
                }
            }
        }
    }

    Finally, is there a way to determine if a User has already been added to the StatisticManager::AddLocalUser(LiveContext->User)?

    Code:
    try
    {
        mgr->AddLocalUser(LiveContext->User);
    }
    Last edited by Jerry.Richards; 07-12-2017, 12:50 PM.

    Leave a comment:


  • replied
    [MENTION=828801]Sparkash[/MENTION] - There's a NuGet reference in UWP.Automation.csproj - we use the Windows Device Portal Wrapper (source here) to assist with deploy and launch on remote UWP devices. If you haven't built that project in VS at least once then the reference may not have been resolved and downloaded. Once the necessary assembly is in place you should be able to package in the editor. (I'm going to try to move the resolution step into Setup.bat when I get a chance.)
    I grabbed that project, and built both the 'WindowDevicePortalWrapper' and the 'WindowDevicePortalWrapper.UniversalWindows' projects in it (in both debug and release), but I'm still getting the error.
    Any other ideas?

    Leave a comment:


  • replied
    Originally posted by jsyarrow View Post
    [MENTION=24297]PhilMaguire[/MENTION] - The UWPDeviceDetector module that's failing is a little special in that it takes a dependency on a Win10 SDK winmd component (Windows:evices::Enumeration:eviceWatcher) in order to locate UWP devices on your local network (for e.g. in-editor deployment to an Xbox). Do you have the Windows 10 SDK installed (for VS2015, I'd recommend 14393)? If so, my only other thought is that maybe there's an incompatibility between SNDBS and use of winmd - that's not something I've tried. If necessary you can turn off use of winmd components in the editor via the branch-specific config variable bUseWindowsSDK10ForEditor (goes in the /Script/WindowsTargetPlatform.WindowsTargetSettings section, set it to false). But you might quickly run into similar issues with the UWP builds themselves.
    [MENTION=494622]jsyarrow[/MENTION] thank you for the advice. I disabled my SN-DBS service and now have an editor build. I can't package the UWP configuration due to our FMOD plugin not having been built to be UWP compatible. I will have to get in touch with them to get that resolved I expect

    Leave a comment:


  • replied
    Originally posted by jsyarrow View Post
    Ugh, after download and unpack the version number on the NuGet package is 2017.07.20170710.01 (note one 0, not two). So that's the string that needs to go in the download script and build.cs. Would be nice if this were consistent...

    Side note: I'm a bit concerned that you still need to make the adjustment for PDBCopy - does WindowsExports.TryGetVSInstallDir not already report "E:\Program Files\Microsoft Visual Studio\2017\Community" in your environment?
    Removing the 0 from the script and OnlineSubsystemLive.Build.cs fixed the GenerateProfectFiles.bat error and the SDK is downloaded properly now.

    Code:
    // Should match versions in GetXboxLiveSDK.ps1
    readonly string XsapiVersionUwp = "2017.07.20170710.01";

    As for the PDBCopyPath problem, without my change I wasn't able to Package my game with UWP in the UE4 Editor. I can try it again though and let you know later. . .
    Last edited by Jerry.Richards; 07-11-2017, 07:36 PM.

    Leave a comment:


  • replied
    Ugh, after download and unpack the version number on the NuGet package is 2017.07.20170710.01 (note one 0, not two). So that's the string that needs to go in the download script and build.cs. Would be nice if this were consistent...

    Side note: I'm a bit concerned that you still need to make the adjustment for PDBCopy - does WindowsExports.TryGetVSInstallDir not already report "E:\Program Files\Microsoft Visual Studio\2017\Community" in your environment?

    Leave a comment:


  • replied
    Originally posted by jsyarrow View Post
    Once again you could try revving the version in GetXboxLiveSDK.ps1. Looks like latest is 20170710.1 (see this page). And as before this may or may not require rebuilding EraAdapter.
    After updating UWPPlatform.Automation.cs (PDBCopyPath for VS2017 Community Edition), OnlineSubsystemLive.Build.cs (XsapiVersionUwp), and modifying the GetXboxLiveSDK.ps1 ($xsapiVersionUwp), running the script, then running GenerateProjectFiles.bat, an error is returned.


    UWPPlatform.Automation.cs
    Code:
    FileReference PDBCopyPath = null;
    
    // VS 2017 puts MSBuild stuff (where PDBCopy lives) under the Visual Studio Installation directory
    DirectoryReference VSInstallDir;
    if (WindowsExports.TryGetVSInstallDir(WindowsCompiler.VisualStudio2017, out VSInstallDir))
    {
    	PDBCopyPath = FileReference.Combine(VSInstallDir, "MSBuild", "Microsoft", "VisualStudio", "v15.0", "AppxPackage", "PDBCopy.exe");
    }
    
    // Earlier versions use a separate MSBuild install location
    if (PDBCopyPath == null || !FileReference.Exists(PDBCopyPath))
    {
            const string VSCommunity = @"E:\Program Files\Microsoft Visual Studio\2017\Community";
            PDBCopyPath = FileReference.Combine(VSCommunity, "MSBuild", "Microsoft", "VisualStudio", "v15.0", "AppxPackage", "PDBCopy.exe");
    
            if (PDBCopyPath == null || !FileReference.Exists(PDBCopyPath))
            {
             }
    }
    OnlineSubsystemLive.Build.cs
    Code:
    public class OnlineSubsystemLive : ModuleRules
    {
    	// Should match versions in GetXboxLiveSDK.ps1
    	readonly string XsapiVersionUwp = "2017.07.20170710.001";
    	readonly string XsapiVersionXboxOne = "2017.05.20170517.001";
    	readonly string CppRestVersion = "2_9";
    }

    GetXboxLiveSDK.ps1
    Code:
    # Package versions.  Should match OnlineSubsystemLive.build.cs
    $xsapiVersionUwp = "2017.07.20170710.001"
    $xsapiVersionXdk = "2017.05.20170517.001"

    The script reports that the SDK is installed, and already installed. However GenerateProjectFiles.bat shows the following error:

    Code:
    Error: Xbox Live SDK (version 2017.07.20170710.001) not found.  Run Engine/Plugins/Online/XboxOne/OnlineSubsystemLive/GetXboxLiveSDK.ps1
    What am I missing?

    Btw, ThirdParty\XSAPI only shows the XboxOne SDK not the UWP as before.

    Click image for larger version

Name:	alreadyInstalled.jpg
Views:	1
Size:	80.8 KB
ID:	1130977
    Last edited by Jerry.Richards; 07-11-2017, 06:59 PM.

    Leave a comment:


  • replied
    Well bother!

    Source is here, but looks like the XBL SDK release currently in use by OnlineSubsystemLive missed the latest change which adds the necessary public constructor, hence the problem.

    Once again you could try revving the version in GetXboxLiveSDK.ps1. Looks like latest is 20170710.1 (see this page). And as before this may or may not require rebuilding EraAdapter.

    Leave a comment:


  • replied
    Originally posted by jsyarrow View Post
    [MENTION=5350]Jerry.Richards[/MENTION] - I think you should just create your own LeaderboardQuery object (warning: forum code)
    Code:
    using namespace Microsoft::Xbox::Services::Leaderboard;
    
    auto Query = ref new LeaderboardQuery();
    Query->SkipResultToMe = true;
    Query->MaxItems = 100;
    Query->SortOrder = SortOrder::Descending;
    mgr->GetLeaderboard(LiveContext->User, StatName, Query);

    If it were only that easy

    Code:
    error C2248: 'Microsoft::Xbox::Services::Leaderboard::LeaderboardQuery::LeaderboardQuery': cannot access private member declared in class 'Microsoft::Xbox::Services::Leaderboard::LeaderboardQuery'
    I can't instantiate the LeaderboardQuery. C# (https://github.com/Microsoft/xbox-li...rboardQuery.cs) looks nice and cleaned up:

    Click image for larger version

Name:	02.jpg
Views:	1
Size:	98.1 KB
ID:	1130967


    Unfortunately I haven't found the matching repository for the DLL we are using. The "older" version (https://github.com/Microsoft/xbox-li.../leaderboard.h) does have a similar setup:

    Click image for larger version

Name:	03.jpg
Views:	1
Size:	53.7 KB
ID:	1130968


    But neither code matches what is in the WINMD file:

    Click image for larger version

Name:	04.jpg
Views:	1
Size:	128.4 KB
ID:	1130969

    The items enclosed by the red box are not one for one in the source that I am referencing. The WINMD doesn't look like there is a public constructor, unless I missed it.

    Are we able to access the repository for the Microsoft::Xbox::Services DLL?

    Leave a comment:


  • replied
    [MENTION=24297]PhilMaguire[/MENTION] - The UWPDeviceDetector module that's failing is a little special in that it takes a dependency on a Win10 SDK winmd component (Windows:evices::Enumeration:eviceWatcher) in order to locate UWP devices on your local network (for e.g. in-editor deployment to an Xbox). Do you have the Windows 10 SDK installed (for VS2015, I'd recommend 14393)? If so, my only other thought is that maybe there's an incompatibility between SNDBS and use of winmd - that's not something I've tried. If necessary you can turn off use of winmd components in the editor via the branch-specific config variable bUseWindowsSDK10ForEditor (goes in the /Script/WindowsTargetPlatform.WindowsTargetSettings section, set it to false). But you might quickly run into similar issues with the UWP builds themselves.

    [MENTION=5350]Jerry.Richards[/MENTION] - I think you should just create your own LeaderboardQuery object (warning: forum code)
    Code:
    using namespace Microsoft::Xbox::Services::Leaderboard;
    
    auto Query = ref new LeaderboardQuery();
    Query->SkipResultToMe = true;
    Query->MaxItems = 100;
    Query->SortOrder = SortOrder::Descending;
    mgr->GetLeaderboard(LiveContext->User, StatName, Query);
    You're definitely using the correct libraries. Some details/history: the Xbox Live SDK comes in two flavors: a pure, standard C++ version (which is mostly what you see in sample code these days); and a WinRT projection (also written in C++, as a layer on top of the pure C++ version, and usable from C++ as well as other WinRT-compatible languages). The latter version actually predates the former, and back when Epic first created OnlineSubsystemLive for Xbox One it was the only version available. As a result, it's the version that UE uses.

    As for the different UI between the doc images and the actual portal, I'd encourage you to provide feedback through the standard Creators Program channels since it's not a UE issue. That's the kind of thing I'm sure they're interested in hearing about from early adopters of the Creators Program.

    [MENTION=828801]Sparkash[/MENTION] - There's a NuGet reference in UWP.Automation.csproj - we use the Windows Device Portal Wrapper (source here) to assist with deploy and launch on remote UWP devices. If you haven't built that project in VS at least once then the reference may not have been resolved and downloaded. Once the necessary assembly is in place you should be able to package in the editor. (I'm going to try to move the resolution step into Setup.bat when I get a chance.)
    Last edited by jsyarrow; 07-11-2017, 01:43 PM. Reason: Needs more line breaks

    Leave a comment:

Working...
X