Page 1 of 1

Linux: Factorio 2.0/SA drops to 30FPS intermittently (sometimes UPS drops too)

Posted: Sat Jan 04, 2025 12:32 am
by Nyrrix
It is difficult to tell me what is going on since I can't seem to find an apparent trigger. The best I can connect it to is when I am "inactive" and then suddenly start to move again. Sorry I can't say much more on it.

System Information:
Operating System: Nobara Linux 40
KDE Plasma Version: 6.2.3
KDE Frameworks Version: 6.8.0
Qt Version: 6.7.2
Kernel Version: 6.11.9-200.fsync.fc40.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 16 × 12th Gen Intel® Core™ i5-12600KF
Memory: 31.2 GiB of RAM
Graphics Processor: NVIDIA GeForce RTX 3070/PCIe/SSE2
Manufacturer: Micro-Star International Co., Ltd.
Product Name: MS-7D98
System Version: 3.0

Attached is the log and screenshots of when my FPS is low and when it is not.

Re: Linux: Factorio 2.0/SA drops to 30FPS intermittently (sometimes UPS drops too)

Posted: Sat Jan 04, 2025 12:37 am
by Jap2.0
Try turning Vsync off; that may or may not help with the FPS issue.

In your screenshots I'm not seeing anything that indicates a drop in UPS.

Re: Linux: Factorio 2.0/SA drops to 30FPS intermittently (sometimes UPS drops too)

Posted: Sat Jan 04, 2025 1:19 am
by Nyrrix
I'll keep an eye out for when UPS drops again, but it happens less often the the FPS dropping. FPS is the main symptom.

I did try disabling VSync, but that caused no changes. I'll give it another shot. Same thing with trying to decrease the sprite resolution, no changes.

Re: Linux: Factorio 2.0/SA drops to 30FPS intermittently (sometimes UPS drops too)

Posted: Sat Jan 04, 2025 1:23 am
by Nyrrix
Additional information: When launching the game it pauses on the loading screen for a minute saying "Loading sounds..." at 95% and then produces the message "Checking for updates failed: Download failed (Resolving timed out after 60000 milliseconds)"

Screenshot attached.

I assume this is irrelevant to the main subject of my post.

Re: Linux: Factorio 2.0/SA drops to 30FPS intermittently (sometimes UPS drops too)

Posted: Sat Jan 04, 2025 1:29 am
by Nyrrix
No dice with turning VSync off.

Would X11 vs. Wayland have any baring on this issue?

Re: Linux: Factorio 2.0/SA drops to 30FPS intermittently (sometimes UPS drops too)

Posted: Sat Jan 04, 2025 11:59 am
by R060
Looking at your frame time, I can see that when your FPS drops, the most time is taken by "Flip (on)" entry. There was a setting to play with in a hidden menu (in main menu, open "Settings" while holding Ctrl+Alt, and you'll see new option "The Rest" appear). Search for "flip" while in this menu and try different options. Please report back your findings!

Re: Linux: Factorio 2.0/SA drops to 30FPS intermittently (sometimes UPS drops too)

Posted: Sat Jan 04, 2025 12:08 pm
by R060
Nyrrix wrote: Sat Jan 04, 2025 1:29 am Would X11 vs. Wayland have any baring on this issue?
I've heard Wayland servers trottle rendering for windows that not in scope (at least what they think is not in scope) by default. You can try running from pure X11 server (you don't need to install a DE for that, just Xorg, sx for running it and either something simple like awesome or dwm, or figure out how to run a game as a root window). That Flip time is seems like this behaviour for me: game just waits for image buffer to be "flipped" and can't do nothing about that.

Re: Linux: Factorio 2.0/SA drops to 30FPS intermittently (sometimes UPS drops too)

Posted: Sat Jan 04, 2025 12:16 pm
by jodokus31
Could it be autosave, which saves in the background? Setting non-blocking-save?

Re: Linux: Factorio 2.0/SA drops to 30FPS intermittently (sometimes UPS drops too)

Posted: Sat Jan 04, 2025 12:35 pm
by R060
jodokus31 wrote: Sat Jan 04, 2025 12:16 pm Could it be autosave, which saves in the background? Setting non-blocking-save?
99.(9)% not, because that would drop your UPS, not the frame rate. And i've never had an issue with it even on a much less powerfull hardware with on-CPU GPU. But i've never tested anything wayland.
(speculation) Although, I'm not sure how Wayland servers deal with forked client sockets. They should not even know about them, because the main process still talks through the same channel after all and I assume forked save-process should not touch anything except file system at all, but I just dont know if KDE does something stupid with that.

Re: Linux: Factorio 2.0/SA drops to 30FPS intermittently (sometimes UPS drops too)

Posted: Sat Jan 04, 2025 1:56 pm
by jodokus31
R060 wrote: Sat Jan 04, 2025 12:35 pm
jodokus31 wrote: Sat Jan 04, 2025 12:16 pm Could it be autosave, which saves in the background? Setting non-blocking-save?
99.(9)% not, because that would drop your UPS, not the frame rate. And i've never had an issue with it even on a much less powerfull hardware with on-CPU GPU. But i've never tested anything wayland.
(speculation) Although, I'm not sure how Wayland servers deal with forked client sockets. They should not even know about them, because the main process still talks through the same channel after all and I assume forked save-process should not touch anything except file system at all, but I just dont know if KDE does something stupid with that.
Yeah probably, was just an idea.
I also play on X11 and have no problems dipping below 60FPS. But I also don't have the setting enabled.

Maybe something related to wayland and/or NVidia

Re: Linux: Factorio 2.0/SA drops to 30FPS intermittently (sometimes UPS drops too)

Posted: Sat Jan 04, 2025 2:42 pm
by Khazul
jodokus31 wrote: Sat Jan 04, 2025 1:56 pm Maybe something related to wayland and/or NVidia
That would be my first assumption unless process monitoring shows some other processes intermittently hammering the machine.
I assume single monitor? I have heard of multi-monitor issues with wayland and nVidia GPUs which I gather nVidia are working to fix/improve.

Re: Linux: Factorio 2.0/SA drops to 30FPS intermittently (sometimes UPS drops too)

Posted: Sun Jan 05, 2025 1:49 am
by Nyrrix
R060 wrote: Sat Jan 04, 2025 11:59 am Looking at your frame time, I can see that when your FPS drops, the most time is taken by "Flip (on)" entry. There was a setting to play with in a hidden menu (in main menu, open "Settings" while holding Ctrl+Alt, and you'll see new option "The Rest" appear). Search for "flip" while in this menu and try different options. Please report back your findings!
I'll try out this Flip time when I have some time for myself to dedicate.

I will mention I got the download failed message to go away. I was trying to play Phasmophobia last night when I got a separate but related issue that said "Failed to connect to unity Gaming Services. Try restarting the game, allowing the game through your firewall, or using a VPN. Error: Network Error: Request: Timeout."

I then tested the game through a Hotspot through my phone and was able to get it functioning. I played for a while with a friend and had no connectivity issues. This lead me to today when I factory reset my router. The issue with updates for Factorio then went away.

Thanks everyone who is making suggestions! I'll be trying some of them as I play. In a larger save file (one I've been playing on my laptop originally, which had no issues) I have been able to more reliably produce the issue by walking away from the largest section of my base and then approaching it again. This seems to drop the frames by 10 to 20 fairly often, with the frames usually being below UPS (by about 5 to 10 frames less than updates). Still trying to get a screenshot.

Re: Linux: Factorio 2.0/SA drops to 30FPS intermittently (sometimes UPS drops too)

Posted: Mon Jan 13, 2025 10:44 pm
by Nyrrix
So, I've been playing around with it off and on for a few days, trying a few different things.

What seems to have finally stabalized the FPS (and by extension, the "Flip" category, still not sure what it is in any case) was changing the Steam Compatibility layer.

I was originally using "Steam Linux Runtime (Scout)" (you can access these options by right-clicking the game, selecting properties, and going to compatibility).

Trying the latest Proton version, 9.01-4, completely failed on launch. But switching to Proton Hotfix allowed the game to run and the processing time from Flip (off or on) drop from about 10 to 14 (somtimes as high as 40 when I alt-tabbed from a YouTube video or something) down to less than 0.1

FPS is as stable as the Windows version.

I do not like that the version I am running is called "Hotfix". If someone more knowledgeable about Proton could explain the differences between version, that would be super appreciated! I would also like to know what Flip is under the graphics run time in the F4 menu.

As a last note, the factorio icon looks weird in the taskbar. But I could not care less.

Re: Linux: Factorio 2.0/SA drops to 30FPS intermittently (sometimes UPS drops too)

Posted: Tue Jan 14, 2025 2:12 am
by R060
Nyrrix wrote: Mon Jan 13, 2025 10:44 pm So, I've been playing around with it off and on for a few days, trying a few different things.

What seems to have finally stabalized the FPS (and by extension, the "Flip" category, still not sure what it is in any case) was changing the Steam Compatibility layer.

I was originally using "Steam Linux Runtime (Scout)" (you can access these options by right-clicking the game, selecting properties, and going to compatibility).

Trying the latest Proton version, 9.01-4, completely failed on launch. But switching to Proton Hotfix allowed the game to run and the processing time from Flip (off or on) drop from about 10 to 14 (somtimes as high as 40 when I alt-tabbed from a YouTube video or something) down to less than 0.1

FPS is as stable as the Windows version.

I do not like that the version I am running is called "Hotfix". If someone more knowledgeable about Proton could explain the differences between version, that would be super appreciated! I would also like to know what Flip is under the graphics run time in the F4 menu.

As a last note, the factorio icon looks weird in the taskbar. But I could not care less.
"Proton" is a Valve's version of "Wine", which is a Windows compatibility layer for Linux (and some other OS'es). You literally switched from native Linux version to Windows version. If this fixed issue for you, this means that something in Steam version running under "Linux runtime (Scout)" environment is broken. I believe you can disable this "Linux runtime" thing and make Steam run the game as it is. Or better yet you should try download the game from the factorio site, unpack it and run without Steam interference. You can create an account on the site (note that it and account on this forum are separate) and link your steam account. Or just download the demo, I think it should be enough to test this particular issue.

Re: Linux: Factorio 2.0/SA drops to 30FPS intermittently (sometimes UPS drops too)

Posted: Tue Jan 14, 2025 2:35 am
by R060
Nyrrix wrote: Mon Jan 13, 2025 10:44 pm I would also like to know what Flip is under the graphics run time in the F4 menu.
It's the game literaly waiting while already prepared frame would be drawn to the "screen" and "screen" returns back and says «Give me the next frame». https://en.m.wikipedia.org/wiki/Multipl ... e_flipping
processing time from Flip (off or on) drop from about 10 to 14 (somtimes as high as 40 when I alt-tabbed from a YouTube video or something) down to less than 0.1
And that's why I was suspecting that something is wrong in your wayland setup. Frame's wait (or "flip") time of 10 to 14 suggests that your screen server forces vsync up to 60 FPS (which is right around 16 ms for 1 frame). And I remember raiguard mentioned in some video on youtube this problem of the game stuttering while not in focus because walyand is basically throttling vsync down to 25 FPS or so.

Re: Linux: Factorio 2.0/SA drops to 30FPS intermittently (sometimes UPS drops too)

Posted: Tue Jan 14, 2025 6:21 pm
by Nyrrix
R060 wrote: Tue Jan 14, 2025 2:12 am
Nyrrix wrote: Mon Jan 13, 2025 10:44 pm So, I've been playing around with it off and on for a few days, trying a few different things.

What seems to have finally stabalized the FPS (and by extension, the "Flip" category, still not sure what it is in any case) was changing the Steam Compatibility layer.

I was originally using "Steam Linux Runtime (Scout)" (you can access these options by right-clicking the game, selecting properties, and going to compatibility).

Trying the latest Proton version, 9.01-4, completely failed on launch. But switching to Proton Hotfix allowed the game to run and the processing time from Flip (off or on) drop from about 10 to 14 (somtimes as high as 40 when I alt-tabbed from a YouTube video or something) down to less than 0.1

FPS is as stable as the Windows version.

I do not like that the version I am running is called "Hotfix". If someone more knowledgeable about Proton could explain the differences between version, that would be super appreciated! I would also like to know what Flip is under the graphics run time in the F4 menu.

As a last note, the factorio icon looks weird in the taskbar. But I could not care less.
"Proton" is a Valve's version of "Wine", which is a Windows compatibility layer for Linux (and some other OS'es). You literally switched from native Linux version to Windows version. If this fixed issue for you, this means that something in Steam version running under "Linux runtime (Scout)" environment is broken. I believe you can disable this "Linux runtime" thing and make Steam run the game as it is. Or better yet you should try download the game from the factorio site, unpack it and run without Steam interference. You can create an account on the site (note that it and account on this forum are separate) and link your steam account. Or just download the demo, I think it should be enough to test this particular issue.
I had the same issue in an instance I downloaded directly and in the Steam version. The Steam version started working with the "Proton Hotfix" option. I'm more thinking there's something up with my Linux set up because of this.

Re: Linux: Factorio 2.0/SA drops to 30FPS intermittently (sometimes UPS drops too)

Posted: Tue Jan 14, 2025 6:49 pm
by Nyrrix
I saw some of the issues re-emerge, but I won't lie I'm just getting tired of chasing the same issue around in circles. To be honest, I'm wondering if the small successes were me just jumping the gun on seeing good behavior. I'm tempted to boot up a different Linux distro on a USB stick and see if I get better or the same behavior there, but I that will prove to be a long ordeal.

Re: Linux: Factorio 2.0/SA drops to 30FPS intermittently (sometimes UPS drops too)

Posted: Tue Feb 25, 2025 7:11 pm
by captchasarebad
There are multiple topics that touch upon this but I'll add my findings here since it it's linux related and I cannot reproduce this issue on windows.

Starting a new space-age game after not having played for a while I ran into issues with the frametimes. The average fps was 60 but the frametimes were all over the place, any kind of scrolling was a jerky mess of nauseating ...jerkyness. I have played around with all the timing-related knobs I could find in factorio's (debug) menus and all the obscure mesa environment flags I could get my hands on; I have switched between all the common X11/wayland WMs and all bleeding-edge mesa versions. Nothing made an impact on the inconsistent frametimes until one fateful day I had a backup job running in the background (that was compressing tarballs) while running factorio in the foreground. Suddenly the frametimes smoothed out and it was a perfectly locked 16.667µs per frame.

tl;dr, the CPU is bored while running factorio and just clocks down, then notices that it's not keeping up with the scheduled tasks and clocks up again.
Running any cpu-intensive task "forces" it into a higher clock and as a sideffect factorio is running smoothly.

One quick way to test this is to run an infinite busy-loop in a shell in the background, e.g. (ctrl+c exits the loop)

Code: Select all

while :; do true; done
A better (short-term) way is to tweak the cpu scheduler to more aggressively raise the clock rate or to set lower bounds for the power states. I'm still on 12th gen intel so I don't have access to the fancy HWP features. A working but simple "hack" for me is to bias the lowest power state via "min_perf_pct" to roughly ~40% (the default in my case is 18%):

Code: Select all

echo 40 | sudo tee /sys/devices/system/cpu/intel_pstate/min_perf_pct
I haven't tested the not-intel_pstate governers yet but those would probably also offer ways to mitigate this issue.

Now, I'm not sure where to report this issue to since it could be either a cpu-scheduler issue, a CPU issue, a mesa issue or a factorio issue or all of them combined. This is probably the only time I had an issue of this nature and so I'm struggling with its classification.

Re: Linux: Factorio 2.0/SA drops to 30FPS intermittently (sometimes UPS drops too)

Posted: Thu Feb 27, 2025 7:16 am
by pioruns
Nyrrix wrote: Tue Jan 14, 2025 6:49 pm I saw some of the issues re-emerge, but I won't lie I'm just getting tired of chasing the same issue around in circles. To be honest, I'm wondering if the small successes were me just jumping the gun on seeing good behavior. I'm tempted to boot up a different Linux distro on a USB stick and see if I get better or the same behavior there, but I that will prove to be a long ordeal.
Trying different distro would be recommended. Your distro, while being advertised at "best for gaming", is very exotic, and uses 6.11 Linux Kernel which in unmaintained mainstream, a weird choice by distro developer. Unless new kernel is available but you have not upgraded to it.
I am playing Factorio on Debian Stable and never had any issues whatsoever. And I am playing native Linux version, not Windows version in Steam via Proton, have you tried that?
And lastly, have you tried X11 instead of Wayland? Someone brought it up earlier on but unsure if I seen your reply and results on it.