Difference between revisions of "Gaming"

From ArchWiki
Jump to navigation Jump to search
(Remote gaming: Addd note regarding emulators. :))
(Updated reference to the actively maintained moonlight AUR package and filled in some additional columns)
 
(35 intermediate revisions by 7 users not shown)
Line 20: Line 20:
  
 
* Native – games written for Linux.
 
* Native – games written for Linux.
* Web – games running in a web browser
+
* Web – games running in a web browser.
** HTML5 games use canvas and WebGL technologies and work in all modern browsers
+
** HTML5 games use canvas and WebGL technologies and work in all modern browsers.
 
** [[Flash]]-based – you need to install the plugin to play.
 
** [[Flash]]-based – you need to install the plugin to play.
* Specialized environments (software emulators) Required for running software designed for other architectures or systems. See [[Video game platform emulators]] for more details.
+
* [[Video game platform emulators]] required for running software designed for other architectures and systems.
** [[Wine]] – allows running of some Windows games, as well as a large amount of Windows software. Performance in Wine varies, the additional CPU overhead will cause slowdown in some games while in some cases games may run faster. Consult [http://appdb.winehq.org/ Wine AppDB] for game-specific compatibility information.
+
* [[Wine]] Windows compatibility layer, allows to run Windows applications on Unix-like operating systems.
** [http://www.codeweavers.com/ Crossover Games] – members of the Codeweavers team are prime supporters of Wine. Using Crossover Games makes the installation & setting up of some games easier, more reliable & even possible, when compared to using other methods.  Crossover is a paid commercial product, which also provides a [http://www.codeweavers.com/support/forums/ forum] where the developers are very much involved in the community.
+
* [[Virtual machine]]s – 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 [https://www.kernel.org/doc/Documentation/vfio.txt "virtual function I/O" (VFIO)], or [[PCI passthrough via OVMF]].
** [[DOSBox]] is a minimal virtual machine which runs a full DOS-compatible environment. It can be used to run classic DOS titles.
 
** {{Pkg|scummvm}} is an all-in-one engine reimplementation of many classic point-and-click adventure games. A full list of compatible titles can be found on the [http://scummvm.org ScummVM website].
 
** Similar to ScummVM, engine reimplementations and ports exist for specific titles, such as Doom.
 
* 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 [https://www.kernel.org/doc/Documentation/vfio.txt "virtual function I/O" (VFIO)], or [[PCI passthrough via OVMF]].
 
  
 
== Getting games ==
 
== Getting games ==
  
A good number are available in the [[official repositories]] / the [[AUR]], see [[List of games]].
+
Just because games are available for Linux doesn't mean that they are native, they might be pre-packaged with Wine or DOSBox.
  
=== Digital distribution ===
+
For list of games packaged for Arch in [[official repositories]] / the [[AUR]] see [[List of games]].
 
 
Just because games are available for Linux doesn't mean that they are native, they might be pre-packaged with Wine or DOSBox.
 
  
 +
* {{App|Flathub|Central [[Flatpak]] repository, has small but growing game section.|https://flathub.org/apps/category/Game|{{Pkg|flatpak}}, {{Pkg|discover}}, {{Pkg|gnome-software}}}}
 +
* {{App|[[Wikipedia:GOG.com|GOG.com]]|DRM-free game store.|https://www.gog.com|{{AUR|lgogdownloader}}}}
 +
* {{App|[[Wikipedia:itch.io|itch.io]]|Indie game store.|https://itch.io|{{AUR|itch}}}}
 +
* {{App|[[Wikipedia:Lutris|Lutris]]|Open gaming platform for Linux. Gets games from GOG, Steam, Battle.net, Origin, Uplay and many other sources. Lutris utilizes various [https://lutris.net/runners runners] to launch the games with fully customizable configuration options. |https://lutris.net|{{Pkg|lutris}}}}
 
* {{App|[[Steam]]|Digital distribution and communications platform developed by Valve.|https://store.steampowered.com|{{Pkg|steam}}}}
 
* {{App|[[Steam]]|Digital distribution and communications platform developed by Valve.|https://store.steampowered.com|{{Pkg|steam}}}}
* {{App|[[Wikipedia:itch.io|itch.io]]|Indie game store.|https://itch.io/|{{AUR|itch}}}}
 
* [https://www.gog.com/games/linux GOG.com]
 
** GOG.com officially only supports Ubuntu and Linux Mint.
 
** The {{AUR|lgogdownloader}} package can be used to download GOG titles from the command line.
 
  
 
== Running games ==
 
== Running games ==
Line 59: Line 53:
  
 
Some SDL games (e.g. Guacamelee) let you disable grabbing by pressing {{ic|Ctrl-g}}.
 
Some SDL games (e.g. Guacamelee) let you disable grabbing by pressing {{ic|Ctrl-g}}.
 
To disable keyboard grabbing at X11 level, install the {{AUR|libx11-nokeyboardgrab}}{{Broken package link|package not found}} package.
 
  
 
{{Note|SDL is known to sometimes not be able to grab the input system. In such a case, it may succeed in grabbing it after a few seconds of waiting.}}
 
{{Note|SDL is known to sometimes not be able to grab the input system. In such a case, it may succeed in grabbing it after a few seconds of waiting.}}
Line 97: Line 89:
  
 
For games that require exceptional amount of mouse skill, adjusting the [[mouse polling rate]] can help improve accuracy.
 
For games that require exceptional amount of mouse skill, adjusting the [[mouse polling rate]] can help improve accuracy.
 
=== Mouse focus in GNOME ===
 
 
{{Merge|GNOME}}
 
 
The 'sloppy' and 'mouse' window-focusing modes in [[GNOME]] are known to cause issues with a variety of games, causing a 'click-through' effect. Users can remedy this problem by switching the focus mode to 'click' (with a tool such as {{Pkg|gnome-tweak-tool}}{{Broken package link|replaced by {{Pkg|gnome-tweaks}}}}), playing in a different desktop environment, or spawing their game in a separate X-session.
 
  
 
=== Binaural Audio with OpenAL ===
 
=== Binaural Audio with OpenAL ===
Line 152: Line 138:
 
== Remote gaming ==
 
== 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 rock-stable internet connection (over the ethernet cable or 5ghz WiFi recommended) with a minimum speed of 5-10mbps (depending on the video quality and framerate).
+
[[Wikipedia:Cloud 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).
  
* [[Steam#In-home_streaming|Steam In-Home]] — Remotely play games on the LAN from host machine. Some users managed to get it working over the VPN.
+
{{Note|Most of the services that work in browser usually mean to be only compatible with {{AUR|google-chrome}}.}}
* [https://ui.parsecgaming.com/ Parsec] — Remotely play games either from your host machine or rented (within an app) cloud machine. It prioritizes direct connection to the host (great for VPN connections) and if it's not available, then connects via Parsec's servers. Can be installed as {{AUR|parsec-bin}}.
 
* [https://liquidsky.com/ LiquidSky] — Remotely play games from rented (within an app) cloud machine. Can be installed as {{AUR|liquidsky}}.
 
* [https://shadow.tech/ Shadow] — Remotely play games from rented (within an app) cloud machine. Can be installed as {{AUR|shadow-beta}}.
 
* [https://vortex.gg/dashboard Vortex.gg] — Remotely play games from their servers. No installation or configuration is required. Works in browser.
 
* [https://rainway.com/ Rainway.com] — Remotely play games from your host machine. Works in browser (Linux client is coming at around 2019 Q3).
 
  
Also there are other services where users have reported success getting it to work under Linux (via [[Wine]] or [[Steam]]'s proton):
+
{| class="wikitable sortable" style="text-align: center;"
 +
! Service
 +
! class="unsortable" | Installer
 +
! In browser client
 +
! Use your own host
 +
! Offers host renting
 +
! Full desktop support
 +
! Controller support
 +
! class="unsortable" | Remarks
 +
|-
 +
| [https://dixper.gg/ Dixper] || {{-}} || {{Yes}} || {{Y|Windows-only}} || ? || ? || ? || {{-}}
 +
|-
 +
| [https://liquidsky.com/ LiquidSky] || {{AUR|liquidsky}} || {{No}} || {{No}} || {{Yes}} || {{Yes}} || {{Yes}} || {{-}}
 +
|-
 +
| [https://moonlight-stream.org/ Moonlight] || {{AUR|moonlight-qt}} || {{No}} || {{Y|Windows-only}} || {{No}} || {{Yes}} || {{Yes}} || This is only a client. Host machine needs GeForce experience installed.
 +
|-
 +
| [https://ui.parsecgaming.com/ Parsec] || {{AUR|parsec-bin}} || {{Yes}} (experimental) || {{Y|Windows-only}} || {{Yes}} || {{Yes}} || {{Yes}} || {{-}}
 +
|-
 +
| [https://playkey.net/ Playkey] || {{AUR|playkey-linux}} || ? || ? || ? || ? || ? || {{-}}
 +
|-
 +
| style="white-space:nowrap" | [https://www.playstation.com/en-gb/explore/playstation-now/ps-now-on-pc/ PlayStation Now] || Runs under [[Wine]] or [[Steam]]'s proton || {{No}} || {{No}} || {{-}} || {{No}} || {{Yes}} || Play PS4, PS3 and PS2 games on PC. Alternatively, you can use [[Video game platform emulators|emulators]].
 +
|-
 +
| [https://rainway.com/ Rainway] || Coming in 2019 Q3 || {{Yes}} || {{Y|Windows-only}} || {{No}} || {{Yes}} || ? || {{-}}
 +
|-
 +
| [https://shadow.tech/ Shadow] || {{AUR|shadow-beta}} || {{No}} || {{No}} || {{Yes}} || {{Yes}} || {{Yes}} || Controller support is dependent on USB over IP, and currently AVC only as HEVC isn't supported
 +
|-
 +
| [[Steam#Steam_Remote_Play|Steam Remote Play]] || Part of {{pkg|steam}} || {{No}} || {{Yes}} || {{No}} || {{No}} || {{Yes}} || {{-}}
 +
|-
 +
| [https://vortex.gg/ Vortex] || {{-}} || {{Yes}} || {{No}} || {{-}} || {{No}} || ? || {{-}}
 +
|}
  
* [https://www.playstation.com/en-gb/explore/playstation-now/ps-now-on-pc/ PS Now] — Play PS4, PS3 and PS2 games on PC. Alternatively, you can use emulators (see [[Video_game_platform_emulators]]).
+
== Improving performance ==
* [https://playkey.net/ PLAYKEY] — Yet another cloud gaming service.
 
  
== Improving performance ==
+
See also main article: [[Improving performance]]. For Wine programs, see [[Wine#Performance]].
  
{{Expansion|{{AUR|gamemode}} and {{AUR|lib32-gamemode}} is also pretty popular app. Especially with {{pkg|lutris}}.}}
+
=== Utilities ===
  
See also main article: [[Improving performance]]. For Wine programs, see [[Wine#Performance]].
+
* {{App|GameMode|Daemon/lib combo for Linux that allows games to request a set of optimisations be temporarily applied to the host OS.|https://github.com/FeralInteractive/gamemode|{{AUR|gamemode}}, {{AUR|lib32-gamemode}}}}
  
 
=== Improving frame rates and responsiveness with scheduling policies ===
 
=== Improving frame rates and responsiveness with scheduling policies ===
Line 192: Line 201:
 
==== Nice levels ====
 
==== Nice levels ====
  
Secondly, the nice level sets which tasks are processed first, in ascending order. A nice level of -4 is reccommended for most multimedia tasks, including games:
+
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
 
  bit.trip.runner -n -4
Line 198: Line 207:
 
==== Core affinity ====
 
==== Core affinity ====
  
There is some confusion in development as to whether the driver should be multithreading, or the program. In any case where they both attempt it, it causes drops in framerate and crashes. Examples of this include a number of modern games, and any Wine program which is running with [[Wikipedia:OpenGL Shading Language|GLSL]] enabled. To select a single core and allow only the driver to handle this process, simply use the {{ic|-a 0x''#''}} flag, where ''#'' is the core number, e.g.:
+
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 [[Wikipedia:OpenGL Shading Language|GLSL]] enabled. To select a single core and allow only the driver to handle this process, simply use the {{ic|-a 0x''#''}} flag, where ''#'' is the core number, e.g.:
  
 
  bit.trip.runner -a 0x1
 
  bit.trip.runner -a 0x1
Line 223: Line 232:
 
==== Optimus, and other helping programs ====
 
==== 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 {{ic|SCHED_FIFO}}, since rarely consumes the whole CPU and needs higher prioritization when possible.
+
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 {{ic|SCHED_FIFO}}, since it rarely consumes the whole CPU and needs higher prioritization when possible.
  
 
  optirun -I -n -5
 
  optirun -I -n -5
 
  wineserver -F -p 20 -n 19
 
  wineserver -F -p 20 -n 19
 
  steam.exe -I -n -5
 
  steam.exe -I -n -5

Latest revision as of 19:01, 19 June 2019

This page contains information about running games and related system configuration tips.

Game environments

Different environments exist to play games in Linux:

  • Native – games written for Linux.
  • 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.
  • Video game platform emulators – required for running software designed for other architectures and systems.
  • Wine – Windows compatibility layer, allows to run Windows applications on Unix-like operating systems.
  • 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.

Getting games

Just because games are available for Linux doesn't mean that they are native, they might be pre-packaged with Wine or DOSBox.

For list of games packaged for Arch in official repositories / the AUR see List of games.

  • Flathub — Central Flatpak repository, has small but growing game section.
https://flathub.org/apps/category/Game || flatpak, discover, gnome-software
https://www.gog.com || lgogdownloaderAUR
https://itch.io || itchAUR
  • Lutris — Open gaming platform for Linux. Gets games from GOG, Steam, Battle.net, Origin, Uplay and many other sources. Lutris utilizes various runners to launch the games with fully customizable configuration options.
https://lutris.net || lutris
  • Steam — Digital distribution and communications platform developed by Valve.
https://store.steampowered.com || steam

Running 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 fullscreen games. In such a case, running a second X server is one possible solution. Another solution may be found in the NVIDIA article (may also apply to non-NVIDIA users).

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.

Note: SDL is known to sometimes not be able to grab the input system. In such a case, it may succeed in grabbing it after a few seconds of waiting.

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 config where the second screen is disabled is advised.

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

So after a chmod +x you would be able to use this script like:

$ ~/game.sh xonotic-glx

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, run the following command:

echo "hrtf = true" >> ~/.alsoftrc

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-0 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.

Double check your CPU frequency scaling settings

If your system is currently configured to properly insert its own cpu frequency scaling driver, the system sets the default governor to Ondemand. By default, this governor only adjusts the clock if the system is utilizing 95% of its CPU, and then only for a very short period of time. This saves power and reduces heat, but has a noticeable impact on performance. You can instead only have the system downclock when it is idle, by tuning the system governor. To do so, see Cpufrequtils#Tuning the ondemand governor.

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).

Note: Most of the services that work in browser usually mean to be only compatible with google-chromeAUR.
Service Installer In browser client Use your own host Offers host renting Full desktop support Controller support Remarks
Dixper Yes Windows-only ? ? ?
LiquidSky liquidskyAUR No No Yes Yes Yes
Moonlight moonlight-qtAUR No Windows-only No Yes Yes This is only a client. Host machine needs GeForce experience installed.
Parsec parsec-binAUR Yes (experimental) Windows-only Yes Yes Yes
Playkey playkey-linuxAUR ? ? ? ? ?
PlayStation Now Runs under Wine or Steam's proton No No No Yes Play PS4, PS3 and PS2 games on PC. Alternatively, you can use emulators.
Rainway Coming in 2019 Q3 Yes Windows-only No Yes ?
Shadow shadow-betaAUR No No Yes Yes Yes Controller support is dependent on USB over IP, and currently AVC only as HEVC isn't supported
Steam Remote Play Part of steam No Yes No No Yes
Vortex Yes No No ?

Improving performance

See also main article: Improving performance. For Wine programs, see Wine#Performance.

Utilities

  • GameMode — Daemon/lib combo for Linux that allows games to request a set of optimisations be temporarily applied to the host OS.
https://github.com/FeralInteractive/gamemode || gamemodeAUR, lib32-gamemodeAUR

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