MasterServer which shows only Local Area Hosts

Hi!

We’re working on a multiplayer enabled game, and we’d like to connect only the devices on the same local area network.

We’re having some problems showing the host list for all the created servers.

Using the Unity MasterServer, it shows all running multiplayer sessions across the globe in the host list.

We’d like to offer a similar functionality to the Master Server, where one creates a server, and the other devices see the servers (host) list, but only those on the same local area network.

We’d rather do this than ask the users to manually input the IP address.

Can you please tell me what would be the easiest way to achieve this?

Thanks a lot,
Bogdan

Might be able to hack the masterserver solution you’re using already – just filter to show only servers that have the same public IP. Downside to this would be that the user would still need internet connectivity. If you want true LAN support (doesn’t need internet/doesn’t rely on master server), you’d have to scan your LAN for computers hosting games and I don’t know how to do that.

Just have the client send out a broadcast based request and any available sessions can reply.

Thanks JRavey!

That sounds like the right thing to do. So do you know how to code that in Unity? :slight_smile:
Or is there some .Net stuff involved?

That would most likely be .NET stuff. Each server would have to have a listener of some sort on a known port, right? That is where I would start. Oh, and probably using UDP is a good idea as it is easier to be spammy and you can get replies from every server listening.

Doesn’t the Unity Networking Example have a local master server example?

Maybe it does, but does a local master server really have that much value?

Not really no, makes no sense at all.
For in-LAN I wouldn’t use it at all, I would use UDP broadcasting to find other games or bonjour

Hi Dreamora!

Thanks for helping out! Do you happen to have some code samples for UDP broadcasting… or could you point me to some documentation for that?

I can’t really use bonjour… as the game should work on iOS as well as Android and PC/Mac.