Having Trouble loading TF2 Or any other games in Steam with Optimus?

So, i had been having an issue with loading games from the steam client. If i run steam with “optirun steam“, then sure..steam loads with optirun. It does not however launch games with optirun as well. So if you pressed the play button for a game in the library, it wouldn’t be “optimized”. So i had to search around for a fix, and i found someone who made a small script that you place into your “Team Fortress 2” folder. Although im not talking just about TF2 here.

Anyway..here is the script. I just made a new document file called optirun-tf2.sh, opened then added this:

# hl2.sh modified for TF2 and optirun
# http://steamcommunity.com/groups/LinuxOptimus

GAMEROOT=$(cd “${0%/*}” && echo $PWD)
STEAMPATH=$(readlink ~/.steampath)
if [ ! -z ${STEAMPATH} ]; then
ulimit -n 2048
if [ ! -f steam_appid.txt ]; then
echo “520” > steam_appid.txt
LANG=C LD_LIBRARY_PATH=~/Steam/ubuntu12_32:$LD_LIBRARY_PATH optirun

./hl2_linux -game tf -steam “$@”

then save the file, and then run “chmod +x optirun-tf2.sh” to make it executable.

i have to explain how to use this for Team Fortress 2, Counterstrike (Beta), and Half-Life (Beta).

LANG=C LD_LIBRARY_PATH=~/Steam/ubuntu12_32:$LD_LIBRARY_PATH optirun./hl2_linux -game tf -steam “$@”    <—- This line right here is what i need to show you.

As you can see it says “./hl2_linux -game tf”  if you have Team Fortress 2 (Beta). You need to change “tf” to “tf_beta“. “tf” is for the non beta version of TF2

For use with Half life and Counterstrike. Make two new scripts with the same script code you just made for TF2, and put them in your half life folder.

(My scripts are called “opti-half.sh“(half life), and “opti-strike.sh“(Counterstrike))

So we will edit the last line again for these two files

Half Life: LANG=C LD_LIBRARY_PATH=~/Steam/ubuntu12_32:$LD_LIBRARY_PATH optirun ./hl_linux -game valve -steam “$@”

Counterstrike: LANG=C LD_LIBRARY_PATH=~/Steam/ubuntu12_32:$LD_LIBRARY_PATH optirun ./hl_linux -game cstrike -steam “$@”

Save them when your done, and chmod them as well.

You must have steam opened, but you can “./opti-half.sh” in a terminal, and it will open with your high powered Nvidia Graphics Card.

I have another way of doing this too. but sometimes less success.

EXAMPLE: ( Try this in a terminal within the folder of  “hl_linux“)

LD_LIBRARY_PATH=~/Steam/ubuntu12_32:$LD_LIBRARY_PATH optirun ./hl_linux -game cstrike  <— or you can use primusrun instead of optirun. It works on mine pretty well.

This script seems to only work for these three games.

Good Luck!


4 comments on “Having Trouble loading TF2 Or any other games in Steam with Optimus?

  1. orkultus says:

    I am currently fighting an error with iBomberAttack. when i try “optirun ./iBomberAttack” it flickers for a split second then goes back to command prompt. when i try “primusrun ./iBomberAttack”, i get another crash with “Segmentation Fault”

  2. orkultus says:

    Trine2 seems to work fine with “optirun ./trine2.sh” as well as “primusrun ./trine2.sh”

  3. orkultus says:

    If you have a problem where TF2 wont seem connected to steam and not find servers or friends playing games…try this in a terminal (while being in the Team Fortress 2 Directory)

    LANG=C LC_NUMERIC=C SteamAppId=440 vblank_mode=0 primusrun ./hl2.sh -steam -console -game tf -novid

  4. orkultus says:

    OK so for the new Couterstrike source, i just made a small script in the Counter-strike Source folder, called “optistrike-source.sh” and added the following


    LANG=C LC_NUMERIC=C SteamAppId=240 vblank_mode=0 optirun -c yuv ./hl2.sh -steam -console -game cstrike -novid

    Then chmod +x optistrike-source.sh and then run ./optistrike-source.sh

    Hope this helps!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s