Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
3
Question by IAMBATMAN · Mar 03, 2016 at 11:57 AM · networkingmultiplayermatchmaking

UNET match making without the relay server

Is it possible to add matchmaking to my game without using unity's relay server? Where a player hosts a game and other players can join with a find a match button?

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image IAMBATMAN · Mar 04, 2016 at 05:03 PM 0
Share

no one? :(

3 Replies

· Add your reply
  • Sort: 
avatar image
10
Best Answer

Answer by thegreatzebadiah · Apr 27, 2016 at 06:53 PM

Yes, this is possible. The way I do it is by storing the host's IP in the match name when creating the unet match.

Something like

 GetComponent<NetworkMatch>.CreateMatch(matchName + ":" + hostExternalIP, advertiseMatch, matchPassword, "", "", eloScore, requestDomain, OnMatchCreate);

Then when you call ListMatches() and get a response you just split on the ":" to parse the ip from that match name. Set the NetworkManager's networkAddress to the ip and then call StartClient() and it will attempt to directly connect to the host's ip. The relay servers won't be used at all (notice you never even call JoinMatch).

The problem you're going to run into is that anyone behind a router (which is everyone) isn't going to be able to host and be connected to without the relays due to NAT security issues. Basically the router blocks incoming connections from any source that the user hasn't already made an outgoing connection to. The solution to this (if you don't want to use the relay servers) is something called NAT Traversal. It's a method for getting around NAT restrictions and allowing players to host even behind a router, without having to do messy things like manually forward ports in their router settings.

I wrote a plugin that adds NAT Traversal on top of Unity's high level networking api. It seems like exactly what you're looking for. Check it out here: https://www.assetstore.unity3d.com/#!/content/58948

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image IAMBATMAN · May 03, 2016 at 11:28 PM 0
Share

I thought this thread was dead. AWESO$$anonymous$$E!! Thanks so much :)

avatar image n00ben · Oct 20, 2016 at 02:02 PM 0
Share

If we do not use Unity's relay server and use that method you provided, we will not use up Unity's CCU?

avatar image ManjiDM · Jul 25, 2017 at 01:38 PM 0
Share

I think this is a good workaround but this is still using the relay server to advertise the match. The relay server just isn't involved in the communications for the match itself, but it's still used for the List$$anonymous$$atches() call. Is there any advantage with whats proposed here? Thanx.

avatar image
0

Answer by brainz · May 27, 2016 at 12:24 AM

@thegreatzebadiah: Is it possible to do the exact opposite? Make your own matchmaker and there connect the players using Unity's Relay service?

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image thegreatzebadiah · May 27, 2016 at 06:04 AM 0
Share

Yep, you just need to pass around the NetworkID of the UNet match as part of your matchmaking system. Clients can then pass it into StartClientAll() to join via relay.

avatar image booferei · Aug 04, 2019 at 09:02 AM 0
Share

I think you cannot. But you could use your own match making and then create a UNet match between the matched players.

avatar image
0

Answer by TheDelhiDuck · Jul 28, 2016 at 02:04 AM

Hi the other problem with this we've found is the player count will be wrong in the returned matches. The client can join the match and not connect to the game via the relay server. It seems they shortly get "booted" from the match, while staying connected to the game. I assume this is because there is no relay server connection. Anyone else found this to be true? And or have figured a work around? I'm thinking of trying to establish a relay server client connection but only using it to send some kind of heartbeat.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image LukePindsle · Jan 24, 2018 at 02:24 AM 0
Share

I am running into the same issues. After about 30 seconds, the matchmaker server will be automatically cleaned up because of a lack of active connection.

Did you ever find a solution?

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

11 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

UNET with Secure Firewalls 0 Answers

UNET Online Match Making? 1 Answer

Is this possible in unity 0 Answers

MatchInfoSnapshot currentSize returns 1 instead of 0 0 Answers

Managed to set up Multiplayer Online on one Computer, but not on 2 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges