I still consider my self a Linux noob
so this tutorial has been written specifically for the distro that I
use (Xubuntu 12.10) but it should work just as well on any other
*buntu or Mint. It might also look quite long but it isn't very
complex, I've just gone into a lot of detail to help avoid mistakes.
First let me explain what this tutorial
is about. The X-server is basically the program that allows you to
have a graphic environment on Linux. On top of the X server you run your
window manager (Gnome, KDE, XFCE, etc) which allows you to have
multiple GUI applications displayed at once as well as providing you
with a desktop.
'So what does this have to do with my
FPS in games run via PlayOnLinux?' I hear you ask. Basically the
desktop environment you're looking at now (Unity in Ubuntu, XFCE in
Xubuntu, KDE in Kubuntu, etc.) is using up resources.
Counterintuitively they don't stop using your computer's resources
when you run a fullscreen game. This will lower your FPS, quite
dramatically if your hardware isn't all that powerful to begin with.
What I'm going to do is show you how to
launch a fullscreen game in a separate X-server. You might think
running two X-servers would decrease your performance but actually it
will improve it because the new X-server will contain nothing but
your game and the one containing your desktop will be 'backgrounded'.
This means it wont use any system resources (apart from maybe taking
up a few megabytes in the swap file on your harddrive). There are
also issues with compositors (the things that give you all those
fancy desktop effects like transparency and shadows) not disabling
themselves when running fullscreen games, significantly impacting on
your FPS, this will fix those issues.
Hopefully you'll have a basic idea of
what we're doing now, so here is how you actually do it;
First, you'll need your game installed
and accessible via PlayOnLinux. In this example I'll be using World
Of Warcraft. It's important I point out that the WoW Launcher will
not launch in a separate X server, I assume because it requires a
window manager (which we're trying to avoid loading). This means
you'll need to start the launcher the normal way to download updates.
To get around this I launch the game directly using the WoW.exe. You
can skip the following steps marked with an *asterix if you do not
need to bypass a launcher program.
*So, we're going to create a shortcut within PlayOnLinux to your game of choice. Open up PlayOnLinux and click
'configure'.
*Select the game you want in the
left-hand pane and then click 'make a new shortcut from this virtual
drive'. Now select your game executable, in my case WoW.exe, click
'next'. I named it 'wowexec'.
*Close the configuration window.
Now, select your game executable
shortcut in the main PlayOnLinux window and click 'create a shortcut'
in the right-hand pane. This will place a shortcut on your desktop.
Go into your home folder, create a
folder named 'gamescripts' (the lack of spaces is important).
In this folder create a blank file
named [game]newx.sh (e.g. wownewx.sh). Right click on this file and
click 'properties', go to the 'permissions' tab and check the box
that says 'allow this file to run as a program'.
Now open the file in a simple text
editor (leafpad, gedit, whatever you have installed). DO NOT DOUBLE
CLICK THE FILE TO OPEN IT.
Paste the folloing into the file:
#!/bin/bash
xinit /usr/bin/ck-launch-session
/usr/share/playonlinux/playonlinux --run "wowexec" %F $* --
:3 & nvidia-settings –load-config-only
Change 'wowexec' to the name of your
game's internal PlayOnLinux shortcut. If you do not have an nvidia card just delete the '&
nvidia-settings –load-config-only' bit. When you are done save the
file.
Now we need to change some permissions
for the X-server so that your script will work. Before you go further
you should know that changing this setting is not a security best
practice but there are no exploits in the wild that make use of it
and the chance of seeing one in our lifetime that targets home Linux
PCs is virtually nonexistant.
If you're fine with that, run this
command in the terminal:
sudo dpkg-reconfigure x11-common
Select the 'Anybody' option and then
'OK' to exit. You can close the terminal emulator now.
Remember that shortcut to your game I
had you create on your desktop? Go to that now, right click and open
the 'properties' window. Click the 'Launcher' tab and replace the
command with the path to your newly created script. If you've
followed this tutorial exactly it should be this with the square brackets replaced with the appropriate info:
/home/[username]/gamescripts/[game]newx.sh
Close the shortcut properties window.
If you double click on the shortcut your game should now launch in a
new X-server.
-- HELP! HELP! --
On one machine I tried this on it
worked perfectly but I couldn't login to my user account after I had
rebooted the computer. You'll know if it happens to you because
everytime you try to log in the screen will go black for a second and
then you'll be dumped back at the login screen.
As best I can tell this is because your
user account no longer has permission to launch X-servers (even
though all other users on the computer can). Don't panic, here's what
you do:
Press Ctrl + Alt + F1 to access the
terminal.
Type in your username and then
password when prompted.
Type 'id' without the quotation
marks and press enter. The uid is your username, the gid is your
groupname (usually this will be the same as your username).
Now type the following replacing
'username' and 'groupname' with your uid and your gid (either use the
numbers or the name but not both):
sudo chown username:groupname
~/.Xauthority
Press Ctrl + Alt + F7 to get back
to the graphical login screen.