Hi everyone, I’ve just started learning Unity’s LLAPI for networking and I have a few questions I want to get straightened out. I have a little experience using networks, but not much with socket connections, which is why I’m here.
I’ve been able to connect the client and server on my local machine using the ip address of localhost, 127.0.0.1 and send data back and forth. I’ve read that in order to connect machines across the internet where one player acts as the host and others connect to them requires NAT punchthrough in order to work. Would I need to do this with the LLAPI or just use the global ip of the host? What would be the best way to connect players to the host through the internet?
Another issue I’ve run into is matchmaking. I though instead of paying for a dedicated server to handle matchmaking could I just use a PHP script that accesses a MySQL database which contains match information? This approach just seems hackey to me so should I go with it, just cough up the money for a VPS or dedicated server, or is there some other method I’m oblivious of? I also know that steam has a matchmaking API but that’s only for games published to steam, and I’m just trying to learn right now.
Finally, and this is a rather small issue, when I ran the standalone build of my testing game as a host, Windows gave me a dialog asking if I wanted to allow Unity through my firewall. I allowed it, but wanted to know if there was a way to automatically allow firewall access so if someone downloaded the game and ran it they wouldn’t be met with the same dialog, it seems unprofessional.
If anyone knows something about any one of this questions I would really like to hear their response since I think networking and multiplayer makes games so much more fun and entertaining! Thanks for hearing my questions and I hope to learn something soon.
Just host your server on some VPS/dedicated machine on the internet and then clients can connect to it with IP+Port, no NAT punchthrough needed.
For matchmaking you can use Unity’s Multiplayer services. Doesn’t seem like you will get much support if something fails, but paying a few bucks a months is probably easier than spending weeks of your time to implement your own matchmaking.