Gaming
Linux has long been considered an "unofficial" gaming platform; the support and target audience provided to it is not a primary priority for most gaming organizations. Changes to this situation have accelerated, starting from 2021 onward, as big players like Valve, the CodeWeavers group and the community have made tremendous improvements to the ecosystem, allowing Linux to truly become a viable platform for gaming. Further, more and more indie development teams strive to use cross-platform rendering engines in order to have their game able to compile and run on Linux.
When it comes to gaming, the majority of user's thoughts are often directed towards popular AAA games which are usually written exclusively for the Microsoft Windows platform. This is understandable, however, it is not the only and sole availability. Please refer to #Game environments and #Getting games further down the page where you can find software to run games from other platforms.
If you however are fixated on getting games written for Microsoft Windows to work on Linux, then a different mindset, tools and approach is required; understanding internals and providing functional substitution. Please read #Game technicality below.
Game technicality
There are ultimately three complications that arise from attempting to play AAA games made for Windows on Linux. They are:
- Graphics SDK
- Games written and compiled for an API that Linux does not recognize (such as DirectX).
- General library dependencies
- Libraries necessary for doing general purpose operations during gameplay, such as saving in-game, loading configuration files (e.g Microsoft Visual C++, MFC, .NET)
- Incompatible interfaces
- Aside from the frameworks mentioned above, there is a further problem with binary formats and compiled code generated by Windows which Linux does not recognize.
Graphics SDK forward graphical calls to the underlying graphics driver which then proceeds to talking to the GPU hardware.
A huge amount of games use DirectX as their main driving SDK. Linux, natively supports only OpenGL and Vulkan. Linux by itself does not support DirectX or any of the aforementioned technologies (Visual C++, MFC, .NET).
Instead, several opensource equivalents have been written which attempt to provide identical functionality, ultimately achieving the same result from a graphics point of view. These equivalents have their "own" written substitutes which attempt to "re-invent" what the original SDK calls would possibly achieve from a black box point of view. Popular ones include:
- Wine (Wine Is Not an Emulator) [provides a "loader vm", self written dependencies, interop and more]
- Proton (forked Wine project, optimized for Steam by Valve)
- Mono (.NET alternative)
- MF-Media (media foundation dependencies)
For example, a call to load, transform and shade vertices on DirectX may be re-written from scratch in a new .dll/.so owned by Wine, providing their own "hypothetical" belief on what the function may be doing underneath, and forward it instead to an OpenGL alternative, effectively trying to achieve similar results. Since these calls are direct equivalents and treated "as if" DirectX was running, performance is not impacted. (with the exception of the starting overhead to interop with these)
These tools are often brought in the distribution together on the system at the same time. A prefix (Wine's terminology for a directory mimicking a Windows sandbox) is created and configured. Dependencies are installed inside the prefix (the "sandbox" still needs the game's redistributables), often with winetricks, followed by an attempt to run the game "as if" it was executed from Windows.
This, nowadays, fortunately works for most games (aside from anti-cheat protected ones, which require a kernel driver that Wine/Proton does not yet have). If a game does not work, it is usually as a result of incompatible packages, missing dependencies or unimplemented functionality by Wine/Proton.
Lutris is a piece of software that provides runners and sandboxes that handle dependencies for you when you install games, if the above process is found tedious and/or complicated.
Common game dependencies
In order to gain a more in-depth understanding of what you will intend to do if you decide to go the Wine/Proton route, it is worthwhile to cover the common dependencies that games require in order to execute. Architecture also needs to be considered in mind, whether x86 or x64, preferably both.
A prefix would need to have the following populated into it in order to run most Windows games.
Mandatory (for high coverage)
- Microsoft Core Fonts
- Microsoft Visual C++ 2015 (2017 has the most coverage, recommended) [2005, 2008, 2010, 2012, 2013, 2015, 2017-2018, 2019]
- DirectX 9.0 (11.0 has the most coverage, recommended) [June SDK update 2010] {which consists of, to name a few:}
- Direct3D
- Direct2D
- DirectShow
- DirectInput
- DirectPlay
- DirectSound
- DXGI
- XAudio2
- .NET Framework (3.5 has most coverage)
- OpenGL
- OpenAL
- OpenAI
- OpenCL
- Vulkan
Optional (but still common)
Rare (less common)
- Gamespy
- MIDI driver
- ACDSee
Machine requirements
It is not enough to just populate a prefix with the dependencies the game will need. The kernel itself has to have the substitution it will provide to the calls the game will make. As already mentioned, drivers and alternatives are available.
Drivers
- AMD drivers: see AMDGPU.
- Intel drivers: see Intel graphics.
- NVIDIA drivers: see NVIDIA.
Dependency for the machine & substitutes
- Wine
- wine-gecko
- wine-mono
- Vulkan
- OpenGL
- Proton Redistributables (optional, but it may help)
- wine-ge-customAUR or TKG (optional, unless unsuccessful) : specially compiled wine versions containing patches for certain games.
Game environments
Wine/Proton are not the only approaches to play games. Different environments exist to play games in Linux, and have just as many (or more) games than on Windows:
- Native – games which have builds targeting the Linux platform, shipping with OpenGL and/or Vulkan graphics API support.
- Emulators – required for running software designed for other architectures and systems. Most games run out of the box once the ROM is fed in to the emulator and issues are rarely encountered. For options, see Video game platform emulators.
- Java - write once, run everywhere platform. Examples of popular games that run on Linux are Minecraft, Runescape, Wurm Online, Puzzle Pirates.
- Web – games running in a web browser.
- HTML5 games use canvas and WebGL technologies and work in all modern browsers.
- Flash-based – you need to install the plugin to play.
- Wine – Windows compatibility layer, allows to run Windows applications (and a lot of games) on Unix-like operating systems. Supports DirectX to Vulkan translation in runtime with the addition of Wine#DXVK, which improves performance in games which only support DirectX.
- Virtual machines – can be used to install compatible operating systems (such as Windows). VirtualBox has good 3D support. As an extension of this, if you have compatible hardware you can consider VGA passthrough to a Windows KVM guest, keyword is "virtual function I/O" (VFIO), or PCI passthrough via OVMF.
- Proton/DXVK – Fork of Wine designed for use in the proprietary steam platform, enabling better support for games than Wine. See Steam#Proton Steam-Play for more information.
Game compatibility
Increase vm.max_map_count
Having the vm.max_map_count
set to a low value can affect the stability and performance of some games. It can therefore be desirable to increase the size permanently by creating the following sysctl config file.
/etc/sysctl.d/80-gamecompatibility.conf
vm.max_map_count = 2147483642
/usr/lib/sysctl.d/10-arch.conf
, if you use a different file make sure it has higher priority. See sysctl(8) § SYSTEM FILE PRECEDENCE.Arch Linux uses the value 1048576 by default [1], which Fedora considers a safe value [2]. This default value is likely to be sufficient for current games, as increasing the value was mostly important when Arch used the kernel default of 65530 [3]. A value of 2147483642 (MAX_INT - 5) is the default in SteamOS.
Apply the changes without reboot by running:
# sysctl --system
Getting games
Just because games are available for Linux does not mean that they are native; they might be pre-packaged with Wine or DOSBox.
For list of games packaged for Arch in official repositories or the AUR see List of games.
- Athenaeum — A libre replacement to Steam.
- Flathub — Central Flatpak repository, has small but growing game section.
- GOG.com — DRM-free game store. Games can be installed through offline installation scripts (either with a gtk2-based UI, or run from a terminal), through the Galaxy client (requiring Wine), or through unofficial clients.
- https://www.gog.com || lgogdownloaderAUR, wyvernAUR, minigalaxyAUR
- Heroic Games Launcher — A GUI for GOG and legendary, an open-source alternative for the Epic Games Launcher.
- itch.io — Indie game store.
- Legendary — A free and open-source replacement for the Epic Games Launcher.
- Lutris — Open gaming platform for Linux. Gets games from GOG, Steam, Battle.net, Origin, Uplay and many other sources. Lutris utilizes various game runners to launch the games with fully customizable configuration options.
- Rare — Another GUI for legendary, based on PyQt5.
- Steam — Digital distribution and communications platform developed by Valve.
For Wine wrappers, see Wine#Third-party applications.
Configuring games
Certain games or game types may need special configuration to run or to run as expected. For the most part, games will work right out of the box in Arch Linux with possibly better performance than on other distributions due to compile time optimizations. However, some special setups may require a bit of configuration or scripting to make games run as smoothly as desired.
Multi-screen setups
Running a multi-screen setup may lead to problems with full-screen games. In such a case, running a second X server is one possible solution. For NVIDIA users, a solution may be found in NVIDIA#Gaming using TwinView.
Keyboard grabbing
Many games grab the keyboard, noticeably preventing you from switching windows (also known as alt-tabbing).
Some SDL games (e.g. Guacamelee) let you disable grabbing by pressing Ctrl-g
.
Starting games in a separate X server
In some cases like those mentioned above, it may be necessary or desired to run a second X server. Running a second X server has multiple advantages such as better performance, the ability to "tab" out of your game by using Ctrl+Alt+F7
/Ctrl+Alt+F8
, no crashing your primary X session (which may have open work on) in case a game conflicts with the graphics driver. The new X server will be akin a remote access login for the ALSA, so your user need to be part of the audio
group to be able to hear any sound.
To start a second X server (using the free first person shooter game Xonotic as an example) you can simply do:
$ xinit /usr/bin/xonotic-glx -- :1 vt$XDG_VTNR
This can further be spiced up by using a separate X configuration file:
$ xinit /usr/bin/xonotic-glx -- :1 -xf86config xorg-game.conf vt$XDG_VTNR
A good reason to provide an alternative xorg.conf here may be that your primary configuration makes use of NVIDIA's Twinview which would render your 3D games like Xonotic in the middle of your multiscreen setup, spanned across all screens. This is undesirable, thus starting a second X with an alternative configuration where the second screen is disabled is advised. Please note, that the X configuration file location is relative to the /etc/X11
directory.
A game starting script making use of Openbox for your home directory or /usr/local/bin
may look like this:
~/game.sh
if [ $# -ge 1 ]; then game="$(which $1)" openbox="$(which openbox)" tmpgame="/tmp/tmpgame.sh" DISPLAY=:1.0 echo -e "${openbox} &\n${game}" > ${tmpgame} echo "starting ${game}" xinit ${tmpgame} -- :1 -xf86config xorg-game.conf || exit 1 else echo "not a valid argument" fi
After making it executable you would be able to do:
$ ~/game.sh xonotic-glx
/etc/X11/xorg.conf.d
, you should also use the -configdir
option, pointing to an empty directory.Adjusting mouse detections
For games that require exceptional amount of mouse skill, adjusting the mouse polling rate can help improve accuracy.
Binaural audio with OpenAL
For games using OpenAL, if you use headphones you may get much better positional audio using OpenAL's HRTF filters. To enable, create:
~/.alsoftrc
hrtf = true
Alternatively, install openal-hrtfAUR from the AUR, and edit the options in /etc/openal/alsoftrc.conf
.
For Source games, the ingame setting `dsp_slow_cpu` must be set to `1` to enable HRTF, otherwise the game will enable its own processing instead. You will also either need to set up Steam to use native runtime, or link its copy of openal.so to your own local copy. For completeness, also use the following options:
dsp_slow_cpu 1 # Disable in-game spatialiazation snd_spatialize_roundrobin 1 # Disable spatialization 1.0*100% of sounds dsp_enhance_stereo 0 # Disable DSP sound effects. You may want to leave this on, if you find it does not interfere with your perception of the sound effects. snd_pitchquality 1 # Use high quality sounds
Tuning PulseAudio
If you are using PulseAudio, you may wish to tweak some default settings to make sure it is running optimally.
Enabling realtime priority and negative nice level
Pulseaudio is built to be run with realtime priority, being an audio daemon. However, because of security risks of it locking up the system, it is scheduled as a regular thread by default. To adjust this, first make sure you are in the audio
group. Then, uncomment and edit the following lines in /etc/pulse/daemon.conf
:
/etc/pulse/daemon.conf
high-priority = yes nice-level = -11 realtime-scheduling = yes realtime-priority = 5
and restart pulseaudio.
Using higher quality remixing for better sound
PulseAudio on Arch uses speex-float-1 by default to remix channels, which is considered a 'medium-low' quality remixing. If your system can handle the extra load, you may benefit from setting it to one of the following instead:
resample-method = speex-float-10
Matching hardware buffers to Pulse's buffering
Matching the buffers can reduce stuttering and increase performance marginally. See here for more details.
Remote gaming
Cloud gaming has gained a lot of popularity in the last few years, because of low client-side hardware requirements. The only important thing is stable internet connection (over the ethernet cable or 5 GHz WiFi recommended) with a minimum speed of 5–10 Mbit/s (depending on the video quality and framerate).
See Gamepad#Gamepad over network for using a gamepad over a network with services that do not normally support this.
Service | Installer | In browser client | Use your own host | Offers host renting | Full desktop support | Controller support | Remarks |
---|---|---|---|---|---|---|---|
Dixper | – | Yes | Windows-only | ? | ? | ? | – |
Reemo | reemod-binAUR | Chromium based only | Yes | Yes | Yes | Windows-only | You can also install the software with the official installation script in the download section via their website. |
Xbox Cloud | xbox-cloud-gamingAUR | Yes | No | No | No | Yes | You need Game Pass Ultimate to be able to use XCloud. |
GeForce Now | – | Yes | No | No | Yes | Yes | You must have games on Steam, Epic Client or GOG to use this service. Not all games are available. |
Moonlight | moonlight-qtAUR | No | Yes | No | Yes | Yes | This is only a client. Host machine must use either GeForce Experience (windows only) or Sunshine (multiplatform). |
Parsec | parsec-binAUR | Yes (experimental) | Windows-only | No | Yes | Yes | Cloud hosting no longer available[dead link 2023-05-06 ⓘ] |
VDI Stream Client | vdi-stream-clientAUR | No | Windows-only | No | Yes | No | VDI client with 3D GPU acceleration and built-in USB redirection |
Playkey | playkey-linuxAUR | ? | ? | ? | ? | ? | – |
PlayStation Now[dead link 2024-07-30 ⓘ] | Runs under Wine or Steam's proton | No | No | – | No | Yes | Play PS4, PS3 and PS2 games on PC. Alternatively, you can use emulators. |
PlayStation Remote Play | chiakiAUR | No | Yes | – | Yes | Yes | Play games from your PS4 and/or PS5 on PC. |
Rainway | Web Browser based | Yes | Windows-only | No | Yes | ? | – |
Shadow | shadow-techAUR | No | No | Yes | Yes | Yes | Controller support is dependent on USB over IP, and currently AVC only as HEVC is not supported |
Steam Remote Play | Part of steam | No | Yes | No | No | Yes | – |
Vortex[dead link 2024-01-29 ⓘ] | – | Yes | No | – | No | ? | – |
VNC | tigervnc or x11vnc | No | Yes | No | Yes | No | General purpose remote desktop protocol, but the latency should be low enough to use it for gaming over a LAN. See Gamepad#Gamepad over network for gamepad support. |
xrdp | xrdpAUR | No | Yes | No | Yes | No | Another general purpose remote desktop protocol, has both OpenGL and Vulkan support after configuring graphical accleration. Recommended for gaming over a LAN. See Gamepad#Gamepad over network for gamepad support. |
X11 forwarding | openssh | No | Yes | No | No | No | X forwarding over SSH with VirtualGL supports OpenGL and works for some but not all games. See Gamepad#Gamepad over network for gamepad support. |
Boosteroid | boosteroidAUR | Yes | No | No | Yes | Yes | You must have games on a digital distribution platform (Steam, EGS, Origin, etc.) to use this service. Not all games are available. You need to sign up (free) to see the full list of games. You need to purchase a subscription, to launch the games you own on the digital distribution platform. |
Blacknut | blacknut-appimageAUR or Blacknut AppImage | Yes | No | No | Yes | Yes | You need a subscription to be able to use this service. Not all games are available. |
Improving performance
See also main article: Improving performance. For Wine programs, see Wine#Performance. For a good gaming experience low latency, a consistent response time (no jitter) and enough throughput (frames per second) are needed. If you have multiple sources with a little jitter they are likely to overlap sometimes and produce noticeable stutter. Therefore most of the time it is preferable to decrease the throughput a little to gain more response time consistency.
Improve clock_gettime throughput
User space programs and especially games do many calls to clock_gettime(2) to get the current time for calculating game physics, fps and so on. The time usage can be seen by running
# perf top
and looking at the overhead of read_hpet (or acpi_pm_read).
If you are not dependent on a very precise timer you can switch from hpet (high precision event timer) or acpi_pm (ACPI Power Management Timer) to the faster TSC (time stamp counter) timer. Add the kernel parameters
tsc=reliable clocksource=tsc
to make TSC available and enable it. After that reboot and confirm the clocksource by running
# cat /sys/devices/system/clocksource/clocksource*/current_clocksource
You can see all currently available timers by running
# cat /sys/devices/system/clocksource/clocksource*/available_clocksource
and change between them by echoing one into current_clocksource. On a Zen 3 system benchmarking with [5] shows a ~50 times higher throughput of tsc
compared to hpet
or acpi_pm
.
tsc
when it's unreliable will cause Firefox to crash randomly because it breaks the monotonicity of clock_gettime(CLOCK_MONOTONIC)
[6], on which Firefox relies. Use at your own risk!Tweaking kernel parameters for response time consistency
You can install the realtime kernel to get some advantages by default (see realtime kernel article) but it costs CPU throughput and can delay interrupt handling. Additionally the realtime kernel is not compatible with nvidia-open-dkms and does not change the scheduler for SCHED_NORMAL (also named SCHED_OTHER) processes, which is the default process scheduling type. The following kernel parameter changes improve the response time consistency for the realtime kernel as well as other kernels such as the default linux kernel:
Proactive compaction for (Transparent) Hugepage allocation reduces the average but not necessarily the maximum allocation stalls. Disable proactive compaction because it introduces jitter according to kernel documentation (inner workings):
# echo 0 > /proc/sys/vm/compaction_proactiveness
Reduce the watermark boost factor to defragment only one pageblock (2MB on 64-bit x86) in case of memory fragmentation. After a memory fragmentation event this helps to better keep the application data in the last level processor cache.
# echo 1 > /proc/sys/vm/watermark_boost_factor
If you have enough free RAM increase the number of minimum free Kilobytes to avoid stalls on memory allocations: [7][8]. Do not set this below 1024 KB or above 5% of your systems memory. Reserving 1GB:
# echo 1048576 > /proc/sys/vm/min_free_kbytes
If you have enough free RAM increase the watermark scale factor to further reduce the likelihood of allocation stalls (explanations [9][10]). Setting watermark distances to 5% of RAM:
# echo 500 > /proc/sys/vm/watermark_scale_factor
Avoid swapping (locking pages that introduces latency and uses disk IO) unless the system has no more free memory:
# echo 10 > /proc/sys/vm/swappiness
Enable Multi-Gen Least Recently Used (MGLRU) but reduce the likelihood of lock contention at a minor performance cost [11]:
# echo 5 > /sys/kernel/mm/lru_gen/enabled
Disable zone reclaim (locking and moving memory pages that introduces latency spikes):
# echo 0 > /proc/sys/vm/zone_reclaim_mode
Disable Transparent Hugepages (THP) at a performance cost. Even if defragmentation is disabled, THPs might introduce latency spikes [12][13][14]. Enable only when the application specifically requests it by using madvise and advise:
# echo madvise > /sys/kernel/mm/transparent_hugepage/enabled # echo advise > /sys/kernel/mm/transparent_hugepage/shmem_enabled # echo never > /sys/kernel/mm/transparent_hugepage/defrag
Note that if your game uses TCMalloc (e.g., Dota 2 and CS:GO) then it is not recommended to disable THP as it comes with a large performance cost [15].
Reduce the maximum page lock acquisition latency while retaining adequate throughput [16][17][18]:
# echo 1 > /proc/sys/vm/page_lock_unfairness
Tweak the scheduler settings. The following scheduler settings are in conflict with cfs-zen-tweaksAUR so for each setting choose only one provider. By default the linux kernel scheduler is optimized for throughput and not latency. The following hand-made settings change that and are tested with different games to be a noticeable improvement. They might not be optimal for your use case; consider modifying them as necessary [19][20][21]:
# echo 0 > /proc/sys/kernel/sched_child_runs_first # echo 1 > /proc/sys/kernel/sched_autogroup_enabled # echo 3000 > /proc/sys/kernel/sched_cfs_bandwidth_slice_us # echo 3000000 > /sys/kernel/debug/sched/base_slice_ns # echo 500000 > /sys/kernel/debug/sched/migration_cost_ns # echo 8 > /sys/kernel/debug/sched/nr_migrate
Make the changes permanent
Usually, the advice for permanently setting kernel parameters is to configure create a sysctl configuration file or change your boot loader options. However, since our change span both procfs (/proc
, containing sysctl) and sysfs (/sys
), the most convenient way is to use systemd-tmpfiles:
/etc/tmpfiles.d/consistent-response-time-for-gaming.conf
# Path Mode UID GID Age Argument w /proc/sys/vm/compaction_proactiveness - - - - 0 w /proc/sys/vm/watermark_boost_factor - - - - 1 w /proc/sys/vm/min_free_kbytes - - - - 1048576 w /proc/sys/vm/watermark_scale_factor - - - - 500 w /proc/sys/vm/swappiness - - - - 10 w /sys/kernel/mm/lru_gen/enabled - - - - 5 w /proc/sys/vm/zone_reclaim_mode - - - - 0 w /sys/kernel/mm/transparent_hugepage/enabled - - - - madvise w /sys/kernel/mm/transparent_hugepage/shmem_enabled - - - - advise w /sys/kernel/mm/transparent_hugepage/defrag - - - - never w /proc/sys/vm/page_lock_unfairness - - - - 1 w /proc/sys/kernel/sched_child_runs_first - - - - 0 w /proc/sys/kernel/sched_autogroup_enabled - - - - 1 w /proc/sys/kernel/sched_cfs_bandwidth_slice_us - - - - 3000 w /sys/kernel/debug/sched/base_slice_ns - - - - 3000000 w /sys/kernel/debug/sched/migration_cost_ns - - - - 500000 w /sys/kernel/debug/sched/nr_migrate - - - - 8
After that reboot and see if the values applied correctly.
Reduce buffer bloat
A device experiences buffer bloat when a large buffer queues requests, causing new requests to be blocked for a long time. This can occur with both sending and receiving data.
Buffer bloat is solved by having a smart queuing algorithm that gives fair and timely share towards the device. Smart queuing algorithms produce quicker and more consistent response times, but increase CPU overhead. For interactive workloads reduced buffer bloat is desirable.
Reduce buffer bloat on storage devices
For storage devices, the BFQ scheduler is the most effective at minimizing buffer bloat and improving interactivity Improving performance#The scheduling algorithms.
Reduce buffer bloat on the network
You can use the default fq_codel or the improved cake smart queue management algorithms. They can be set via sysctl. Your home internet router can cause buffer bloat, which might be mitigated by reconfiguring it, installing a new router OS, or replacing the router (more info).
Here are some easy ways to test for network buffer bloat.
Improve PCI Express Latencies
Change the PCI Express Latencies similar to CachyOS [22]. Reduce the maximum cycles a PCI-E Client can occupy the bus, except for sound cards [23]. Note that these settings are in conflict with Professional audio#System configuration.
# setpci -v -s '*:*' latency_timer=20 # setpci -v -s '0:0' latency_timer=0 # setpci -v -d "*:*:04xx" latency_timer=80
To enable these settings consistently run them as super user on system boot.
Set the environment variable
LD_BIND_NOW=1
for your games, to avoid needing to load program code at run time (see ld.so(8)), leading to a delay the first time a function is called. Do not set this for startplasma-x11 or other programs that link in libraries that do not actually exist on the system anymore and are never called by the program. If this is the case, the program fails on startup trying to link a nonexistent shared object, making this issue easily identifiable. Most games should start fine with this setting enabled.
Utilities
Gamemode
Gamemode is daemon and library combo that allows games to request a set of optimisations be temporarily applied to the host OS. This can improve game performance.
Gamescope
Gamescope is a microcompositor from Valve that is used on the Steam Deck. Its goal is to provide an isolated compositor that is tailored towards gaming and supports many gaming-centric features.
ACO compiler
Reducing DRI latency
Direct Rendering Infrastructure (DRI) Configuration Files apply for all DRI drivers including Mesa and Nouveau. You can change the DRI configuration systemwide in /etc/drirc
or per user in $HOME/.drirc
. If they do not exist, you have to create them first. Both files use the same syntax; documentation for these options can be found at https://dri.freedesktop.org/wiki/ConfigurationOptions/. To reduce input latency by disabling synchronization to vblank, add the following:
<driconf> <device> <application name="Default"> <option name="vblank_mode" value="0" /> </application> </device> </driconf>
Improving frame rates and responsiveness with scheduling policies
Most games can benefit if given the correct scheduling policies for the kernel to prioritize the task. These policies should ideally be set per-thread by the application itself.
For programs which do not implement scheduling policies on their own, application known as schedtool, and its associated daemon schedtooldAUR can handle many of these tasks automatically.
To edit what programs relieve what policies, simply edit /etc/schedtoold.conf
and add the program followed by the schedtool arguments desired.
Policies
SCHED_ISO
(only implemented in BFS/MuQSSPDS schedulers found in -pf and -ck kernels) – will not only allow the process to use a maximum of 80 percent of the CPU, but will attempt to reduce latency and stuttering wherever possible. Most if not all games will benefit from this:
bit.trip.runner -I
SCHED_FIFO
provides an alternative, that can even work better. You should test to see if your applications run more smoothly with SCHED_FIFO
, in which case by all means use it instead. Be warned though, as SCHED_FIFO
runs the risk of starving the system! Use this in cases where -I is used below:
bit.trip.runner -F -p 15
Nice levels
Secondly, the nice level sets which tasks are processed first, in ascending order. A nice level of -4 is recommended for most multimedia tasks, including games:
bit.trip.runner -n -4
Core affinity
There is some confusion in development as to whether the driver should be multithreading, or the program. Allowing both the driver and program to simultaneously multithread can result in significant performance reductions, such as framerate loss and increased risk of crashes. Examples of this include a number of modern games, and any Wine program which is running with GLSL enabled. To select a single core and allow only the driver to handle this process, simply use the -a 0x#
flag, where # is the core number, e.g.:
bit.trip.runner -a 0x1
uses first core.
Some CPUs are hyperthreaded and have only 2 or 4 cores but show up as 4 or 8, and are best accounted for:
bit.trip.runner -a 0x5
which use virtual cores 0101, or 1 and 3.
General case
For most games which require high framerates and low latency, usage of all of these flags seems to work best. Affinity should be checked per-program, however, as most native games can understand the correct usage. For a general case:
bit.trip.runner -I -n -4 Amnesia.bin64 -I -n -4 hl2.exe -I -n -4 -a 0x1 #Wine with GLSL enabled
etc.
Optimus, and other helping programs
As a general rule, any other process which the game requires to operate should be reniced to a level above that of the game itself. Strangely, Wine has a problem known as reverse scheduling, it can often have benefits when the more important processes are set to a higher nice level. Wineserver also seems unconditionally to benefit from SCHED_FIFO
, since it rarely consumes the whole CPU and needs higher prioritization when possible.
optirun -I -n -5 wineserver -F -p 20 -n 19 steam.exe -I -n -5
Peripherals
Mouse
You might want to set your mouse acceleration to control your mouse more accurately.
If your mouse has more than 3 buttons, you might want to see Mouse buttons.
If you are using a gaming mouse (especially Logitech and Steelseries) you may want to configure your mouse polling rate, DPI, LEDs etc. using piper. See this page for a full list of supported devices by piper. Alternatively solaar for logitech devices.
LEDs
You can change and manipulate various RGBs with openrgb, for a list of currently supported devices see [24]
See also
- linux_gaming - Forum on reddit.com with gaming on linux as its topic, subpages: Wiki, FAQ.
- Linux Gaming Guide - Compilation of different techniques for optimizing the Linux gaming experience.
- are we anti cheat yet A comprehensive and crowd-sourced list of games using anti-cheats and their compatibility with GNU/Linux or Wine/Proton.
- proton db crowdsourced Linux compatibility reports