Tick of update call is different from expected result.

Options


Server updates are called 60 times per second



On the client, it is usually called 120-180 times per second. However, when packet transmission is frequently occurred, it is called up to 300 times.


I tried to use FixedNetworkUpdate to synchronize motion control and time calculation, but this difference causes a larger error.

Doesn't FixedNetworkUpdate guarantee the same frequency of calls for everyone?

Best Answer

  • ramonmelo
    ramonmelo mod
    Answer ✓
    Options

    Hi @Elen ,


    Doesn't FixedNetworkUpdate guarantee the same frequency of calls for everyone?

    In summary, no, this will never happen.

    You can see the complete explanation here: https://doc.photonengine.com/en-us/fusion/current/manual/network-simulation-loop

    The short version is:

    1. The Server always forwards the simulation, so it will tick the FixedNetworkUpdates as expected, changing the simulation based on the Clients inputs and so on, hence why you see 60 ticks per second.
    2. The Client, on the other hand, needs to simulate, predict, reconsolidate and re-simulate the game. Every time the client receives a confirmation snapshot from the Server, it will reset the simulation to that new "true" state and predict from there, so the "FixedNetworkUpdates" can and will be invoked several times per second much more than the Simulation Rate.


    I tried to use FixedNetworkUpdate to synchronize motion control and time calculation, but this difference causes a larger error.

    In order to synchronize motion, it really depends on what you need, are you moving using Physics (?), then you can just use the NetworkRigidBody to keep your objects in sync, if that is not necessary, maybe just use the NetworkTransform, for example. You can read more about the pre-built components here: https://doc.photonengine.com/en-us/fusion/current/manual/prebuilt-components

    And for time calculation, better to use the pre-built TickTimer class, which is a timer associated with the Runner Tick. Take a look here for an example: https://doc.photonengine.com/en-US/fusion/current/fusion-100/fusion-103


    --

    Ramon Melo

    Photon Fusion Team

Answers

  • ramonmelo
    ramonmelo mod
    Answer ✓
    Options

    Hi @Elen ,


    Doesn't FixedNetworkUpdate guarantee the same frequency of calls for everyone?

    In summary, no, this will never happen.

    You can see the complete explanation here: https://doc.photonengine.com/en-us/fusion/current/manual/network-simulation-loop

    The short version is:

    1. The Server always forwards the simulation, so it will tick the FixedNetworkUpdates as expected, changing the simulation based on the Clients inputs and so on, hence why you see 60 ticks per second.
    2. The Client, on the other hand, needs to simulate, predict, reconsolidate and re-simulate the game. Every time the client receives a confirmation snapshot from the Server, it will reset the simulation to that new "true" state and predict from there, so the "FixedNetworkUpdates" can and will be invoked several times per second much more than the Simulation Rate.


    I tried to use FixedNetworkUpdate to synchronize motion control and time calculation, but this difference causes a larger error.

    In order to synchronize motion, it really depends on what you need, are you moving using Physics (?), then you can just use the NetworkRigidBody to keep your objects in sync, if that is not necessary, maybe just use the NetworkTransform, for example. You can read more about the pre-built components here: https://doc.photonengine.com/en-us/fusion/current/manual/prebuilt-components

    And for time calculation, better to use the pre-built TickTimer class, which is a timer associated with the Runner Tick. Take a look here for an example: https://doc.photonengine.com/en-US/fusion/current/fusion-100/fusion-103


    --

    Ramon Melo

    Photon Fusion Team

  • Elen
    Options

    Thanks it was helpful.