You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Netcode] Direct connections (NAT punching) fail often, players fall back to relays #119
The game tried for only three seconds and never again. If the other player's router answered a little late, the pair stayed on the relay for the whole session.
Some routers give each destination its own outgoing port. With those, only one direction got through: the other player could reach you, but you never punched back to the address you were actually seeing. In the worst case your side ended up with no path at all, and the connection never came up.
There was no IPv6. Many connections today share one IPv4 address with lots of other customers (carrier-grade NAT, DS-Lite, mobile) but have their own public IPv6 address. IPv6 usually has only a firewall in the way, not address translation.
What changes in 0.6.3
IPv6 first: the game offers your own public IPv6 address to the players in your lobby and tries IPv6 before IPv4. The server only passes it on to your lobby; it is never logged or stored. The server doesn't need IPv6 for this. (Thanks to QuantX for the hint.)
Punching back: when a probe from the other player arrives from an unexpected address, the game now probes back to exactly that address.
Keep trying: the relay still starts after three seconds, so joining is just as fast. But punching keeps going for a while, then retries now and then in the background. If the direct path opens later, the game switches from the relay to direct during the match.
No more dead pairs: if only the other side gets through, your side uses the relay instead of waiting for a direct path that never comes.
All security rules stay as they are: probes are encrypted and authenticated, no bigger than the answer, and strictly limited in number.
Lab test (simulated router types, 2 runs each, before → after): direct connections went from 4 to 16 out of 20 attempts.
Late answer: 0 → 2
One-way routers: 0 → 2. Before, the connection didn't come up at all.
Both sides behind the hardest NAT type, with IPv6: 0 → 2, also with a real public IPv6 address.
Switch from relay to direct in the middle of a session: 0 → 2
Two players who are both behind the hardest NAT type and have no IPv6 still use the relay – that's expected, and the relays keep working well (all relay links under 1 % loss).
The statistics now also count direct connections over IPv6 vs IPv4, late switches to direct, and how punching failed (one-way vs. no answer at all), so I'll see the effect after the update.
Activity
Greevee commentedon Nov 26, 2026
Thanks – the statistics were very helpful here.
Why punching failed so often
What changes in 0.6.3
Lab test (simulated router types, 2 runs each, before → after): direct connections went from 4 to 16 out of 20 attempts.
Two players who are both behind the hardest NAT type and have no IPv6 still use the relay – that's expected, and the relays keep working well (all relay links under 1 % loss).
The statistics now also count direct connections over IPv6 vs IPv4, late switches to direct, and how punching failed (one-way vs. no answer at all), so I'll see the effect after the update.