Factorio

Factorio

View Stats:
Huge Lag
Hello everyone,

I'm experiencing an increasingly intense lag problem...
Initially, the game slowed down after each autosave, for a few minutes. I decided to space out the duration between each autosave, but recently, the game lags all the time : it is very slow at base, and becomes almost unplayable following a saving operation (automatic or not).
At this point, I can no longer play Factorio... :(
Any idea to solve the problem?
< >
Showing 1-10 of 10 comments
Fel Jan 30 @ 1:02pm 
Press F5 and take a screenshot to post here if you don't understand all of the text that shows up.
The large amount of informations are debug infos and are pretty key in figuring out what is causing the "lag".

Just to be clear though, it's (most likely at least) not technically lag but the game's performances going down, usually because at least one thing is using a lot of resources.
What fel said. But also it does not hurt if you post a log file. The logfile has your pc specs and what settings you are using and a bunch of other stuff that might seem like unrelated things at first that could give a clue on what the problem is.

I think there is a pinned topic about logfiles and where to find them if you need help locating them.
Briochus Jan 30 @ 1:30pm 
Thank you for your answers.

Here is the screenshot : http://www.image-heberg.fr/files/17382722903234917882.jpg
Fel Jan 30 @ 1:44pm 
Your "flip" seems a bit high, maybe try toggling it off in the graphics settings (second column, last checkbox) to see if it helps.
I don't see anything obvious other than that, at least.
Originally posted by Briochus:
Thank you for your answers.

Here is the screenshot : http://www.image-heberg.fr/files/17382722903234917882.jpg
Strange things I noticed. Update is less than 4 milliseconds yet ups is 29.7 which somehow matches exactly with fps. I thought the game engine was capable of having lower fps than ups.

All the rendering numbers look normal except flip.

After searching the forums for similar issues the next thing I would try after what Fel suggested is turning off steam overlay to see if that fixes it. You can do that by right clicking the game on your steam library and then selecting properties. And right at the top should be a switch to turn off steam overlay.
There's a new thing in Steam which could be taxing your system. It could hit it rather hard.

Game Recording

Check your Steam settings for the game. In the same menu as the overlay, there's one for Game Recording. Simply turn it off for now. It's going to be using quite a few resources of both the CPU and the disk storage, possibly also a hit to the GPU if it's using an encoding your card is set to handle. Without the log file, and system specs from it, can't tell if that's a big enough hit to cause the problem. Turning it off, however, is a sure way to see if it is part of the problem.
RiO Feb 3 @ 10:26am 
Originally posted by Fel:
Your "flip" seems a bit high, maybe try toggling it off in the graphics settings (second column, last checkbox) to see if it helps.
I don't see anything obvious other than that, at least.


Originally posted by PunCrathod:
Originally posted by Briochus:
Thank you for your answers.

Here is the screenshot : http://www.image-heberg.fr/files/17382722903234917882.jpg
Strange things I noticed. Update is less than 4 milliseconds yet ups is 29.7 which somehow matches exactly with fps. I thought the game engine was capable of having lower fps than ups.

All the rendering numbers look normal except flip.

After searching the forums for similar issues the next thing I would try after what Fel suggested is turning off steam overlay to see if that fixes it. You can do that by right clicking the game on your steam library and then selecting properties. And right at the top should be a switch to turn off steam overlay.

Draw engine is hitting between 8 and 11ms per frame.
Which worst-case leaves 5ms frame budget for game logic, assuming the game logic and draw engine are not parallelized.

This could put the game at the cusp of twiddling between the 30/30 FPS/UPS decimation and the 60/60 standard, where it continuously 'hits' and then 'just misses' the boundary value. Which would neatly explain why flip is oscallating between 20~30ms and a full 59~60ms, where the latter is another full frame miss.

Flip-waiting is just everything halting until the next vsync. Yes. Even if you're not running exclusive full-screen. That comes courtesy of a (relatively new to some, no doubt) feature called MPO - aka Multi Planar Overlay - which allows the GPU to directly compose multiple layers of content and allows programs that use DX11+ operating in certain flip modes* (which includes the one used by Factorio) to be rendered without the desktop compositor doing any actual compositing. Instead the compositing goes directly through the GPU, and uses the real vsync. (Corollary: this also means you get real tearing without vsync...)

As for what could be causing that:
My money is on old video drivers.

Specifically, some Nvidia and AMD driver revisions have documented problems with the water shaders used by Factorio 2.0 Space Age on Gleba. It's known to absolutely tank FPS on Gleba, when you're affected - ranging from 40 FPS on high-end cards to 15 FPS on low end cards.
Assuming other shaders were written along similar lines (e.g. the oil ocean shader, maybe?) that same problem might crop up on other planets as well.

I might also suspect a bad MPO implementation in the driver. But that's unlikely, given that back on my old machine - which was equipped with a Geforce 960 card, this was already stabilized technology.



*) Some other fun knowledge: if you enable the "fullscreen optimizations" option in Windows 10 and 11, then DX11 / DX12 exclusive fullscreen mode as requested by programs, will not actually be exclusive anymore when the driver supports MPO. If it does, you get a 'borderless windowed' non-exclusive render output -- which to the software in question will behave basically the same as actual exclusive mode. But has a few very significant performance benefits for when you want to ALT-TAB out of said fullscreen application.
Last edited by RiO; Feb 4 @ 10:14am
As far as I was aware the only part of rendering that needs to be synchronized with updates is the prepare step where the game collects all the information from the update for all the things that happen to be on screen. The rest should be done parallel. I have had situations where factorio had under 25fps but 60ups because of a bug in xorg and firefox. Which only manifested when vsync was on. So clearly factorio ups should not be affected by flip.

Which is why I suspected steam overlay. Overlays usually halt the rest of the program during their rendering to avoid race conditions. And those are usually hooked to run when the program calls flip. Wouldn't be the first time steam overlay caused fps issues on a game.
RiO Feb 4 @ 10:14am 
Originally posted by PunCrathod:
Which is why I suspected steam overlay. Overlays usually halt the rest of the program during their rendering to avoid race conditions. And those are usually hooked to run when the program calls flip. Wouldn't be the first time steam overlay caused fps issues on a game.

True. Had plenty of issues like that myself in the past. That and the Steam overlay flat out corrupting the state of the rendering pipe for some games, causing complete instability.

It's why I keep the damned thing switched off, come hell or high water. Valve would literally have to re-engineer Steam to have games not be able to start without it at all, for me to re-enable it.

Originally posted by PunCrathod:
So clearly factorio ups should not be affected by flip.
The thing I'm wondering: was your case under Factorio 2.0 or 1.1 ?
With everything done to the engine in-between, Wube might also have accidentally done something that ended up directly or indirectly tying UPS back to FPS -- or maybe the heuristics used to decide when to throttle back to hit the 50% decimation were changed at some point. (I mean -- they probably had to touch that code to lock it into 30 FPS for the Switch, right?)

Either way - the seriously high draw engine time and high flip time means something in the actual rendering code must be lagging out. It's not the actual game state logic, since that amounts to a pittance of load.

The only other explanation is that the real culprit is different still; and is in a part of the game engine that isn't tracked by the ingame debug overlay stats. In which case you'd probably need a debugger/profiler attached to figure out what is happening.
Last edited by RiO; Feb 4 @ 4:20pm
Originally posted by RiO:
The thing I'm wondering: was your case under Factorio 2.0 or 1.1 ?
Both actually. It has been a thing the whole time I have been using linux so before 1.0 and it still happened when we did a space age run with friends. Tough I am on linux so it could be that the windows version had a change that causes flip to pause the update thread too. Very unlikely but possible.
< >
Showing 1-10 of 10 comments
Per page: 1530 50