[SOLVED] Multiplayer lag with more than 2 players

Anything that prevents you from playing the game properly. Do you have issues playing for the game, downloading it or successfully running it on your computer? Let us know here.
Post Reply
kennux
Manual Inserter
Manual Inserter
Posts: 2
Joined: Wed Mar 16, 2016 11:50 pm
Contact:

[SOLVED] Multiplayer lag with more than 2 players

Post by kennux »

Hello,

I just recently bought factorio and i started playing it with a friend.
At the beginning anything was working well (No lag / desync at all for about 30 hours of gameplay), but when a third player joins the game started lagging heavily (debug mode shows a watch next to the ping, so it seems to be something related to the lockstep buffer).

We switched from playing via tunngle to a linux dedicated / headless server (located in a datacenter).
All players and the server are located in the same country and all got a ping of ~40ms to the gameserver.
At the beginning anything was working well with the dedicated server. All 3 players were connected and there was no lag at all (also, the map download was very fast).

But soon, maybe 30 minutes after all players joined the lagging started again.

I did some network monitoring while testing the dedicated server.
At the beginning when everything was fine i had about 4kb/s upstream.
When it started lagging this suddenly jumps up to 100% upload usage of my connection (60kb/s).

We tried changing the latency and enable / disable the peer connections. But nothing helped.
Something really strange i also noticed is that i can reproduce this lag (Stopwatch in debug mode) by connecting to the same server with 2 different computers from my home internet connection.
If i just join with computer 1, all is well. Map download is very fast and there is no lag at all.
When i start connecting with computer 2 the map download is incredibly slow (from 350kb/s down to ~15kb/s) and as soon as im ingame it starts lagging heavily on both clients.

I checked all physical ethernet connections and tested my connection for packet loss as those were my first 2 ideas what could cause this, but thats not the reason.
Does anybody have an idea what to do to solve this problem?

Edit://

Problem solved! Netgear routers have a "DDoS Protection" enabled on default which limited udp-packets to max 60 per second. Disabling it fixed it :)
Last edited by kennux on Sat Mar 19, 2016 3:52 pm, edited 2 times in total.

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3700
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Multiplayer lag with more than 2 players

Post by DaveMcW »

Did you give each computer a different port?

kennux
Manual Inserter
Manual Inserter
Posts: 2
Joined: Wed Mar 16, 2016 11:50 pm
Contact:

Re: Multiplayer lag with more than 2 players

Post by kennux »

Do the clients need different ports?
They are behind NAT. I tried portforwarding the standard port when we were playing with 3 players but that didnt change anything for the lagging.

I also just rerun the test with 2 computers and now it seems to work, but both clients show pings of 0ms even though they are connected to a dedicated server that doesnt use P2P (both computers are on the same network locally).
It seems like it uses P2P regardless of the config.

WalkinTalkinHawkin
Burner Inserter
Burner Inserter
Posts: 14
Joined: Tue Apr 05, 2016 3:01 pm
Contact:

Re: [SOLVED] Multiplayer lag with more than 2 players

Post by WalkinTalkinHawkin »

kennux wrote:Hello,

I just recently bought factorio and i started playing it with a friend.
At the beginning anything was working well (No lag / desync at all for about 30 hours of gameplay), but when a third player joins the game started lagging heavily (debug mode shows a watch next to the ping, so it seems to be something related to the lockstep buffer).

We switched from playing via tunngle to a linux dedicated / headless server (located in a datacenter).
All players and the server are located in the same country and all got a ping of ~40ms to the gameserver.
At the beginning anything was working well with the dedicated server. All 3 players were connected and there was no lag at all (also, the map download was very fast).

But soon, maybe 30 minutes after all players joined the lagging started again.

I did some network monitoring while testing the dedicated server.
At the beginning when everything was fine i had about 4kb/s upstream.
When it started lagging this suddenly jumps up to 100% upload usage of my connection (60kb/s).

We tried changing the latency and enable / disable the peer connections. But nothing helped.
Something really strange i also noticed is that i can reproduce this lag (Stopwatch in debug mode) by connecting to the same server with 2 different computers from my home internet connection.
If i just join with computer 1, all is well. Map download is very fast and there is no lag at all.
When i start connecting with computer 2 the map download is incredibly slow (from 350kb/s down to ~15kb/s) and as soon as im ingame it starts lagging heavily on both clients.

I checked all physical ethernet connections and tested my connection for packet loss as those were my first 2 ideas what could cause this, but thats not the reason.
Does anybody have an idea what to do to solve this problem?

Edit://

Problem solved! Netgear routers have a "DDoS Protection" enabled on default which limited udp-packets to max 60 per second. Disabling it fixed it :)
I feel like this might be related to the issue people are having here viewtopic.php?f=49&t=23353 Could you give some more information on how you fixed this, I have also got a netgear router so im wondering if that may be the big issue between us?

Paned
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sun Mar 13, 2016 10:02 am
Contact:

Re: [SOLVED] Multiplayer lag with more than 2 players

Post by Paned »

Hmmh that does not solve our Problem :( we got the same Problem here..
we found no solution till now :(

edit:

Oh - i think it is my connection
Every server i join lags - if i leave it works for everyone fine
i got DSL with 1000kBit/s down and upstream is that to low for this game? 0.o

Rseding91
Factorio Staff
Factorio Staff
Posts: 13219
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [SOLVED] Multiplayer lag with more than 2 players

Post by Rseding91 »

Paned wrote:Hmmh that does not solve our Problem :( we got the same Problem here..
we found no solution till now :(

edit:

Oh - i think it is my connection
Every server i join lags - if i leave it works for everyone fine
i got DSL with 1000kBit/s down and upstream is that to low for this game? 0.o
Not really. For one or two people maybe that's fine but as you get more players you need more bandwidth and you've only got 125 KB/s both ways.
If you want to get ahold of me I'm almost always on Discord.

Paned
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sun Mar 13, 2016 10:02 am
Contact:

Re: [SOLVED] Multiplayer lag with more than 2 players

Post by Paned »

Hmh that is because of the p2p connection?
Other games like Minecraft or Space Engineers or something like that - i think they got more data to deliver? - work very well. (tested with 6 people in SE and hundreds in MC)

bergi9
Long Handed Inserter
Long Handed Inserter
Posts: 51
Joined: Tue Jun 07, 2016 7:54 am
Contact:

Re: [SOLVED] Multiplayer lag with more than 2 players

Post by bergi9 »

kennux wrote:Problem solved! Netgear routers have a "DDoS Protection" enabled on default which limited udp-packets to max 60 per second. Disabling it fixed it :)
how about this?
Packet-loss/-drop may factorio send more (duplicated?) packets like tcp does which increase the bandwidth usage. (blame me if it's not correct)
Paned wrote:Every server i join lags - if i leave it works for everyone fine
i got DSL with 1000kBit/s down and upstream is that to low for this game? 0.o
this should be enough for >10 players since 2 players consume ~2kb/s in both way.
perhaps your computer is not fast enough to keep up with other players (posting your cpu specs would be helpful).
Paned wrote:Other games like Minecraft or Space Engineers or something like that - i think they got more data to deliver? - work very well. (tested with 6 people in SE and hundreds in MC)
don't compare factorio with these game. they have different netcode logic.

Paned
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sun Mar 13, 2016 10:02 am
Contact:

Re: [SOLVED] Multiplayer lag with more than 2 players

Post by Paned »

I got I7 3930K, 16GB ram, Asus Rampage Extreme IV and an AMD R9 290 <- i think this should be fine for factorio XD

I know about the DDoS Protection - i read it in this thread that is because i thought that i have found the problem.. but no. that is not the reason for it. (it makes no difference if it is enabled or not to me)
My firewall has a protection from DDoS too (ICMP settings) - i also deactivated it to test if it is better
no changes

I do not know where i should search the problem

Edit:

The Download of the Map with two Players playing on runs with 120kB/s <- at the game everything is lagging
If there are 6 Players at the Map and i start Downloading the download speed goes down to a view B/s <- not tested just kicked the factorio process.. 3 hours for 4 MB is really long :D

Edit2:
I actually got a Ping of 53ms with TTL of 6 my Packet Lost is at 5% (that is a really good number for the connection i got.. view days ago i got 30% of Packet Lost - but at the end that makes no difference of the lagging factorio multiplayer)

Edit3:
Other server (lagging too):
Ping: 49ms TTL 56 PL: 9%

bergi9
Long Handed Inserter
Long Handed Inserter
Posts: 51
Joined: Tue Jun 07, 2016 7:54 am
Contact:

Re: [SOLVED] Multiplayer lag with more than 2 players

Post by bergi9 »

Paned wrote:Edit2:
I actually got a Ping of 53ms with TTL of 6 my Packet Lost is at 5% (that is a really good number for the connection i got.. view days ago i got 30% of Packet Lost - but at the end that makes no difference of the lagging factorio multiplayer)

Edit3:
Other server (lagging too):
Ping: 49ms TTL 56 PL: 9%
You checked the packetloss with teamspeak right?

I have one friend who's lagging on factorio too with his 100mbits internet connection (cable). He's not only lagging in factorio, as well on other games/softwares which works on udp, so his result is that his ISP don't provide a good udp support. He has called his ISP often, and they never fixed it. Only at good days all connections with udp works fine.

You can ask your ISP if they have UDP control (limitier).

I asume you don't live in a city but live on country with low connection speed?

The story of my grandpa was great. He live on a place around forest on a mountain. Normally his connection speed is around 1.5mbits. Since he changed to IP-based DSL connection his ISP says he can have 6mbits but never reach that speed, only 3mbps with a lot connection breaks, the AVM box reports up to 15k errors per hour. The technican of ISP came to every house where he lives to check why on all dial lines around 10km of his house has 800kHz interference. Found that the psu of grandpa's satellite receiver are interferencing the dial lines. After replacing his satellite receiver his connection breaks solved and his speed as well all of his neighbours internet speed increased (doubled) to 6mbits. I laughed so hard.

Paned
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sun Mar 13, 2016 10:02 am
Contact:

Re: [SOLVED] Multiplayer lag with more than 2 players

Post by Paned »

No it was not teamspeak.
I directly pinged the game host (server).

Teamspeak has no interaction with the game host.


I got a satellite receiver too but it has no connection to my network. But i dont know if a neighbor has one that is connected.. we got something around 300 people in our village - i dont like to ask everyone if he has a receiver connected and if he like to disconnect for testing the result.

Edit:

i called my provider about the UDP limitation
They told me that they had a view years ago the plan to do that. but they decided not to do it. There is no Limitation for the UDP Connection.

bergi9
Long Handed Inserter
Long Handed Inserter
Posts: 51
Joined: Tue Jun 07, 2016 7:54 am
Contact:

Re: [SOLVED] Multiplayer lag with more than 2 players

Post by bergi9 »

You have a ping of ~50ms and over 5% packetloss? For me the latency is good for your connection but the packetloss is too much. Perhaps you can check your router if it reports errors.

Me and my Grandpa have a router from AVM (in germany called Fritz!Box). This can show nearly every details include the amount of errors.
Error Counter at bottom of an AVM router
Paned wrote:I got a satellite receiver too but it has no connection to my network. But i dont know if a neighbor has one that is connected.. we got something around 300 people in our village - i dont like to ask everyone if he has a receiver connected and if he like to disconnect for testing the result.
It doesn't need to be a satellite receiver, it can be any broken device that can interference the dial lines through the power line (is really rare to have the interferences). Before you ask your neighbour, measure the dial lines if there are no interferences.

Paned
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sun Mar 13, 2016 10:02 am
Contact:

Re: [SOLVED] Multiplayer lag with more than 2 players

Post by Paned »

The Package Lost comes from the Provider - in Germany called Telekom ;-)
I had view month ago Package Lost about 80% so i am really happy with 5%. All other Games work very well with that - why can Factorio not handle that too?

edit:
Collisions: 0
line loss: down - 36.5 db, up - 22.5 db
signal-to-noise ratio: down - 18.6 db, up - 17.0 db

bk5115545
Fast Inserter
Fast Inserter
Posts: 123
Joined: Sun Apr 03, 2016 7:00 pm
Contact:

Re: [SOLVED] Multiplayer lag with more than 2 players

Post by bk5115545 »

I skimmed over the thread so forgive me if I missed it but I don't see what version of the game you're running.

The network update in 0.14 really changed how the game copes with imperfect networks and lowers bandwidth requirements overall. If you're not on 0.14 (maybe because of mods being outdated) then please update and see if the game runs smoother.

Glad you fixed it but it's worth mentioning that 0.14 lets the game cope with packet loss, variable ping, and non-constant bandwidth very VERY well.

Paned
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sun Mar 13, 2016 10:02 am
Contact:

Re: [SOLVED] Multiplayer lag with more than 2 players

Post by Paned »

Ah thank you for that Information. I got the Version that is available at Steam - 0.13

Edit:

i tested it now with 0.14 - THAT IS AWESOME! :D
Thank you!

Hmmh is there a Date when this Update will be available at Steam?
My buddies don't like to update the Server manually XD

bk5115545
Fast Inserter
Fast Inserter
Posts: 123
Joined: Sun Apr 03, 2016 7:00 pm
Contact:

Re: [SOLVED] Multiplayer lag with more than 2 players

Post by bk5115545 »

Sometime soon-ish. 0.14 is pretty much only the networking overhaul and I believe 0.15 is HD textures.
Probably either 0.14 or 0.15 will be pronounced version 1.0 eventually as well.

The Fact-Fridays are super informative. Here's the source for the above https://www.factorio.com/blog/post/fff-151.

orzelek
Smart Inserter
Smart Inserter
Posts: 3911
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: [SOLVED] Multiplayer lag with more than 2 players

Post by orzelek »

Paned wrote:Ah thank you for that Information. I got the Version that is available at Steam - 0.13

Edit:

i tested it now with 0.14 - THAT IS AWESOME! :D
Thank you!

Hmmh is there a Date when this Update will be available at Steam?
My buddies don't like to update the Server manually XD
You can get it on steam easily.
In game properties go to betas tab and select experimental-0.14 there or one of specific versions.

BlueRaja
Burner Inserter
Burner Inserter
Posts: 9
Joined: Sun Mar 20, 2016 8:04 am
Contact:

Re: [SOLVED] Multiplayer lag with more than 2 players

Post by BlueRaja »

Since this is one of the top posts on google:
Try UPS-up mod. It made Farlands mod (which is ridiculously laggy with a large base) playable for me and my friend.

Post Reply

Return to “Technical Help”