Why you should stop playing UrT to become a better player
 

Stop playing UrT

Tips

 
44 Magnum – Yet another sidearm for Urban Terror 4.2
 

44 Magnum in 4.2

News

 
Razer Mamba Review
 

Razer Mamba Review

Review

 

Solve Urban Terror Graphic Problems with Affinity

PreviousN writes: …about a year and a half ago I built what I thought would be a rockin’ computer. I was an early adopter of the AMD Phenom 9500 (I didn’t know about the memory hole prior to purchasing- OUCH!), a Geforce 8800gs (which overclocks like crazy), 4GB of RAM, and some speedy disk drives in RAID. Urban Terror is really the only game I play and I made the (wrong) assumption that my rig would own it like noobs on h2o’s Texas TDM. After setting up a dual boot (Windows XP and Ubuntu), I powered up Urban Terror and was left with an ugly 50fps taste in my mouth. What could have possibly gone wrong? After much googling I found out that Urban Terror has a well known bug that messes up with CPU scheduling on multi-core processors. Straight from the official Urban Terror FAQ “…people with dual core cpu’s might need to turn off affinity on 1 core…”. My understanding is that the Urban Terror process is opened up and then tossed around like a baseball between processor cores. The constant switching between cores creates a choppy game play and low fps. I’ve stumbled upon Daily Nade’ and wanted to share my knowledge in fixing the problem. Here’s how to do it on Windows and Linux. Sorry Mac users, but I don’t own a Mac (Engine’s note: I do and got no problems thank you :D ).

Windows:

  1. Open your Urban Terror directory and start the game.
  2. Alt-Tab out back to Windows, and right click on the taskbar, choose “Task Manager.” Or just Ctrl-Alt-Del.
  3. Right click on the Urban Terror process, choose set Affinity.

    Set affinity in Windows

    Set affinity in Windows

  4. Uncheck all but one processor core.

    Leave 1 Checked

    Leave 1 Checked

  5. Bask in better fps glory and own some noobs in UrT.

Ubuntu: There is a great amount of arguing among Linux enthusiasts over whether manually setting affinity should be required. I don’t care which side of the fence you’re on but to me results (and what “does happen”) matters more than what “should happen.” Setting affinity manually makes so much of a difference for me that I will never again play Urban Terror competitively without setting it manually.

  1. Open a terminal. This can be done by navigating to the Applications menu. Choose “Accessories” –> “Terminal.”
  2. Type “sudo apt-get install schedtool” without the quotes. You’ll be prompted for your password. You are now installing the scheduling tools for Linux.

    Installing Schedtools on Ubuntu

    Installing Schedtools on Ubuntu

  3. Start Urban Terror. For me, this means double-clicking on “ioUrbanTerror.x86_64”.
  4. In the terminal you used to install schedtools, type “top” and hit enter. This gives you a list of processes and how much CPU/RAM they are using.

    Running the "top" command in ubuntu

    Running the "top" command in ubuntu

  5. Open a new terminal. A shortcut to do this (if you are still focused on Terminal) is “shift-ctrl-n”. Type in “schedtool –a (CPU #, starting with 0) PID (from top)”. So, “schedtool –a 0 6297” would make process 6297 (Urban Terror in my screenshot) have an affinity for CPU0.

    setschedtoolsmall

    Setting schedtools in Ubuntu via Terminal

  6. Enjoy smoother gameplay! Tip: In Urban Terror, I get better FPS on Linux versus Windows.

Or

  1. For an automated solution, create a gnome launcher or script that contains something similar to this: “schedtool –a 0 –e /pathtoUrT/ioUrbanTerror.x86_64”. Replace “pathtoUrT” with the path to Urban Terror, and the script will launch Urban Terror with an affinity for CPU0.
  2. So for me, the command looks like this: “schedtool -a 0 -e /media/Shorty/UrbanTerror/ioUrbanTerror.x86_64″LauncherScreenshot

That’s all! Now go out there and enjoy some improved performance! Best, PreviousN

Related posts:

  1. Ubuntu 9.10 & Urban Terror Readers at the Ubuntu Forums are reporting that the upgrade to Ubuntu 9.10 is causing strange behavior with mouse movement in Urban Terror and other 3D games. Worse is that some are reporting random crashes and runaway processes that can only be stopped with the kill command. It seems that a fix has been found [...]...
  2. Funny minigames hidden in Urban Terror Did you ever played Team Survivor and died first? Isn't it annoying? You have to wait for the round to end, and if they don't find each other it will take forever. Kinfe is boring. So what are you going to do? I found myself playing with the iPhone in the meantime, but thanks to Fleet I've discovered two minigames hidden inside Urban Terror. Let's play some games!...
  3. Urban Terror Server: 64 slot madness! A 64 players slot is possible? Apparently yes. The WarriorTeam clan from Italy managed to set up a 64 player server for UrbanTerror. How is it? Let's find out with this review!...
  4. Urban Terror Aim Settings Basics This is a long awaited post. There are a few variables that you can use to improve your mouse precision besides sensitivity. These variables can really help, in conjuntion with a good mouse to improve your aim skills. Today we are going to take a look just at the basics, since the topic is really [...]...
  5. Could Urban Terror become the next Counter Strike? The next Urban Terror update is gonna be really important. In my opinion is gonna equal the importance that the 3.0 and the 4.0 had in the past. The 3.0 and the 4.0 created the game, but the next relase is going to perfect it. Urban Terror 4.2 is really going to tell if Urban Terror is going to [...]...

14 Comments

  1. Flamey says:

    This is a helpful reference post as many people have this issue and it’s simply dealt with informally on a case-by-case basis. Good job on the article.

  2. Erken says:

    Thanks for sharing this tip with us, Windows and Linux users! :-)

  3. Gnorkh says:

    There’s also an easy solution to automate the core affinity on windows:

    1. Download the file “imagecfg.exe”, for example from here:
    http://www16.brinkster.com/salvage/thief/darkengine.htm

    2. Unzip it to Windows\system32\

    3. Open the Windows Command Prompt and type the following line:
    imagecfg -a 0×1 c:\UrbanTerror\ioUrbanTerror.exe
    (of course, if your path to UrT is not “c:\UrbanTerror\ioUrbanTerror.exe”, you have to change the command accordingly)

    That’s it :)

  4. Thanks! I’ve wondered if doing this would fix my FPS issues on my crappy netbook, I’ve been playing at 20-30 FPS on that thing for so long that when I get to play at 125 of my real computer everything seems off… Thank You!!!

  5. Sirmimer says:

    I got triple core (i dont know much about pc’s but isnt that 3 cores?).

    I get 101 (cap at 100, cause when i like look into trees it falls to 75, and i dont wanna go from 126 to 75) but in an old game as this i should be able to get a stable 126, shouldnt i?

    I havnt really read it all yet, just taken a quick look at it.. I’m using ubuntu, and got that triple core. Can i fix it with this guide? And will it effect my pc in other games and stuff?

  6. PreviousN says:

    Sirmimer: You would think that, wouldn’t you? (That with such an old game it should be easy to get a higher fps). I can’t say you’ll have a stable 126 at all times but depending on your processor you’ll likely see the frame rate become more stable and at a higher frame rate.

    I say give it a try, you don’t have much to lose do you? I’ve noticed that this works best when you also force xorg onto a different core too. Say, for example, put urban terror on core 0 and xorg on core 1. As for other games, I’m not sure. On a case by case basis I think it depends on if the game has been optimized for multi-core systems.

  7. apw says:

    any news on this for mac?

    • PreviousN says:

      APW, I’ve done a lot of research and it seems that a tool to control affinity does not exist for mac. However, that does not mean that the problem does not affect mac.

      I’ll keep looking and reply if I find something.

  8. Eyrie says:

    schedtool -a 0 -e /pathto/urt didn’t work for me.
    I’m running schedtool_1.3.0-1_amd64.deb

    > schedtool –a 0 –e /opt/UrbanTerror/ioUrbanTerror.x86_64
    ERROR: Ignoring arg –a: is not a PID
    PID 0: PRIO 0, POLICY N: SCHED_NORMAL , NICE 0, AFFINITY 0×3
    ERROR: Ignoring arg –e: is not a PID
    ERROR: Ignoring arg /opt/UrbanTerror/ioUrbanTerror.x86_64: is not a PID

    Any ideas?

    • PreviousN says:

      I see you’re trying to run it as a script. Here is a copy/paste of my script:
      schedtool -a 0 -e /media/Shorty/UrbanTerror/ioUrbanTerror.x86_64

      I also noticed you have Urban terror in /opt/ which sounds weird to me. Maybe that isn’t where your UrT lives, and that’s why it’s throwing you an error. Below is a command to find out for sure where it lives:

      sudo su
      find / | grep ioUrbanTerror.x86_64

      The above command will search your whole computer for ioUrbanTerror.x86_64. I’m guessing you won’t find it in /opt. It’ll more likely be in /usr/bin or something like that. If it is in /opt, make sure it is executable. (sudo chmod +X ioUrbanTerror.x86_64)

      If you’re still getting an error, try using it after the game loads and see if you get the error.
      (top, take note of the number, then try with schedtool -a 0 number) You may also try schedtool -a 0 ‘ioUrbanTerror.x86_64′ (with the quote).

      Here’s a description of the meaning of the flags:

      -a = affinity (so when you use schedtool -a you need a number after it telling your computer which processor it should have an affinity for. You can tell it to have an affinity for multiple processors, though that’s pointless in this case).

      -e = command (this is the command executed)

      Here are some examples from the man page:
      EXAMPLES
      To query the $SHELL’s policies:
      #> schedtool $$

      To query some PIDs, namely 1 2 and 3:
      #> schedtool 1 2 3

      To execute mplayer in SCHED_RR with priority 20. The priority arg is needed for both SCHED_RR and SCHED_FIFO.
      #> schedtool -R -p 20 -e mplayer -quiet some_file.avi

      To set current shell to SCHED_BATCH, which all programs the shell starts will inherit:

      #> schedtool -3 $$

      To set all processes with the name ‘cpu_hog’ to SCHED_BATCH:
      #> schedtool -3 `pidof cpu_hog`

      To set a process’ affinity to only the first CPU (CPU0):
      #> schedtool -a 0×1

      Using the list mode and affinty of CPU0 and CPU3:
      #> schedtool -a 0,3

      A combination of an affinity and a policy-argument is – of course – always possible.
      #> schedtool -B -a 0×1

      I hope this helps you. I’m guessing you are pointing schedtool towards something that isn’t executable or something that doesn’t exist. I think that because it says: “not a PID”. So it’s looking for a pid/program and not finding it.

    • Mr.Phi says:

      Don’t paste the command, there is an encoding bug with ‘ – ‘.
      schedtool don’t know than -a and -e are two options, it use them like arguments because the ‘ – ‘ are dash long.
      Sorry for my bad english, I’m french. :p

Leave a Comment

Get your avatar at Gravatar.
Be kind and stay on topic.