FAF Game Lobby Repo

Post here if you want to help developing something for FAF.

FAF Game Lobby Repo

Postby Ryan_Ryan_Ryan » 16 Aug 2017, 03:24

Where in the FAF github is the repo/code for the FAF Game Lobby?

I'm curious about the two-player disconnect issue I'm frequently getting and I want to take a look at the FAF game lobby code to get started.

To be more specific, my guess is that the disconnecting issue is something that is happening because of bad coding done on the original supcom FA side, and not FAF. Its probably something you have trouble fixing because you don't have access to that code (another guess).

I guess that when the game starts there is connection info for each player passed to the game process from the game lobby and then the game process makes a new connection upon launch and starts the game. If all of these guesses are right, I think a path towards a solution would be to give the game process a fake connection for each player that loops back to the player's own computer. Another process would receive the outbound packets intended for the other players in the game. This process can forward them normally, and can have code to revive lost connections between individual players.

I'm new to FAF, so I'm probably 100% wrong with my assumptions here. If so, could you just feed me whatever specifics you know about the issue?
Ryan_Ryan_Ryan
 
Posts: 6
Joined: 16 Aug 2017, 03:08
Has liked: 0 time
Been liked: 2 times
FAF User Name: Ryan_Ryan_Ryan

Re: FAF Game Lobby Repo

Postby Brutus5000 » 16 Aug 2017, 09:58

Hi Ryan,

all of our repos are linked in the wiki. The game lobby code that we can touch is in the lua code repo "fa", but that only covers the lobby screen with the chat, map, slots etc. The connection code behind that is original SupCom code as you stated. It uses UDP, so if you have an unreliable internet connection with packet drops, it won't work (TCP would be able to "repair" this - but GPG chose UDP for performance reasons).

Did you checkout the wiki article? http://wiki.faforever.com/index.php?tit ... evelopment
We also have a youtube tutorial that covers the basics: https://www.youtube.com/watch?v=lUUDdL05QAA
Want to know what I'm working on? Browse my public task queue
Brutus5000
Avatar-of-War
 
Posts: 169
Joined: 05 Aug 2016, 23:32
Has liked: 17 times
Been liked: 164 times
FAF User Name: brutus5000

Re: FAF Game Lobby Repo

Postby Ryan_Ryan_Ryan » 18 Aug 2017, 11:26

A follow up question.

https://github.com/FAForever/ice-adapter

I see in the logs that everyone is connecting through a proxy that is running on my machine when the game or lobby starts. Is the ICE Adapter repo being used or is the proxy something else?

Code: Select all
Line 754: info: ConnectToPeer (name=IkarosDC,      uid=204248, address=127.0.0.1:54582, USE PROXY)
Line 760: info: ConnectToPeer (name=Sloth,         uid=38166,  address=127.0.0.1:54583, USE PROXY)
Line 765: info: ConnectToPeer (name=kukuczka,      uid=27975,  address=127.0.0.1:54584, USE PROXY)
Line 770: info: ConnectToPeer (name=KaworuKun,     uid=217349, address=127.0.0.1:54585, USE PROXY)
Line 784: info: ConnectToPeer (name=Sunaiac,       uid=150038, address=127.0.0.1:54586, USE PROXY)
Line 791: info: ConnectToPeer (name=Lout_is_taken, uid=214622, address=127.0.0.1:54587, USE PROXY)
Line 828: info: ConnectToPeer (name=Evil_in_Me,    uid=35369,  address=127.0.0.1:49547, USE PROXY)
Line 862: info: ConnectToPeer (name=lastman88,     uid=35363,  address=127.0.0.1:49548, USE PROXY)
Ryan_Ryan_Ryan
 
Posts: 6
Joined: 16 Aug 2017, 03:08
Has liked: 0 time
Been liked: 2 times
FAF User Name: Ryan_Ryan_Ryan

Re: FAF Game Lobby Repo

Postby Brutus5000 » 20 Aug 2017, 02:00

The ice-adapter is not used on our production servers yet, it's still under development. But it is supposed to be our future networking technology.
Want to know what I'm working on? Browse my public task queue
Brutus5000
Avatar-of-War
 
Posts: 169
Joined: 05 Aug 2016, 23:32
Has liked: 17 times
Been liked: 164 times
FAF User Name: brutus5000

Re: FAF Game Lobby Repo

Postby Ryan_Ryan_Ryan » 20 Aug 2017, 23:36

Thanks for the help so far. Got another question.

Where is the code for the proxy being actively used by FAF? I see that the a proxy is listed in the client code but none of the client code appears to use it.

Code: Select all
    'proxy/host': 'proxy.{host}',
    'proxy/port': 9124,
    'lobby/relay/port': 15000,
    'lobby/host': 'lobby.{host}',
    'lobby/port': 8001,


Code: Select all
Search "proxy/port" (1 hit in 1 file)
    ...\client-devop\src\config\production.py
    'proxy/port': 9124,


I want to read through to code to see how it works and if some edge cases I think of are covered or would lead to a disconnect.
Ryan_Ryan_Ryan
 
Posts: 6
Joined: 16 Aug 2017, 03:08
Has liked: 0 time
Been liked: 2 times
FAF User Name: Ryan_Ryan_Ryan

Re: FAF Game Lobby Repo

Postby Brutus5000 » 21 Aug 2017, 18:05

I'm no expert on the network stuff. We are using a dockered version of Coturn for some parts of the routing. To be precise, we are running this docker version: https://github.com/bprodoehl/docker-turnserver.

The rest (client-side) is implemented in the python client (repository "client"). But I don't know the details.
Want to know what I'm working on? Browse my public task queue
Brutus5000
Avatar-of-War
 
Posts: 169
Joined: 05 Aug 2016, 23:32
Has liked: 17 times
Been liked: 164 times
FAF User Name: brutus5000

Re: FAF Game Lobby Repo

Postby Ryan_Ryan_Ryan » 27 Aug 2017, 07:27

I keep having a problem where I will "disconnect" with another player mid game. This locks the game up until one of the two of us quits. I know my internet connection is fine, but this happens to me regularly.

I've been looking into this problem to try to figure out why it happens.

Take the most recent game. 12 Players.
Code: Select all
Name / IP:Port / UID
MrHighCake          61.108.15.94:6112    193533
WarbosGorgutz        37.58.123.3:52340   196906
onkel_mihail         37.58.123.3:61424   169407
Ryan_Ryan_Ryan - - - (me)
aliengfx             37.58.123.3:50038   190575
jebacsuczki       159.205.153.53:6112     68429
Nerfy             77.172.209.155:54476    93547
Xenix             37.146.147.229:6112    209320
yellowcolorado31   68.11.145.168:6112    145905
FRAGMASTER99         37.58.123.3:58270   176589
Zelen            194.165.121.117:6112    158549
SWEDGE               68.108.8.17:6112    164688


This game I disconnected with aliengfx who is proxied through the faf servers. Using Wireshark, I recorded a trace of joining the lobby and playing the game. After alt-f4ing during the lock I stopped and investigated the trace. The UDP stream between me and aliengfx continued normally until the end of the game (disconnect) when this happened.

Image

After these ICMP responses from the server, I get no more information coming from aliengfx. Scrolling down shows a continuous UDP stream from me to the server, which eventually ends with this.

Image

ICMP Destination Unreachable (Port unreachable).

If aliengfx is connected by proxy to everyone through the FAF servers, then logically, he should either reach the FAF server for all players or for no players. It shouldn't be possible that only packets directed towards me fail to reach the FAF server. If aliengfx can still reach other players ingame through his FAF proxy, then the ICMP message directed back at me could be indicative of some problem on the server. I have not had time to look into the server code, so I don't know what could be the root cause of the problem.

I'll still keep looking into this bug to try to figure out the root cause, but I'm posting this because maybe other people who see can give me some insight into the problem.
Ryan_Ryan_Ryan
 
Posts: 6
Joined: 16 Aug 2017, 03:08
Has liked: 0 time
Been liked: 2 times
FAF User Name: Ryan_Ryan_Ryan

Re: FAF Game Lobby Repo

Postby ozonex » 27 Aug 2017, 12:02

I have had this problem for a long time. Sometimes it disconnects me with 1-2 people in the middle of the game, always with whom the connection is through a proxy. From what I've noticed, I have a problem with people from other European countries, but never with people from my own. I also did not notice that the problem was with the US people. Usually by proxy I am connected to 1-2 people in the game. I notice this after the connection to some people takes much longer, and when I lose connection, it is only with these people. Maybe someone will finally fix this.
FAF Map Editor Alpha v0.604 > Get it now!
User avatar
ozonex
Priest
 
Posts: 353
Joined: 16 Feb 2012, 20:11
Location: Poland
Has liked: 188 times
Been liked: 245 times
FAF User Name: ozonex

Re: FAF Game Lobby Repo

Postby Ryan_Ryan_Ryan » 03 Sep 2017, 21:19

Is there a way I can get access to a snippet of the FAF Server Logs? Specifically, I'm looking for log outputs of functions like this:

Code: Select all
    async def EstablishConnection(self, peer_connection: "GameConnection"):
        """
        Attempt to establish a full duplex UDP connection
        between self and peer.

        :param peer_connection: Client to connect to
        :return: (own_addr, remote_addr)
        """
        own = self.connectivity.result  # type: ConnectivityResult
        peer = peer_connection.connectivity.result  # type: ConnectivityResult
        if peer.state == ConnectivityState.PUBLIC \
                and own.state == ConnectivityState.PUBLIC:
[b]            self._logger.debug("Connecting %s to host %s directly", self, peer_connection)[/b]
            return own.addr, peer.addr
        elif peer.state == ConnectivityState.STUN or own.state == ConnectivityState.STUN:
[b]            self._logger.debug("Connecting %s to host %s using STUN", self, peer_connection)[/b]
            (own_addr, peer_addr) = await self.STUN(peer_connection)
            if peer_addr is None or own_addr is None:
[b]                self._logger.debug("STUN between %s %s failed", self, peer_connection)
                self._logger.debug("Resolved addresses: %s, %s", peer_addr, own_addr)[/b]
                if self.player.id < peer_connection.player.id and own.state == ConnectivityState.STUN:
                    return await self.TURN(peer_connection)
                elif peer.state == ConnectivityState.STUN:
                    return tuple(reversed(await peer_connection.TURN(self)))
            else:
                return own_addr, peer_addr
[b]        self._logger.error("Connection blocked")[/b]


I'm not familiar with the networking stuff and it is tough to piece together what lines like this
Code: Select all
server, protocol = await self.loop.create_datagram_endpoint(lambda: NatServerProtocol(address, self._futures), address)
are actually doing without the ability to debug and watch variables. Seeing a chunk of the log file would go a long way towards tracking what data is actually moving through the networking code.
Ryan_Ryan_Ryan
 
Posts: 6
Joined: 16 Aug 2017, 03:08
Has liked: 0 time
Been liked: 2 times
FAF User Name: Ryan_Ryan_Ryan

Re: FAF Game Lobby Repo

Postby Ryan_Ryan_Ryan » 04 Sep 2017, 01:10

In addition to the above, I can't find any reference to https://github.com/bprodoehl/docker-turnserver in the server repository.

This has me confused because I can't figure out the interface between docker-turnserver and the server repo code.
Ryan_Ryan_Ryan
 
Posts: 6
Joined: 16 Aug 2017, 03:08
Has liked: 0 time
Been liked: 2 times
FAF User Name: Ryan_Ryan_Ryan

Next

Return to Contributors

Who is online

Users browsing this forum: No registered users and 1 guest