## Tuesday, June 16, 2015

### Civilization 4 on Linux Via Wine

I have a week off, and figured I'd be productive by playing Civ continuously the entire time.  I've used Wine a bit, but not much with modern games like Civ 4.  It took me several hours, so I figured I'd document the process here for future reference.

To begin, get iso's of the game and two expansions.  Wine doesn't work well with multidisc installations, but if you have isos you can mount them all before you begin.  Also each disc is one independent installation.  I have the actual discs, but found it much easier to download them.

It is also easier to use Wine as 32 bit, instead of trying to get 64 bit to work.  Since I wasn't using Wine for anything important, I just deleted my ~/.wine directory.  I then ran export WINEARCH=win32 before I ran any wine command.  Export will save that variable in your terminal window until you close it, but with multiple terminals open I found it safer to just compulsively enter it.

Next, you'll need a shell script called Winetricks.  You run Winetricks with arguments of various dlls and other things you need to be manually overridden.  For Civ 4 you'll need msxml3 for sure.  I ran winetricks msxml3 msxml4 vcrun2003 quartz devenum corefonts lucida tahoma, because I found it somewhere on the internet.

Run winecfg and go to the Libraries tab.  Find the library called gameux, and add it to the list of overrides, and then edit it to be disabled.  I also found that Wine did not do a good job of guessing my graphics RAM, so I had to run wine regedit.exe and add the key HKCU>Software>Wine>Direct3D>VideoMemorySize and set the value to 512.

Now, mount your 3 isos.  Navigate to the directory containing the installs and run them via Wine (make sure you've exported WINEARCH=win32 first).  The installs were straightforward.  After you've installed Beyond the Sword, download the latest patch (3.19) and install that via Wine.  The expansions will install the patches for the vanilla game, and the latest patch makes it no-cd so no need to download cracks.

You can navigate to ~/.wine/drive_c/.  If you see "Program Files (x86)" it means you messed up with your export WINEARCH=win32's and installed the game as 64 bit.  It may still work, but if not delete ~/.wine and try again.

The game is at: "~/.wine/drive_c/Program Files/Firaxis Games/Sid Meier's Civilization 4/Beyond the Sword/Civ4BeyondSword.exe".  Run it via Wine.  After it starts, you can exit and then find the config file at "~/My Games/Beyond the Sword/CivilizationIV.ini".  If you are having trouble you can set FullScreen = 0 and find ScreenHeight and ScreenWidth and set them low.  I have no trouble with full screen 1920x1080 though.  Set NoIntroMovie = 1, AutoSaveInterval = 1, DisableFileCaching = 1, DisableCaching = 1, ModularLoading = 1.

After that you should be good.  The game runs quite well, I've only noticed some slight graphics errors on some of the 3d animated leaders' faces.  I did have crashing sometimes when attempting to open certain advisor windows (military advisor seemed most common).  The Windows error message recommended I lower graphics settings and so I did from high to medium and haven't had a crash since.