Files
homelab/active/os_arch/gaming.md
ducoterra ef9104c796
All checks were successful
Reese's Arch Toolbox / build-and-push-arch-toolbox (push) Successful in 14s
moving everything to active or retired vs incubating and graduated
2025-04-19 18:52:33 -04:00

13 KiB

Gaming

Discord

pacman -S discord

Steam

https://wiki.archlinux.org/title/Official_repositories#multilib

Edit /etc/pacman.conf

[multilib]
Include = /etc/pacman.d/mirrorlist
pacman -S steam

When prompted use vulkan-radeon on AMD and vulkan-intel on intel.

autostart

ln -s ~/.local/share/applications/steam-native.desktop ~/.config/autostart/

mangohud

Start steam with mangohud

pacman -S mangohud lib32-mangohud
cp /usr/share/applications/steam.desktop ~/.local/share/applications/steam.desktop

Edit ~/.local/share/applications/steam.desktop:

Exec=/usr/bin/mangohud /usr/bin/steam-native %U

Scaling

On HiDPI screens you might need to manually scale the steam interface. This can be done by editing the .desktop file:

cp /usr/share/applications/steam.desktop ~/.local/share/applications/steam.desktop

Edit ~/.local/share/applications/steam.desktop

Exec=/usr/bin/mangohud /usr/bin/steam-runtime -forcedesktopscaling 2 %U

Streaming

See Sunshine and Moonlight first! It's much better than steam streaming.

Works great from Arch hosts to Arch guests with a little configuration.

  1. wifi

    Your wifi should be isolated to the fastest band you have available at the widest channel width on the least populated channel. BSS Transition and Fast Roaming are the only settings I enable since they do make a difference for video calls and streaming while moving from room to room but don't cause interference or connectivity issues like the other settings.

    unifi wifi config

  2. host

    Your host settings don't matter too much since you'll be limited to Steam's compatibility with Arch's mesa drivers, the current kernel version, and whether Mercury is retrograde. Steam does a pretty good job automatically selecting the correct libraries and capture mechanism. Here are the settings I use:

    steam host settings

  3. Client

    Here's where things start to matter. As of kernel 6.7.6-arch1-2, mesa 1:24.0.2-1, libva 2.20.0-1, mesa-vdpau 1:24.0.2-1, and libvdpau 1.5-2 hardware decoding works on Arch with AMD integrated graphics on both my framework (Ryzen 7 7840U w/ Radeon 780M Graphics) and my Steam Deck.

    In the steam advanced client settings select "Enhanced 4k" to start. Do not change the Resolution limit. Decoding at the native resolution of your screen will always perform better than using a non-native resolution. In my testing even lower resolutions result in 20-30ms of additional delay over native. Framerate limit should stay at automatic. This will try to match the streaming framerate to your display's refresh rate. You can set this to 60 if things are lagging too much. Bandwidth limit can be adjusted up and down to fit your wifi's limitations if you are experience frame drops and stuttering. If you experience issues like crashing on launch, blank screen or strange artifacts disable hardware decoding. HEVC and low latency networking have never caused me issues. Here are my settings:

    steam client settings

    And to show what a properly configured client can do, here's Crab Champions streamed to my laptop at 2k, 99fps. Note the streaming latency is ~10ms and the dark blue (encode time), light blue (network transmit time), and red (decode time) lines are extremely close together.

    enhanced 4k framework

    My Steam Deck performs about the same but with a lower (~7ms) streaming latency. This is expected because the steam deck streams at 1280x720 which means faster encode and transmit.

    If the red line is far above the blue lines it means your decoding (software or hardware) is struggling to keep up. Either it's not decoding at native resolution (likely transforming the decoded frame to match the display resolution) or your cpu/gpu is doing something else.

    If the light blue line is far above the dark blue line your wifi is slow. Increase channel width, increase transmit power, ensure devices are connected to 5 or 6Ghz, and ensure your device has the latest drivers.

    If the dark blue line is far above the x axis of the graph your host is struggling to encode fast enough. Likely the host's cpu/gpu is doing something else or it's an old computer

FSR

https://linux-gaming.kwindu.eu/index.php?title=FSR_-_FidelityFX_Super_Resolution

This sharpens the image. 4 is an example value. 0 is maximum sharpness, higher values mean less sharpening. 5 is the maximum value. The default is 2

WINE_FULLSCREEN_FSR=1 WINE_FULLSCREEN_FSR_STRENGTH=2

Sunshine and Moonlight

https://docs.lizardbyte.dev/projects/sunshine/en/latest/

Sunshine is desktop streaming service that leverages hardware encoding to provide near-zero latency network streaming to any device that can run moonlight.

Install Sunshine

The flatpak seems to work well. The arch package keeps breaking due to deps. See boost-libs and then libicuuc.so.76.

https://docs.lizardbyte.dev/projects/sunshine/latest/md_docs_2getting__started.html#install-system-level

flatpak install --system flathub dev.lizardbyte.app.Sunshine
sudo -i
flatpak run --command=additional-install.sh dev.lizardbyte.app.Sunshine
systemctl enable --now sunshine

Ports

HTTPS: 47984 TCP (offset by -5 from the main port) HTTP: 47989 TCP (the main port) Web: 47990 TCP (offset by +1 from the main port) RTSP: 48010 TCP/UDP (offset by +21 from the main port) Video: 47998 UDP (offset by +9 from the main port) Control: 47999 UDP (offset by +10 from the main port) Audio: 48000 UDP (offset by +11 from the main port) Mic (unused): 48002 UDP (offset by +13 from the main port)

TCP: 47984, 47989, 48010 UDP: 47998-48000, 48002, 48010

ufw allow 47984/tcp
ufw allow 47989/tcp
ufw allow 48010/tcp
ufw allow 47998-48000/udp
ufw allow 48002/udp
ufw allow 48010/udp

Install Moonlight

Flatpak

flatpak install moonlight

Commands

Ctrl + Alt + Shift + Q (Moonlight Stream) Quit the streaming session (leaving the game running on the host PC)

Ctrl + Alt + Shift + S (Moonlight Stream) Open performance stats overlay (not supported on Steam Link or Raspberry Pi)

Ctrl + Alt + Shift + M (Moonlight Stream) Toggle mouse mode (pointer capture or direct control)

Ctrl + Alt + Shift + V (Moonlight Stream) Type clipboard text on the host

Configuration

Sunshine doesn't need a ton of config. For streaming to devices like the steam deck and my computer I would recommend adding a new application that uses the display_scale.py script to set the resolution of the host before connecting.

  1. Copy display_scale.py to your host
  2. Create a new application
  3. Add command: /home/ducoterra/display_scale.py 1920x1080 1
  4. Optionally add undo command: /home/ducoterra/display_scale.py 3840x2160 1
  5. Save and connect!

ProtonUp-QT

https://davidotek.github.io/protonup-qt/

mv ~/Downloads/ProtonUp-Qt*.AppImage ~/Applications/ProtonUp-Qt.AppImage
chmod +x ~/Applications/*.AppImage
[Desktop Entry]
Name=ProtonUp-Qt
Exec=/home/ducoterra/Applications/ProtonUp-Qt.AppImage
Icon=/home/ducoterra/.icons/ProtonUp-Qt.png
Type=Application

VSCode

For the open source version of code install code:

pacman -S code

XWayland

Provides compatibility with X server applications (like wine)

pacman -S xorg-xwayland

Wine

pacman -S wine

Spotify

pacman -S spotify-launcher

VLC

pacman -S vlc

Remote Desktop

pacman -S remmina freerdp

OBS

https://aur.archlinux.org/packages/obs-vkcapture-git

pacman -S obs-studio qt6-wayland
cd ~/aur
git clone https://aur.archlinux.org/obs-vkcapture-git.git
cd obs-vkcapture-git
makepkg -si

Add "Game Capture" to your scene.

Start your games with env OBS_VKCAPTURE=1 %command%

Xbox Controller

  1. Install bluetooth packages
pacman -S bluez bluez-plugins bluez-utils
  1. Edit the bluetooth conf and set the controller to bredr

/etc/bluetooth/main.conf

ControllerMode = bredr
  1. Now reset the bluetooth service
systemctl restart bluetooth
  1. Connect your controller
  2. Comment out the line in the bluetooth conf you just edited
  3. Restart the bluetooth service

Mangohud

https://github.com/flightlessmango/MangoHud#arch-based-distributions

sudo pacman -S mangohud lib32-mangohud
mkdir ~/.config/MangoHud
cp /usr/share/doc/mangohud/MangoHud.conf.example ~/.config/MangoHud/MangoHud.conf

Edit ~/.config/MangoHud/MangoHud.conf and tweak as you see fit.

Then add mangohud env MANGOHUD_CONFIGFILE=/home/ducoterra/.config/MangoHud/MangoHud.conf %command% to your steam launch.

Minecraft with Mangohud

MultiMC offers a "Wrapper" option in Settings -> Custom commands. Add /usr/bin/mangohud --dlsym.

ffmpeg

https://wiki.archlinux.org/title/FFmpeg

AUR

https://aur.archlinux.org/ffmpeg-full.git

Intel 11th gen

pacman -S ffmpeg libmfx intel-media-sdk

ffmpeg \
-hwaccel qsv \
-c:v hevc_qsv \
-hwaccel_output_format qsv \
-i input.mkv \
-c:v hevc_qsv \
-global_quality 25 \
output.mp4

AMD 7900xtx

https://wiki.archlinux.org/title/FFmpeg#VA-API

sudo pacman -S ffpmeg mesa libva-mesa-driver

reboot

ffmpeg \
-hwaccel vaapi \
-vaapi_device /dev/dri/renderD128 \
-hwaccel_output_format vaapi \
-i input.mp4 \
-c:v hevc_vaapi \
-rc_mode 1 \
-qp 25 \
output.mp4

ffmpeg \
-hwaccel vaapi \
-vaapi_device /dev/dri/renderD128 \
-hwaccel_output_format vaapi \
-i input.mp4 \
-c:v h264_vaapi \
-b:v 0 \
-maxrate 100M \
output.mp4

Taking Game Cips

  1. Install MPV

  2. Open the video clip in mpv

  3. Press del to always show the seek bar

  4. Click the timestamp in the bottom left to show milliseconds

  5. Use , and . to seek frame by frame to find the start frame

  6. Use the following ffmpeg command to trim clips

    # format start_time and end_time like `00:00:34.000` (hh:mm:ss.mmm)
    export input_file=
    export output_file=
    export start_time=
    export end_time=
    
    # -r 30 == frame rate of 30
    # -vf scale scales the output
    ffmpeg \
        -ss $start_time \
        -to $end_time \
        -i $input_file \
        -c:v libx264 \
        -b:v 0 \
        -vf scale=1920:1080 \
        -r 30 \
        $output_file
    
  7. Then concat clips with the following

    # Create mylist.txt
    cat <<EOF > clips.txt
    file '/path/to/file1'
    file '/path/to/file2'
    file '/path/to/file3'
    EOF
    
    ffmpeg -f concat -i mylist.txt -c copy output.mp4
    

MPV

https://wiki.archlinux.org/title/Mpv

MPV is an alternative to VLC with a couple key benefits:

  1. Reverse frame-by-frame seeking
  2. millisecond timestamp

These are great for video clipping with ffmpeg.

pacman -S mpv

Minecraft

Launcher

https://wiki.archlinux.org/title/minecraft

https://aur.archlinux.org/packages/minecraft-launcher

cd ~/aur
git clone https://aur.archlinux.org/minecraft-launcher.git
cd minecraft-launcher
makepkg -si

MultiMC

MultiMC allows you to maintain and run multiple installations of minecraft with handy shortcuts for installing mod loaders and many more features. It's super easy to install on arch.

https://github.com/MultiMC/multimc-pkgbuild

  1. Install jre-openjdk-headless
cd ~/aur
git clone https://github.com/MultiMC/multimc-pkgbuild.git
cd multimc-pkgbuild
makepkg -si