Page 1 of 1

Multiplayer Lag

Posted: Tue Nov 12, 2024 7:19 am
by mblue
Hi,

When I run Factorio (Space Age) solo it has no performance issues at all.
The moment I invite my friend to join the game the lag issues start to happen after +/- 30 minutes of gameplay
We both see no significant raise in CPU usage on our pc's and our internet speeds are around 900 Mbps (according the speed tests)
His PC is more upgraded, outperforming my Game Laptop, but normally we can run all type of games without lag issues (e.g. Total Warhammer 3 field battles are no problem)
My Game Laptop:
Videocard: Geforce GTX 1080
VRAM: 32 GB

Main events that cause lag happen when the non-host:
1. Is driving a vehicle mainly exploring new territority
2. Returns to base where the bots are active (we have around 1k bots atm)

So we have an idea what are are the causes, but anybody has an idea how to solve it?

Cheers

Re: Multiplayer Lag

Posted: Wed Nov 13, 2024 1:47 pm
by meganothing
"Factorio uses UDP only. The game builds its own "reliable delivery" layer built on UDP to deal with packet loss and reordering issues. Make sure you configure your router's port forwarding correctly for port 34197. Make sure your router does not randomize the source port on packets outbound from 34197."

Didn't know routers would do that, I stumbled on this sentence when checking whether factorio uses UDP. This is one thing you might check.

The other thing is testing if your network connection is problematic in some way that specifically hurts factorios multiplayer and not the multiplayer of other games as they use a different method of synchronizing. Generally a network connection could have problems with speed, high packet loss or latency.

My guess would be that factorio is susceptible to high packet loss, and ping can be used to test that. To also test latency you might use a tool like ndt. https://netbeez.net/blog/testing-packet-loss/ has a list of linux command line tools, for windows you would have to find out yourself which tools would be useful.

Re: Multiplayer Lag

Posted: Wed Nov 13, 2024 4:36 pm
by mblue
So I need additional tools/settins to get multiplayer stable… what I dont get why is it OK for like 30 minutes and causes lags after what is port forwarding adding as a benefit?

Re: Multiplayer Lag

Posted: Thu Nov 14, 2024 5:59 pm
by meganothing
mblue wrote:
Wed Nov 13, 2024 4:36 pm
So I need additional tools/settins to get multiplayer stable… what I dont get why is it OK for like 30 minutes and causes lags after what is port forwarding adding as a benefit?
If this were a widespread phenomenon someone else might find out the cause. And it would also suggest that factorio has at least part of the blame to carry.
But if only you get that problem, it is more likely your specific internet setup. And only you have the means to dissect it if your groups internet connection is part of the problem.
Wube might have better ideas to get at the bottom of it (sometimes logfiles provide more info), I don't know.

Another idea: If the friends you are playing with are in your local area you could invite them over and see if the problem is still there if you are in a local LAN together. If not, one by one go back to your homes in further sessions and see when the problem re-emerges. This could give a hint at the connection that is the troublemaker (if it is your internet after all).

PS: Just a wild guess: What CPU or Laptop do you have? A CPU that is too old could be fast enough but not have enough memory bandwith or a cache too small to host larger Factorio bases. (Just a wild guess)

Re: Multiplayer Lag

Posted: Thu Nov 14, 2024 8:59 pm
by mblue
That is too easy... the other games we play are flawless, no lags or whatever.
We even started a new factorio game to see on both our pc's and had the same issue no matter who was the host.

I mean we have no issues with like Total Warhammer 3 field battles , 7 days to die spawning in multiple zombies that all runs smooth.
But factorio Multiplayer is just messed up, solo it runs flawless

My laptop: Processor Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz, 3696 MHz, 6 core('s), 12 logic processor(s)

Re: Multiplayer Lag

Posted: Fri Nov 15, 2024 12:07 am
by fwyrl
Your router or ISP (or theirs) might also be flagging this as an attempted DDoS attack because Factorio traffic doesn't look much like normal MP game packets, and the protocall they use is also used by bad actors attempting to perform a DDoS attack (most likely for the same reason Factorio uses it, actually!)

You should check your routers aren't blocking the traffic as malicious traffic, and check with your ISP if your routers logs are clear.

This would also explain the 30 minute time window - the DDoS detection might be on a rolling 30 minute window, for instance.

It could also just be some networking equipment overheating too - I made my old modem too hot to touch the same way before I upgraded it. Wifi adapters can have the same thing happen (though it mostly effects external wifi adapters).

Re: Multiplayer Lag

Posted: Fri Nov 15, 2024 3:54 am
by mblue
Forget the 30 minutes it can be random, we tried several cases and sometimes lag kicks in within 5 minutes even within a new game.

We both have a monitoring app on our phone with smart application to check modem and wifi spots if there are issues, no notifications.

And we both play with ethernet cable. I checked both TCP and UDP download and upload speeds. Worse case scenario is that my upload speed UDP goes to 400 Mbps (if everybody of the family is on the net) but that still should be sufficient to normally play the game.

I mean we play literally every other game in peek hours without any problem.

If Factorio protocol really uses DDOS protocol for traffic isnt the fault than on their side?

I have contacted the Factorio support by mail and will continue do so till they have a fix or share an acceptable timeline for the fix.

Re: Multiplayer Lag

Posted: Fri Nov 15, 2024 3:56 pm
by meganothing
mblue wrote:
Fri Nov 15, 2024 3:54 am
...
I mean we play literally every other game in peek hours without any problem.
I already explained that that could be the result of the unusual way Factorio handles multiplayer synchronization. Just saying, if that were actually the **main** reason for your problems, then there would be no fix realistically possible.
If Factorio protocol really uses DDOS protocol for traffic isnt the fault than on their side?
The IEEE does not standardize some protocol to be used by DDOS and then providers block that because the bad boys dilligently follow the protocol :D . In other words, using "protocol" to call a general method of communication may be a bit misleading. The previous poster probably just meant to say that the UDP protocol is often used by DDOS, but that doesn't mean UDP isn't a legit protocol used for a lot of things.

DDOS attacks do not follow any rules. They get detected by guesswork how a DDOS should look like, with the inbuilt possibility for false positives. IF Factorio traffic by accident looks like what some provider thinks could be a DDOS attack (without violating any common sense rules like occupying the whole bandwidth) then it isn't a fault of Wube but of the heuristic used by the provider. The provider would have to be contacted (or even changed)

I am not saying that anything above is the source of your problems. Just that if it were one of the above then the solution would be something different than a patch.