Gaming

From ArchWiki
Revision as of 06:46, 10 September 2010 by Jookia (Talk | contribs)

Jump to: navigation, search

Running games in Arch

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. For instance, 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

Some games grab the keyboard, noticeably preventing you from switching windows (also known as alt-tabbing). Download sdl-nokeyboardgrab to gain the ability to use keyboard commands while in SDL games. If you wish to turn it up to 11, you can disable keyboard grabbing at X11 level using libx11-nokeyboardgrab.

Note: The SDL package is no longer maintained.
Note: When (I atleast, could be some 64bit magic going on) switch out a game to do something then switch back in, SDL doesn't grab my mouse, so I found that if you wait for a second or so (possibly with the mouse outside the window), SDL will grab the mouse. Hacky, isn't it?

Getting games

While a lot of games can currently be found in the official repositories, not all current Linux games are packaged there. Some of them can only be found on AUR. However, there is a dedicated Arch Linux gaming repository that addresses this by providing pre-compiled packages from AUR.

Arch Linux gaming repository

To make use of the gaming repo, add these to your pacman.conf:

[arch-games]
# The Arch Linux Gaming repository project
Server = http://arch.twilightlair.net/games/$arch
Server = http://pseudoform.org/arch-games/games/$arch

Executing Games

Certain games or game types may need special configuration to run or to run as expected.

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" our of your game by using CTRL-ALT-F7 / CTRL-ALT-F8, no crashing your primary X session (which may have open work) in case a game conflicts with the graphics driver. To start a second X server (using Nexuiz as an example) you can simply do:

xinit /usr/bin/nexuiz-glx -- :1

This can further be spiced up by using a seperate X configuration file:

xinit /usr/bin/nexuiz-glx -- :1 -xf86config xorg-game.conf 

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 Nexuiz 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:

$ cat ~/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 nexuiz-glx

Adjusting mouse detections

For games that require exceptional amount of mouse skill, adjusting the response rate can help improve accuracy. Read more here.

See also