2

I'm trying to figure out how to make a simple multiplayer game where players don't have to worry about port forwarding and can connect directly to each other without a dedicated server in-between. Manual port forwarding is a hassle for less tech-savvy players and servers cost money.

I've looked at UDP hole-punching but that requires a middleman between the clients, and UPnP from what I understand has security issues and is not supported on all devices.

Is there another way other than what I mentioned - maybe something other than TCP or UDP that I might have overlooked? I want the players experience to be as easy as possible, and not have to worry about server costs myself.

Thanks in advance

Carson
  • 21
  • 3
  • Search up UPnP(Universal Plug and Play), although not everyone has it enabled on their router - It allows you to do port forwarding on demand for those who have it. – WalterM Dec 01 '15 at 18:56
  • UPnP is not fully supported and is known to have security issues. This would be an ideal solution if not for those points. – Carson Dec 01 '15 at 19:00
  • I'm currently unaware of any other ways to do it, but UPnP is quite common anyways. Alot of people have UPnP on their router enabled by default without knowing. More tech savvy people might disable it, but if they know how to do that then they obviously know how to forward their ports manually anyhow. The security problem with UPnP is in the router, not your application - meaning by you using it, it won't make the security any worse. It's not your problem if the user is using UPnP, but if it's available then go ahead and use it. – WalterM Dec 02 '15 at 08:51

1 Answers1

1

Any solution you implement is likely to have the same security implications that UPnP does. NAT as used by your average home router is basically a hack to get around ISPs charging for multiple IP addresses. Since most home users aren't running servers this has worked reasonably well. But as you've discovered, it doesn't allow hosting a game without jumping through some hoops. My recommendation is implement UPnP and document what ports you use for users whose routers lack support.

Drgnkght
  • 121
  • 4
  • Do most modern routers have UPnP support? If there is only a small percentage of players like 1-5% that lack support I'd consider going with this method and detailing a workaround for those who don't have it. Also if more and more routers are supporting UPnP these days maybe it will be fully supported in the future. – Carson Dec 01 '15 at 20:43
  • Honestly not sure if most home routers support it now. I haven't used a home router in ages. However it was steadily becoming more common back when I did. – Drgnkght Dec 01 '15 at 21:35
  • 1
    You can't trust on users to have UPnP-IGD on their routers. @Drgnkght is right about the security though: it's silly to to be concerned with UPnP security problems when what you want to do is exactly what UPnP-IGD does: make it possible for other computers to connect to a computer that is "protected" by NAT. – Jussi Kukkonen Dec 02 '15 at 09:52