question

martin-2 avatar image
martin-2 asked

PlayFab Party as Unity NetworkTransport Running Slow?

Hello,

I have implemented a NetworkTransport for Unity which runs all of NetCode for Gameobjects messages through PlayFabMultiplayerManager.SendDataMessage and PlayFabMultiplayerManager.OnDataMessageReceived. Took a bit of effort, but got it all working in the end; the client and host players can send and receive all their messages through PlayFab Party. So far, so good.

The issue I am experiencing is the latency; the message receiving appears to be very slow, maybe even staggered. We originally had the UnityNetworkTransport set up to use Unity's Relay service, and the game ran fine/smooth with that. With PlayFab Party, the messages appear to be received at a much slower pace, causing the client to fall further and further behind on network messages, and eventually the game goes very out-of-sync between host/client.

With NDAs and such it's difficult to give more information than that; If there';s any more information you'd require, please let me know and I'll see what I can do. I would very much like to get to the bottom of this. Further questions would be:

1. Is this PlayFab Party data messages acting as intended? By that I mean, is PlayFab Party messages supposed to be able to handle and entire games worth of network messages (player positions, messages sent for gameplay events, etc), or is it designed to be used for small, game-but-not-gameplay-messages (like changing an image, sending a join code, etc).

2. If this is not acting as intended, and it should be able to handle a game's worth of messages no-problem, what do you think the areas of issue could be? Is there a setting somewhere that I couldn't see on the developer page that's throttling the messages? Or should it be working perfectly and I need to look at my own code to find the issue? Are there known PlayFab coding structure/organization issues which could cause what I'm seeing, and I might be guilty of?

Thank you for getting this far, and hope someone can answer my questions soon :)

Martin

unity3d
7 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.

martin-2 avatar image martin-2 commented ·

As some extra information to help get to the bottom of this, it appears that the OnDataMessageReceived event from PlayFabMultiplayerManager (part of the Unity PlayFab Party SDK) is being invoked roughly every ~25 frames, give or take a frame here and there. I used Time.frameCount to come to this conclusion. It doesn't seem to matter the frequency of the messages being sent, the messages being received (via the OnDataMessageReceived event) appear to be every ~25 frames like clockwork.

0 Likes 0 ·
Neils Shi avatar image Neils Shi commented ·

I will do some research.

0 Likes 0 ·
martin-2 avatar image martin-2 Neils Shi commented ·

Thanks, Neil. If it helps, I have looked a bit further into this, and I hit bedrock at PartyCSharpSDK.Interop.PFPInterop.PartyStartProcessingStateChanges, called by PartyCSharpSDK.SDK.PartyStartProcessingStateChanges.

It appears that PartyCSharpSDK.SDK.PartyStartProcessingStateChanges is called every frame via the Update and then the ProcessStateChanges methods in PlayFab.Party.PlayFabMultiplayerManager, however PartyCSharpSDK.Interop.PFPInterop.PartyStartProcessingStateChanges is only outing a stateChangeCount greater than 0 every ~25 frames. I cannot get any deeper into the code, as I have hit a dll.

0 Likes 0 ·
martin-2 avatar image martin-2 martin-2 commented ·

If it helps, whenever the stateChangeCount is above 0, it is always 1.

0 Likes 0 ·
martin-2 avatar image martin-2 Neils Shi commented ·

Hey Neils, any update on this?

0 Likes 0 ·
martin-2 avatar image martin-2 Neils Shi commented ·

Looking more at the PlayFab.Party.PlayFabMultiplayerManager, I am at a loss for finding any setting to do with "rate" or "frequency". Because it seems to be receiving every ~25 frames is still making me think it's a deliberate choice by PlayFab, but receiving one message every 25 frames makes the service completely unusable for running a game. Is it just the Unity PlayFab Party data relay service, or has anyone experienced this with PlayFab Party's data sending on something other than Unity?

0 Likes 0 ·
martin-2 avatar image martin-2 commented ·

An additional point of information, it does not appear that PlayFab.Party.DeliveryOption plays a role in this issue. There are only 2 (BestEffort and Guaranteed), and neither has any impact on the issue.

0 Likes 0 ·

0 Answers

·

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.

Error rendering WebPanel (widgets/consolidation-widget.ftl): org.hibernate.hql.internal.ast.QuerySyntaxException: AvailableConsolidation is not mapped [from AvailableConsolidation up where up.node = :node]