Here's how I got StarCraft II running under Kubuntu 12.04 with Wine 1.5 and Bumblebee (for NVIDIA Optimus laptops). Hopefully, someone else will find it useful. I will assume you've already installed Wine 1.5 and Bumblebee. Make sure Bumblebee is working correctly for Linux apps before tackling Wine with it.
- First, install Visual C++ runtimes:
winetricks vcrun2005 vcrun2008
- Run winecfg. Go to the Libraries tab and add a new override for "msvcp90" (without the quotes). Then edit the override and select Native (Windows). The dialog should now resemble the screenshot below. Click OK to save and exit.
- Open a terminal and spawn a bash process under optirun. Then start the StarCraft II downloadable installer under Wine. The executable name might vary.
At this point, the game should install and run correctly. Note that you cannot specify the wine command as an argument to optirun because StarCraft II spawns child processes and terminates the parent process. However, it's a pain to spawn a bash process every time we want to run StarCraft, so we'll solve that problem next.
Launching StarCraft II after installation: You can't use the shortcut that the installer creates to launch StarCraft II because it won't run under Bumblebee that way. Starting it directly under optirun doesn't work either because StarCraft II's launcher spawns several child processes and terminates the launcher process, which terminates optirun, too. Instead, you need to make sure optirun is started and stays running until all the child processes have exited. I've written a little Python script that handles this.
Save the above script as /usr/local/bin/starcraft2 (or whatever you prefer) and make it executable by running:
# Run StarCraft II via Optirun. Requires jumping through hoops because
# the first executable launches a couple of subprocesses so we need to
# keep Optirun alive for those.
if 'RUNNING_WITH_OPTIRUN' in sys.argv:
home_dir = os.environ['HOME']
subprocess.check_call(['wine', home_dir + '/.wine/drive_c/Program Files (x86)/StarCraft II/StarCraft II.exe'])
# Wait for initial launcher subprocess to be called. It handles patch updates and such.
# Keep alive until the launcher terminates.
while subprocess.Popen(['pidof', 'Blizzard Launcher.exe'], stdout=subprocess.PIPE).communicate():
# Wait for game executable to be called.
# Keep alive until the game executable terminates.
while subprocess.Popen(['pidof', 'SC2.exe', 'Agent.exe'], stdout=subprocess.PIPE).communicate():
# Call myself with optirun.
subprocess.check_call(['optirun', sys.argv, 'RUNNING_WITH_OPTIRUN'])
Now you can launch StarCraft II by running:
sudo chmod +x /usr/local/bin/starcraft2
Create a menu item for the script if you like. Enjoy!