Hi, I'm currently an Indie developer working on games in the spare time I get after and before work... Everything I know is self taught and through online youtube tutorials and documentation. With that being said, I haven't had much time to really get into networking, and the game I'm currently working on will only have 2 players playing against each other at a time... Currently, my plan is to have a "Play" button on the home screen. Player clicks play, game searches for any rooms available that match the player's rating (or come within like 30 points of it) and then joins the first room available. If none are available, a new room will be created. To connect to a server, you'd enter the IP and port and bam, you're in... So what makes it so hard for a player to hit Play, their device's host IP and an open port gets entered into the database, and the joining player connects directly to that? I know this isn't the most secure method, but for now I just need to get something like this to work, and I can build on securing it or finding a better solution later... Unless someone has a better solution for a simple host or join 1v1 system that doesn't require some huge CCU relay server...
Pretty much every player is using a device which is behind a NAT router. When you host a server behind a NAT router, and a client attempts to connect to it, the request hits the NAT router and it has no idea where to send it. For home PC's you can log into your router and manually add a port forwarding rule. When on a network such as a school network, corporate network, 4G wireless network, etc, etc, that is usually not possible. So you need a server which connects the two clients together, either via NAT punchthrough (connecting two clients together instead of one acting as a typical server) or relay, which are the typical approaches to the problem. . Research NAT for more information.
I have two projects that will solve your issue. https://github.com/MidLevel/MLAPI.Puncher https://github.com/MidLevel/MLAPI.Relay Or if you dont want to deal with it yourself, and wish to use Steam as your platform. You can use steams P2P service. It has built in support in my high level library MLAPI. https://github.com/MidLevel/MLAPI
Thanks, looks like I need to spend a lot more time looking into networking later when I get to that stage... Focusing on all the things I can currently do right now, then I'll research more into the things I can't.