Search Unity

Match Up - Drop in matchmaking system

Discussion in 'Assets and Asset Store' started by thegreatzebadiah, Nov 7, 2017.

  1. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    786
    @RoyArtorius

    Yeah, that's pretty normal, especially if you're running it behind a router. You can use the -i option to set the ip to host on explicitly but usually it's not necessary:
    MatchUpServer.exe -i 68.201.34.250

    I suspect the problem is more likely either a firewall or a router causing issues. If you're hosting the MatchUpServer behind a router you need to forward the port that it listens on (20203 by default). If you're hosting it on AWS you need to open the port in your Security Group settings. Other hosting providers may have similar settings. Since you're using the Windows version you also want to be extra sure windows is not blocking it with the built in firewall.
     
  2. RoyArtorius

    RoyArtorius

    Joined:
    Jul 11, 2013
    Posts:
    69
    I just noticed, after updating the server program from the link here and running it, the port number listed in the console is 20202.

    I am using AWS with Windows. I also updated the security groups and checked Windows Firewall and it is allowed. The weird thing is that the Facilitator from NatTraversal was having the same issues yesterday and today it works just fine. So I don't know if I'm just trying too soon after updating thing.
     
  3. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    786
    You should use the version of the server that is packaged with the plugin. Recent changes mean that older clients don't work with newer versions of the server and vice versa. Also it seems like the link here is out of date, the newer versions use port 20203.

    I would also run it with the -v flag so you can get more verbose output.
     
  4. RoyArtorius

    RoyArtorius

    Joined:
    Jul 11, 2013
    Posts:
    69
    The console window just stops after displaying the ip addresses
     

    Attached Files:

  5. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    786
    Yeah it doesn't have anything interesting to output until a client connects.
     
  6. RoyArtorius

    RoyArtorius

    Joined:
    Jul 11, 2013
    Posts:
    69
    Found the issue. I had set the custom rule in the AWS Security Group to be UDP. I switch the rule to TCP and it works just fine now. Reason I was using UDP was the Facilitator rule was UDP and it worked, so I assumed the same was true for MatchUp. My bad.
     
    thegreatzebadiah likes this.
  7. unity_lMIeOVJm710RxQ

    unity_lMIeOVJm710RxQ

    Joined:
    Jul 1, 2018
    Posts:
    3
    Does MatchUp offer a way to create player objects from different prefabs for different players?
     
  8. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    786
    @unity_lMIeOVJm710RxQ that's outside of the scope of the plugin. Match Up simply allows you to create, store, and filter a list of matches (and associated match data) on a remote server. What you do with the matches and match data is up to you.

    What you are trying to do is fairly simple though and can be done with a few lines of code in UNET. You just need to
    1. Make sure your player prefabs have a NetworkIdentity on them with "Local Player Authority" checked.
    2. Add each prefab to the list of spawnable objects on the NetworkManager.
    3. Create a script that extends from NetworkManager (if you don't already have one)
    4. Override OnServerAddPlayer() in your NetworkManager and
    5. Spawn your prefab of choice via AddPlayerForConnection().
     
  9. unity_lMIeOVJm710RxQ

    unity_lMIeOVJm710RxQ

    Joined:
    Jul 1, 2018
    Posts:
    3
    thegreatzebadiah, that worked great, thank you! You explained it much better than the other docs on this topic that I have found online.
     
    thegreatzebadiah likes this.
  10. dariorigon

    dariorigon

    Joined:
    Oct 27, 2018
    Posts:
    3
    Hello there, i dont understand why, but when using this plugin, when i start the game, the host goes to the online gameplay scene, while the client fails to join. It tries to connect then times out the connection. Is it because the testing server is down? Because it finds the match, i try to join, but it doesnt switch to the gameplay scene. Seems strange. The example scene seem to work though.
     

    Attached Files:

  11. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    786
    @dariorigon That doesn't sound like anything related to Match Up. Once you have the match, Match Up is done and you're just making a normal UNet connection. How are you connecting to the host when you get the match? If you're connecting directly to the host's IP and not using Unity's relays then I'm not surprised it would fail. Most people are not directly connectable due to NAT issues. If that actually if your issues you can look in to our NAT Traversal plugin, but ultimately you will need some sort of relays to guarantee connectability.
     
  12. Hummy91

    Hummy91

    Joined:
    Jun 7, 2017
    Posts:
    22
    @thegreatzebadiah Hey, I wanted to ask if this asset works with the HLAPI replacement Mirror?
     
  13. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    429
    @Hummy91
    Match Up is independent of the network system so it will work with Mirror. You just need to add the host's Mirror connection info as match data and use it on the client to connect.

    Let me know if you have any issues.
     
    Last edited: Dec 10, 2018
  14. metalkat

    metalkat

    Joined:
    Feb 19, 2011
    Posts:
    33
    Does this asset comes with an example on how to transfer data from the "lobby" or non-match-game-scene to the actual match-game-scene ?
     
  15. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    429
    @metalkat
    It has an example on how to put up data to the MatchUp server and how to pull data from the MatchUp server.
    I also go into an overview here on how to use it:


    It won't matter what scene you are in for either.

    Let me know if I misunderstood your question.
     
  16. metalkat

    metalkat

    Joined:
    Feb 19, 2011
    Posts:
    33
    I don't know if I don't understand or if it's obvious I'm not getting it. I'm new to this networking stuff

    Lets say I have playerdata which is an object or whatever with player.name, player.weapon, player.skin, player.example1, etc.
    where/how can I share the playerdata of a user and pass it through the match so they can see each other names/weapons/examples.
     
  17. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    429
    @metalkat
    Ah, I think I see what you are talking about.

    Match Up would be for listing matches and getting information about a match when you aren't connected together in Unity already. You are already connected when when you are in someone's game playing together.

    To send stuff within a single match(game) you would use RPCs or CMDs and stuff like that.

    You could use Match Up within a match to send stuff but it would be slow and isn't really what Match Up is for.

    If you bought Match Up in error, send me your invoice in a PM and I can refund it.
     
  18. TCROC

    TCROC

    Joined:
    Aug 15, 2015
    Posts:
    119
    @Fuestrine We are looking into different services that we could use to host our multiplayer games. One that we found was Spacial OS. They don't provide match making by default, so I was wondering if this would be the solution if we decided to go with them.
     
  19. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    429
    @TCROC
    Yeah, I don't see any reason why it wouldn't work with Spacial OS.

    Match Up is basically just an easy way to talk with a MySQL server while inside Unity with easily filterable MySQL searches. It works independently of the implemented network solution. You would just pass in whatever the connection data for Spacial OS is when you put the Match online. Then you'd receive that info to connect in whatever way Spacial OS connects.

    Let me know if you have anymore questions.
     
  20. GameMunchers

    GameMunchers

    Joined:
    Jul 3, 2017
    Posts:
    37
    If I get Match Up will you help me Link it with USurvival?? :)
     
  21. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    429
    @GameMunchers
    There shouldn't be any issues with using any networking system.

    If you would need some type of connection info to connect to another USurvival game, you would just have the host put that information up to the matchmaking server when they host the game.
    Take a look at the second image on the store page. You would just pass in your specific USurvival connection information there. Which can then be easily accessed from your clients and used to connect.

    Let me know if you run into any issues or have any questions or comments.
     
  22. SparkyMcCode

    SparkyMcCode

    Joined:
    Dec 29, 2018
    Posts:
    1
    can i apply this to my chess game?
     
  23. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    429
    @SparkyMcCode
    I don't see why not. It's just a system to be able to find games that are being hosted and it should work with any networking system.

    Let me know if you have any questions.
     
  24. metalkat

    metalkat

    Joined:
    Feb 19, 2011
    Posts:
    33
    Any chances on changing the GLIBCXX to 3.4.19 so it could work on CentOS?
     
  25. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    786
  26. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    786
  27. Cyberboy55

    Cyberboy55

    Joined:
    May 20, 2018
    Posts:
    5
    Hello,
    I just Imported this into my game (running UNET). I ran into an error before I even changed anything. Would appreciate any help.
     

    Attached Files:

  28. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    786
    Hi @Cyberboy55 I'll need some more info to go on. What version of Unity are you using? It seems like UNET networking can't be found at all so it may be that I need to make some changes for newer versions of Unity as UNET gets removed.

    The quick and dirty fix would be to delete that NetworkManagerExtension and comment out everything to do with NetworkManager in matchmaker.cs

    Assuming you're in a newer version of Unity where that's all removed that code isn't doing you any good anyway so it should be safe to remove.

    I'll make sure to get a real fix in the next release as well.

    Let me know if you run in to any issues after making those changes.
     
    Last edited: Feb 22, 2019
  29. Cyberboy55

    Cyberboy55

    Joined:
    May 20, 2018
    Posts:
    5
    Thank you for such a quick reply. Yes, I am using the new 2019.1.0b1 (Beta though not the newest). I did what you instructed and the errors went away (though I was forced to delete the example project). I haven't implemented it yet so I don't know if it truly fixed it or not. Thanks again.
     
    thegreatzebadiah likes this.
  30. hellabeatz

    hellabeatz

    Joined:
    Jan 25, 2018
    Posts:
    2
    How would one go on about connecting to steam servers with this asset? would be amazing if you could point me in the right direction!
     
  31. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    786
    @hellabeatz How you do your networking is kind of a separate issue from the matchmaking. I'm not sure the best way to use steam with unity. I imagine though if you did want to use Match Up with steam you could store the lobby id's as Match Data and use Match Up to find and filter lists of lobbies. What you do with those lobbies and how you connect is up to you though.

    Honestly it's kind of redundant though, if you're using steamworks you've already got access to steam's lobby system which can be used for matchmaking itself.
     
  32. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    429
    @hellabeatz
    For how to code the connection information with Match Up:
    Take a look at the ExampleMatchmakerForUNet.cs script.
    You could pass the information you need to connect to a Steam game like this(from HostAMatch()):
    Code (CSharp):
    1. var matchData = new Dictionary<string, MatchData>() {
    2.             { "Steam info", steamConnectionIPOrSomething },
    3. };
    4.  
    5. matchUp.CreateMatch(networkManager.maxConnections + 1, matchData);
    Then you'd pull the info on the client like in GetMatchList().

    Then you have a list of matches from that and you can access the array like in the
    // Display the match list
    section and use the information you passed over to connect.

    Let me know if you have further questions.
     
  33. hellabeatz

    hellabeatz

    Joined:
    Jan 25, 2018
    Posts:
    2
    that clarifies some things, but in the matchmaker prefab I am required to give a matchmaking server. Steam does have their own matchmaking servers they allow you to use through their steamworks.net c# wrapper, so should I just tweak your code to match that? (using https://github.com/rempelj/unet-steamworks this method at the moment)
     
  34. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    786
    you're not going to be able to use steam servers with match up for matchmaking like that sorry. You'll need to either host a matchmaking server or use the one we provide.
     
  35. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    786
    Match Up 3.0 Released
    • Fixed error when getting match list with no filters.
    • Fixed error error when destroying non-existent match.
    • Added equality operator for Matches
    • Added support for 2019.1
    • Re-organized plugin
    The plugin has been re-organized a bit. Hopefully it's even simpler to get started now. Unity Engine 2019.1 is now supported with a new basic example that does not depend on any networking system. Hopefully this serves as a better example, as the old one was just filled with UNet code that really had nothing to do with Match Up. I hope the new example will also make it more clear how Match Up works independently of the networking system, so that it can be used with just about anything.

    There are also a few bug fixes in there, but nothing too exciting.

    More things coming from Noble Whale Studios in the near future. Keep those eyes open. :cool:
     
  36. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    786
    Match Up 3.01 Released
    • *Added Mirror example.*
    • Fixed some issues cleaning up matches when clients abruptly lose internet.
    • Updated the server.
    • Updated the docs.
    • Cleaned up, commented, and organized code.
    There is now a Mirror example included to make things super easy for Mirror users. If there is any other networking system you would like to see an example for let me know and I'll add one.
     
  37. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    429
    @uncookedzebra
    I see it in the 2018 3.6 version that's on the Asset Store.

    One issue could be that Unity loves to just not download new versions and keep older versions. You could try clearing your Unity Asset Store cache. Mine was around AppData/Roaming/Unity. Search for the "Match Up.unitypackage" and delete it.

    Another issue could be that you are at a version of Unity that is lower than 2018 3.6 which is the lowest version that the Mirror asset supports. Mirror seems to work at 2018 3.0 for me though but I haven't done any major work in Mirror. I'll just PM you a copy of the 2018 3.6 asset if this is the case and it should be able to be imported, but keep in mind that you'll be running Mirror in an unsupported version.
     
  38. SoftwareGeezers

    SoftwareGeezers

    Joined:
    Jun 22, 2013
    Posts:
    507
    Hi,

    I started a networked game a few years back and basically had to put it on hold as I couldn't work around networking effectively. I'm investigating a proper solution now, starting with just getting networking up and running.

    The idea is a drop-in, drop-out P2P game that can be played locally on the LAN or P2P over WAN, four players, maybe 8 max. I have the TNet Asset and a working example scene that creates a networked match and has chat. I've tested it with a friend - when he runs the app I can connect, but he can't connect to me when I host the game.

    That's led me to a quest to understand what the heck networking is and how it works! ;) As I understand it, no device is going to be able to see another across the internet with an internet server, so I either use a networked server host and bounce all my network traffic through that, or I use a matchmaking system. A friend (the one who ran the test earlier!) linked to this asset.

    So, would Matchup be compatible with TNet and its existing server solution? TNet has a great handling of the drop-in, drop-out process, but it rarely gets much love from the mainstream Unity community.
     
  39. Fuestrine

    Fuestrine

    Joined:
    Feb 13, 2013
    Posts:
    429
    @SoftwareGeezers
    Match Up will be able to work with TNet. Instead of passing in the IP address and port like with UNet, you would host and pass in whatever TNet uses to connect to (probably still the IP address and port but some systems use different things). Then your clients will be able to see this information with a simple query, then you use the information to connect like normal.

    It seems like you are having NAT Traversal issues though with you not being able to be connected to while hosting. Match Up will not solve this issue as Match Up is basically just an easy way to get the connection information so you can attempt a connection.

    We have other products, NAT Traversal and Noble Connect, that help facilitate the connection even when behind routers that get in the way of you trying to connect, but they do not currently work with TNet.

    Let me know if I didn't answer anything or if you have any questions.
     
  40. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    786
    Match Up 3.02 Released
    • Fixed missing UNET support in 2018.3 and 2018.4
    • Improved output.
    • Reworked example scenes so you can't destroy a match before you have created / joined one.
    • Reworked client side keep-alive messages to be on a separate thread so scene loading will not interrupt it.
    • Removed server side keep-alive in favor of read timeout.
    • Fixed read timeout in windows server.
    • Removed re-connecting logic from client because nothing good can come of it.
    • Reworked message parsing on server and client to actually make sense for tcp / streaming protocol (how was anything ever working?!).
    • Bumped default port number to 20205 so I can keep old server running which is incompatible with new client.
    • Better socket error catching.
    • Hopefully fixed lingering matches from clients not being properly cleaned up on disconnect.
    • Hopefully fixed lost connection to server errors.
    Lots of fixes in this one. I took a good hard look at the socket code on both ends and reworked it to make a lot more sense.
     
  41. Cecrit

    Cecrit

    Joined:
    May 18, 2015
    Posts:
    17
    Hey,
    I was wondering how to make it work with mirror lobbies. Having the example scene create the server won't switch to the lobby scene (using lobbynetworkmanager), forcing the load of the lobby scene doesn't work either.

    And as for Matchup, do I need to put the matchmaker into every scene in order to call functios (e.g. player leaving the lobby), or do I implement a DontDestroyOnLoad?
     
  42. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    786
    @Cecrit
    You should use DontDestroyOnLoad. I'm not sure about the lobbies issue though. Match Up should be able to work with the Mirror lobby just like the normal NetworkManager. Let me know if you're still stuck though and I can maybe put together a Mirror lobby example for Match Up.
     
  43. Cecrit

    Cecrit

    Joined:
    May 18, 2015
    Posts:
    17
    I worked around the problem by restructuring my main menu. Menu wise I was really early in development at that point and thus integrated the lobby into the main menu scene. Since people should not be able to join a running game there was also no need to keep MatchUp alive once the actual game started.
    Now everything works like a charm!
     
    thegreatzebadiah likes this.
  44. thegreatzebadiah

    thegreatzebadiah

    Joined:
    Nov 22, 2012
    Posts:
    786
    Glad to hear you got it all sorted. Don't forget to rate / review Match Up on the Asset Store. Thanks!