LiteNetLib P2P question

Hello, I’m trying to implement a P2P architecture in my game. I thought that clients could connect directly to each other, but unfortunately, it’s not possible. So, my question is, how do you do it? Do you start with a server, make connections between its peers, and then “turn” the server off?

Well, it is certainly possible, but you’d have the same issues that older networked games had before games moved to internet-based server models. Namely, when setting up a P2P model, you’re essentially making one of the machines act as the game server for itself and all other game clients. The issue with this is that for a machine on a local network to act as a server, the end-user generally has to setup firewall holes, port forwarding, etc with their own network infrastructure for that to work. That, and having control of the server for various anti-cheat and whatever other reasons, is why almost all games have moved to internet-based server models (i.e. the devs host a server that tunnels all traffic from each client to each other).

1 Like

Could be many reasons.

I had this game that was coded in a few hours and showcases P2P networking. You can check the code if it helps: GitHub - Apostolique/UltimateTicTacToe: Ultimate tic-tac-toe implementation in MonoGame with online multiplayer.

It was done with Dcrew’s help.

You can try it at:


I think what you want to look into is called NAT Traversal

1 Like

This @Dcrew ? @Apostolique


That would be him!

1 Like