Search Unity

Question Reconnecting player using different IP address from the same device

Discussion in 'Relay' started by zunayed-hassan_unity, Nov 26, 2022.

  1. zunayed-hassan_unity

    zunayed-hassan_unity

    Joined:
    Jul 13, 2020
    Posts:
    1
    This is an urgent issue on ongoing project...
    • I have created a board game using Unity netcode for game objects and relay service.
    • The game is working fine using internet connection.
    • If player disconnected from internet temporarily, a bot plays the game until the player join in the game using same IP and data sync as expected.
    However, the problem occurs, when the player rejoin the internet connection using different internet services, meaning, if the ip address has changed after disconnect and connect to the internet then it shows in the console:
    Relay: allocation ID client mismatch


    I need to make the game playable using any type of internet service, not just one fixed network.
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    6,001
    The docs seem to indicate that this isn't possible because the player changes identity when connecting from a different IP.

    I don't work with Relay, so just an idea what I would attempt: allow any player to connect as a new client to the host via Relay if there's currently one or more bots playing due to disconnected player(s).

    During connection approval, the host determines the identity of that player through your own code. This could be as simple as creating a new GUID upon launching the game for the first time, and subsequently send that GUID to the host via connection approval payload.

    If upon connection approval the player identity matches the identity of a disconnected player in the match you would allow to join and take the place of the bot, otherwise deny connection to a running game session.