HOWTO: Set up a seperate X-server (New)

HOWTO: Set up a seperate X-server (New)

Discuss everything related to running Spring on your chosen distribution of Linux.

Moderator: Moderators

User avatar
Relative
Posts: 1371
Joined: 15 Oct 2006, 13:17

HOWTO: Set up a seperate X-server (New)

Post by Relative »

This HOWTO is based off this earlier HOWTO:

http://spring.clan-sy.com/phpbb/viewtop ... =20&t=8403

It has been updated not to rely on an outdated package config:

This guide has Ubuntu 7.10 or 8.04 in mind, but may work on other distributions, but I wouldn't know.

The aim of this guide is to show you how to setup a separate x-server to run spring. This improves spring's performance and allows you 'alt-tab' (or return to your desktop and back) as you would with windows, but better as that didn't always work well even under windows.

Step 1: Giving users the authority to start x-server sessions by editing Xwrapper.config:


First open the terminal and execute this:

Code: Select all

gksudo gedit '/etc/X11/Xwrapper.config'
You should get something like this at the bottom of that file:

Code: Select all

allowed_users=console
nice_value=0
Now you want to make sure it looks like this:

Code: Select all

allowed_users=anybody
nice_value=0
Save and close you text editor.

Step 2: Making your spring script!:

Open up your favorite text editor and paste this:

Code: Select all

#!/bin/bash
xinit /usr/games/spring $* -- :1
Save it as "spring".

3. Making your spring script an executable:

Code: Select all

cd /to/file/directory
chmod a+x ./spring
And that's it. Just run that file and spring with open up in a new x-server session. To swap back to your desktop session the key binding is ctrl+alt+F7. To swap back its ctrl+alt+F9. If you use springlobby or aflobby you just set this file to be your spring executable and it should work as normal.

Edit:
http://springrts.com/phpbb/viewtopic.php?f=20&t=19252
Last edited by Relative on 28 Jun 2009, 16:22, edited 6 times in total.
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: HOWTO: Set up a seperate X-server (New)

Post by aegis »

You should be able to skip to step 4 with

Code: Select all

sudo X :1

and change the script to do

Code: Select all

export DISPLAY=:1
if you have sudo privileges.

and can kill compiz-fusion with one of these in the script to launch spring

gnome/gdm:

Code: Select all

metacity --replace
kde:

Code: Select all

kwin --replace

at the end to restart compiz when it is done:

Code: Select all

compiz --replace
Last edited by aegis on 23 Apr 2008, 02:58, edited 4 times in total.
User avatar
LordMatt
Posts: 3393
Joined: 15 May 2005, 04:26

Re: HOWTO: Set up a seperate X-server (New)

Post by LordMatt »

hmm these are all the steps I forgot to explain to someone when I told them how to set up dual screens with separate xserver, no wonder it didn't work. @_@
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: HOWTO: Set up a seperate X-server (New)

Post by aegis »

if they have an nvidia card, they can run nvidia-settings and configure dual-monitor with ease :)
User avatar
Vadi
Posts: 446
Joined: 03 Jan 2008, 14:51

Re: HOWTO: Set up a seperate X-server (New)

Post by Vadi »

Does a separate X server really give that much of performance? I used to do that (manually logout, login to failsafe terminal) and didn't notice a performance increase.

Plus, I found out that that if you use glXCreateWindow, you can normally alt+tab out of games and even use compiz screen edges and so on to get out. Unfortunately the only game on Linux that I found so far to use that is Savage 2 :(
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: HOWTO: Set up a seperate X-server (New)

Post by aegis »

if nothing else, a separate X server prevents you from losing your X session if spring seizes up :)
User avatar
Vadi
Posts: 446
Joined: 03 Jan 2008, 14:51

Re: HOWTO: Set up a seperate X-server (New)

Post by Vadi »

*continues digging on the intrawebs on this wtflol-amazing glXCreateWindow method to bug devs later*...
User avatar
LordMatt
Posts: 3393
Joined: 15 May 2005, 04:26

Re: HOWTO: Set up a seperate X-server (New)

Post by LordMatt »

aegis wrote:if they have an nvidia card, they can run nvidia-settings and configure dual-monitor with ease :)
Of course it isn't that simple if you want a different display configuration for spring and your regular desktop. ;)
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: HOWTO: Set up a seperate X-server (New)

Post by aegis »

copy your /etc/X11/xorg.conf file at the state you want it

then start X with:

Code: Select all

X --config /path/to/file
or for a separate virtual terminal (the method above)

Code: Select all

sudo X :1 --config /path/to/file
User avatar
LordMatt
Posts: 3393
Joined: 15 May 2005, 04:26

Re: HOWTO: Set up a seperate X-server (New)

Post by LordMatt »

The full line that I use is:

Code: Select all

xinit /usr/local/games/spring $* -- :1 -config xorg-spring-dualscreens.conf > /home/matt/.spring/console.log
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: HOWTO: Set up a seperate X-server (New)

Post by aegis »

do you actually need to edit your Xauthority to allow more than one session?
User avatar
det
Moderator
Posts: 737
Joined: 26 Nov 2005, 11:22

Re: HOWTO: Set up a seperate X-server (New)

Post by det »

The script I use to start a new X server follows

Code: Select all

#!/bin/sh

if [ "$1" = "/V" ]; then
    echo "Spring 0.76b1"
else
    startx /usr/games/spring $@ -- :1
fi
I had to edit Xwrapper, but I didn't have to edit my XAuthority. I also symlink "~/.wine/drive_c/Program Files/Spring/spring.exe" to this script so that TASClient launches it.
gorgofdoom
Posts: 2
Joined: 12 May 2008, 04:22

Re: HOWTO: Set up a seperate X-server (New)

Post by gorgofdoom »

I really appreciate this post, it appears to get me about 10-15 extra fps while playing spring for some reason, which i don't think all comes form a separate x server. Even tho, it i have also used it for Urban Terror, Nexuz, and Alien Arena, however i am not sure that it is helping with the performance of these games.

p.s. im a n00b at anything coding, so if I'm an idiot, please tell me.
dila813
Posts: 1
Joined: 28 May 2008, 02:53

Re: HOWTO: Set up a seperate X-server (New)

Post by dila813 »

This is Enrique Schiel's Script and with the parms that were laid out in this string, the two work very well togeather.


!/bin/bash
# runner
#
# Sun Oct 28 07:17:37 2007
# Copyright 2007 Enrique Schiel
# <ecschiel@yahoo.com.ar>

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA

CHANGE=0

if ps -e | grep compiz; then
CHANGE=1
fi

if [ $CHANGE == 1 ]; then
printf "Disabling advanced desktop efects...\n"
/usr/bin/metacity --replace &
fi

printf "Running the game...\n"
xinit /usr/games/spring $* -- :1 &
wait $!

if [ $CHANGE == 1 ]; then
printf "The game is finished. Restoring advanced desktop efects...\n"
/usr/bin/compiz --replace &
fi
User avatar
Relative
Posts: 1371
Joined: 15 Oct 2006, 13:17

Re: HOWTO: Set up a seperate X-server (New)

Post by Relative »

@ dila813
Thanks for the script, but why does it have a copyright notice. That's almost the equivalent of having a copyright notice for 2+2=4, its absurd.
User avatar
Vadi
Posts: 446
Joined: 03 Jan 2008, 14:51

Re: HOWTO: Set up a seperate X-server (New)

Post by Vadi »

It's not absurd, because this is more than 2+2=4.
bashar
Posts: 152
Joined: 03 Dec 2006, 23:06

Re: HOWTO: Set up a seperate X-server (New)

Post by bashar »

ANd why do u need to turn off 3d adv effects if you run spring in a second X server?
User avatar
Relative
Posts: 1371
Joined: 15 Oct 2006, 13:17

Re: HOWTO: Set up a seperate X-server (New)

Post by Relative »

bashar wrote:ANd why do u need to turn off 3d adv effects if you run spring in a second X server?
You don't really have to.
bashar
Posts: 152
Joined: 03 Dec 2006, 23:06

Re: HOWTO: Set up a seperate X-server (New)

Post by bashar »

Relative wrote:
bashar wrote:ANd why do u need to turn off 3d adv effects if you run spring in a second X server?
You don't really have to.
Yes that was I meant.
User avatar
Hobo Joe
Posts: 1001
Joined: 02 Jan 2008, 21:55

Re: HOWTO: Set up a seperate X-server (New)

Post by Hobo Joe »

To make it so you can alt-tab/switch workspaces with Spring WITHOUT a separate X server, all you have to do is put the game in windowed mode, then as soon as it starts, use your window manager hotkey to put the game into fullscreen(if it's not set, in Ubuntu, go to 'System > Preferences > Keyboard Shortcuts'). Everything works as it should, but now you can alt-tab. :)

I originally did this because Linux with dual monitors and full screen apps tends to freak out, but if you put apps into fullscreen with the window manager hotkey it'll only fullscreen them on ONE of your screens, instead of trying to stretch it across both.

This works with or without Compiz.
Post Reply

Return to “Linux”