Restricting Lobby search to same network

Hello,

I’m wondering if it’s possible to restrict what lobbies I display as joinable to the same network that I’m on?

Essentially, I want the lobby service to only display hosts that are on the same LAN, without having to input an IP address manually.

Is this possible?

Thanks,
-Brett

You can add custom properties to the Lobby and use that custom property in the filter the lobbies that are returned. In your case, you would need to provide some property that uniquely identifies which LAN the users are on. This may be difficult to do. The MAC address of the Gateway that everyone on the LAN is connected could potentially be used for that but I have no idea if there’s a trivial way for you to get that from any machine (and it could change depending on a few things like Wired vs Wireless).

The Lobby service itself doesn’t have any way of identifying whether a specific Lobby is part of one LAN or another unfortunately. The way this usually works is that a game client on your LAN will advertise itself on the LAN (not through the Unity service) using some sort of Service Discovery mechanism. This is how lots of Apple devices find each other on the same network. I can’t even begin to provide a recommendation for how to get started with this though.

The service advertisement could contain something like “MyGame:Lobby:”. Then any clients on the local LAN would be able to see these advertisements and use the ID to get the lobby details from the Lobby service and display it in game.

Hi Veleek, thank you for your great reply!

I see, so this would have to be handled by the app, not the Lobby service. That makes sense.

Strictly speaking, my players don’t have to be on the same LAN, per se, just in the same physical area. I was thinking another thing I could do to reduce the Lobby list would be to use Geo-Location and filter by distance. This way players in the same house would see each other, and if you went to a convention or whatnot, you’d still see all the players playing in the same conference hall regardless of their connectivity method (Wifi, Cellular, etc).

Sounds like an interesting problem, I’ll report back what my solution is when I implement it!

Thanks,
-Brett