How to: P2P based session games

P2P is the priviled solution for games hosting limited number of players in their game session. This solution minimizes server cost because no gameplay runs on the server. It’s common to run more than 20k concurrent users per server instance (or node) for P2P games on top of Stormancer with relatively low CPU and memory consumption serverside.

However, P2P game sessions introduce additionnal complexities:

Nat traversal

Most routers are configured to not expose user endpoints directly on the Internet for security reasons, so establishing direct connections between players requires performing a process known as Nat traversal.

Nat traversal may fail depending on the configuration of the player’s NAT. In this case, the distributed system is able to switch to relay mode.

Game session result arbitration