question

ALTER Florent avatar image
ALTER Florent asked

Custom Data not correctly received when sending a WritePlayerEvent request

Hello ! I'm currently trying to send custom event with the function WritePlayerEvent but i didn't manage to get some additionnal data for double values and array values.

Here's the JSON sent :

{
    "Body":{
	"posPlayer_x":34.189247131347656,
	"posPlayer_y":-113.29052734375,
	"posPlayer_z":-11.767612457275391,
	"test":"thisisatest",
	"testArrayBool":[
		true,
		false,
		true
	],
	"testInt":1
    },
    "EventName":"TEST_BUSTED",
    "Timestamp":null
}

And here's the data i've got on the dashboard :

{
    "EntityId": "XXXXXXXXXXXXXXX",
    "EntityType": "player",
    "EventId": "d84d6bc36fb2488b9e4627c8b81fbfa9",
    "EventName": "TEST_BUSTED",
    "EventNamespace": "title.XXXXX",
    "PlayFabEnvironment": {
        "Application": "mainserver",
        "Cloud": "main",
        "Commit": "1e16dff",
        "Vertical": "master"
    },
    "Source": "XXXXX",
    "SourceType": "GameClient",
    "test": "thisisatest",
    "testArrayBool": "[true,false,true]",
    "testInt": 1,
    "Timestamp": "2019-05-23T09:03:07.6322134Z",
    "TitleId": "XXXXX"
}

As you can see there's no sign of posPlayer_x/posPlayer_y/posPlayer_z

Also my array has been saved as a string value.

I declared testArrayBool as a JSON::arrayValue and

posPlayer_x/posPlayer_y/posPlayer_z as JSON::double

Is there something i have missed ?

Current SDK used : XPlatCppSdk-3.8.190410

2 comments
10 |1200

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

jital avatar image jital ♦ commented ·

Hello,

Would you be able to post the exact C++ code you used and your TitleID?

0 Likes 0 ·
ALTER Florent avatar image ALTER Florent jital ♦ commented ·

Hello !

I can't post the exact C++ code unfortunately but here's the pseudo code I used to send events :

Json::Value eventData( Json::objectValue );

eventData[ Json::StaticString( "posPlayer_x" ) ] = static_cast< double >( player->GetOrigin().x );
eventData[ Json::StaticString( "posPlayer_y" ) ] = static_cast< double >( player->GetOrigin().y );
eventData[ Json::StaticString( "posPlayer_z" ) ] = static_cast< double >( player->GetOrigin().z );

eventData[ Json::StaticString( "test" ) ] = "thisisatest";
Json::Value testArrayBool( Json::arrayValue );
testArrayBool[0] = true;
testArrayBool[1] = false;
testArrayBool[2] = true;
eventData[ Json::StaticString( "testArrayBool" ) ] = testArrayBool;
eventData[ Json::StaticString( "testint" ) ] = 1;

PlayFab::ClientModels::WriteClientPlayerEventRequest request;
request.EventName = _eventName;
request.Body      = eventData;
PlayFab::PlayFabClientAPI::WritePlayerEvent( request, &OnWriteEventResultCallback, &OnErrorCallback );

And here's my titleID : FD7C6

0 Likes 0 ·

1 Answer

·
ALTER Florent avatar image
ALTER Florent answered

I try to send events with PlayFab::PlayFabEventsAPI::WriteEvents function and I add additional data for each event with the PayloadJSON field and it's working.

I'll stuck with this method as it will be easier to send multiple events at once in order to not overload my API calls quota.

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.