UNET Matchmaking using own server

Hello,

Recently i’ve been very familliar with UNET. Even if it’s deprecated, I really like it.
I have a CentOS 7 Server. I’ve made some APIs to create rooms and get existing ones which works perfectly fine.
My problem is that I don’t want to use Unity Services because I’m low on budget and 20 CCU might not be enough. Also there is no future support to buy a subscription.
So, I want to know how can I use my server for hole punching to let users connect without changing router’s firewall. I want the host/client model.

Any suggestion can be helpfull.
Thank you.

You could use my open source relay and host it on your own. It’s free and open source. https://github.com/MidLevel/MLAPI.Relay

If you want to dig deep and avoid relaying you can follow the ICE implementation as described in RFC8445

Or if you have no intention of following the standards, the usual route is:

  1. Try UPnP (has no cost for you, the Open.NAT C# lib has worked great in my experience)
  2. If UPnP fails, try UDP punchthrough by tricking it into creating a routing entry. Raknets documentation on this is simply amazing (http://raknet.net/raknet/manual/natpunchthrough.html)
  3. If that fails, you have to relay, not much else you can do.

As you can see, you can extend this as much as you like by doing funny mesh connections between clients etc. It’s all down to the quality you require and the development time and expertise you have.

Or if this is all overwhelming, then look at @thegreatzebadiah 's assets.

Thank you so much for your response!

Is there any tutorial on how can I use MLAPI.Relay?
Or maybe the steps on how I should configure it?

Not other than what’s in the readme. I just wrote the relay in a few days cause I was bored and there was no alternative to it. But you can ask me questions either on the forums or on my discord server ( http://discord.mlapi.network/ ). I’m always happy to help.

Thank you so much, I will try it out! You did an amazing job!

@Dragonic_TV
We have two UNet products that will help with this. There’s a NAT Traversal product that does Punchthrough. There’s also Noble Connect which has better Punchthrough and also falls back to worldwide Relays that we host if punchthrough fails (typically the strictest of router settings).

Both of these will allow you to keep your UNet code basically the same.

Let me know if you have any questions.