Revision Difference
proton#551349
<cat>Play.Intro</cat>
<title>Proton</title>
# Proton
All information regarding running and developing S&Box on Linux will described here.
# Running
Steam > Library > Right Click S&Box > Click Properties
<upload src="9831e/8d9d38bda11273e.png" size="36050" name="asdf.png" />
Compatibility > Click Force the use of a specific Steam Play compatibility tool > Select Proton Experimental
Currently `Proton Experimental` works best, if this doesn't work try a different version.
<upload src="9831e/8d9d38c4b3de597.png" size="107372" name="image.png" />
⤶
You will need to use one of these methods to be able to play in any map⤶
⤶
To load in any map you'll have to increase maximum number of memory map areas a process can access. To do so temporarily (until next reboot) run in terminal:⤶
```
Temporary method:⤶
sudo sysctl -w vm.max_map_count=16777216
Permanent method:⤶
```⤶
You can also apply this setting permanently by running in terminal:⤶
```⤶
sudo bash -c 'echo "vm.max_map_count = 16777216" > /etc/sysctl.d/20-sbox-max_map_count.conf && sysctl --system'
```
⤶
You will also need to use this method to be able to play any games in s&box⤶
⤶
In case of s&box not launching, you may also need to set Windows version reported to s&box by Proton to Windows 8 or newer. To do so install protontricks either by your distro package manager or by flatpak:⤶
```
1. If not already done, set up flatpak (https://flatpak.org/setup/)
2. flatpak install flathub com.github.Matoking.protontricks
3. flatpak run --branch=stable com.github.Matoking.protontricks 590830 win8⤶
2. Run in terminal: flatpak install flathub com.github.Matoking.protontricks
```⤶
Run protontricks (`protontricks --gui` from terminal) and choose s&box prefix:⤶
<upload src="b4b73/8db92c85f5f77d7.png" size="44665" name="sboxss01.png" />⤶
Then select `Select the default wineprefix` and subsequently `Run winecfg`. In the new window choose desired reported Windows version:⤶
<upload src="b4b73/8db92c8bcf27eca.png" size="61643" name="sboxss02.png" />⤶
⤶
You can also do so from the terminal. In case of system-installed protontricks run:⤶
```⤶
protontricks 590830 win10⤶
```⤶
Or, in case of flatpak installation:⤶
```⤶
flatpak run --branch=stable com.github.Matoking.protontricks 590830 win10⤶
```
# Developing
## Creating your first addon
```
cd ~/.local/share/Steam/steamapps/common/sbox/addons
git clone https://github.com/Facepunch/sbox-minimal.git my-addon
cd my-addon
rm -rf .git
```
## sbox-dev
At the time of writing *(Jan 2022)* you can launch s&box development executable but it is very buggy and is known to crash randomly.
Steam > Library > Right Click S&Box > Click Properties > General > Add `-tools` to Launch Options
<upload src="9831e/8d9d38d29c48c70.png" size="146265" name="image.png" />
To run s&box developer mode, you will need to follow these steps⤶
⤶
0. If not already done, set up flatpak (https://flatpak.org/setup/)⤶
1. Install protontricks via flatpak with⤶
To run s&box developer mode, you will need to set-up Proton prefix:⤶
⤶
### System-wide protontricks (from package manager):⤶
⤶
1. Install DirectX dependency by running in terminal:⤶
```⤶
protontricks 590830 d3dcompiler_47⤶
```⤶
2. Run sbox-dev.exe:⤶
```⤶
protontricks --no-runtime --no-bwrap -c "wine sbox-dev.exe" 590830⤶
```⤶
⤶
### Flatpak protontricks:⤶
⤶
0. Configure flatpak and protontricks:⤶
```
flatpak install flathub com.github.Matoking.protontricks
0.1. If not already done, set up flatpak (https://flatpak.org/setup/)
0.2. Run in terminal: flatpak install flathub com.github.Matoking.protontricks ⤶
```
2. Install a directx dependency with
1. Install a DirectX dependency with
```
flatpak run --branch=stable com.github.Matoking.protontricks 590830 d3dcompiler_47
```
3. Run sbox-dev.exe with⤶
2. Run sbox-dev.exe:⤶
```
flatpak run --branch=stable com.github.Matoking.protontricks --no-runtime --no-bwrap -c "wine sbox-dev.exe" 590830
```
4. S&box dev mode should start and stay open until you close it or crashes as it so usually does on Linux.
5. After closing, should Steam still display s&box as running, you have to exit out of steam completely to stop it.⤶
S&box dev mode should start and stay open until you close it or crashes as it so usually does on Linux. After closing, should Steam still display s&box as running, you have to exit out of steam completely to stop it.
# Troubleshooting
## How to use the proton logs
Proton logs sometimes could help solve issues with games not launching or working properly under proton. Proton logging can be enabled inside the launch options of s&box:
```
PROTON_LOG=1 %command%
```
If you want smaller log files but still keep useful information use this launch option:
```
WINEDEBUG=+error+threadname+debugstr+loaddll+mscoree PROTON_LOG=1 %command%
```
By default it should generate a file inside your home directory `$HOME/steam-590830.log` but it can be modified as well:
```
PROTON_LOG=1 PROTON_LOG_DIR='/path/to/log' %command%
```
## Game is randomly crashing or locking up after playing for an amount of time
This is an unknown cause, but adding `PROTON_NO_ESYNC=1 PROTON_NO_FSYNC=1` to your launch options seems to fix the problem
## Input (e.g. movement) does not work
This is probably caused by having multiple keyboard layouts, adding `-input_button_code_is_scan_code` to your launch options fixes the problem
# Useful Resources:
1. [S&box proton github issues](https://github.com/ValveSoftware/Proton/issues/4940)
2. [Proton parameters guide](https://github.com/ValveSoftware/Proton#runtime-config-options)