Search Unity

Third Party Photon Pun 2 lag when testing on one PC but no lag on another

Discussion in 'Multiplayer' started by Deleted User, Mar 20, 2019.

  1. Deleted User

    Deleted User

    Guest

    I have two Windows PC's which I work on my game with. One is a gaming machine and the other is more of a software development computer. High specs with CPU and RAM but the graphics card on the gaming PC is obviously way better.

    When building the network game and connecting to the unity ran version of the game, the PCs act differently. The gaming PC syncs the players quickly while the other PC has like a 3 second lag and is really slow on syncing. What I'm wondering is: what type of problem is this and how to address it.

    I can't see it being a graphics card problem...as the local game controls run fine on both PC's no matter what.

    It's not vital to even test the multiplayer aspect of the game on the PC that experiences lag but I'm wondering if, when deployed, some computers will get that lag when trying to play the game. That's no good.

    Any help on what could be going on would be great!

    (new to posting so if any other information is needed, just ask)

    Thanks!
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    Use the Unity profiler to see what the nature of the lag is.
     
  3. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,068
    A three second lag is very uncommon. If both clients are in the same network, they also should have similarly fast network access.
    You could build and run the demos from the PUN package and check if those show the same behaviour. If not, it's not a network problem but something in the logic of your project. Maybe one client is sending so much, it just takes a while to arrive on the other side? If you send a lot of data, it gets fragmented and all fragments must arrive before the complete message can be reconstructed (automatically on a lower level). This may take longer, the more you send.
     
    AssassinSquid likes this.
  4. Deleted User

    Deleted User

    Guest

    I'm still looking into this but have mainly just been doing the network testing on the computer that has no lag.

    One thing I did notice is that if I build the game and run it twice so there is a master and a client, I can run somewhere as the client and see me running slowly on the master but if I alt-tab to the master it updates really quickly to the right time (gets rid of all the lag). Same thing happens swapping and running on the master.

    I'll try building the pun demos.
     
  5. darmova

    darmova

    Joined:
    Nov 27, 2019
    Posts:
    10
    Have you tried this?
     
  6. payalzariya07

    payalzariya07

    Joined:
    Oct 5, 2018
    Posts:
    85
    Last edited: Dec 13, 2019
  7. AssassinSquid

    AssassinSquid

    Joined:
    Nov 5, 2020
    Posts:
    4

    Thank you so much! I realized after reading this that my pc which was slower was the one running at a higher frame-rate and so it was calling more rpcs than the other. I stopped the game from calling too many rpcs and now it runs so much better!
     
    tobiass likes this.
  8. firepizzaninja

    firepizzaninja

    Joined:
    Sep 4, 2021
    Posts:
    3
    How did you do this? I am having the same issue.