Hi.
With my startup EduMode we’re developing an “educational multiplayer first person shooter”. So it’s evident that the game works on a variety of school networks which unfortunately are known to be rather restrictive.
I’ve researched the issue and I’m not an expert but understand that Unity multiplayer networking needs access to specific IP addresses and specific ports.
Whenever people have theses issues, the response is to change the firewall settings. But that is rarely a user friendly solution for the non-technical teacher who needs it to work immediately.
How far can we go on our own? Is it possible to have the game first test the network for various combinations of IPs and ports, and then use one that’s functioning?
In that case I would have the teacher launch first, test, and then tell the pupils which port and/or IP to use (in a simple way).
The point of ports are to specify the type of service that a server is providing. However only the first 1024 ports (called “well-known ports”) are defined and should not be used for other purposes than specified. So for example port 80 is HTTP and port 443 is HTTPS. While it is “possible” to use a well-known port for anything as long as the port isn’t in use yet, it might not be a good idea.
Some firewalls are more restrictive and school networks are known for that. They usually don’t allow any incoming connection from the outside. Also the only allow a few ports going out which usually includes port 80. Though a lot schools have content filters implemented in their firewalls to prevent access to certain resources on the internet. For this the firewall / content filter usually analyses the traffic sent over port 80. If you now use port 80 for other things than HTTP a firewall might just block you completely.
Furthermore in most larger networks the individual users don’t have their own public IP address. They are usually behind a local NAT router. This makes it in most cases impossible to directly contact an individual inside the network as you have no way to specify the target.
In the past Unity used RakNet as networking engine (the Network class). RakNet had the built-in ability to perform a “NAT-Punchthrough” which is actually a security flaw in most consumer router. Since this was highly unreliable and users as well as developers complaint a lot about it, the new networking system doesn’t provide it at all ^^.
Your best option is to host a server outside your network(s) somewhere on the internet which (hopefully) can be reached by everyone. It’s very unlikely that things like NAT punchthrough works on your school networks but anyways NAT punchthrough also needs a “facilitator” on the internet that is reachable by everyone.
You haven’t mentioned what networking “engine” you actually use / want to use. In theory it’s possible to setup a public webserver (on the internet, not the local network) and use the WebSockets protocol extension of HTTP. This would probably be the most compatible approach but still isn’t guaranteed to work everywhere.