Hi, I want to make mulitplayer game working only on local wifi hotspot not connected to internet probably, just set up only for this purpose. So people come and connect to wifi with phone and if they want multiplayer they will either create game server on device or connect to existing server on some other device. However I want to avoid typing IP address so I want discovery of created local network games. It seems to me too much to set up master dedicated server on the LAN just for this. Is there a solution for clients to discover games on LAN directly? Something like instead of connecting to master and asking for game list it will broadcast message to all devices on network and the ones which host game will reply to it and client will build up a list of available games from replies.
thanks for advice.
You just explained how it will do it. Broadcast, get replies, connect to one of those respondents.
Great ;o) so how do I get list of games? is there a feature for that in built-in networking? can’t see much here Unity - Scripting API: Network and didn’t find any tutorial or example how to do this. Can you point me to right place?
You’re going to have to buckle down an learn to program. Read up on C# networking over at MSDN.
so there is not built in functionality for this. I’m a programmer actually, not familiar with C# though. It won’t be a big deal to look to documentation and get familiar with networking API, but if I want to do real broadcast I’d probably have to go down to very low networking level and use ICMP packets to broadcast and then to watch and catch them on servers and reply to it. It may not even be exposed by API to application level. Other option is to try connecting to all IPs on subnet but that’s 254-1 combinations which may take quite long.
I was hoping someone has done this already.
Sending out a broadcast isn’t a “very low networking level”. Since you’re clearly going to head down the wrong path if you’re talking about ICMP and trying to connect to everything, have each server bind to a UDP port, use a UDP broadcast and put the replies into a collection, then display that collection to the user.
Do a good search in the forum, there should be thread about something like you want to create, and if I remember right it worked well.
Ok guys, thanks, I’ll try to search more through forum and in worse case probably will look into creating UDP broadcaster which seem to be a good idea. Thanks.