Start a new X-Server for playing games

I often start games in a new X-Server. This is handy, because your desktop does not get affected at all whether your game changes the resolution of the screen, the gamma or anything else (especially annoying when it crashes and it keeps that). Additionally you can do something else while the game is loading (Counter-Strike: downloading a map takes ages!). Plus if you use Compiz Fusion, you will definitely have more FPS. Another good point is when you run wine apps and they crash, you can easily kill everything related with Ctrl+Alt+Backspace (if zap is activated).

I do this with two scripts, save them somewhere and give them executable rights (chmod +x file):

1. newx

#!/bin/bash

DISPLAY=:1.0

xinit $* -- :1

This one sets the display variable to 1:0 instead of 0:0, so all apps with a gui that are started from here will be on this X-Server.

2. gamespecificscript – example: thug2

cd „/mnt/ntfs/Games/Tony Hawk’s Underground 2/Game/“
wine THUG2.exe

This file contains just the commands to start the game. I like to add mumble-overlay and some nvidia releated environment variables like antialiasing here.

When you got all that set up, just start the game per terminal or make a desktop starter which starts this:

/path/newx /path/gamespecificscript

Now you can switch between both X-Servers with Ctrl+Alt+F7 (desktop) and Ctrl+Alt+F8 (game). Note that some games might need to display normal GUIs instead of just the game (Steam eg), so you should run a lightweight window manager like openbox in this case. Install it and add

openbox-session &

on the top of the gamespecific script.

Also if you use GDM, you might not be able to start a second X-Server. You can give yourself the rights you need, somehow. I already googled this once and found it, it isn’t too hard.

Note for SLiM users: X.org will execute your .xinitrc, where you propably have the command to start your desktop environment. It’s a good idea to just copy the file elsewhere and point SLiM there instead of the normal one (archlinux: /etc/slim.conf)

2 Antworten zu „Start a new X-Server for playing games“


  1. 1 Gen2ly 28. Juli 2009 um 11:00

    My old newx script broke on xorg 1.6. Thank you.


  1. 1 re. keyboard issue solved. « Thoughty's Blog Trackback zu 17. August 2009 um 18:22

Eine Antwort schreiben




languages

both  
english    
german    

newest tweets & articles (en)

licenses

Except where otherwise noted:

Creative Commons License
All the text is licensed under a Creative Commons Attribution-Share Alike 3.0 Germany License.



CC-GNU GPL

Code snippets are licensed under the CC-GNU GPL version 2.0 or later.