Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Creating a match in 5.4beta

Discussion in 'Multiplayer' started by FoxCastz, Apr 3, 2016.

  1. FoxCastz

    FoxCastz

    Joined:
    Jun 18, 2015
    Posts:
    75
    So the basic to the bones code to start a server was this back on 5.3:
    NM.matchMaker.CreateMatch(matchName, NM.matchSize, true, "", NM.OnMatchCreate);
    but now it asks for a lot more eg.
    string publicClientAddress, string privateClientAddress, int eloScoreForMatch, int requestDomain.
    I understand the eloScoreForMatch feature, but what do I put in the spots for the other 3 new variables for creating a match?
     
  2. pracalic

    pracalic

    Joined:
    Oct 23, 2012
    Posts:
    13
     
  3. JeremyUnity

    JeremyUnity

    Unity Technologies

    Joined:
    Mar 4, 2014
    Posts:
    147
    @FoxCastz @pracalic
    The members in question do the following:
    public and private address: Strings you can upload to store in the db that represent the local and / or internet accessible addresses for the client creating the match. If you choose to put something in here it's given to all clients that get the match info in listmatches. It's not required at all for matchmaker or relay to function and totally optional for you to use as you see fit.

    EloScore: a numeric identifier you come up with describing the skill level of clients in a match. If you choose to not use this just put 0 there and all clients in a match will be the same skill level, basically disabling any matchmaker logic related to this. If you put in a value here, clients returned in listmatch results are first sorted according to the absolute value of the difference between the listing clients Elo and the match avg elo. Closer results display first, so basically you can use this to sort according to skill level.

    request domain: If you wish clients to only be visible to another subset of clients in list results use this. So if all clients are domain 0, they will all see each other's games. If one group of clients have domain 0 and another domain 1, clients not in the same domain will be invisible to each other for the purposes of listmatch. This can be useful to control listing for different game modes or client versions.

    I do apologize for the state of the manual too. It will be updated in the coming weeks.
     
    isidro02139 likes this.
  4. FoxCastz

    FoxCastz

    Joined:
    Jun 18, 2015
    Posts:
    75
    @JeremyUnity
    Thank you for the explanation, it'll be helpful when it is all working, but I am still having another major issue getting the multiplayer to work.

    So, while using the Unity built in networking hud I click enable matchmaker, then create internet match. It seems like it is firing up like normal, but stops at this:
    MatchMakingClient Create :https://mm.unet.unity3d.com/json/reply/CreateMatchRequest
    UnityEngine.Networking.NetworkManagerHUD:OnGUI()

    and never returns from it. The match is never made and the character never spawns in, like in older versions of Unity.
     
  5. RavenTravelStudios

    RavenTravelStudios

    Joined:
    Oct 15, 2015
    Posts:
    98
    Well, seems that with this new sign i can finally ping the rooms directly from the clients which are listing the matches, right? Thank you for this!
     
    JeremyUnity likes this.
  6. moco2k

    moco2k

    Joined:
    Apr 29, 2015
    Posts:
    294
    I think the 5.4 matchmaking changes are somce nice improvements as they make the API more easy and intuitive to use. However, the example code snippets in the docs (Manual and Scripting API) are still outdated. So an update would be much appreciated.

    For everyone searching for examples right now, I recommend to look into both the API changes docs and the recent 5.4 NetworkManager source. For example, it shows how the matchmaking callbacks are used.
     
    Last edited: Aug 31, 2016
    MrLucid72, g__l and isidro02139 like this.
  7. DRRosen3

    DRRosen3

    Joined:
    Jan 30, 2014
    Posts:
    681
    BUMP'ing this because I'm having the same issue that @FoxCastz is having. The coroutine never returns...it just hangs.
     
    MrLucid72 likes this.
  8. voltage

    voltage

    Joined:
    Nov 11, 2011
    Posts:
    515
    So basically I can leave int requestDomain 0 for non-dedicated servers, 1 for dedicated and create a tab that separates the lists? Awesome feature.

    I'm glad all the added variables are optional.

    Some Server Lobbies display a latency limit and your avg latency if you were to join that server. Does anyone know how to read your latency to a match before even joining it?
     
  9. MrLucid72

    MrLucid72

    Joined:
    Jan 12, 2016
    Posts:
    900
    I'm actually getting an error if these are null and says it's required :/

    EDIT: I just discovered this - I'll test it later:

    string publicClientAddress = Network.player.externalIP; // EDIT 2: Works
    string privateClientAddress = Network.player.ipAddress; // EDIT 2: Doesn't work

    I'd also like to know:)

    Nov 2016, this still holds true :/
     
    Last edited: Dec 5, 2016