Linux Guide

From NS2 community wiki
Jump to: navigation, search
TuxRine.png
Last edit: Build 263

This Guide assumes that you have installed NS2 via Steam on Ubuntu. This is how we test it. So, if you have feedback, let Confused know and it will get added. Also my focus here is mostly on the client running not the dedicated server


Setting up ns2 on linux:

Before we can even start worrying about NS2 you are gonna need to install some stuff for to make your Linux client work. Dependencies chaps.

Compatibility/Requirements

ns2 on linux requires:

  • OpenGL 3.1 core
  • HLSL 1.40

Install Steam , Graphics drivers, and dependencies

Ubuntu’s wiki has these instructions to install steam right. Follow them. Be sure you install graphics card drivers. If you don't, I guarantee you that you will have a bad time.

Install NS2 Client

Open up steam sign in, pick NS2 off the list. Install that bad boy. Easy, peasy lemon squeezy. Wait a while, and you should be good.

Install NS2 Server

Zaggy has a quick and dirty linux server setup guide here. His guide is likely to be pretty good. If you are using steam cmd to setup your server, the NS2 appid is Client: 4920 Dedicated Server: 4940.

Running NS2

You know getting the game to run is pretty important. So, here is how we do it.

Running the client

You can run the game from the steam client which is recommended or via the command line as follows:

steam steam://rungameid/4920

Max says: You can run NS2 outside the Steam environment by using the Steam runtime. This is what we do for development. This readme describes more https://github.com/ValveSoftware/steam-runtime/blob/master/sdk/README.txt

Here is how this goes down:

$ cd ~/path/steam-runtime/sdk
$ ./shell-i386.sh
$ cd ~/.local/share/Steam/SteamApps/common/Natural\ Selection\ 2/
$ run.sh ~/.local/share/Steam/SteamApps/common/Natural\ Selection\ 2/ns2_linux32

It is important to:

  • call run.sh from the ns2 install directory
  • to provide a path to the executable as well.
  • use shell i386

Otherwise you get an error like the following, though possibly not in french:

$ run.sh ~/ns2/ns2_linux32 
  run.sh: ligne 32:~/ns2/ns2_linux32: Permission non accordée
  run.sh: ligne 32 : exec:~/ns2/ns2_linux32 : impossible d'exécuter : Permission non accordée

It should be noted that running the client requires opengl 3.1. AND shader language 1.4+

Running the server

Zaggy has a quick and dirty linux server setup guide here. His guide is likely to be pretty good. Start here.

Update for 259:

All of the dependencies required by the Linux dedicated server are included in the Steam Runtime. You should not need to install any other packages in order to run the dedicated server.

To run the dedicated server, you will need to run it through the Steam Runtime which is packaged with the server. To setup the Steam Runtime, use the following command from the directory where the dedicated server is installed:

steam-runtime/setup.sh --auto-update

Then to run the dedicated server use the follow command:

steam-runtime/shell.sh server_linux32

Getting Backtraces

NS2 on linux will occasionally fail spectacularly. It is very hard for us to test across all the distros of the world. If you do get a crash, it will help everyone if you can post a back trace. So, once you suspect you have a reproducible crash, follow the below steps and get a back trace using [1].

  • Start NS2 up, however you normally do,
  • Start up gdb in a terminal window
  • Attach gdb to NS2
  • Tell gdb to continue running
  • When you crash gdb should have paused execution.
  • Get the trace
  • Head to the support forum. Post that trace and your log into a thread either the existing one for the issue or you very own.

Here is how this looks:

$ps -e| grep ns2_linux32
  8200 ?        00:00:09 ns2_linux32
$gdb (you may need to sudo this)
lots and lots of text
(gdb) attach 8200
lots and lots of text
(gdb) cont
Continuing.
...
<ns2 crashes at some point>
Program received signal SIGSEGV, Segmentation fault.

(gdb) bt
 #0  0xf7afa214 in XXXXX (this=0x0) at ../Source/Render/YYYY.cpp:zzz
 ....


Then you just play until you get your crash, capture your back trace, and you are golden. You can also try using the script factoid provided though it will take a bit of editing to run unless you are using primusrun.

Debug information

Things you probably want to know eventually about your new shiny tux based NS2. These are useful debugging tools etc that help since techsupport.exe doesn't really work on linux.

NS2 LOG directory aka %appdata% folder

The directory formerly known as  %appdata% is now ~/.config/Natural Selection 2/. This is your home directory ie /home/confused/.config/Natural Selection 2

STEAM directory aka c:/program files/steam

This is now ~/.local/share/Steam. This is in your home directory ie /home/confused/.local/share/Steam

Generating DXDIAG/ sysinfo

Dxdiag doesn’t exist on linux. Your best option is to run sysinfo. It is not installed in most base images so you might have to install it. Easy peasy.

Open a terminal and run:

$ sysinfo

If you get this follow the instructions, apt-get to the rescue. The program 'sysinfo' is currently not installed. You can install it by typing:

$ sudo apt-get install sysinfo
$ sysinfo

You should see something like this:

Sysinfo.png


click File-> Save and get that bad boy saved somewhere. It should start something like this if you open it up in the editor:

System information report, generated by Sysinfo: 8/23/2013 10:58:02 AM

Listing all the installed packages:

If for some ungodly reason you want to list all the things you got installed on your machine you can run: dpkg --get-selections > packages.txt

Issues and fixes

Issues you might encounter and how to fix them. By and large these are going to be client issues. There is a whole page about dedicated server issues on the wiki. It may also help to look here in case the issue you are having is with steam and not with ns2 directly. steam for linux issue tracker

[Client] Game does not load, Error: OpenGL version 3.1 is required

You need to install a different video driver, or your hardware is not opengl 3.1 compatible. This error seems to occur primarily on older intel hardware.

You can check specific cards using this tool to determine if your software hardware combo supports OpenGL 3.1 Run glxinfo|grep OpenGL. The output should contain your exact OpenGL version.

If your hardware or your drivers do not support OpenGL 3.1, you are not going to be able to play using OpenGL and thus not on Linux.

[Client]error while loading shared libraries:

  • You are trying to run the game without the steam runtime enabled. Run the game via steam or using the run script.
  • You may need to instal ia32-libs and/or ia32-libs-multiarch
  • If you are running using run.sh you need to execute from the ns2 install directory

[Client]Strange Resolution choices

On Linux we have a predefined list of resolutions and we filter out the ones that are higher than your native resolution or don’t match the aspect ratio. -Max

You can manually set them in ~/config/Natural Selection 2/system_options.xml though it will be overwritten if you change your graphics options in game.

[Client] Issue with binding keys in certain keyboard layouts

It is reported. sorry for now.

[Client] crash while running nvidia-319 and nvidia-325 on ubuntu 12.04

Debate about updating to 13.04, unsure the results.

The nvidia-current package seems to work as well.

[Client] Crash while running on AMD hardware. Black screen at startup

This is on going please check out this thread: http://forums.unknownworlds.com/discussion/131759/linux-black-screen-at-start-up-then-exit#latest

Try the suggested driver version:fglrx 13.8 beta 2 If it says broken, post in the thread and we will see what else we can do.


[Client] unable to bind keys/ mouse buttons

This issue occurs in primarily non US keyboard layouts as well as for mouse buttons. UWE knows about it but has not yet released a patch. also make sure you have followed the Bit 2 notes above about console bindings.

[CLIENT] Black screen after driver update

If you get this after a driver update and an error message in the log reading:

Error: Program binary could not be loaded. Binary is not compatible with current driver/hardware combination.

please delete your shader cache from ~/.config/Natural Selection 2/cache


[SERVER] Cannot load libspeex.so

This error occurs when you have run the server without the steam runtime. You really gotta run with the steam runtime. It can also occour that your linux distribution doesn't support the i386 architecture (32bit). You have to install this architecture via Multiarch. You will need atleast Debian 7.0 Wheezy or Ubuntu 12.10 to use this feature. To check your debian version type:

cat /etc/debian_version

To check your ubuntu version type:

lsb_release -r

If your server meets the requirements, check out this Dedicated Server Prerequisites - NS2 community wiki If you can't install the i386 packages and/or can't use "dpkg --add-architecture i386" you have to update your server! (for Debian to version 7.0 Wheezy and for Ubuntu to atleast 12.10 Quantal Quetzal)

[Client] Cannot get sound

If you don't see sound as an option and or cannot get it working.

try two things first:

  • set the audio driver in steam using the following:
    • SDL_AUDIODRIVER=alsa steam
    • SDL_AUDIODRIVER=pulseaudio steam
  • install lib32-alsa-plugins

if that fails post in this thread: http://forums.unknownworlds.com/discussion/132931/

Performance Tips and Tweeks

Try the tips and tweeks thread.

Disable Catalyst AI

For amd cards tuxator is reporting a significant frame rate increase if you disable catalyst AI.

Try a different window manager

Some users have had success with changing their window manager to get better frame rates. No real suggestions here but it might be worth a try.

As a test I compared cinnamon, from linux mint, to gnome 3d fall back. i get 25-45 fps on gnom and 3-7 in cinnamon on my overtaxed old hardware. So, maybe the rule here is that a 2d window manager is better than a 3d one. shocking I know.

AppleTalk posted a similar fix with some instructions here

r_mt false

Some users seem to think that this is a game changer. Why not try it?

Use Full Screen at desktop resolution

seems like it helps