Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Other Community Discussions > Tutorials & Tips
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Tutorials & Tips
The place to find Ubuntu related Tips & Tricks.

 
Thread Tools Display Modes
Old July 24th, 2005   #1
endy
Ubuntu Extra Shot
 
endy's Avatar
 
Join Date: Apr 2005
Beans: 267
Dapper Drake Testing/
HOW TO: Run games on a new X server

I already covered this in an unrelated post in the gaming forum and the nuts and bolts of this are all probably in the linux-gamers.net how to, but I like to keep things local here

Basically the ideas behind this is you run can run your games like Doom 3, Quake, Enemy Territory and pretty much anything in a new X server. The main benifit of this is that your dektop will get backgrounded which should give the game a performance boost and the ability to switch between your fullscreen game and your desktop, for example to check on an irc message.

I found this incredibly useful while clan gaming in the past as people would message me alot in irc while I played and otherwise I had to quit the game to see what it was. And now even though I don't play seriously any more I can't live without it. I will be using Enemy Territory as the example as it's my favorite game

"Enough already, show me the stuff" I hear you say, well ok then here you go:


1. First to allow you to run a new X display you need to edit the "/etc/X11/Xwrapper.config" file:

Code:
sudo cp /etc/X11/Xwrapper.config /etc/X11/Xwrapper.config.custom
sudo su
md5sum /etc/X11/Xwrapper.config > /var/lib/xfree86/Xwrapper.config.md5sum
exit
sudo dpkg-reconfigure xserver-common
Then make sure you change the first option to "Anybody" and hit enter twice.


2. Next we have to set your ~/.Xauthority file up. This may look tricky but it's very straight forward, all you need to do is add a line using a special key we find. So, in a terminal type:

Code:
xauth
list
And you should get an output something like this:

Code:
ananke/unix:0  MIT-MAGIC-COOKIE-1  9fde426e5g03b20f4b7e51cb329d3033
localhost.localdomain/unix:0  MIT-MAGIC-COOKIE-1  9fde426e5g03b20f4b7e51cb329d3033
Yours WILL be different, thats ok. Now we need to add a new line and then exit to save it. So we type in "add :1.0 MIT-MAGIC-COOKIE-1" followed by that long alpha numeric string. I've highlighted mine in bold above so you know what I'm talking about but remember to use yours. So for me I would type the following:

Code:
add :1.0 MIT-MAGIC-COOKIE-1 9fde426e5g03b20f4b7e51cb329d3033
exit
Remember YOU have to use YOUR OWN sting of numbers and letters copied form the output we got earlier, mine is just an example. Ok? I know it's a bit abstract but hopefully this is clear enough.


3. Create the script "x.et":

Code:
gedit x.et
And paste the following:

Code:
#!/bin/bash
xinit /usr/local/games/enemy-territory/et $* -- :1

4. Now we need to make it executable and move it to the right place:

Code:
chmod a+x ./x.et
sudo cp ./x.et /usr/local/bin

5. Run "x.et" in a terminal, ET should run on a new X server. To access your desktop you need to press:

Code:
CTRL + ALT + F7

6. To go back to ET by pressing:

Code:
CTRL +  ALT + F8

That's it! Another great benefit to this is that with the "x.et" script you don't even need to be running your desktop to play a game. Meaning if you boot up to "run level 3" or you quit gnome and gdm to get to a command prompt you can run "x.et" and it will still work saving even more resources!


Extra notes:

If like me you use an ~/.Xmodmap file to amend your mouse buttons (I have a Logitech mx510) then you need to add that like to the script aswell so that X server is configured properly like this example of my script:

Code:
#!/bin/bash
xmodmap -display :1 -e "pointer = 1 2 3 6 7 8 9 10 4 5" &
xinit /usr/local/games/enemy-territory/et $* -- :1
Obviously you need to put your own setting in the quotes but it's important you keep the ampersand (&) at the end to background the command or else your game will never run.

If you use the fabulous XQF then you can change the command to run "x.et" instead of just "et", that's a real winning combination!

Last but not least, it's a good idea to turn screensavers off so they don't load on your idle desktop while you're playing and suck up resources. It's probably a good idea to have the "Blank Screen Only" set which shouldn't affect performance.

Hope you like it

Last edited by endy; August 16th, 2005 at 07:44 AM..
endy is offline   Reply With Quote
Old July 24th, 2005   #2
Nightblade
Just Give Me the Beans!
 
Join Date: Jun 2005
Beans: 50
Re: HOW TO: Run games on a new X server

Quote:
Originally Posted by endy
I already covered this in an unrelated post in the gaming forum and the nuts and bolts of this are all probably in the linux-gamers.net how to, but I like to keep things local here

Basically the ideas behind this is you run can run your games like Doom 3, Quake, Enemy Territory and pretty much anything in a new X server. The main benifit of this is that your dektop will get backgrounded which should give the game a performance boost and the ability to switch between your fullscreen game and your desktop, for example to check on an irc message.

I found this incredibly useful while clan gaming in the past as people would message me alot in irc while I played and otherwise I had to quit the game to see what it was. And now even though I don't play seriously any more I can't live without it. I will be using Enemy Territory as the example as it's my favorite game

"Enough already, show me the stuff" I hear you say, well ok then here you go:

1. First to allow you to run a new X display you need to edit the "/etc/X11/Xwrapper.config" file:

Code:
sudo cp /etc/X11/Xwrapper.config /etc/X11/Xwrapper.config.custom
sudo md5sum /etc/X11/Xwrapper.config > /var/lib/xfree86/Xwrapper.config.md5sum
sudo dpkg-reconfigure xserver-common
Then make sure you change the first option to "Anybody" and hit enter twice.


2. Create the script "x.et":

Code:
gedit x.et
And paste the following:

Code:
#!/bin/bash
xinit /usr/local/games/enemy-territory/et $* -- :1

3. Now we need to make it executable and move it to the right place:

Code:
chmod a+x ./x.et
sudo cp ./x.et /usr/local/bin

4. Run "x.et" in a terminal, ET should run on a new X server. To access your desktop you need to press:

Code:
CTRL + ALT + F7

5. To go back to ET by pressing:

Code:
CTRL +  ALT + F8

That's it! Another great benefit to this is that with the "x.et" script you don't even need to be running your desktop to play a game. Meaning if you boot up to "run level 3" or you quit gnome and gdm to get to a command prompt you can run "x.et" and it will still work saving even more resources!


Extra notes:

If like me you use an ~/.Xmodmap file to amend your mouse buttons (I have a Logitech mx510) then you need to add that like to the script aswell so that X server is configured properly like this example of my script:

Code:
#!/bin/bash
xmodmap -display :1 -e "pointer = 1 2 3 6 7 8 9 10 4 5" &
xinit /usr/local/games/enemy-territory/et $* -- :1
Obviously you need to put your own setting in the quotes but it's important you keep the ampersand (&) at the end to background the command or else your game will never run.

If you use the fabulous XQF then you can change the command to run "x.et" instead of just "et", that's a real winning combination!

Hope you like it
I got "client rejected by server" or something when i ran this, just a checkerboard screen with a X in the middle.

Also sudo md5sum /etc/X11/Xwrapper.config > /var/lib/xfree86/Xwrapper.config.md5sum <- that line gave me permission denied on the part after >... =) Anyway, great guide, will be glad to use it when I make it work.
Nightblade is offline   Reply With Quote
Old July 24th, 2005   #3
endy
Ubuntu Extra Shot
 
endy's Avatar
 
Join Date: Apr 2005
Beans: 267
Dapper Drake Testing/
Re: HOW TO: Run games on a new X server

Ok I did miss a whole part out.

*bangs head on desk *

Sorry about that, I've amended the how to and I hope it should work now. The bit about the xauth is kinda hard to explain, I've done my best but if you have any questions I'll do my best to clear it up. But if it all goes wrong on the xauth bit just type "quit" instead of "exit" and no changes will be saved.

Hope this does the trick this time

Last edited by endy; July 24th, 2005 at 09:34 AM..
endy is offline   Reply With Quote
Old July 24th, 2005   #4
Nightblade
Just Give Me the Beans!
 
Join Date: Jun 2005
Beans: 50
Re: HOW TO: Run games on a new X server

Quote:
Originally Posted by endy
Ok I did miss a whole part out.

*bangs head on desk *

Sorry about that, I've amended the how to and I hope it should work now. The bit about the xauth is kinda hard to explain, I've done my best but if you have any questions I'll do my best to clear it up. But if it all goes wrong on the xauth bit just type "quit" instead of "exit" and no changes will be saved.

Hope this does the trick this time
Yay! Works like a charm now Except for one thing... I usually run armyops with the aoss option before to have sound... is there a way to do that with xinit? Tried adding aoss before the path to armyops bin but no go...

Thanks for a great guide, been looking for this a long time.
Nightblade is offline   Reply With Quote
Old July 24th, 2005   #5
shawn
Just Give Me the Beans!
 
Join Date: Jul 2005
Beans: 43
Re: HOW TO: Run games on a new X server

This worked perfectly for my copy of Doom 3, I can now edit config files in gedit and switch back to Doom 3 and execute them. Incredibly slick!

Thank you very much endy - you just made gaming in Ubuntu a far more pleasant experience for me!
shawn is offline   Reply With Quote
Old July 25th, 2005   #6
endy
Ubuntu Extra Shot
 
endy's Avatar
 
Join Date: Apr 2005
Beans: 267
Dapper Drake Testing/
Re: HOW TO: Run games on a new X server

Quote:
Originally Posted by Nightblade
Yay! Works like a charm now Except for one thing... I usually run armyops with the aoss option before to have sound... is there a way to do that with xinit? Tried adding aoss before the path to armyops bin but no go...

Thanks for a great guide, been looking for this a long time.
If it's an argument for the game then you can pass it as you would usually, for example using enemy territory again, if I wanted to tell it to run in a window I'd type:

Code:
x.et +set r_fullscreen 0
Just like I would normall type:

Code:
et +set r_fullscreen 0
Does this help?
endy is offline   Reply With Quote
Old August 6th, 2005   #7
ishtvan222
5 Cups of Ubuntu
 
ishtvan222's Avatar
 
Join Date: May 2005
Beans: 24
Re: HOW TO: Run games on a new X server

This is a great howto. I am having a problem tho. I can start it fine but then if i switch back to my desktop and then back to the game (CTRL ALT F6) all I see is the terminal output. I cannot acccess the game. It is still running because I can hear the music but I cannot get into the game.

Any ideas?

BTW im playing with Unreal Tournament 2004

edit: oops, never mind. I realized that the new X server is started on F8 and i thought it wud be on F6 because that is where i ran the command.

Last edited by ishtvan222; August 6th, 2005 at 02:31 PM..
ishtvan222 is offline   Reply With Quote
Old August 8th, 2005   #8
Jesus Franco
A Carafe of Ubuntu
 
Join Date: Jan 2005
Location: Lawernce, Mass, USA
Beans: 78
Re: HOW TO: Run games on a new X server

This seems very interesting.

I just wanted to know how would this increase performance? I would think running another X server would use up more ram. If thats not the case then awesome.
Jesus Franco is offline   Reply With Quote
Old August 9th, 2005   #9
BanskuZ
5 Cups of Ubuntu
 
Join Date: May 2005
Location: Finland
Beans: 39
Ubuntu 7.10 Gutsy Gibbon
Re: HOW TO: Run games on a new X server

Nice guide. I use this script:
Code:
#!/bin/bash
xinit $* -- :1 > /dev/null
And then: anotherscreen ~/your/path/to/game
BanskuZ is offline   Reply With Quote
Old August 11th, 2005   #10
muszek
5 Cups of Ubuntu
 
Join Date: Jul 2005
Beans: 42
Re: HOW TO: Run games on a new X server

Hi. I did everything you mentioned exactly the same (the only difference is that I named the file x.armyops). Got a unusual greyish background with an "x" mouse cursor and a (correct) armyops splash image. Normally it's a black background. Then (in the console) I saw it was terminated due to an error. Here's the full output:

Code:
muszek@muszek:~$ x.armyops

_XSERVTransSocketOpenCOTSServer: Unable to open socket for inet6
_XSERVTransOpen: transport open failed for inet6/muszek:1
_XSERVTransMakeAllCOTSServerListeners: failed to open listener for inet6

X Window System Version 6.8.2 (Ubuntu 6.8.2-10 20050405154308 root@terranova.war thogs.hbd.com)
Release Date: 9 February 2005
X Protocol Version 11, Revision 0, Release 6.8.2
Build Operating System: Linux 2.6.10 i686 [ELF]
Current Operating System: Linux muszek 2.6.10-5-k7 #1 Fri Jun 24 18:51:20 UTC 20 05 i686
Build Date: 05 April 2005
        Before reporting problems, check http://wiki.X.Org
        to make sure that you have the latest version.
Module Loader present
OS Kernel: Linux version 2.6.10-5-k7 (buildd@vernadsky) (gcc version 3.3.5 (Debi an 1:3.3.5-8ubuntu2)) #1 Fri Jun 24 18:51:20 UTC 2005 T
Markers: (--) probed, (**) from config file, (==) default setting,
        (++) from command line, (!!) notice, (II) informational,
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.1.log", Time: Thu Aug 11 18:51:13 2005
(==) Using config file: "/etc/X11/xorg.conf"
Skipping "/usr/X11R6/lib/modules/extensions/libGLcore.a:m_debug_clip.o":  No sym bols found
Skipping "/usr/X11R6/lib/modules/extensions/libGLcore.a:m_debug_norm.o":  No sym bols found
Skipping "/usr/X11R6/lib/modules/extensions/libGLcore.a:m_debug_xform.o":  No sy mbols found
(WW) fglrx: No matching Device section for instance (BusID PCI:3:0:1) found
Skipping "/usr/X11R6/lib/modules/libfb.a:fbmmx.o":  No symbols found
(EE) fglrx(0): Failed to initialize UMM driver.
Warning: font renderer for ".pcf" already registered at priority 0
Warning: font renderer for ".pcf.Z" already registered at priority 0
Warning: font renderer for ".pcf.gz" already registered at priority 0
Warning: font renderer for ".snf" already registered at priority 0
Warning: font renderer for ".snf.Z" already registered at priority 0
Warning: font renderer for ".snf.gz" already registered at priority 0
Warning: font renderer for ".bdf" already registered at priority 0
Warning: font renderer for ".bdf.Z" already registered at priority 0
Warning: font renderer for ".bdf.gz" already registered at priority 0
Warning: font renderer for ".pmf" already registered at priority 0
Could not init font path element unix/:7100, removing from list!
Couldn't set video mode: Couldn't find matching GLX visual


History:

Exiting due to error

waiting for X server to shut down
Please help.
muszek is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:20 AM.


vBulletin ©2000 - 2010, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. lingonberry