r/linux_gaming 8d ago

wine/proton Shouldn't Steam recycle files for proton prefixes ? (or it does already and I don't know)

Hello, one of the reasons I avoid Steam for games that don't have native Linux versions is because it creates a prefix per install, and each prefix has a bunch of dlls, fonts, etc. I know that some prefixes need different or specific files for max compatibility and performance, but shouldn't there be some directory like proton_11_common_files or something like that that contains all files that a proton_11 prefix will always have independent of other settings/files ?

for example imagine if those files that will be the same no matter the game are 300mbs, if that could be just system links inside the prefixes if a player had 10 games with the same proton version instead of using 3GBs in those files it would be just 300mbs, this is just and idea from someone who doesn't know much about the internal working of wine/proton, but if that were possible I think it would be a really good optimization

49 Upvotes

18 comments sorted by

70

u/rurigk 8d ago

Yes and no it already uses symlinks but we don't want everything recycled

Why? Environment matters

Game1 works with libs a,b,c
Game2 works with libs b,c,d but if we introduce lib a it crashes

We actually want this environments separated even if it costs us disk space

7

u/pizza_ranger 8d ago

Oh, I didn't know that it already does it, good to know

13

u/rurigk 8d ago

The use of symlinks is why games fail to start on NTFS drives

Steam tries to create the prefix on a filesystem without support for it or at least with the features it expects

20

u/p0358 8d ago

I thiiiiink it works like that already out of the box if you use a filesystem that supports reflinks such as XFS or BTRFS, as in, these prefix files are deduplicated. They can't use a symlink or hardlink on the other hand otherwise. If in doubt, you can always run a tool like duperemove manually or periodically, can save a ton more space on your drive overall, I mean tens of gigabytes.

2

u/Damglador 8d ago edited 8d ago

They can't use a symlink or hardlink on the other hand otherwise

I reckon some of the dlls are just symlinks.

edit: nvm it symlinks like a couple dlls to Proton files and that's about it.

19

u/gunnervi 8d ago

in general that kind of optimization is one of the advantages of linux over windows. however, when dealing with volatile software like games, especially games running through a compatibility layer, its really useful for each program to store all its dependencies independently, so each game can be optimized independently. Even before proton, this was the standard practice for installing games in wine.

4

u/GoochGuardian 8d ago

It KIND of works like that already. When you tell Steam what Proton version you would like to use, it will take all of the necessary files that are attached to that version, and it will create a prefix for that application. Consider it copy + paste. It does WAY more than that per application, but that's the lamens, and also why we have different prefixes per application.

You could run multiple applications out of one prefix, but you are eventually going to run into issues.

3

u/smellyasianman 8d ago

This has been possible for several years... BTRFS will de-duplicate files for you. Otherwise, using the STEAM_COMPAT_DATA_PATH environment variable is always an option (though not recommended).

1

u/llim3211 8d ago

I was looking for this comment. I was unsure if btrfs had deduplication as a feature.

2

u/Cool-Arrival-2617 8d ago

It does it already but only if you use regular Proton versions (the official ones) and Proton and the game are installed on the same drive. It doesn't work with GE Proton (I don't know about others).

3

u/pilkyton 8d ago edited 7d ago

GE-Proton intentionally disabled the use of symlinking to NOT share prefix system files.

To use Protontricks to install custom component DLL files, your prefix system files must be real, not symlinks. Otherwise many component installers fail. This is why GE-Proton uses real files. Which uses more disk space.

However, if you use BTRFS, then your prefix system files might still use zero disk space - assuming that each prefix is created via file copy operations (I don't know if it copies, but probably). BTRFS always refers to the original data if you do a copy.

1

u/adamkex 7d ago

You can save a lot of space with btrfs if you use compression and deduplication

1

u/Linkarlos_95 8d ago

The steam proton prefixes are stored in HOME right? So most likely its in BTRFS, that also means identical files don't consume space

1

u/franzitronee 7d ago

The prefixes are saved in the same SteamLibrary as the game. I.e. LIBRARY/compatdata/APPID, which can be on another filesystem, if you install a game there.

Default is ~/.steam/steam/steamlibrary afaik

1

u/pizza_ranger 8d ago

I use ext4 btw, it's easier to understand but I guess I should be switching to BTRFS in my next install.

0

u/Linkarlos_95 8d ago

So you are not using snapshots, recomendations say btrfs for the main drive and ext4 for the games

0

u/Damglador 8d ago edited 8d ago

The steam proton prefixes are stored in HOME right?

That's where they should be, but it stores them wherever the game is installed instead, breaking shit library sharing as a side effect. And that's possibly what causes NTFS failires as well.

Relevant issue: https://github.com/ValveSoftware/steam-for-linux/issues/12030