Page 1 of 1

[Rseding91] [1.1.30] NatPunchRequest not sent unless a multiplayer game has been hosted first

Posted: Tue Apr 06, 2021 9:58 pm
by Hornwitser
While looking into NAT punching I noticed the following weird behavior:

If you start the game and go directly to the public server list, click on servers and try to connect one no NatPunchRequest messages are sent by the client.

If you start the game and choose "Host new game" that is publicly visible, let it run for a few seconds before exiting, and after that go browse the public server list then the client sends NatPunchRequest messages for each server you click on and before each connection attempt to a server.

I don't think this is how it's supposed to work.

Re: [1.1.30] NatPunchRequest not sent unless a multiplayer game has been hosted first

Posted: Wed Apr 07, 2021 5:09 pm
by Rseding91
Hornwitser wrote:
Tue Apr 06, 2021 9:58 pm
If you start the game and go directly to the public server list, click on servers and try to connect one no NatPunchRequest messages are sent by the client.
That is intended. Nat punching is only relevant for the host and it's design is to keep the port open on the host side so client packets reach the host. The act of sending packets from the client to the server is itself nat-punching on the client side.
Hornwitser wrote:
Tue Apr 06, 2021 9:58 pm
If you start the game and choose "Host new game" that is publicly visible, let it run for a few seconds before exiting, and after that go browse the public server list then the client sends NatPunchRequest messages for each server you click on and before each connection attempt to a server.

I don't think this is how it's supposed to work.
That doesn't sound intended. The nat-punch sending should stop as soon as the server has been quit.

Re: [1.1.30] NatPunchRequest not sent unless a multiplayer game has been hosted first

Posted: Wed Apr 07, 2021 5:17 pm
by Hornwitser
diagram.png
diagram.png (14.86 KiB) Viewed 878 times
This diagram shows for the packet labeled 1. how NatPunchRequest is sent by the client in 0.16.51. When sent in this manner nat punching works.

In 1.1.30 NatPunchRequest is not sent unless you first host a game. If NatPunchRequest packets are not sent then nat punching will not work. Nat punching is therefore highly relevant to the client, if the client doesn't send a NatPunchRequest to your ping pong server that is then forwarded to the target server then no nat punching can take place.

Re: [1.1.30] NatPunchRequest not sent unless a multiplayer game has been hosted first

Posted: Thu Apr 08, 2021 1:52 am
by Rseding91
I think you're misunderstanding part of what nat punching is/does. The ping-pong servers don't relay anything; they simply reply to the packet sent to them with the IP they got the packet on.

So in that regard: the ping-pong server only talks with the computer that sent it the packets. It never sends anything to other computers.

Re: [1.1.30] NatPunchRequest not sent unless a multiplayer game has been hosted first

Posted: Thu Apr 08, 2021 3:28 am
by Hornwitser
And I think you don't understand how nat punching works. But the good news is that it actually functions in 0.16.51, so I've put together this demonstration video for you that shows the ping pong servers does relay nat punch requests contrary to what you're saying, and that this relaying is integral to making nat punching work.

https://youtu.be/08u9eD7Iieo

Re: [1.1.30] NatPunchRequest not sent unless a multiplayer game has been hosted first

Posted: Thu Apr 08, 2021 2:10 pm
by Rseding91
After talking with one of my co-workers I believe it's time for me to eat-crow as the saying goes and admit I was wrong. I'll be looking into this more and seeing if I can figure out what's going on.

Re: [Rseding91] [1.1.30] NatPunchRequest not sent unless a multiplayer game has been hosted first

Posted: Thu Apr 08, 2021 2:46 pm
by Rseding91
Ok, it's now fixed for the next release.