Page 1 of 1

disconnect 30 minutes into every single game

PostPosted: 05 Nov 2018, 13:13
by debtslave
Hi all, I am posting this here, to see if it might be useful to others with the same issue.

Basically my games go well, but after 10-30 minutes, it shows a screen that 1 player has disconnected. after 2 minutes they are kicked. It shows that the established connection has been cut between my pc and another pc.

This is most likely caused by ISP's using CGNAT.

You might say, try ICE-Adapter. It is basically a Application, that takes all FAF Game data, and uses a WebRTC p2p library, to connect to peers.
This most likely will not fix my problem, as I have no trouble connecting to peers, but trouble with established connections getting cut.

So my solution is to force the FA Forever client to use a relay server, and force NO direct connections.

The FA Forever Relay server is: 148_251_238_131

To do this I created 4 windows firewall rules:
0. Block all Inbound, Block all Outbound
1. Inbound Rule > Allow, TCP, C:\Program Files (x86)\Forged Alliance Forever\FAForever.exe, Scope:148_251_238_131
2. Inbound Rule > Allow, UDP, C:\Program Files (x86)\Forged Alliance Forever\FAForever.exe, Scope:148_251_238_131
3. Outbound Rule > Allow, TCP, C:\Program Files (x86)\Forged Alliance Forever\FAForever.exe, Scope:148_251_238_131
4. Outbound Rule > Allow, UDP, C:\Program Files (x86)\Forged Alliance Forever\FAForever.exe, Scope:148_251_238_131

Then I launched ColaSoft-Capsa11Free to verify that only packets to 148_251_238_131 are occurring.
Blocked packets can also be seen at System32\LogFiles\Firewall\pfirewall.log.

So I created a test game, FinFin joined, and we played for 5 minutes with no direct connection, and my ping was much improved at 300.

If anyone else wants to try RELAY ONLY connections, this might be a good way to disable P2P direct connections.

If it works for you, please share your results.

Re: disconnect 30 minutes into every single game

PostPosted: 05 Nov 2018, 13:51
by Geosearchef
The ICE adapter will extremly likely fix your problem as it would detect the lost connection, attempt to reconnect and in case it doesnt work fall back to a relay candidate.

The solution you've presented here is indeed working, I have been privately telling this to people with constant connection problems aswell, there is only the small problem that it costs FAF money if a lot of people do that, so we might delete this thread.

(Btw., ice adapter uses no webrtc anymore ;) )

Re: disconnect 30 minutes into every single game

PostPosted: 06 Nov 2018, 12:33
by debtslave
Thank you for your reply.

Looking at the github page for Ice-Adaptor project, it shows it depends on libwebrtc. (located
What library is it using now?

The big issue with Ice-Adaptor is that the 2 main clients have no simple way to host a game using IceAdaptor.
It could be as simple as a checkbox, and the game name could be prefixed with ICE.

Secondly, I can see d0wnlord client includes faf-ice-adapter.exe, so I would assume that the clients could already transparently launch ice-adaptor to join ICE games.

Sorry that I cannot contribute to development, as I am a C and Javascript dev, and OO looks like spaghetti to me.

Re: disconnect 30 minutes into every single game

PostPosted: 06 Nov 2018, 14:55
by Geosearchef
The old (3rd) ICE adapter was written by muellni in c++, that's the ice-adapter repo. I don't understand that one either.

I have written a test server and client for debugging the adapter and after a few months of runnikg tests we finally got it working. Everything seems to be fine, it only slows down the game on slower connections. This is due to WebRTC enforcing SRTP (if I remember correctly) with DTLS 1.2 encryption. This get's an issue as FA is sending between 15-45 bytes per packet (on average) therefore with DTLS 1.2 (27 byte overhead) effectively doubling the required bandwidth.

I therefore rewrote the adaptee using a different library, in this case ice4j using Java. The adapter can be found in the FAForever/java-ice-adapter repository. Currently it looks extremly promising, there are just some problems with the python server/client.

There is also a java-ice-adapter branch in the java client using this adapter. Running two different connectivity solutions at the same time as been decided to be to complicated.

Both clients do already support ICE in a different build when connecting to a server supporting ice (e. g.

If you are interested in contributing to FAF please tell me, there are a lot of different sub projects in FAF, from reverse engineering over UID (C), all the java projects (java client (downlords client), java server, api), python client and server, python replay server to game coding (lua) and the website, discord bot, unit db and faf tools (all JS). Also the galactic war (web) frontend may need help soon.

Re: disconnect 30 minutes into every single game

PostPosted: 09 Nov 2018, 11:00
by debtslave
Hi, thank you for pointing me to Ice-Adaptor Java Repo. I installed NetBeans, Gradle Plugin, Jdk, and built client-1.0-SNAPSHOT.jar.
I made a run.bat with following content "E:\jdk\bin\java.exe -jar client-1.0-SNAPSHOT.jar" --help

It failed with:
"Exception in thread "main" java.lang.NoClassDefFoundError: net/ScenarioOptionsMessage at client.TestClient.<clinit>("

I was therefore unable to host my own Ice-Adaptor game.

I eventually found a forum post:

It says a special client has to be used: ... -win32.msi

However this means any game hosted will not be visible by the public, and only developers?

Maybe it would be possible to create a mod, named "ice4", which would include the faf-adaptor-proxy.exe, therefore making the game visible to public, as well as allowing public to connect, as they would automatically download mod files?

Re: disconnect 30 minutes into every single game

PostPosted: 09 Nov 2018, 14:34
by Geosearchef
The client you tried to build is a simple test client that manages the ice adapter, emulates the games network behaviour, tests it and sends all logging data to the server. The server software used with this is the server project in the repo you cloned. It is just intended for testing the ICE adapter. It has nothing to do with FAF, it doesn't launch the game, it 's just for isolating and running automated tests on the ice adapter without users having to do anything or having to send logs/tell what they see.

If you want to play with the adapter you will have to run an actual FAF client that supports the ICE adapter (and includes an actual build of the java-ice-adapter repo -> ice-adapter project). Downlords client currently does that using the java-ice-adapter branch. There is also a build of 0.9.0-beta-RC8, but it's marked as a draft so not visible. I also don't know if everything is running on the java test server(downlord's server running the faf-java-server).

The FAF test server is currently running the python server with an ICE branch I think, but afaik the java-api is currently somewhat broken, so the java client (downlords client) won't be able to connect.

You should though be able to use the python client with an ice branch (the release you linked should work). It should connect to the test server, log in using an existing FAF user account and any pw.

It is not possible to run ICE and non ICE clients on the same server at the same time as it requires support from the server. (not just the ICE adapter, deactivating the old connectivity code which is necessary for running with ICE breaks old non ICE clients)
There are some last issues to be investigated and we will be doing an public ICE test weekend on the production server soon. (switching the entire server to ICE only)

Why do you need it/what are you trying to achieve?

Re: disconnect 30 minutes into every single game

PostPosted: 12 Nov 2018, 17:15
by SiN
Well with original client i never had a connection loss to all players, with downlord his client in game already 2 times i lose conn to everyone while i am still in lobby and still can internet. This is weird. Not gone use the client anymore.

Re: disconnect 30 minutes into every single game

PostPosted: 18 Dec 2018, 13:25
by debtslave
Hi Developer.

Thank you for the detailed description of the project and its codebase.
Having had a look at the code, I can see how complicated it is, how interconnected it is, and why it is difficult to make changes.
If anything I have a new appreciation of the time developers must have spent to make it happen.

I think the game disconnection issues are caused by packet loss. ie in TCP this would cause Re-transmission Packets. UDP does not have this, it just fails.
Looking at my Packet Capture, I have constant re-transmission even on youtube, every few seconds.
So I assume alot of other customers are having disconnects due to terrible ISP's and the internet transport providers.

I hope that the D0wnlords 0.9.0-beta-RC8 Test Client becomes common, so that the community can transition to new technology, and increased stability and increased customer base.

Sadly I am not able to contribute to development as I am not proficient in OO and Java Libraries.
I am more used to MVC such as Angularjs. M=Simple 2d Arrays of data, C=a few lines of code that sync arrays with database server, V=Html files that bind to Models.