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:
#!/bin/bash
# hl2.sh modified for TF2 and optirun
# http://steamcommunity.com/groups/LinuxOptimus
GAMEROOT=$(cd “${0%/*}” && echo $PWD)
STEAMPATH=$(readlink ~/.steampath)
export LD_LIBRARY_PATH=”${GAMEROOT}”/bin:$LD_LIBRARY_PATH
if [ ! -z ${STEAMPATH} ]; then
export LD_LIBRARY_PATH=”$(dirname ${STEAMPATH})”:$LD_LIBRARY_PATH
fi
ulimit -n 2048
export __GL_THREADED_OPTIMIZATIONS=1
cd “$GAMEROOT”
if [ ! -f steam_appid.txt ]; then
echo “520” > steam_appid.txt
fi
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!
-Orkultus-