Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

RPC causes high latency?

Discussion in 'Multiplayer' started by FNGamesAlex, Sep 24, 2014.

  1. FNGamesAlex

    FNGamesAlex

    Joined:
    Sep 22, 2013
    Posts:
    4
    Hello everybody. I've been working on some multiplayer stuff recently. Wrote some scripts for hosting and connecting to a server, spawning monsters etc. (
    ) The problem I have is that when I try to play it online with a friend, his ping goes up and up and eventually he freezes. I noticed it mostly happens when there ARE monsters in the scene. The monsters have several scripts, with several RPC functions, could that be the problem? Does many RPC functions cause high latency? Could it be something else? Thanks in advance :)
     
    Last edited: Sep 24, 2014
  2. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    This sounds a lot like you try to send too much. If you produce more data/sec than you can send (or more than others can consume) then the incoming values will fall behind and at some point things break.

    Try to sync only the monsters that are visible and make sure only one user sends commands for them.