Special Fried Dice

Beer Gaming and Geekery

Running "Sid Meier's Civilization V" Under Linux

Posted By: Rich

Tagged: Wine - Ubuntu - Turn based strategy - Technology - Sid Meier - PC Game - Linux - Civilization V - civ5 -

Civ5 is one of the great games of our time, it is built on a fine heritage of turn based strategy games in the same franchise, and it has refined this concept to a perfect finish. The only downside is that there is no Linux version, so I thought I would put together a piece on getting this game up and running under Linux.

The short version

The short version, for the guys who just want to play the game now and don't care how things work. Don't take offence to that, weekday evenings I am a Guy who 'just wants stuff to work' too. So for you here is the short version, this makes the following assumptions.

  1. You have Civ5 Installed on windows already

  2. You have Wine installed on your Linux Machine already (inc winetricks)

Copy the game install Dir from the windows drive/partition/VM to the wine subfolder, usually "/home/Username/.wine/Drive_C/Program Files/"

Then you will need to meet a few dependencies for the game to run, winetricks will fix them for us:

./winetricks vcrun2008 d3dx9_36

that ought to pull down all the DLL files you will need, now just run the game with the normal

  wine "C:\Program Files\Sid Meier's Civilization V\CivilizationV.exe"



help - I am getting a bug where sound cuts out

This is to do with how wine interfaces with pulseaudio on some systems. just use the pulseaudio oss wrapper when you launch the game. Launch the game with this:

padsp wine "C:\Program Files\Sid Meier's Civilization V\CivilizationV.exe"

Ok, thats 99% of you sorted out, if anyone is curious as to what was done, how and why, then read on.


The Long Version

Otherwise known as the way of pain, or “what I did this weekend”, this part isn't intended for people who want things to 'just work'. This is an 'Under the hood' piece which explains why we did what we did in the short version.

First thing I do when looking to get something to work on wine, I run it in windows first to get a feel for the app.  This can either be a Virtual Machine, or a dedicated windows install.  I have a duel-boot setup for this, so I boot into windowsXP and install the game.  Although this is much more hassle than using a virtual machine, in the case of games, running on a native install is always better because VM's dont have the GPU support yet to properly test games. 

Anyway once the game is installed I Ran "Dependency Walker" over the main game exe. Dependency Walker is a free program used to list the imported and exported functions of an executable file. It also displays a recursive tree of all the dependencies of the executable file (all the files it requires to run). It only shows the load-time dependencies; it is not possible to know every run-time dependency without disassembling or executing the program.

Screenshot below of the dependency tree of "CivilizationV.exe"

This gives us a lot of great info on the exe, but the bit we are interested in is a list of what DLLs the exe calls, as shown below:

Side-by-Side components (Windows 2000/XP/2003/Vista/+)

   [F ] c:\windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4048_x-ww_d4179ccd\MSVCP90.DLL
   [F ] c:\windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4048_x-ww_d4179ccd\MSVCR90.DLL
   [F ] c:\windows\winsxs\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.0.6001.22319_x-ww_f0b4c2df\GDIPLUS.DLL
The system's "KnownDLLs" list
   [F ] c:\windows\system32\ADVAPI32.DLL
   [F ] c:\windows\system32\APPHELP.DLL
   [F ] c:\windows\system32\COMCTL32.DLL
   [F ] c:\windows\system32\COMDLG32.DLL
   [F ] c:\windows\system32\GDI32.DLL
   [F ] c:\windows\system32\IEFRAME.DLL
   [F ] c:\windows\system32\IERTUTIL.DLL
   [F ] c:\windows\system32\IMAGEHLP.DLL
   [F ] c:\windows\system32\KERNEL32.DLL
   [F ] c:\windows\system32\LZ32.DLL
   [F ] c:\windows\system32\MPR.DLL
   [F ] c:\windows\system32\MSVCRT.DLL
   [F ] c:\windows\system32\NORMALIZ.DLL
   [F ] c:\windows\system32\NTDLL.DLL
   [F ] c:\windows\system32\OLE32.DLL
   [F ] c:\windows\system32\OLEAUT32.DLL
   [F ] c:\windows\system32\OLECLI32.DLL
   [F ] c:\windows\system32\OLECNV32.DLL
   [F ] c:\windows\system32\OLESVR32.DLL
   [F ] c:\windows\system32\OLETHK32.DLL
   [F ] c:\windows\system32\RPCRT4.DLL
   [F ] c:\windows\system32\SECUR32.DLL
   [F ] c:\windows\system32\SHELL32.DLL
   [F ] c:\windows\system32\SHLWAPI.DLL
   [F ] c:\windows\system32\URL.DLL
   [F ] c:\windows\system32\URLMON.DLL
   [F ] c:\windows\system32\USER32.DLL
   [F ] c:\windows\system32\USERENV.DLL
   [F ] c:\windows\system32\VERSION.DLL
   [F ] c:\windows\system32\WININET.DLL
   [F ] c:\windows\system32\WLDAP32.DLL
   [F ] c:\windows\system32\WOW32.DLL
The application directory
   [  ] C:\Program Files\Sid Meier's Civilization V\
The 32-bit system directory
   [  ] C:\WINDOWS\system32\
The 16-bit system directory (Windows NT/2000/XP/2003/Vista/+)
   [  ] C:\WINDOWS\system\
The system's root OS directory
   [  ] C:\WINDOWS\
The application's registered "App Paths" directories
The system's "PATH" environment variable directories
   [  ] C:\Program Files\NVIDIA Corporation\PhysX\Common\
   [  ] C:\WINDOWS\system32\
   [  ] C:\WINDOWS\
   [  ] C:\WINDOWS\System32\Wbem\


Ok, so most of those are general system DLL's which wine will provide as standard.  The only ones which leap out as problematic is MSVCR90.DLL and MSVCP90.DLL.   From the file name we can tell that Sid and his team use 'Visual studio 2008', and the 2 files listed are the "visual C Runtime" and "Standard Library" respectivly (Multi-threaded Dynamically linked).  We are going to have to get those DLLs from somewhere.  Grab the "Visual C Runtime 2008 Redistributable" installer from download.microsoft.com (vcredist_x86.exe)

In order to keep things tidy I am going to make a new wine prefix.  This is good practice as it neatly encapsulates the program we are running, so (unlike windows) there is no risk of one programs install or uninstall effecting other programs.  Naturally the downside is this costs a tiny bit more hard disk space but hey, megabytes are really cheap nowadays. 

So, we make the new prefix

rich@chrome:~$ WINEPREFIX=/home/rich/.wine-civ5 winecfg
wine: created the configuration directory '/home/rich/.wine-civ5'

And I copy the VisualC runtime installer to the newly created virtual C drive.

rich@chrome:~$ cp ~/Downloads/vcredist_x86.exe ~/.wine/Drive_C/
rich@chrome:~$ WINEPREFIX=/home/rich/.wine-civ5 wine "C:\vcredist_x86.exe"

Although wine should pick this up automatically, its worth setting it as a manual override anyway

Run winecfg for the new prefix as shown below, and check the dll is overridden.

Once I had run through the install I decided to give the game a try on the off chance it may work.  It didnt, but you see where I am going with the iterative steps of testing until something works. 

rich@chrome:~$ WINEPREFIX=/home/rich/.wine-civ5 wine "C:\Program Files\Sid Meier's Civilization V\CivilizationV.exe"
wine: Call from 0x7b8373a2 to unimplemented function d3dx9_36.dll.D3DXFillTexture, aborting
wine: Unimplemented function d3dx9_36.dll.D3DXFillTexture called at address 0x7b8373a2 (thread 0009), starting debugger...
Unhandled exception: unimplemented function d3dx9_36.dll.D3DXFillTexture called in 32-bit code (0x7b8373a2).
Register dump:
 CS:0023 SS:002b DS:002b ES:002b FS:0063 GS:006b
 EIP:7b8373a2 ESP:0032f174 EBP:0032f1d8 EFLAGS:00200246(   - --  I  Z- -P- )
 EAX:7b8265b9 EBX:7b883ff4 ECX:00000000 EDX:80000100
 ESI:80000100 EDI:0bdd2f00
Stack dump:
0x0032f174:  0032f1f8 00000008 0032f33c 80000100
0x0032f184:  00000001 00000000 7b8373a2 00000002
0x0032f194:  7eb61f80 7eb62854 00000015 0032f200
0x0032f1a4:  7df60218 0810a2c0 081404d8 00000100
0x0032f1b4:  00000100 00000007 00000000 00000015
0x0032f1c4:  00000001 0032f1e8 7b83735a 00000000
=>0 0x7b8373a2 in kernel32 (+0x273a2) (0x0032f1d8)
  1 0x7eb61c38 in d3dx9_36 (+0x41c37) (0x0032f208)
  2 0x7eb32111 in d3dx9_36 (+0x12110) (0x0bdb1158)
wine: Call from 0x7b8373a2 to unimplemented function d3dx9_36.dll.D3DXFillTexture, aborting
wine: Call from 0x7b8373a2 to unimplemented function d3dx9_36.dll.D3DXFillTexture, aborting

Ok so this crashed horribly, whilst calling d3dx9_36.dll.  So this is a DirectX bug.  While wine provides a fairly good DirectX enviroment, due to the nature of graphics hardware and how rapidly things evolve, its sometimes a good idea to use the microsoft implementation rather than the wine one as more function calls are supported.

So we Pull the "DirectX 9.0c Redistributable Package Feb2010" from Microsoft.com, copy it to the wine C Drive root and run it

rich@chrome:~$ WINEPREFIX=/home/rich/.wine-civ5 wine "C:\directx_feb2010_redist.exe"

Ok that was just a self extracting archive, now we run the installer.

rich@chrome:~$ WINEPREFIX=/home/rich/.wine-civ5 wine "C:\dx9\DXSETUP.exe"

Once that has been installed I tried to run the game again

rich@chrome:~$ WINEPREFIX=/home/rich/.wine-civ5 wine "C:\Program Files\Sid Meier's Civilization V\CivilizationV.exe"


There are a few other tweaks to make just to make sure things keep running smoothly. 

First up, Graphics.  I run a duel-monitor setup, which adds complication to matters.  In order to smooth over the rough edges I set up the following

  • Within Civ5, Under graphics options, I set the game to run FULLSCREEN

  • Within Winecfg, I set the app to lauch in a virtual desktop the same size as ONE of my two monitors

The result is the app happily running on one screen while I can work on the other monitor.  Good luck ever getting that to work smoothly under windows.  You may also want to tick the box preventing the mouse leaving the game window.  Some people like it locked in, other prefer to keep it free roaming and use the keyboard instead.  It all depends how you are used to playing the game.

Sound, as already covered, I use OSS inside as its the simplest, and pipe that to Pulseaudio for output.  The settings I used are shown below, just remember to launch your game using "padsp"


WINEPREFIX=/home/rich/.wine-civ5 padsp wine "C:\Program Files\Sid Meier's Civilization V\CivilizationV.exe"

Last Up, Just showing off, but if you have everything set up ok, the Game window shouldn't lag up too much when compositing under Compiz or similar window manager.  Screenshot below spans both my monitors, using the compiz plugins "cube", "Cube-reflect", and the sperical cube settings.  But now I'm just showing off

Ok, I really hoped this has helped people.  In the finest traditionof linux users, if anyone has any comments questions or suggestions, please feel free to fuck off and RTFM.  Lol, only kidding :D. Once I have enabled public comments on this website feel free to leave one