Search Unity

Sometimes Problems Connecting

Discussion in 'Multiplayer' started by marty, Jul 25, 2008.

  1. marty

    marty

    Joined:
    Apr 27, 2005
    Posts:
    1,170
    Okay, I've written a nice little multiplayer test/demo based on my readings of the networking documentation and perusal of the networking demo code.

    The good news, it usually works.

    The bad news, games started on some computers cannot be joined. Clients attempting to join them will see the host computer listed as a game server, but when the client player hits the Connect button, nothing happens.

    Yet, often, when this happens, if the two computers reverse roles, everything works fine.

    Is there anything glaring and obvious that might cause something like this?

    TIA!
     
  2. nafonso

    nafonso

    Joined:
    Aug 10, 2006
    Posts:
    377
    I think that this is a NAT problem. Probably, what happens is that the server (A) sets up NAT as true and the client (B) leaves it as false, and the client (B) can't connect to the server because Network.useNat needed to be true.

    When the roles are inverted, as when B now creates the server he sets Network.useNat to true, and since A already had Network.useNat set to true when he created the server before, when he tries to connect B he is able because NAT is active.

    Regards,
    Afonso
     
  3. marty

    marty

    Joined:
    Apr 27, 2005
    Posts:
    1,170
    Thanks, nafonso, I figured that might be it as well.

    I thought about letting the user toggle enabling NAT in the connect dialog, but that would be kind of confusing for some users. Besides, Unity's demo code seems to be doing the triage for me.

    Any suggestions anyone?