Multiplayer Lag

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
dani0854
Burner Inserter
Burner Inserter
Posts: 10
Joined: Thu Aug 02, 2018 6:09 pm
Contact:

Multiplayer Lag

Post by dani0854 »

I have a Debian 9 VPS on which I run Headless version of Factorio. When we just launched the server(yesterday) it was fine. My friend was having a very tiny lag but nothing special. Today is completely unplayable. It works for most of times. But some times it lags a lot. The server how ever only uses 40% of ram, and 40-50% CPU. When latency has no minimum it is around 10 for both of us. Even when it lags it is still no more than 15. When it lags there is a little clock appearing above latency. Few times It was even that bad that the server kicked us. The console was spiting something like this.
ImageImage
Most of the time it happens is when some one is running.

What could be the problem possibly be? Our pingtests to that VPS is fine. Thanks in advance.

Jap2.0
Smart Inserter
Smart Inserter
Posts: 2339
Joined: Tue Jun 20, 2017 12:02 am
Contact:

Re: Multiplayer Lag

Post by Jap2.0 »

Try typing "/c game.speed = 0.8" in the console. If this works, it means that your computers cannot keep up with the server. Otherwise, please post everything requested here. Thanks!
There are 10 types of people: those who get this joke and those who don't.

dani0854
Burner Inserter
Burner Inserter
Posts: 10
Joined: Thu Aug 02, 2018 6:09 pm
Contact:

Re: Multiplayer Lag

Post by dani0854 »

When no lag
Image



When its lagging(there also a litle clock flashing by FPS/UPS but it didnt't get in the screenshot)
Image
Attachments
mods.zip
Mods
(36.49 MiB) Downloaded 100 times
factorio-previous.log
Log
(13.77 KiB) Downloaded 76 times
factorio-current.log
Log
(24.02 KiB) Downloaded 81 times
Hohland.zip
Save
(19.19 MiB) Downloaded 75 times

Jap2.0
Smart Inserter
Smart Inserter
Posts: 2339
Joined: Tue Jun 20, 2017 12:02 am
Contact:

Re: Multiplayer Lag

Post by Jap2.0 »

I'm guessing that setting sprite resolution to normal should fix this, but (if you still have issues, or want more specific suggestions) a log from the client would help with that.
There are 10 types of people: those who get this joke and those who don't.

dani0854
Burner Inserter
Burner Inserter
Posts: 10
Joined: Thu Aug 02, 2018 6:09 pm
Contact:

Re: Multiplayer Lag

Post by dani0854 »

No, the problem was before I set Sprite resolution. I set it to very low when trying to investigate my self what happening. How ever nothing changed when I changed sprite resolution. I also changed game speed to 0.8 but it didn't help either.
Attachments
factorio-previous.log
Log
(29.48 KiB) Downloaded 110 times
factorio-current.log
Log
(17.02 KiB) Downloaded 89 times

Zavian
Smart Inserter
Smart Inserter
Posts: 1641
Joined: Thu Mar 02, 2017 2:57 am
Contact:

Re: Multiplayer Lag

Post by Zavian »

Just to add to what Jap2.0 said, on the screenshot where you are lagging, the render step is taking 30ms, and the whole update and render cycle is taking 48ms, which mean you are only getting about 20 fps. (Actually probably lower, since the server is running at 47 ups, and client will skip rendering some frames so it can keep up). Most likely reason is that the textures aren't all fitting into the video card vram. Client side logs should provide more info there.

Edit: You posted a follow up whilst I wrote the above. having looked at the logs, I think you might be memory starved (on the client machine, not the server), and windows might be swapping to and from disk. That would slow down processing each update and rendering as well. (From the screenshots, it looks like most entity updates are taking less than 10ms, but you have also had some 35ms and over 80ms).

dani0854
Burner Inserter
Burner Inserter
Posts: 10
Joined: Thu Aug 02, 2018 6:09 pm
Contact:

Re: Multiplayer Lag

Post by dani0854 »

The reson I have 20 fps is because i zoomed out. If I zoom in it goes back to normal. The issue when its laging is that fps could be fine but i will get kind of teleported my few steps in random sides. And also a lot of warnings that server console spits out(In 1st post). Also my friend has a much more powerfull PC than I do. He has the same problem.

Loewchen
Global Moderator
Global Moderator
Posts: 8285
Joined: Wed Jan 07, 2015 5:53 pm
Contact:

Re: Multiplayer Lag

Post by Loewchen »

First thing to do should be removing the minimum latency, 60 is completely nonsensical.
The lag could be explained solely by the lacking graphics hardware, the fact that it occurs at night is suggestive. You could try to run the server at a very low speed (after removing the latency setting) like .3 to rule out a CPU bottleneck on the client but I would expect a non zero jump count if this would be the lag causing issue based on the screenshot.

cbhj1
Fast Inserter
Fast Inserter
Posts: 166
Joined: Tue Apr 25, 2017 2:53 pm
Contact:

Re: Multiplayer Lag

Post by cbhj1 »

The question that sticks with me is what type of server are you using? You say VPS, sounds like it could be server node congestion, especially with how demanding Factorio is on the RAM and CPU.

dani0854
Burner Inserter
Burner Inserter
Posts: 10
Joined: Thu Aug 02, 2018 6:09 pm
Contact:

Re: Multiplayer Lag

Post by dani0854 »

CPU 2 cores 2.4GHz
RAM 4GB
How ever none of them loads more than 50%.

dani0854
Burner Inserter
Burner Inserter
Posts: 10
Joined: Thu Aug 02, 2018 6:09 pm
Contact:

Re: Multiplayer Lag

Post by dani0854 »

Also i noticed that trains often after server reboot, or sometimes even during the game, have a "bug" and say that there no path available.

nuhll
Filter Inserter
Filter Inserter
Posts: 922
Joined: Mon Apr 04, 2016 9:48 pm
Contact:

Re: Multiplayer Lag

Post by nuhll »

its just lagging.

client and or server is too slow for ur factorio.

Upgrade client/server or downgrade the game speed (as suggested above)

dani0854
Burner Inserter
Burner Inserter
Posts: 10
Joined: Thu Aug 02, 2018 6:09 pm
Contact:

Re: Multiplayer Lag

Post by dani0854 »

What kind of specs i need for server?

dani0854
Burner Inserter
Burner Inserter
Posts: 10
Joined: Thu Aug 02, 2018 6:09 pm
Contact:

Re: Multiplayer Lag

Post by dani0854 »

I don't care if client lags. I need to make sure that servers works properly. Server only uses half of its power. Could it be possible that headless version only loads one core of CPU? If VPS is not powerfull enough which specs should be optimal. Because i heard people running server on crapy vps with 1 core and 1 gb of ram and it worked fine.

dani0854
Burner Inserter
Burner Inserter
Posts: 10
Joined: Thu Aug 02, 2018 6:09 pm
Contact:

Re: Multiplayer Lag

Post by dani0854 »

Or maybe the connection problem. The VPS has 200 mbit chanel. The ping to it is 30-40 ms averege for us to that server.

Zavian
Smart Inserter
Smart Inserter
Posts: 1641
Joined: Thu Mar 02, 2017 2:57 am
Contact:

Re: Multiplayer Lag

Post by Zavian »

Most of the factorio simulation code is only single threaded, (that applies to both the server and the client), so I'm not surprised that the server is only using one cpu core.

As I've already stated, from your second screenshot above, the client is struggling to keep up. It is doing 47 updates per second, but only 20 frames per second. That means that in order to keep up with the server it is skipping rendering 25 frames per second. From the timings in that screenshot the render step is taking 30 ms. That is a lot. (On my 7 year old HD 5770 rendering normally takes around 3-4ms). It's also around 4 times as long as the render step in your first screenshot. Indeed your timings are all over the place. The game update in the first screenshot takes 17ms, but the same game update takes only 9ms in the second screenshot. Now some of the difference in render time can be explained by the fact that you have zoomed out further, which means your integrated graphics need to render more sprites. There are also more trees on screen, which again adds more sprites, but even both together shouldn't cause the render step to take 30ms.

From the log files you provided above your client machine only has 4GB or ram, some of which is going to be used by the integrated graphics. Hence my suspicion that the root cause is windows running low on available ram and swapping things to disk. There isn't anything here that makes me think the server is the problem, but there is plenty that shows the client is struggling to keep up with the server.

dani0854
Burner Inserter
Burner Inserter
Posts: 10
Joined: Thu Aug 02, 2018 6:09 pm
Contact:

Re: Multiplayer Lag

Post by dani0854 »

I don't care about client. The reason i had frezez is because of lack of CPU and RAM on my PC. I know that. That was beacause i had about 40 tabs opened in the background in google chrome which took all the RAM. That was because i was ivestegating the problem to do not with frezeez. But instead with server problem, when sometimes server were stop responfing for 10-30 second or responded just a bit. If you still think its client problem. My friends had the same problems with that server. He has 1080ti and 32 gb of RAM. I don't realy think its to do with client. My issue is not the frezez on client side. Is that the server some times respondes much slower. So i can walk up 10 meters in game without frezez and then get teleported back. My friend has the same problem. I can only see the overall loading of the server. And sometimes it jumped to 50% on 2 cores. If the game only uses 1 core for calculation then it means one of them sometimes uses more than 100%. Is there are any way to make game multithreaded? Or what are the required specs for modded headles servers on Debian 9?

Zavian
Smart Inserter
Smart Inserter
Posts: 1641
Joined: Thu Mar 02, 2017 2:57 am
Contact:

Re: Multiplayer Lag

Post by Zavian »

as far as I'm aware the server basically runs the same simulation code as the client, but without the rendering code. Given your oldish cpu (mine is even older), you will probably run into issues client side before you run into issues server side, unless that server cpu is even older than the client. So that leave network issues. If you are using wireless network, you could try switching to wired, and see if that helps. You could also run something like wireshark to log all packets at both end, and see if you can track down the issue that way. (A simpler first step might be to ping the server, and look for packet loss that way).

Regarding multithreading read this post (viewtopic.php?f=5&t=39893&start=60#p238247). Note that Harkonnen was a factorio developer at the time he wrote that post, and that belts had a major performance boosting rewrite since then.

adam_bise
Filter Inserter
Filter Inserter
Posts: 346
Joined: Fri Jun 08, 2018 10:42 pm
Contact:

Re: Multiplayer Lag

Post by adam_bise »

My friend and I had same issue (unplayable lag) on Linux headless 16.51 and never could figure out why.

But when we put the map on a windows box suddenly it was fine. You might try that if convenient.

Funny thing though, a routed player only had lag when at least one other player was online. A local player never lagged and a routed player never lagged if alone... no idea why.

Post Reply

Return to “Technical Help”