question

aaronbuhr avatar image
aaronbuhr asked

Does Playfab provide geolocation data that can be used for matchmakin

From reading other forum posts(https://community.playfab.com/questions/12296/find-nearby-users-by-location-country-continent.html) there is a recommendation for using the location as provided by Playfab as a geolocation for matchmaking purposes: for matchmaking "...takes into account the location of players (which you can get from their profile data)". Am I understanding that advice properly, and if so where is that data provided? I see "Locations" in the PlayerProfileModel that is returned on login, but it looks and sounds like that will not do the job. That only returns "list of geographic locations from which the player has logged into the title", for which I don't understand the granularity provided, and furthermore we would need the CURRENT location that the user is logging in from; also for initial matchmaking it sounds like we would not receive any location data from Playfab.

Matchmaking
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Andy avatar image
Andy answered

In order to receive a value in InfoResultPayload you have to have requested specific values in the request using the InfoRequestParameters request field. This is described in more detail here: https://docs.microsoft.com/en-us/rest/api/playfab/client/authentication/loginwithcustomid?view=playfab-rest#getplayercombinedinforequestparams.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

John avatar image
John answered
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

aaronbuhr avatar image
aaronbuhr answered

Thank you for the reply. Is the geolocation information provided in the field "InfoResultPayload"? Using both LoginWithCustomID (from C#) and LoginWithSteam (from C++) the InfoResultPayload field is coming back null. The documentation says that for a new player this profile (including the location) will not exist. In my testing I have used the abovementioned methods multiple times, presumably satisfying the non-new-player requirement, and in all cases the InfoResultPayload is null. What am I doing wrong, or why do I get null InfoResultPayload? Is the requirement for non-new-player more involved? Below is the C# code that I'm using: public class PlayfabService
{
public void Initialize(string titleId, string devApiKey)
{
PlayFabSettings.staticSettings.TitleId = titleId;
PlayFabSettings.staticSettings.DeveloperSecretKey = devApiKey;
} public PlayFab.ClientModels.LoginResult LoginUser(string titleId, string customId)
{
var request = new PlayFab.ClientModels.LoginWithCustomIDRequest
{
TitleId = titleId,
CustomId = customId,
CreateAccount = false
};
var task = PlayFabClientAPI.LoginWithCustomIDAsync(request);
PlayFabResult<PlayFab.ClientModels.LoginResult> result = task.Result;
return result.Result;
}
}
---
class Program
{
const string devApiKey = "xxxx";
const string titleId = "20ee";
static readonly string[] playerCustomId = { "F0D4CC0D0F783187", "D16B8203BD326C75", "A9ED11C209C7D5C9" }; static void Main(string[] args)
{
var svc = new PlayfabService();
svc.Initialize(titleId, devApiKey);
var loginResult1 = svc.LoginUser(titleId, playerCustomId[0]); // in loginResult1 InfoResultPayload is null
}
}

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

aaronbuhr avatar image
aaronbuhr answered

Is there a response to this? I'll rephrase my question to perhaps help explain the difficulty. If I should add this to the linked thread please let me know.

I'm trying to get player location information using either the Location sub-item of the InfoResultPayload sub-item of the client LoginResult result of the LoginWithCustomId method, or using the Locations sub-item of the PlayerProfile item of the client GetPlayerProfile method. In the former result InfoResultPayload is coming back null; in the latter result Locations is coming back null. In both cases no errors are given, and in both caes LastLoginTime is populated so as I understand it this would satisfy "for a new player this profile will not exist". How can I resolve this problem? Thank you.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

aaronbuhr avatar image
aaronbuhr answered

Sorry, I missed the first response to my message. I am able to retrieve the data when I fill out all the information requested true/false fields. Thank you for the help.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.