ValveSoftware / Proton

Compatibility tool for Steam Play based on Wine and additional components
Other
24.57k stars 1.07k forks source link

Fractal Block World (1540570) #8254

Open TheRogueArchivist opened 2 days ago

TheRogueArchivist commented 2 days ago

Compatibility Report

System Information

I confirm:

Symptoms

When saving the game, it can take quite a while longer than on Windows. With Proton, it takes roughly a minute to save 2,000 chunks (which is how it measures progress in saving), which can be quite an issue in the later game when a normal save can require 5,000+ chunks. It also appears to save them in chunks in groups of even hundreds, instead of a smoother, continuous progression.

Reproduction

Requires fairly significant progression within the game to run into noticeable issues. If you play enough for there to be a sizeable difference since your previous save, and then save (whether through menu option or using a save block in game), you will notice the save screen pop up and take longer than it should in order to finish. Image of this screen is attached.

20241119053825_1

steam-1540570.log

simifor commented 1 day ago

@TheRogueArchivist Could you run the game with proton experimental and add this as launch parameter: PROTON_LOG=+file,+volume,+path %command%. Run the game until you get a slow save screen, compress the resulting log and upload it.

It would also be interesting to have some time estimates for windows, you mention that it saves faster but didn't mention by how much.

TheRogueArchivist commented 1 day ago

I'll see about getting timing from Windows, but it seemed to be better by an order of magnitude at least. Saving never was a noticeable issue whatsoever on it, though I'll check shortly to be more exact. Attached is the log file with the parameters requested. I did notice that the save screen itself didn't pop up this time, but my game was frozen while saving for several minutes when I saved so the bug was still triggered, just in a slightly different way. I had to compress this one and upload it separately, due to the log being roughly 4 GB.

The dev said this in relation to why performance on Linux is likely an issue: There is not much we can do about it. Changes to a chunk are stored in a "chunk file". Since each chunk file is a separate file, this means there are lots of files that need to be written to. This must be the problem. Eventually we hope to use a database for saved games instead of thousands of files. Hopefully that will improve things, but it will be a while before we implement that.

Log: https://drive.google.com/file/d/1iY_g7V3quCJ1O3X2ioIBYg8ePSWwZ74r/view?usp=sharing

TheRogueArchivist commented 1 day ago

Confirmed that Windows is much faster, saving about 2,000 chunks takes only a few seconds. I also noticed overall performance is slightly better as well.

gofman commented 15 hours ago

The dev said this in relation to why performance on Linux is likely an issue: There is not much we can do about it. Changes to a chunk are stored in a "chunk file". Since each chunk file is a separate file, this means there are lots of files that need to be written to. This must be the problem. Eventually we hope to use a database for saved games instead of thousands of files. Hopefully that will improve things, but it will be a while before we implement that.

Log: https://drive.google.com/file/d/1iY_g7V3quCJ1O3X2ioIBYg8ePSWwZ74r/view?usp=sharing

But from the log, besides opening those files, the game does no less of calls like this:

165290.078:0124:0128:trace:file:FindFirstFileExW L"Z:\\run\\media\\nyxh\\mg\\SteamLibrary\\steamapps\\common\\Fractal Block World\\Data\\Save\\b;arb\\Chunks\\*" 0 01A2DE30 0 000
00000 0
165290.078:0124:0128:trace:path:PathFindFileNameW L"Z:\\run\\media\\nyxh\\mg\\SteamLibrary\\steamapps\\common\\Fractal Block World\\Data\\Save\\b;arb\\Chunks\\*"

The result of FindFirstFile doesn't seem to be used, FindNext is only called once and thus only ".", ".." special folders are retrieved. Maybe avoiding repeated FindFirstFile() may already avoid a lot of the overhead.

I am not sure we currently have a good way to substantially optimize this pattern of file I/O in Proton.

TheRogueArchivist commented 4 hours ago

"Maybe avoiding repeated FindFirstFile() may already avoid a lot of the overhead."

Is this something relevant for Proton development or for the game? I'll be happy to reach out the dev regarding that if it'll be helpful.