Today on Apolyton POLYCAST #58 (PROMO #9) MODCAST #23 CIVCON '09 ANNOUNCED: AUGUST 7-9, 2009 TRI-LEAGUE #27 BTS TEAM D.G.: ENGAGE NOW
Apolyton Civilization Site Forums
main | civ4 | col | civrev | galciv2 | alt | civ3 | civ2 | ctp2 | smac | about | polycast
- Order Civilization IV: Colonization (Amazon US)/(UK) -
- Order Civilization: Revolution [360] (Amazon US)/(UK) | [PS3] (US)/(UK) | [DS] (US)/(UK) -
ApolytonPLUS | register | new posts | pm (-/-) | members
faq | news | civgroups (news) | hall of fame | downloads | upload | plus | store | search
Apolyton Civilization Site Forums : Powered by vBulletin version 2.0.3 Apolyton Civilization Site Forums > Civilization IV > Civ4 Creation > Compiling the SDK
Page: Print | Email | Subscribe | Report News       0 votes -  average
19.Jul: A RELIGIOUS REVIEW
18.Jun: BTS PATCH 3.17 OUT NOW!!!
15.Apr: RTW ADDON PACK 2 AVAILABLE NOW
CivGroups
Civilization IV Creators (96): Not a Member - Join

bottom of page
  - CIVILIZATION 4 (C&B) $49.95 - CIVILIZATION 4 (EB) $49.99 - CIVILIZATION 4 (AMZ) $49.99
Author
Thread   
Pages (3): [ 1   2   3   ]
< Last Thread     Next Thread > Post New Thread     Post A Reply
Locutus
Apolytoners Hall of FameCiv4 SP Democracy GameCiv4 InterSite DG: Apolyton TeamBtS Tri-LeagueC4BtSDG TemplarsC4WDG Team ApolytonCivilization IV CreatorsCTP2 Source Code ProjectPolyCast Team
Co-Owner/ Administrator
De Hel van Enschede
Nov 1999
time: 23:33
13-04-2006 21:42 | www
edit | quote
#1 | report |
Compiling the SDK Support Apolyton, pre-order Civilization IV


Edit: I merged this thread with smacfan's, since they cover the same topic.

I suspect there will be some issues with this, so might as well create a thread about it.

If you have Visual Studio 2003 (Visual C++ 7) you should be able to load the SDK up directly. If not, you can use the following process to get codeblocks to allow you to modify and compile the SDK. All the software you need for this is freeware. DaveMcW pioneered this:

quote:
Here is a free method of building the DLL. (Thanks to Ogre Wiki for many of the details.)

I had trouble getting some of the debug options to compile, so I turned them off.


1: Download the VC++ Toolkit 2003 and install it.

2: Grab the 3 multithreaded library files and put them in C:\Program Files\Microsoft Visual C++ Toolkit 2003\lib.
msvcrt.lib and msvcrtd.lib (found in the .NET runtime)
msvcprt.lib (Read Ogre Wiki to see where this comes from)

3: Download the Platform SDK. You can also use internet explorer to install it automatically (recommended).

4: Download the latest CodeBlocks "without compiler" and install it.

5: The first time you install CodeBlocks, you will be shown a list of compilers. Select Microsoft Visual C++ Toolkit, and click Set As Default. Press OK.

6: Go to Settings->Compiler in the CodeBlocks menu. Click the "Directories" tab and add the the following directories to the compiler tab (changing to account for where you installed the packages):

code:
C:\Program Files\Microsoft Visual C++ Toolkit 2003\Include C:\Program Files\Microsoft Platform SDK\Include


In the Directories/Linker tab add the following directories:

code:
C:\Program Files\Microsoft Visual C++ Toolkit 2003\Lib C:\Program Files\Microsoft Platform SDK\Lib


7: Open \CvGameCoreDLL\CvGameCoreDLL.vcproj in CodeBlocks.

8: Go to Project->Build options->Final Release.

On the "Compiler Flags" tab, uncheck "Produce debugging symbols [/Zi]".

On the "Other options" tab, change EHsc to /EHsc

On the "Linker" tab, add a new link library called user32

Also on the Linker tab, delete the linker option "/pdb:Final Release\CvGameCoreDLL.pdb" and press OK.

9: Change the "Build target" drop-down to Final Release.

10: File->Save project. This creates a CodeBlocks project (.cbp) that you can open in the future.

11: Build->Build. When the compiler finishes, you will have \..\Assets\CvGameCoreDLL.dll !

Last edited by Locutus on 15-04-2006 at 12:53

MMC

Civ4 SP Democracy GameCivilization IV CreatorsCivilization IV: MultiplayerCiv4 InterSite DG: Apolyton TeamDiploGamesSpore
King
of the wet little isle known as Britain
Mar 2006
time: 22:33
13-04-2006 22:14 | www
edit | quote
#2 | report |
Support Apolyton buy from Amazon


The SDK converts to Visual C++ 2005 (8.0) as long as you remember the ensure that no files are read-only. I haven't tried compiling it yet, so I can't say about possible stability issues, but I don't think there should be many (VC++ 2003 -> 2005 shouldn't have anywhere near as many problems as VC++ 6 -> 2003 is famous for).

Also Visual Studio 2005 Express Edition is fully capable of handling the SDK. Plus it's free, which is rare for Microsoft.

Locutus
Apolytoners Hall of FameCiv4 SP Democracy GameCiv4 InterSite DG: Apolyton TeamBtS Tri-LeagueC4BtSDG TemplarsC4WDG Team ApolytonCivilization IV CreatorsCTP2 Source Code ProjectPolyCast Team
Co-Owner/ Administrator
De Hel van Enschede
Nov 1999
time: 23:33
13-04-2006 22:23 | www
edit | quote
#3 | report |
Got spare money?


quote:
Originally posted by MMC
The SDK converts to Visual C++ 2005 (8.0) as long as you remember the ensure that no files are read-only. I haven't tried compiling it yet, so I can't say about possible stability issues, but I don't think there should be many (VC++ 2003 -> 2005 shouldn't have anywhere near as many problems as VC++ 6 -> 2003 is famous for).


Nope, 2005 doesn't compile. There's some problem with something in the Boost Python code IIRC (which is outside the SDK). This may well be fixed in the XP (no promises though), but for this SDK it's too late.

Last edited by Locutus on 13-04-2006 at 22:28

MMC

Civ4 SP Democracy GameCivilization IV CreatorsCivilization IV: MultiplayerCiv4 InterSite DG: Apolyton TeamDiploGamesSpore
King
of the wet little isle known as Britain
Mar 2006
time: 22:33
13-04-2006 22:26 | www
edit | quote
#4 | report |
Support Apolyton buy from Amazon


Ok... Although I have been able to compile Source (ie Half Life 2) on VC++ 2005, and that's not supposed to work either. Maybe I have a weird version of VC++ that doesn't have all the bugs in it that M$ use to make you need the service packs.

Nacht
Prince
Amsterdam
May 2002
time: 23:33
14-04-2006 08:00
edit | quote
#5 | report |
Support Apolyton, buy Civilization III: Complete


So microsoft incorporates bugs just to make sure that we download service packs that are free anyway?

MMC

Civ4 SP Democracy GameCivilization IV CreatorsCivilization IV: MultiplayerCiv4 InterSite DG: Apolyton TeamDiploGamesSpore
King
of the wet little isle known as Britain
Mar 2006
time: 22:33
14-04-2006 14:55 | www
edit | quote
#6 | report |
Support Apolyton, buy Galactic Civilizations


meh... just because the services packs are free, why should they change the operating policy that seems to have worked for them for 20 odd years? :P

DOS never had 'service packs'. You had to buy the next version to fix problems or get new features.

smacfan
Chieftain
Brooklyn, NY
Jan 2005
time: 17:33
15-04-2006 03:08
edit | quote
#7 | report |
Compiling the SDK to match 1.61 Support Apolyton, buy GURPS/ Alpha Centauri


OK, per the post by PJayTycy in the 1.61 patch thread (about 2/3 of the way down on this page: http://www.apolyton.com/forums/show...59&pagenumber=2) I have installed the MSVC 2003 stuff, Platform SDK, .NET SDK, .NET libs, plus CodeBlocks, made the compiler & linker dir and option changes, saved the project file and ran a build. Substituting my DLL for the 1.61 DLL, first thing I notice is that the intro graphics and movie are even choppier than they were with the 1.61 release version.

So, what can we do in building the DLL to fix the choppiness of the movies? I noticed a linker switch in the Final Release target, "/debug", does this need to be deleted? I also notice that the newly built DLL is about 1 MB bigger than the released patch version. How did they do that?

To prevent the same question from being asked again, yes I am building the "Final Release" target, and *not* a debug target. Checked and double-checked.

TIA for any help you can provide.

smacfan

smacfan
Chieftain
Brooklyn, NY
Jan 2005
time: 17:33
15-04-2006 03:37
edit | quote
#8 | report |
Support Apolyton, buy Call to Power 2


Sorry to answer my own post, but I tried a build without the Linker "/debug" switch, this reduced the "Final Release" DLL to 3756KB in size, vs 3620KB for the released 1.61 patch DLL. I would presume that the Linker switch was including debug libraries even though compiler debugging had been turned off.

However, it is still not identical in size, which worries me a little.

Can anyone tell what that "/pdb:..." switch in the original "vcproj" project file was intended to do? I deleted it per the instructions, but I hate to do things without knowing the reasons for doing it.

WRT the size difference, could it be differences in the MS SDK or .NET SDK libs that cause the difference?

Oh, and the rebuilt DLL runs the game just fine (so far, not really thoroughly tested yet on my games in progresss, but I'll get around to it, sooner or later... )

smacfan

Peter Triggs
CTP2 Source Code ProjectCivilization IV Creators
King
Gone Fishin, Canada
Jan 2000
time: 22:33
15-04-2006 04:44
edit | quote
#9 | report |
Remove this text


That must be the switch that (now) builds a program database file:

quote:

A program database (PDB) file holds debugging and project state information that allows incremental linking of a Debug configuration of your program.


http://msdn2.microsoft.com/en-us/library/yd4f8bd1(VS.80).aspx

Mirakle
NationStates
Settler
Aug 2003
time: 23:33
15-04-2006 11:02
edit | quote
#10 | report |
Avatar Enlargement: We've got the solution


Is it possible to compile with another compiler than Visual C++ ?

Locutus
Apolytoners Hall of FameCiv4 SP Democracy GameCiv4 InterSite DG: Apolyton TeamBtS Tri-LeagueC4BtSDG TemplarsC4WDG Team ApolytonCivilization IV CreatorsCTP2 Source Code ProjectPolyCast Team
Co-Owner/ Administrator
De Hel van Enschede
Nov 1999
time: 23:33
15-04-2006 12:44 | www
edit | quote
#11 | report |
Lose 30 kilos (of popups)


quote:
Originally posted by Mirakle
Is it possible to compile with another compiler than Visual C++ ?


Sure, but you'll have to make your own makefile.

Gramphos
Civilization III MultiplayerC4WDG Team ApolytonCivilization IV: MultiplayerAge of Nations TeamCivilization IV Creators
Technical Director
Chalmers, Sweden
Apr 2001
time: 23:33
15-04-2006 13:41
edit | quote
#12 | report |
Tired of ads?


quote:
Originally posted by Locutus


Sure, but you'll have to make your own makefile.

The exported function names has to be decorated in the same way as MS compilers decorartes them. This makes it difficult, but not impossible to use other compilers. (You will most likely have to assign the export names for the functions yourself.)

Locutus
Apolytoners Hall of FameCiv4 SP Democracy GameCiv4 InterSite DG: Apolyton TeamBtS Tri-LeagueC4BtSDG TemplarsC4WDG Team ApolytonCivilization IV CreatorsCTP2 Source Code ProjectPolyCast Team
Co-Owner/ Administrator
De Hel van Enschede
Nov 1999
time: 23:33
15-04-2006 14:24 | www
edit | quote
#13 | report |
Support Apolyton, buy Galactic Civilizations: Deluxe Edition


I never said it was easy

smacfan
Chieftain
Brooklyn, NY
Jan 2005
time: 17:33
15-04-2006 17:42
edit | quote
#14 | report |
Enter the AD-FREE zone


quote:
Originally posted by Peter Triggs
That must be the switch that (now) builds a program database file:

http://msdn2.microsoft.com/en-us/library/yd4f8bd1(VS.80).aspx


Many thanks, that eases my worries.

Now, if I (we) can figure out how the Fireaxians created a DLL that's 136KB smaller than I (we) can create out here in the wild, I would have no worries at all.

Can we ask Soren or Thamer to chime in on this, please?

Pretty please? With a cherry on top?

smacfan

kato-uke
Settler
Mar 2006
time: 22:33
15-04-2006 20:01
edit | quote
#15 | report |
Increase the size of your Attachments


136 KB sounds almost exactly like the default debug info VC/VC+ adds if you don't turn that off. on binaries at least, no idea about libraries.

smacfan
Chieftain
Brooklyn, NY
Jan 2005
time: 17:33
15-04-2006 20:47
edit | quote
#16 | report |
Avatar Enlargement: We've got the solution


quote:
Originally posted by kato-uke
136 KB sounds almost exactly like the default debug info VC/VC+ adds if you don't turn that off. on binaries at least, no idea about libraries.


Interesting. I'll check the VC++ "/help" output to see if there is a switch other than just not specifying the debug one I know about.

On a second item, the choppiness of the movies, especially the intro movie:

I have discovered that it is choppy (or not) depending on the resolution I use. On my desktop system I normally play at 1600x1200 (19in monitor), but on my 1280x800 laptop the movies are not choppy at all.

SO, I reduced the desktop game graphics to 1280x800, and lo and behold, no choppiness.

I guess the 128K video memory in my Radeon X300 isn't quite enough for non-choppy movies at 1600x1200 resolution.

At least I have an explanation, and it isn't the rebuilt SDK I'm now using. That's the good news.

smacfan

smacfan
Chieftain
Brooklyn, NY
Jan 2005
time: 17:33
15-04-2006 22:18
edit | quote
#17 | report |
Help yourself to an AD-FREE life


A couple of things:

1. The "/EHsc" switch on the "Other Options" screen, under "Build Options" for the "Final Release" target, can be replaced in CodeBlocks with the "Enable C++ Exception Handling [/GX]" switch on the "Compiler options" tab instead. "/GX" (according to the VC++ help output) is equivalent to "/EHsc". Checked by rebuilding and comparing the size of the outputs, got the same 3756KB size with "/GX" as with "/EHsc".

2. In the project file, the optimization for the "Final Release" target is "Maximize Speed [/O2]". By chosing "Minimize space [/O1]" instead, the DLL became only 3132KB instead of the 3620KB of the 1.61 patch or the 3756KB of the SDK build with "Maximize speed [/O2]".

I don't intend to run the "Minimize space" version, since like everyone else I would far rather "Maximize speed"! However, it's an interesting difference nonetheless.

Now to actually start looking at some code!

smacfan

[edit] -- Checked the compiler switches in the VC++ help output, and there do not seem to be switches to turn off any "default" debugging info that might be generated in an SDK build. There are some switches I won't claim to understand, but I guess the bottom line is that the SDK build seems to work OK, even if it isn't *exactly* what they released.

nik9000
Settler
Mar 2005
time: 22:33
16-04-2006 13:33
edit | quote
#18 | report |
Lose 30 kilos (of popups)


I wish they had spent some more time documenting this thing. Every time I look for something its like trying to stab someone through curtain.

Edit:
Its probably worth saying what I'm trying to do and what I'm looking for.

I want to create a framework to allow interrested parties to write AIs and have them all in the same game. My first point of order is to figure out how the game stores its CvPlayer objects and to then define an interface for client AIs that does not allow them to "cheat."

At this point, I'm looking for where that player information is stored. I know in objects of type CvPlayer, but not where they are kept.

dsplaisted
Settler
Nov 2005
time: 22:33
17-04-2006 21:23
edit | quote
#19 | report |
Lose 30 kilos (of popups)


quote:
Originally posted by nik9000
I want to create a framework to allow interrested parties to write AIs and have them all in the same game. My first point of order is to figure out how the game stores its CvPlayer objects and to then define an interface for client AIs that does not allow them to "cheat."

At this point, I'm looking for where that player information is stored. I know in objects of type CvPlayer, but not where they are kept.


I am working on something similar, although I am not going to worry about preventing the AI from cheating. I have a feeling it would add a lot of overhead, and if an AI is using compiled code they can bypass your interface and cheat anyway.

If I remember correctly, the CvPlayer objects are actually CvPlayerAI objects. CvPlayerAI is a subclass of CvPlayer. There is a static array of these objects in CvPlayerAI.h and also a GET_PLAYER macro which will return the object given an id.

It appears that the enum PlayerTypes is used for the player id. This is kind of confusing because based on the name you would think the enum would be used for something else.

Daniel

Fromafar
CTP2 Source Code Project
Prince
May 2003
time: 23:33
18-04-2006 22:18
edit | quote
#20 | report |
Enter the AD-FREE zone


quote:
Originally posted by Locutus
Nope, 2005 doesn't compile. There's some problem with something in the Boost Python code IIRC (which is outside the SDK). This may well be fixed in the XP (no promises though), but for this SDK it's too late.


Actually, it will compile with MSVC 2005 after a small change. Frankly, I am somewhat surprised that it does not issue a compiler error in its present form. In CyInfoInterface2.cpp, line 304 is really suspect. I would suggest changing
code:
.def_readwrite("getUniqueRange", &CvBonusClassInfo::getUniqueRange)
to either
code:
.def("getUniqueRange", &CvBonusClassInfo::getUniqueRange, "int ()")

for read-only access through a Getter, or
code:
.def_readwrite("iUniqueRange", &CvBonusClassInfo::m_iUniqueRange)

for direct read-write access to a member variable. In the latter case, you also have to make CvBonusClassInfo::m_iUniqueRange public.

You would have to ask Firaxis which version is intended.

wgabrie
Prince
New York, USA
Oct 2001
time: 17:33
22-04-2006 02:37
edit | quote
#21 | report |
Put an end to popups!


I couldn't build the SDK after following the instructions in the first post. I got a "fatal error C1083 - windows.h not found" when I tried to build the project.

To fix this I needed to add "C:\Microsoft Visual Studio 8\Microsoft Platform SDK\Include" path to the Project >> build-options >> Final >> Directory list.

Just thought everyone should know, in case they are having the same problem.

Ari
Warlord
Boston
Nov 2001
time: 22:33
22-04-2006 14:58
edit | quote
#22 | report |
Got spare money?


When I follow the link to get the toolkit, I'm told that "The Visual C++ Toolkit 2003 has been replaced by Visual C++ 2005 Express Edition."

Given that posts below mention that this cannot compile, am I out of luck? Or can I search for a 2003 version elsewhere? Or am I wrong and the 2005 version is perfectly acceptable?

smacfan
Chieftain
Brooklyn, NY
Jan 2005
time: 17:33
22-04-2006 15:53
edit | quote
#23 | report |
Support Apolyton buy from Amazon


quote:
Originally posted by Ari
When I follow the link to get the toolkit, I'm told that "The Visual C++ Toolkit 2003 has been replaced by Visual C++ 2005 Express Edition."

Given that posts below mention that this cannot compile, am I out of luck? Or can I search for a 2003 version elsewhere? Or am I wrong and the 2005 version is perfectly acceptable?


Oh my. You are quite correct, M$ seems to have removed that DL since I got it on April 13th.

I can upload it if someone can host it, it is about 32MB (32,177KB) though, so it needs to be a big HD and fast net connection.

Don't know the legality of hosting it either, IANAL.

smacfan

Ari
Warlord
Boston
Nov 2001
time: 22:33
22-04-2006 20:20
edit | quote
#24 | report |
Support Apolyton, buy Civilization: The Boardgame


I went to the archived page on archive.org, and got a valid link to *a* download. I won't know until I actually install it if it's 2003 or simply the newest version pointed to from the same link (which will be later today, since I'm on a 56k, and have to get out anyway)

http://web.archive.org/web/20060422...&displaylang=en


edit: confirmed that this is indeed the 2003 version.

Last edited by Ari on 22-04-2006 at 22:24

smacfan
Chieftain
Brooklyn, NY
Jan 2005
time: 17:33
23-04-2006 23:57
edit | quote
#25 | report |
Full PM-box? Change here!


quote:
Originally posted by Ari
I went to the archived page on archive.org, and got a valid link to *a* download. I won't know until I actually install it if it's 2003 or simply the newest version pointed to from the same link (which will be later today, since I'm on a 56k, and have to get out anyway)

http://web.archive.org/web/20060422...&displaylang=en

edit: confirmed that this is indeed the 2003 version.


Glad you got it, I just checked your web.archive.org link and it's gone from there as well.

Do you think M$ is trying to send a message? Will they come after us next?

smacfan

Ari
Warlord
Boston
Nov 2001
time: 22:33
24-04-2006 20:04
edit | quote
#26 | report |
Inflate your Upload Space


Geez, so it is. I wonder if my downloading it prompted them to realize they still had it on their server. I'd be more than happy to upload it someplace if anyone wants.

PJayTycy