Problems with sending and receiving rpc at same time.

Options
Hello,

at first, Hello :) i'am pretty new here. I searched a lot but found no answer to my question.

i develop a 1vs1 Tower Defense. You can send enemys to the other player. The other player builds towers, to defend.

Now my question is. I wanted to instantiate the enemy locally via RPC, because i read, that its not performant, when we use a lot of PhotonNetwork.Instantiate. The other player builds towers and the path of the enemys is changing. everything works but, cause of the lag/ping via sending RPC to scan the new path and the RPC to instantiate enemys , the position of the enemys has a small difference on both clients. I hope you know what i mean.

My first solution was to PhotonNetwork.Instantiate the enemys and to synch the position. But there are a lot of enemys. And every enemy has his own photonView. Thought about using a prefab Pool for this.

Is there a more performant solution. I read about PhotonNetwork.Time and Timestamps but only in connection with synchronizing physical objects...

i attached an image. Hope you can see the problem and help me :)

the red arrow is the path of the monster.


https://www.bilder-upload.eu/bild-00fa3d-1574421143.png.html

Comments

  • THMMeep
    Options
    If PhotonNetwork.Instantiate works for you, keep using it. The performance dip won't be noticeable unless you really are spawning a LOT of enemies.

    If you create your own RPC for instantiation you could possibly reduce the size of your messages over the network, but this is only for specific reasons or objects which do not require a photon view.

    If you really don't want to use PhotonNetwork.Instantiate you could create another RPC which waits for the enemy to be synchronised on both ends before continuing the game.
  • Hey :) thank you for your answer. In the documentations of photon is written, that if you have more than a few photonViews you make something wrong. But i think i will do it like you said and use Photon Instantiate.