View unanswered posts | View active topics It is currently 24 Feb 2020, o 19:34

Reply to topic  [ 2 posts ] 
 How to compile the game core 
Author Message
RI Team
User avatar

Joined: 2 May 2009, o 15:44
Posts: 841
Location: Olympia, WA, USA
Post How to compile the game core
NOTE: This post is a work-in-progress and isn't finished yet.

Operating Systems
The instructions in this guide should be suitable for Windows XP, Vista, 7, 8 and 10. Both 32-bit and 64-bit editions of each operating system should work.

Civilization IV was originally developed with Visual Studio 2003. At the time it was state of the art, but today it's considered an antiquated build environment, and a legal copy of Visual Studio 2003 is very difficult to come by. At this time of writing, Visual Studio 2015 is the current incarnation of Microsoft's development environment.

Incompatible Compilers
Unfortunately, the Visual Studio 2015 compiler isn't compatible with the Visual Studio 2003 compiler. This means that even if we could build the game core using the VS 2015 compiler, it would fail to load because the main executable (Civ4BeyondSword.exe) was compiled with the VS 2003 compiler. A major change to the memory layout of structs was made in VS 2005, and as a result every release since has produced code libraries that are incompatible with VS 2003.

Fortunately, Visual Studio can be configured to use a makefile to build a project instead of using the typical build process. A makefile a custom set of instructions that outline what to do to build the project. If we have the old VS 2003 compiler available to us, we can use a makefile to tell Visual Studio 2015 to use the old compiler. This is how development of Realism: Invictus continues today.

Windows Platform SDK
In addition to the compiler, we need a set of C++ libraries that enable our compiled game core to work with Windows. These libraries are contained in the "Windows Platform SDK". Like the compiler, there are much newer versions available and today it's simply called the Windows SDK, but we need a particular vintage from the era that Civilization IV was developed.

Acquiring Visual Studio 2015
If you happen to own Visual Studio that's great, but if you don't you can download "Visual Studio 2015 Community Edition" from this link:

The Community Edition of Visual Studio is free, but it might require registration of some kind.

Acquiring Visual C++ Toolkit 2003
Microsoft used to distribute the toolkit on their website, but they no longer provide the older versions. Kael acquired a copy and made it available here: (31 MB)

Download the 31 MB toolkit and install it. The default installation location will be "C:\Program Files (x86)\Microsoft Visual C++ Toolkit 2003". The default options should be reasonable for most people.

Acquiring additional libraries
There are three additional .lib files which are needed for compilation but aren't automatically included in the toolkit. Download the following files and copy them to the toolkit's lib directory "C:\Program Files (x86)\Microsoft Visual C++ Toolkit 2003\lib":

Acquiring the Microsoft Platform SDK
Many versions of the Microsoft Platform SDK that have been released over the years. The "Windows® Server 2003 SP1 Platform SDK" seems to have a compatible set of include libraries for us to build with. At the time of writing, it is still available from the Microsoft Download Center as a web install:

Note that there are three different installers that are available for different architectures (32-bit, 64-bit, and Itanium which nobody uses). Download the installer that is appropriate for your system:
  • PSDK-amd64.exe [for 64-bit systems] (1319 KB)
  • PSDK-x86.exe [for 32-bit systems] (1294 KB)

When you run the installer, you'll want to do a custom install so that you can avoid installing unnecessary components. The only two components out of the entire SDK that you need to install are the tools and the 32-bit build environment. We'll be building a 32-bit DLL so select the 32-bit component even on 64-bit systems:
  • Microsoft Windows Core SDK / Tools
  • Microsoft Windows Core SDK / Build Environment / Build Environment (x86 32-bit)

Instruct the installer to install these two component to the local hard drive, and change everything else to "Will not be available". The "Tools (AMD 64-bit)" and "Tools (Intel 64-bit)" sub-components are not needed, only the root "Tools" component.

Proceed with the install, which might take a while because it actually downloads data from the Microsoft servers.

2 Nov 2012, o 00:07
User avatar

Joined: 7 Sep 2007, o 18:27
Posts: 402
Location: Brazil, Latin America
Post Re: How to compile the game core
This will be very useful!

This link provides more useful information to compile:

2 Nov 2012, o 20:49
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.