Tick of update call is different from expected result.

The whole answer can be found below.

Please note: The Photon forum is closed permanently. After many dedicated years of service we have made the decision to retire our forum and switch to read-only: we've saved the best to last! And we offer you support through these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on Fusion.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Tick of update call is different from expected result.

Elen
2022-04-08 04:25:27

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?

Comments

ramonmelo
2022-04-08 10:08:39

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:

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

  • 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
2022-04-11 02:08:47

Thanks it was helpful.

Back to top