Page 1 of 1

Making "proxy-server" for GTA2 Networking

Posted: 29 Nov 2011, 15:00
by ALPINE
As I know GTA2 uses two-way connections (client and server) and requires forwarded ports to make connections from out outside are possible. Schematic of connections can be figured like this:
gta2_mp.png
gta2_mp.png (6.6 KiB) Viewed 15396 times
But if we can make something like "proxy-server", one-way connection can be achieved, like this:
gta2_proxy_mp.png
"Proxy" means program that open two-side connection(s), one for GTA2 (localhost), one for opposite side (other proxy). After connections be established, program just transfer incoming buffers from one side to outcoming buffer to other side. As a result, traffic will be transfered like at "direct" connection.

By using only TCP protocol in proxy-proxy connections we can "transform" GTA2's UDP traffic to TCP traffic (no package loss), so number of "out of sync" lags probably will be reduced.

What are you thinking about this?

I'm a C programmer, I'm now learning winsock and I think I can make this program, but I don't have any program that can analyse gta2.exe's connections and I absolutely don't know what kind of connections gta2.exe establishes. So I need your help and I offer to develop this thing together.

Re: Making "proxy-server" for GTA2 Networking

Posted: 29 Nov 2011, 15:08
by Cuban-Pete
This would be the one million dollar question.

I would like to use the hotline and call Vike.

Re: Making "proxy-server" for GTA2 Networking

Posted: 29 Nov 2011, 15:22
by Sektor
v11.41 already uses TCP for everything important. It is possible to make it so only the host needs open ports. Vike and I got it working a while back by using socat to proxy the data.

Re: Making "proxy-server" for GTA2 Networking

Posted: 29 Nov 2011, 15:24
by ALPINE
Sektor wrote:v11.41 already uses TCP for everything important. It is possible to make it so only the host needs open ports. Vike and I got it working a while back by using socat to proxy the data.
So you already tried to realise this idea?

Re: Making "proxy-server" for GTA2 Networking

Posted: 29 Nov 2011, 15:25
by Sektor
Yes we tried it but great to see you thinking the same.

Re: Making "proxy-server" for GTA2 Networking

Posted: 29 Nov 2011, 15:28
by ALPINE
So what are results?

I don't think that integrating proxy server to gta2.exe is good idea. I you know what connections is gta2.exe opening maybe its better to write separate program? Or you are already tried to use _separate_ program?

P.S. Oh, I missed up socat. Is socat built only for cygwin? It's bad.

Re: Making "proxy-server" for GTA2 Networking

Posted: 29 Nov 2011, 15:30
by Sektor
We used a separate program: http://www.dest-unreach.org/socat/

I'm looking for the settings we used but I think I lost them. http://gtads.blogspot.com used proxy method for GTA1, so only the host needed a port open.

TCPView is useful for seeing what ports a program uses.

Re: Making "proxy-server" for GTA2 Networking

Posted: 29 Nov 2011, 15:35
by ALPINE
I really don't want to run 202 servers (100 for TCP range 2300-2400, 100 for UDP, and 2 for 47624). Maybe there are ways to define only ports are REALLY used by gta2.exe?

Re: Making "proxy-server" for GTA2 Networking

Posted: 01 Dec 2011, 10:19
by Vike the Hube
It is possible to force GTA2 to use specific ports; you use dxport. It just "hogs" all the ports that gta2 would otherwise use :P

yeah we've been pondering this for a while. The problem is it gets hairy when you have more than 2 players.

And then we start thinking about adding UPnP, and TCP or UDP hole punching, trying to make the whole thing general and always work. At which point it becomes ugly :P

Re: Making "proxy-server" for GTA2 Networking

Posted: 01 Dec 2011, 10:53
by Vike the Hube
By the way for writing stuff like this I recommend libev ;) Not that I've tried it myself yet but yeah.

Re: Making "proxy-server" for GTA2 Networking

Posted: 02 Dec 2011, 10:02
by ALPINE
I've just correctly configured my router and - at last - played GTA2 Multiplayer.
Now when multiplayer works my interest of making this tool is quite lower than when I've created this topic :)