Compensating LAG

Options
Hi! I've searching info online about the following topics, but I haven't found much so far. Could someone help me?

I would like to know the delay of my events, so I could apply some lag compensation of my own
(i.e. calculate the number of frames an event took to arrive, and predict unity physics with a simple method)
We do this to periodically synchronise a tennis ball.

For getting these frames, I've tried

int frames = (int)(PingAliased / (2 * Time.fixedDeltaTime * 1000));
//(applicable if the ping comes in miliseconds, not clear in the api documentation)

and

int frames = (int)(PingAliased / 2 * Time.fixedDeltaTime);
//(applicable if the ping comes in seconds, not clear in the api documentation)

But ping value is always so low, that I get 0 frames to compensate
(and this is now what we see on the screen)

Where did I go wrong? Am I not using PingAliased correctly? Is there any other variable which I should be using with this purpose?

Thanks in advance,

Gloria

Comments

  • ramonmelo
    Options
    Hello @Gloria ,

    Sorry for the lack of information on the docs, we will update them.

    Currently, to get the ping properties in milliseconds you need to multiply them by 1000.

    Also, either "BoltConnection.NetworkPing" and "BoltConnection.AliasedPing" returns the same value from the internal "NetworkPing".

    This value is the total Round-Time Trip between the peers excluding the processing delays and acknowledgment times.

    --
    Ramon Melo
    Photon Bolt Team
  • Gloria
    Options
    Hi Ramon, thanks for your reply!

    So NetworkPing/AliasedPing come in seconds.

    Is it normal that still, it's always so small that I get always 0 frames? Im testing with 2 laptops on same room, but in the screen we can definitely observe some lag every once in a while which is not reflected in this ping value.
  • ramonmelo
    Options
    Hello @Gloria ,

    Do you have disabled the "Dejiiter Buffer"?

    If not, you will see some visual lag between the players, even if they are close together, as Bolt will store some updates and interpolate between them.
    If you are using the Interpolation algorithm on the Transform property of your entity, you will also see some kind of "lag", and if you are using the "Temporal Anti-aliasing" implementation from Bolt (https://doc.photonengine.com/en-us/bolt/current/in-depth/temporal-anti-aliasing), you may also see some difference between the peers.

    Also, keep in mind that none of the property updates are instantaneous.

    --
    Ramon Melo
    Photon Bolt Team