In the last post, we discussed using Gnome Do to do awesome things such as maintaining Twitter easily.

Elder Scrolls IV: Oblivion (in Wine)One of the key factors in finally making the switch over to Linux completely was when I learned that Windows Emulation had progressed far enough that I’d be able to play modern games on it successfully. I hate to seem so shallow that video games would make or break the decision, but I just know that if I can’t do pretty much EVERYTHING I like to do while on Linux, the likelihood of its endurance is far less.

Counter Strike: Source (in Wine)In any case — with a few simple steps, a few downloaded files, and some patience, you can easily setup DirectX 9 in WinE and play many modern games including Civilization IV, Elder Scrolls IV: Oblivion, Counterstrike: Source, and many others. NVidia cards tend to have much better success than ATI, but there area workarounds for ATI users.

Wine’s official website maintains a very comprehensive database of applications that have been tested under Wine. The list is intimidatingly long, and contains both popular and esoteric gmes; old and new. The “Platinum Top 10″ (top 10 most popular games, raked by popularity, that work perfectly in Wine without any modification) are:

  1. Guild Wars
  2. Photoshop CS2 (CS3 and CS4 have not bee fully emulated yet)
  3. Supreme Commander
  4. Watchtower Library 2008 (yes, as in the Jehova’s Witnesses… strange that it’s a top 10 app)
  5. Half-life 2 Retail
  6. Silkroad Online
  7. Spore
  8. Day of Defeat: Source (via Steam)
  9. Star Wars: Jedi Knight – Jedi Academy
  10. Call of Duty 2

see more games/apps from the Platinum list

The Gold list, games that require a few tweaks but work perfectly once fixed. The tweaks are almost always in the AppDB profile, but if not, it’s just a google search away. :) The Top 10 list has some high profile games, and so it’s worth mentioning:

  1. Final Fantasy XI
  2. Warhammer Online Live
  3. World of Warcraft (The profile explains that the only reason “Platinum” wasn’t chosen is because the Installation wasn’t tested — they likely just copied it over from a Windows computer; full installation instructions are available on the Wine Profile though.)
  4. EVE Online
  5. StarCraft Brood War
  6. Steam (the distribution platform for games from the “Valve” distributor — there may be some issues with “purchasing” games on Steam, but any games that you have already purchased on your account should be downloadable just fine)
  7. Team Fortress 2 (Steam)
  8. Aion: The Tower of Eternity
  9. Command & Conquer 3: Tiberium Wars
  10. Warcraft III: The Frozen Throne (Battle.net play was not officially tested, but may work)

Not every game works just yet, but the list is growing. See the Wine ApplicationDB for info about whether or not your favorite apps will work, and how well they work.

Pretty much every modern game (made for windows) requires DirectX, but fortunately setting up DirectX is pretty easy and can be done in less than 30 minutes (assuming a broadband Internet connection). Below is all the files, and instructions, to getting set up with DirectX in Wine.

Installing Wine

Make sure you have Wine installed. This is most easily done through the Ubuntu Software Center, but you can also do it through Synaptic, or from the command line (“sudo apt-get install wine” will do it). Lonewolf’s original instructions (see below for link) have not yet been updated for Karmic Koala, so you can’t follow his verbatim anymore.

Trust me on this, though — install Wine through USC and you’ll be fine. It covers all the bases. Once it’s installed, you should see a “Wine” submenu in your “Applications” menu, probably at the bottom of the list. No need to do anything with it just yet — but you can at least ensure that it has indeed installed.

Preparing for DirectX

Humongous thanks go to Lone Wolf for his absolutely awesome guide to getting setup with DirectX. The instructions below are a distilled down version of his original instructions. I am also mirroring his files as well. If for some reason you are unable to download the files from me, check his website.

The files you need to download have been neatly compressed and are available for download here.  Before you download them though, we need to put the gloves on because we’re going to get our hands a little dirty. Start by opening up a terminal window — click on “Applications” -> “Accessories” -> “Terminal”. From here on, any text appearing in a blockquote will be stuff you can copy and paste into your terminal directly. Start with this:

cd /tmp
wget http://amhill.net/pub/directx/directx_pack_nov2009.tar.gz
tar xzvf directx_pack_nov2009.tar.gz

That file, directx_pack_nov2009.tar.gz contains files from LoneWolf’s site that were pulled, and tested, in November 2009. It’s ~89MB, but contains all the big files you’ll need to download, including the DirectX setup file.

Until that file and those commands have finished, you can’t proceed. I’ll wait.

Link up our sound drivers to Wine

This assumes you use ALSA — and unless you specifically uninstalled it, you probably do. In your terminal window, enter:

/usr/bin/regedit /tmp/audio.reg

There won’t be mch fanfare unless something didn’t work correctly.

Link up our video drivers to Wine

Copy and paste this behemoth into your terminal. Don’t be afraid of it, just be sure you get it all. What this does is examine your video hardware, extract a few crucial details, and pop them into one of the files you downloaded.

/usr/bin/lspci | /bin/grep VGA | /bin/sed -e ‘s/^\([^ ]* \).*/\1/’ \
| /usr/bin/xargs -iPCIID /bin/sh -c “/usr/bin/lspci -v -s PCIID” \
| /bin/grep Memory | /bin/sed -e ‘s/.*size=\([0-9]*\).*/\1/’ \
| /usr/bin/sort -g | /usr/bin/tail -n1 \
| /usr/bin/xargs -iVIDEORAM /bin/sed -i -e ‘s/VIDEO_RAM/VIDEORAM/’ /tmp/video_ram.reg

And now, like last time, enter it into the Wine registry.

/usr/bin/regedit /tmp/video_ram.reg

Optinonal: Retrofit for older games

This next command is only necessary if you plan on playing certain older games (Lonewolf mentions “Caesar III” as an example). Older games were apparently allowed to be a little more cavalier with their use of memory. If you are only going to be playing modern games, you can probably skip this step.

sudo /bin/cp /etc/sysctl.conf /etc/sysctl.conf.back
sudo /bin/sed -i -e ‘s/^\(vm.mmap_min_addr =\) .*/\1 0/’ /etc/sysctl.conf
sudo /sbin/sysctl -p

Installing DirectX

Now we’re ready to get into the nitty-gritty.

First, there are a few DLL’s that need to be loaded and registered for the DirectX setup program to work. These were in the big pack you downloaded earlier. The DLLs need to be in the system32 folder, so we’ll move them there first:

mv /tmp/*.dll ~/.wine/drive_c/windows/system32/

…and now register them.

/usr/bin/regedit /tmp/directx.reg

Wine is now ready to have DirectX installed. First we need to create a folder to hold the install files, then extract the files, and then we’ll actually run setup.

mkdir ~/.wine/drive_c/DIRECTX

/usr/bin/cabextract -d ~/.wine/drive_c/DIRECTX /tmp/directx_mar2008_redist.exe
/usr/bin/wine “C:\DIRECTX\DXSETUP.exe”

That should show some familiar screens.

If you’d like to confirm that DirectX has been installed successfully, you can run the DX Diagnostic tool. Please note that some of the tests may not work correctly, but this is OK. As long as the program itself loads, we’re in good shape.

/usr/bin/wine “C:\windows\system32\dxdiag.exe”

We can now delete the setup files.

rm /tmp/directx_mar2008_redist.exe
rm -r ~/.wine/drive_c/DIRECTX
rmdir ~/.wine/drive_c/DIRECTX

Install Additional Libraries

Technically, DirectX will work right now. But many modern games require some additional libraries to work correctly. We’ll go ahead and install them all now just so that you don’t have to think about it again.

One of the files downloaded in the package was “winetricks” — this is a really cool script that handles a lot of the complex library installation / setup. It is possible that everything above could have been handled by a winetricks command, but I’ve never tested it that way. When you run this command, expect a lot of text to fly by quickly. Just let your eyes glaze over while it works, or play minesweeper, or browse the net while it’s running. It should take 30 secs – 1 minute to run, and shouldn’t require any interaction on your part.

First, we need to move winetricks to its permanent home:

mv /tmp/winetricks ~/.wine/

HTML Renderer

The HTML renderer is used for rendering web content in DirectX. Steam-based games will absolutely require this. To install, all you need to do is:

/bin/sh ~/.wine/winetricks gecko

Lonewolf suggests testing it by loading up Internet Explorer. Be sure you’re connected to the Internet, and then enter this command in the terminal:

wine “C:\Program Files\Internet Explorer\IEXPLORE.EXE” http://appdb.winehq.com/

If you saw the WineHQ website, you’re golden. If not, go check the many lines of text that flew by and look for lines that suggest “error”, then google those messages. Sorry I can’t be more specific than that. :) I’ve never had any problems with that step, and really, if you’ve made it this far, I doubt you will either.

Movie Renderers (Activemovie & Quicktime)

These applications are necessary for some games from the late 1990s (Myst, 7th Guest, etc.).

Installing ActiveMovie requires that you first install the program, then add it to the Wine registry, then add it to the Windows registry.

wine /tmp/amov4ie.exe
/usr/bin/regedit /tmp/active_movie.reg
/usr/bin/regsvr32 “c:\windows\system32\amstream.dll”

Installing Quicktime is similar, but there’s one extra step because of a glitch in how Quicktime acts. (It’s expecting a Windows 95/98 environment) First, install Quicktime itself, then load up the Control Panel and change some settings (see below). The screen may go black / change during installation. This is ok.

wine /tmp/quicktimefullinstaller-6-5-2.exe
wine “c:\windows\system32\rundll32.exe” shell32.dll,Control_RunDLL QuickTime.cpl

Lonewolf now instructs to change the following settings:

  • In section “Browser Plug-in”, uncheck “QuickTime system tray icon”.
  • In section “Video Settings”, choose “Save Mode (GDI Only)”.
  • Close the Quicktime Control Panel window.

Installing MSXML3

Many newer games, such as Civilization IV, require the newer XML library from Microsoft. It’s a painless install and won’t hurt to do now, even if you don’t plan on installing any of those games. Winetricks handles the grunt work for us — again, you may see a bunch of text flyby, just don’t worry about it.

/bin/sh ~/.wine/winetricks msxml3

You’re all done!

Installing Your Games

Generally, all you need to do to install a game is pop the CD in, right click on the setup.exe file and choose “Open with wine”. The rest of the process should proceed normally. If you run into problems, consult the Wine AppDB for advice.

There are some games that are unable to install correctly due to DirectX issues — Civilization: Beyond the Sword was one of them. I was able to get it working by installing it in Windows and then copying that whole directory over to Linux (either burn it to DVD or copy over the network, either works). It works perfectly after that.

Some games, such as Sid Meier’s Railroads!, will install but have gameplay issues. Again, consult the AppDB. If a game is at least “Silver” rated, it should be playable, for the most part.

Non-game applications can be installed in a similar fashion. But most of those don’t require DirectX. :)

More with Winetricks (Optional)

Winetricks can handle the installation of numerous other windows libraries including .NET, Flash, Visual J#, and many others.

The official list is available on wine’s website, in a special page devoted to Winetricks. Typically, the winetricks command only require you to specify which package you want to load, and the script will handle all the other details. It’s pretty amazing.

That’s It For This Time!

Thanks for reading the 7-part “Karmic Win” series! We’ll have some more “Linux FTW” in the near future, I’m sure.

Popularity: 5% [?]