Hacker News new | ask | show | jobs
by infinite8s 1583 days ago
If your game is web-based, you could leverage WebRTC - where you only need to share a unique link between users - see peerjs (https://peerjs.com/) or croquet.io (https://croquet.io/docs/croquet/)
2 comments

If you target desktop, should be fine, but mobile users tend to use cell towers which are on Symmetric NAT, which would require a TURN server on top of the WebRTC.
I'm targeting desktop, but your point is good to know, thanks. I will keep it in mind.
Even on desktop you run into people with weird configs. For example my router will not allow mDNS to work but my ISP NAT is pretty good so I can connect two machines as long as they’re not on the same network! In the end you almost always will need a relay to guarantee connectivity for any random pairing of participants in a large enough population.

The good news is that WebRTC is perfectly straightforward if all you want to do is to connect to a server on the open internet.

It is web-based, yes. I was aware of WebRTC but assumed I would need a least to host the server myself. I'm looking at the links you provided and they seem very interesting. Thank you.