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

Client "Hot Join" during started game, and matchmaking servers location

Discussion in 'Multiplayer' started by ben-maurin, Apr 14, 2016.

  1. ben-maurin

    ben-maurin

    Joined:
    Apr 7, 2016
    Posts:
    47
    Hi,

    I'm using the lobbymanager and HLAPI to create parties.

    I have three questions:

    -With direct IP, if a player try to join an already started game it just does not work.
    With unity matchmaking, once the game is started, the game is still visible in game list, but if a player try to join, it does not work. (also the members count does not update when a client leave a game). Is there a way to do hot join, or is this a normal HLAPI "non - feature"? ( a little specification : All works fine when starting games with all player at the beginning)

    - I am thinking about using Unity matchmaking service and I wonder if there is servers in all continent (europe,US, and especially Asia).

    -Once a party is started, does bandwidth is still used by unity server? Only matchmaking data is sent to/by unity server, and no game related data, right? the amount should be really low. Also, I did not find anywhere a link that explain clearly what do/is Relay Server. Does the lobby manager use relay server? Why it is better to use one? Does it cost a lot more bandwidth? UNetInternetServicesOverview is not really clear.

    Thanks
     
    Last edited: Apr 14, 2016
    sun_stealer likes this.
  2. moco2k

    moco2k

    Joined:
    Apr 29, 2015
    Posts:
    294
    As it concerns the missing hot-join feature, as far as I know, this is a particular issue with the network lobby, not the matchmaking. You may also have a look into this thread where I had pointed this issue 5 months ago:
    http://forum.unity3d.com/threads/networking-lobby-example-beta-q-a.341592/page-2#post-2412764

    Unfortunately, there had been no response yet until today.
    IMO, the current design choice here is just wrong. Just because a game uses a lobby this is no reason to argue that it would never ever need hot join. There are many games that use both a lobby and hot join. So, the network lobby should be improved to support hot join.

    An explanation on the relay server can be found here.
     
    Last edited: Apr 14, 2016
  3. ben-maurin

    ben-maurin

    Joined:
    Apr 7, 2016
    Posts:
    47
    Thank for your answer.
    I also tried hot join with the simple NetworkManager and direct IP connection :
    When clients and host connect, then ,when everybody is ready, load a scene from server, everything works fine.
    But if a host load a scene then a client join, every networked scene object trigger an error on client :

    ...

    then :

    Is hot join possible with scene object with networkidentity? it seems to have no problem with server spawned objects with NetworkServer.Spawn();

    Thank for the relay doc. As far as I understand , when a client join a host with the relay server, every data , even during game, will transit via the relay. So it will cost something. Why just not share IP adress via the relay server then only communicate directly from client to host? for firewalls problems?
     
  4. moco2k

    moco2k

    Joined:
    Apr 29, 2015
    Posts:
    294
    You have understood right. The relay server is supposed to ensure a proper connection and to avoid firewall issues. But there are alternatives, e.g. you may have a look here.

    As it regards your other issue, I think I remember also having the error message "A connection has already been set as ready." when I implemented a custom NetworkManager which override some original functions. But I managed to solve it. You can always have a look at the NetworkManager source code and retrace where the calls of intereste are (like ClientScene.Ready or NetworkServer.SetClientReady).

    Do you use the original NetworkManager without changes, or do you override some methods?
    While I cannot say where your issue is located, I can tell you that hot join basically should work fine as long as you avoid the network lobby. It should also work fine with scene objects.
     
    Last edited: Apr 14, 2016
    camogamer and thegreatzebadiah like this.
  5. ben-maurin

    ben-maurin

    Joined:
    Apr 7, 2016
    Posts:
    47
    Ok thanks. I'm not pretty at ease to use some unknown library for such important things. It needs a lot of maintenance with unity version, etc... Hope Unity will release a NAT solution for Unet soon.

    I found out the problem for the hot join, it was because a "Online Scene" need to be referenced in the networkManager. If not, it only work for "normal" scenarios (not hot join). Strange but at least I found out. So I put an empty scene in it and now it works...

    Do you know if the Unity relay servers are good in Asia?
     
  6. crazybeek

    crazybeek

    Joined:
    Aug 23, 2012
    Posts:
    46
    I'm also wondering if we can hot join via de lobbynetworkmanager in the near future. I think this is a very important feature what we need in our current project.

    Or at least have a filter or something to hide matches that already started and moved to the play scene in the matches response from the server because they can't join it...

    Also I would like to mention that updating the match attributes for an already started match is a must have.
     
    iamthejames likes this.
  7. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    836
    @ben.maurin I totally understand your reservations about using our rather new plugin for such a critical part of your game. Maybe it will help ease your mind a bit to know that the plugin is built on two very solid and proven technologies. The automatic port forwarding is provided by Open.NAT and the punch-through is done using RakNet, which is actually the library that Unity's own networking was based on before the switch to UNet.

    You are absolutely right though that there is maintenance required to keep the plugin up to date with Unity. As it stands though the plugin has been tested with the latest beta version of the editor and it works great. We are also actively developing the plugin for use in our game Grabbles so we are highly motivated to keep it up to date.
     
  8. l333

    l333

    Joined:
    Jan 7, 2017
    Posts:
    3
    Check the source code of NetworkLobbyManager Line 257.
    https://bitbucket.org/Unity-Technol...anager.cs?at=5.3&fileviewer=file-view-default
    Thats the reason why you can not join the game in the middle. Delete lines from 257 to 263, then copy the rest of the code as a new NetworkLobbyManager. Change the base class of LobbyManager from NetworkLobbyManager to this new one. You also need to rewrite NetworkLobbyPlayer a little bit and replace the old one. Further more, there will be a problem with the GetPlayerController method. Its a private method, solve the problem with reflection. LobbyReadyToBeginMessage class is private too, so you need to write one by yourself( I googled it).

    More simply, you can just create and join a game without a lobby. I have tried just use networkmanager.StartHost() to host a game and networkmanager.StartClient() to join it later. It works.
     

    Attached Files:

  9. l333

    l333

    Joined:
    Jan 7, 2017
    Posts:
    3
    I have built them to a dll, changed nothing but wrote off line 271 to 279(version 5.6).
    For OSX, go to folder /Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/Networking/
    and replace the corresponding files(dont forget copy the originals first), "UnityEngine.Networking.dll" and "UnityEngine.Networking.dll.mdb" in Networking, Standalone and Editor.
     

    Attached Files:

    RaphaelBuquet likes this.
  10. Melloe

    Melloe

    Joined:
    Feb 22, 2015
    Posts:
    5
    Hey l333 thanks for the work! Though im having a couple issues, its letting me join in the server list within the lobby but when I join it leads to a new game server instead of the hosts :/ Is there something I need to do after installing the dll that I might have missed?
     
  11. l333

    l333

    Joined:
    Jan 7, 2017
    Posts:
    3
    I remember that I had tested it, so the bug of your game must be somewhere else. Maybe you had joined the right server but there was something wrong about the synchronization.
     
  12. Coloradota1

    Coloradota1

    Joined:
    Mar 28, 2015
    Posts:
    1
    Hey l333 Thanks for your help, how should i install the dll and how should i use it. Thanks!!
     
  13. indgaming

    indgaming

    Joined:
    Aug 22, 2014
    Posts:
    2
    I installed the DLLs and I connected to the host but all objects that were spawned on the network BEFORE the client connected (including the host player object) were not spawned/synced for the client.

    Any thing spawned over the network after the client had joined would show up for the client. Also a player object for the client was not automatically created either.
     
  14. xtilly5000

    xtilly5000

    Joined:
    Oct 12, 2017
    Posts:
    2
    Although this is an old post, I would like to know something. I have the new NetworkLobbyManager class and I derive from it. I am able to see the already started game and I can connect to the game. Once the client successfully joins, I immediately receive a connection drop request from my network identity. Is there any way to fix this? Has anything changed?