Making "proxy-server" for GTA2 Networking

Anything to do with GTA1/GTA2 modding (tools, scripts and more).
Post Reply
User avatar
ALPINE
Car Jacker
Car Jacker
Posts: 36
Joined: 03 Jan 2010, 12:47
GH nick: ALPINE
Location: Togliatti, Russia
Contact:

Making "proxy-server" for GTA2 Networking

Post by ALPINE » 29 Nov 2011, 15:00

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 9825 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.
.4LPINE

User avatar
Cuban-Pete
Immortal
Posts: 909
Joined: 29 Jan 2010, 15:03
GH nick: Cuban-Pete

Re: Making "proxy-server" for GTA2 Networking

Post by Cuban-Pete » 29 Nov 2011, 15:08

This would be the one million dollar question.

I would like to use the hotline and call Vike.
"Mmmm, your eyes are so beautiful."

User avatar
Sektor
Boss
Boss
Posts: 1370
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: Making "proxy-server" for GTA2 Networking

Post by Sektor » 29 Nov 2011, 15:22

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.

User avatar
ALPINE
Car Jacker
Car Jacker
Posts: 36
Joined: 03 Jan 2010, 12:47
GH nick: ALPINE
Location: Togliatti, Russia
Contact:

Re: Making "proxy-server" for GTA2 Networking

Post by ALPINE » 29 Nov 2011, 15:24

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?
.4LPINE

User avatar
Sektor
Boss
Boss
Posts: 1370
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: Making "proxy-server" for GTA2 Networking

Post by Sektor » 29 Nov 2011, 15:25

Yes we tried it but great to see you thinking the same.

User avatar
ALPINE
Car Jacker
Car Jacker
Posts: 36
Joined: 03 Jan 2010, 12:47
GH nick: ALPINE
Location: Togliatti, Russia
Contact:

Re: Making "proxy-server" for GTA2 Networking

Post by ALPINE » 29 Nov 2011, 15:28

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.
Last edited by ALPINE on 29 Nov 2011, 15:31, edited 1 time in total.
.4LPINE

User avatar
Sektor
Boss
Boss
Posts: 1370
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: Making "proxy-server" for GTA2 Networking

Post by Sektor » 29 Nov 2011, 15:30

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.

User avatar
ALPINE
Car Jacker
Car Jacker
Posts: 36
Joined: 03 Jan 2010, 12:47
GH nick: ALPINE
Location: Togliatti, Russia
Contact:

Re: Making "proxy-server" for GTA2 Networking

Post by ALPINE » 29 Nov 2011, 15:35

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?
.4LPINE

User avatar
Vike the Hube
Hitman
Hitman
Posts: 143
Joined: 28 Feb 2010, 22:34
GH nick: vike

Re: Making "proxy-server" for GTA2 Networking

Post by Vike the Hube » 01 Dec 2011, 10:19

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

User avatar
Vike the Hube
Hitman
Hitman
Posts: 143
Joined: 28 Feb 2010, 22:34
GH nick: vike

Re: Making "proxy-server" for GTA2 Networking

Post by Vike the Hube » 01 Dec 2011, 10:53

By the way for writing stuff like this I recommend libev ;) Not that I've tried it myself yet but yeah.

User avatar
ALPINE
Car Jacker
Car Jacker
Posts: 36
Joined: 03 Jan 2010, 12:47
GH nick: ALPINE
Location: Togliatti, Russia
Contact:

Re: Making "proxy-server" for GTA2 Networking

Post by ALPINE » 02 Dec 2011, 10:02

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 :)
.4LPINE

Post Reply