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
    Trying to read the leaderboard now using the Stats Manager. Since ReadLeaderboardsAroundUser wasn't implemented I decided to replace its function body:

    Code:
    bool FOnlineLeaderboardsLive::ReadLeaderboardsAroundUser(TSharedRef<const FUniqueNetId> Player, uint32 Range, FOnlineLeaderboardReadRef& ReadObject)
    {
    	//UE_LOG_ONLINE(Warning, TEXT("FOnlineLeaderboardsLive::ReadLeaderboardsAroundUser is currently not supported."));
        if (!LiveSubsystem)
            return false;
    
        const FOnlineIdentityLivePtr Identity = LiveSubsystem->GetIdentityLive();
        if (!Identity.IsValid())
            return false;
    
        const FUniqueNetIdLive UserLive(Player.Get());
        Windows::Xbox::System::User^ XBoxUser = Identity->GetUserForUniqueNetId(UserLive);
        if (!XBoxUser)
            return false;
    
        Microsoft::Xbox::Services::XboxLiveContext^ LiveContext = LiveSubsystem->GetLiveContext(XBoxUser);
        if (LiveContext == nullptr)
            return false;
    
        Microsoft::Xbox::Services::Statistics::Manager::StatisticManager^ mgr = Microsoft::Xbox::Services::Statistics::Manager::StatisticManager::SingletonInstance;
        if (mgr != nullptr)
        {
            FOnlineLeaderboardRead olr = ReadObject.Get();
            TArray<FColumnMetaData> cols = olr.ColumnMetadata;
            for (FColumnMetaData data : olr.ColumnMetadata)
            {
                mgr->GetLeaderboard(LiveContext->User, data.ColumnName, );
            }
    
            return true;
        }
    
        return false;
    }

    Unfortunately I need a third parameter for the mgr->GetLeaderboard(LiveContext->User, data.ColumnName, ); call.

    Leave a comment:


  • replied
    That would go to the regular log file. For UWP without a cook server this is %localappdata%\Packages\{Package_Family_Name}\LocalState\{Project_Name}\Saved\Logs\{Project_Name}.log. You should also see it in the Project Launcher output window if running using the Project Launcher, or in the debugger output window if running under the debugger.

    Sounds, though, as if an error is not the problem. I suspect the stat is not actually getting the 'Feature on players' profile' flag, and it sounds as though there may be no way to apply that in the current UI for Creators Program titles. Have you had a chance to try retrieving the stat in your own code yet, (e.g. via StatisticManager::GetLeaderboard)?

    Leave a comment:


  • replied
    [MENTION=494622]jsyarrow[/MENTION] - where can I find the log written to in the below code:

    Code:
        Microsoft::Xbox::Services::Statistics::Manager::StatisticManager^ mgr = Microsoft::Xbox::Services::Statistics::Manager::StatisticManager::SingletonInstance;
        if (mgr != nullptr)
        {
            auto EventList = mgr->DoWork();
            for (auto Event : EventList)
            {
                if (Event->ErrorCode != 0)
                {
                    UE_LOG_ONLINE(Warning, TEXT("DoWork error: %s"), Event->ErrorMessage->Data());
                    :
                }
            }
        }
    I placed a breakpoint in the ErrorCode block but it was never hit. Most likely an error never occurred.

    Leave a comment:


  • replied
    It will be something like:

    Code:
    auto EventList = Manager->DoWork();
    for (auto Event : EventList)
    {
    	if (Event->ErrorCode != 0)
    	{
    		// Event->ErrorMessage should have more details
    	}
    }

    Leave a comment:


  • replied
    Originally posted by jsyarrow View Post
    - Make sure you've checked the box to 'Feature on players' profiles'
    I think the 'Feature on players' profiles' is what concerns me the most. It isn't shown on my 'New featured stat/leaderboard' dialog:

    Click image for larger version

Name:	FeaturedStatDialog.jpg
Views:	1
Size:	51.2 KB
ID:	1130903

    I've seen this mentioned and other peculiarities in the documentation yet it isn't visible on mine. I was hoping that a Dev Center Portal update was coming.

    Originally posted by jsyarrow View Post
    - If you're not already, you should capture and process the returned events from the DoWork call on the StatisticsManager. These might provide some clue if there's an error encountered.
    - Try retrieving the leaderboards in your own code - this will be the only way to display global leaderboards in any case, since the dash/Xbox App focuses on social.
    How do I attach to the DoWork events call stack? I'll look for it but if you happen to know that may save me a bit of time.

    Leave a comment:


  • replied
    A few ideas on the stats update:
    - Make sure you've checked the box to 'Feature on players' profiles'
    - If you're not already, you should capture and process the returned events from the DoWork call on the StatisticsManager. These might provide some clue if there's an error encountered.
    - Try retrieving the leaderboards in your own code - this will be the only way to display global leaderboards in any case, since the dash/Xbox App focuses on social.

    You beat me to it on deployment to Xbox. There are indeed some limitations on package size at the moment, and using a network share or deploying loose files are the best options for working around them.

    Leave a comment:


  • replied
    [MENTION=494622]jsyarrow[/MENTION] - A smaller application size worked. I was able to build and deploy the UWP Third Person sample onto my Xbox:

    Click image for larger version

Name:	99.XboxTestInstall.02.jpg
Views:	1
Size:	71.5 KB
ID:	1130864


    And running on the Xbox:

    Click image for larger version

Name:	99.XboxTestInstall.03.jpg
Views:	1
Size:	242.2 KB
ID:	1130865


    This confirms (mostly) that my steps are correct, and my setup is working.

    The test game size is: 85.4 MB
    The actual game size is: 3.53 GB

    When I try to deploy my game the Xbox Device Portal timesout. Is there something I can do?

    [EDIT]
    With Windows Explorer I can copy my AppX file but I don't know where it should be copied to and how to install it (yet):

    Click image for larger version

Name:	WindowsExplorer.jpg
Views:	1
Size:	61.0 KB
ID:	1130891


    [EDIT]
    Using Register a game from a shared network location on the Xbox One Dev Mode console I am able to install my game, which is 3.53GB in size.

    For those that may not know, this is a two step process:

    1. Share the folder:
    a. From Windows Explorer right-click the folder name and select Share with and Specific people...

    Click image for larger version

Name:	ShareFolder.jpg
Views:	1
Size:	46.0 KB
ID:	1130900

    2. Enter the needed location and credentials on the Xbox One:
    a. Select Register a game from a shared network location
    b. At the Add a network share screen enter the location to the AppX manifest, for example, \\COMPUTERNAME\Releases\2017.07.08.UWP\LongshotHero
    c. At the Username enter: COMPUTERNAME\username, and password
    Last edited by Jerry.Richards; 07-10-2017, 01:17 PM.

    Leave a comment:


  • replied
    [MENTION=494622]jsyarrow[/MENTION] - I'm hoping not to get too far ahead as there a couple of other issues that I noted.

    Now I'm trying to test on the Xbox One but unfortunately the Xbox Device Portal deployment fails. Is there an FTP option available?

    Click image for larger version

Name:	03.Deployment.01.jpg
Views:	1
Size:	86.3 KB
ID:	1130818

    Leave a comment:


  • replied
    [MENTION=494622]jsyarrow[/MENTION] - As mentioned above, I added FTickableGameObject to the FOnlineLeaderboardsLive class, along with a couple of other support functions:

    Code:
    class FOnlineLeaderboardsLive : public IOnlineLeaderboards, public FTickableGameObject
    {
    public:
    
        virtual void Tick(float DeltaTime) override;
        virtual bool IsTickable(void) const override;
        virtual TStatId GetStatId(void) const override;
    }
    
    
    bool FOnlineLeaderboardsLive::IsTickable(void) const
    {
        return true;
    }
    
    
    TStatId FOnlineLeaderboardsLive::GetStatId(void) const
    {
        static TStatId statId;
        return statId;
    }
    
    
    void FOnlineLeaderboardsLive::Tick(float DeltaTime)
    {
        Microsoft::Xbox::Services::Statistics::Manager::StatisticManager^ mgr = Microsoft::Xbox::Services::Statistics::Manager::StatisticManager::SingletonInstance;
        if (mgr != nullptr)
            mgr->DoWork();
    }
    The class does tick and DoWork is called with each tick (maybe not with some exclusions, such as it's not ready).

    With that should I be able to see my Leaderboard updates (assuming I did it correctly)?


    [EDIT]
    According to the content on this page:

    https://developer.microsoft.com/en-u...ve-experiences

    the stats should be visible on the Xbox One dashboard, and on the Xbox app on Windows 10. Unfortunately I don't see it. I've been re-reading several pages with no luck seeing the stat:

    https://developer.microsoft.com/en-u.../data-platform
    https://developer.microsoft.com/en-u...7/player-stats
    https://developer.microsoft.com/en-u...stats-updating

    Is there a difference between the C# (https://github.com/Microsoft/xbox-live-api-csharp) and C++ (https://github.com/Microsoft/xbox-live-samples) API's?

    This may be a dumb question. . .but could I be inadvertently using the wrong libs/dlls? I would think that the underlying call to the service would be the same though regardless of which was used.

    [MENTION=494622]jsyarrow[/MENTION] - I don't think the update to the leaderboard/achievements is working. I read the documentation and my settings look right but I don't see any indication on the Xbox for Windows 10 Achievements. Are you able to investigate this on your side?
    Last edited by Jerry.Richards; 07-08-2017, 10:56 AM.

    Leave a comment:


  • replied
    Originally posted by jsyarrow View Post
    I haven't had a chance to play with the new StatisticsManager API yet, but from a quick look at the header I'd guess you're missing a call to AddLocalUser.
    Adding the call to AddLocalUser did fix the problem. I might not be performing it at the most optimal location but it did stop the exception from occurring.

    Originally posted by jsyarrow View Post
    Also make sure that you're regularly calling the DoWork method, probably from a Tick method on FOnlineLeaderboardsLive.
    FOnlineLeaderboardsLive doesn't inherit from a tickable component, which we might have to include if calling DoWork is needed.


    Btw, where would I see the posting? I don't see anything in the Xbox Live portal on my Windows machine nor anywhere on the Dev Portal.

    Leave a comment:


  • replied
    I haven't had a chance to play with the new StatisticsManager API yet, but from a quick look at the header I'd guess you're missing a call to AddLocalUser.

    Also make sure that you're regularly calling the DoWork method, probably from a Tick method on FOnlineLeaderboardsLive.

    The SocialManager-based implementation of FOnlineFriendsLive might be a decent example of how to deal with these manager objects.

    Leave a comment:


  • replied
    StatisticManager::SetStatisticIntegerData throws a "User not found in local map" exception:

    Click image for larger version

Name:	UserNotFound.jpg
Views:	1
Size:	76.3 KB
ID:	1130769

    The code is fairly straightforward:

    Code:
    bool FOnlineLeaderboardsLive::WriteLeaderboards(const FName& SessionName, const FUniqueNetId& PlayerId, FOnlineLeaderboardWrite& WriteObject)
    {
    	UNREFERENCED_PARAMETER(SessionName);
    
        if (!LiveSubsystem)
            return false;
    
        const FOnlineIdentityLivePtr Identity = LiveSubsystem->GetIdentityLive();
        if (!Identity.IsValid())
            return false;
    
        const FUniqueNetIdLive UserLive(PlayerId);
        Windows::Xbox::System::User^ XBoxUser = Identity->GetUserForUniqueNetId(UserLive);
    
        Microsoft::Xbox::Services::XboxLiveContext^ LiveContext = LiveSubsystem->GetLiveContext(XBoxUser);
        if (LiveContext == nullptr)
            return false;
    
        Microsoft::Xbox::Services::Statistics::Manager::StatisticManager^ mgr = Microsoft::Xbox::Services::Statistics::Manager::StatisticManager::SingletonInstance;
        if (mgr != nullptr)
        {
            for (FStatPropertyArray::TConstIterator item(WriteObject.Properties); item; ++item)
            {
                Platform::String^ itemName = ref new Platform::String(*item->Key.GetPlainNameString());
    
                int32 itemValue;
                item->Value.GetValue(itemValue);
    
                long long llValue;
                llValue = itemValue;
    
                mgr->SetStatisticIntegerData(LiveContext->User, itemName, llValue);
            }
    
            mgr->RequestFlushToService(LiveContext->User);
    
            return true;
        }
    
    	return false;
    }

    Am I using the call to GetLiveContext with the user correctly?
    I've also tried using LiveSubsystem->GetDefaultLiveContext() but that didn't work either.

    Any help is appreciated.

    Leave a comment:


  • replied
    Originally posted by Jerry.Richards View Post
    I cannot access the stats namespace:
    You do indeed want the types in Microsoft::Xbox::Services::Statistics::Manager. Looks like the name change is part of the WinRT projection. Sorry for the confusion.

    Leave a comment:


  • replied
    Great, that update fixed all my pathing issues. Thanks!

    Leave a comment:


  • replied
    [MENTION=494622]jsyarrow[/MENTION] - I'm happy to report that the change worked and I am now able to Debug UWP64 projects. Thank you for the help.

    Now. . . what is the best way to make use of the Stats Manager API that you mentioned above?

    I cannot access the stats namespace:

    Code:
    using namespace Microsoft::Xbox::Services::Stats::Manager;

    Does this go back to the EraAdapter problem?

    I can access other namespaces:

    Code:
    using namespace Microsoft::Xbox::Services;
    using namespace Microsoft::Xbox::Services::Achievements;
    using namespace Microsoft::Xbox::Services::Leaderboard;
    using namespace Microsoft::Xbox::Services::Statistics;
    using namespace Microsoft::Xbox::Services::Statistics::Manager;
    I do see a change for the renaming:

    https://github.com/Microsoft/xbox-li...6b37ea4d7f0e39
    Attached Files
    Last edited by Jerry.Richards; 07-06-2017, 01:25 PM.

    Leave a comment:

Working...
X