Forums

Improve Your FPS In All Games

By running them in a separate X-server

Auteur Réponses
Fibbs Mardi 13 Novembre 2012 à 23:58
FibbsAnonymous

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:


  1. Press Ctrl + Alt + F1 to access the terminal.

  2. Type in your username and then password when prompted.

  3. 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).

  4. Now type the following replacing 'username' and 'groupname' with your uid and your gid (either use the numbers or the name but not both):

  5. sudo chown username:groupname ~/.Xauthority

  6. Press Ctrl + Alt + F7 to get back to the graphical login screen.

am_i_registered Jeudi 30 Mai 2013 à 0:37
am_i_registeredAnonymous

Hello, I know I'm ressurecting an old post here, but... I followed the instructions and now I am able to run my games on a separate X and I'm really happy with the performance boost.

However, there is an issue!

When I use my keyboard and mouse to play the game, there is no problem, but when I use the my gamepad... after ~15min the screen goes off and I need to move my mouse to turn the screen back on...
I'm not a linux guru, but I tried several things to stop it, but with no success...

I've tried to add the following commands to the script:

xset -dpms
xset s off

but nothing happened.. I don't even know if I did it correctly... could you please help me with this?

Many thanks in advance, D.

Edité par am_i_registered

Ronin DUSETTE Jeudi 30 Mai 2013 à 19:31
Ronin DUSETTE

Well, thats literally just your screen going to sleep, but Im not sure how to control that on a seperate x server.

Please:
Post debug logs & full computer specs in first post
No private messages for general help, use the forums
Read the wiki, Report broken scripts
Smon Vendredi 31 Mai 2013 à 1:55
SmonAnonymous

In what script have you added these lines:
xset -dpms
xset s off

Maybe an
export DISPLAY=:1

at the beginning of the script would help.
Maybe
DISPLAY=:1 xset -dpms s noblank
can help here
Smon Vendredi 31 Mai 2013 à 1:56
SmonAnonymous

Little on topic: I run Crysis Benchmark in my X with xfce and in a seperate X, there was no real difference.
Ronin DUSETTE Vendredi 31 Mai 2013 à 17:59
Ronin DUSETTE

Then this thread is probably of little use. I dont see how a seperate X server would make a difference.

Please:
Post debug logs & full computer specs in first post
No private messages for general help, use the forums
Read the wiki, Report broken scripts
booman Jeudi 18 Juillet 2013 à 14:38
booman

I found that running games in Openbox works really good too. Practically doing the same thing.
I'll just login to Openbox instead of Cinnamon and then open terminal and run PlayOnLinux.

I have seen some performance boost doing this with PlayOnLinux games and Native Linux games.

Just my two cents...

† Booman †
Mint 21.3 64-bit | Nvidia 535| GeForce GTX 1650
Linux for Beginners | PlayOnLinux Guides | PlayOnLinux Explained

This site allows content generated by members, and we promptly remove any content that infringes copyright according to our Terms of Service. To report copyright infringement, please send a notice to dmca-notice@playonlinux.com