An unofficial patch for Civ IV 1 reply

Please wait...


I tawt I taw a puddy tat...

50 XP

30th December 2002

0 Uploads

2,806 Posts

0 Threads

#1 12 years ago

Here is the original thread that this is from. Any questions should be directed there.

This patch only affects some .ini files which you can either backup or restore from the links provided at the bottom of this post. It has made significant improvements to how Civ IV runs for many people. It mainly addresses the memory usage of Civ IV, which seems to have a memory leak that usually makes the game unplayable in the later eras. Just read the thread I linked to above if you are curious about the effects of this patch.

Many thanks are due to Harkonnen for all his time and effort in creating this patch. I am simply sharing this info for those who need help making Civ IV run better. He says he will update this patch in the next few days to address the problem some people are having with wonder movies being choppy and a couple of other things.

HarkonnenThe patch I was coding during last month is finally out. Here we go.

You will need 3 files to be placed into your civ4 game folder (where Civilization4.exe resides)

A single zipped pack is attached to this post (see bottom of the post), or you may visit this URL (thanks to phalzyr for this mirror):

Or you may want to download those files separately:

'zlib1.dll' just loads 'PatchByHarkonnen.dll', otherwise it was compiled from most recent zlib source from

Note that it is necessary to download and replace zlib1.dll (either via .zip or solely), otherwise memory fix won't have any effect because PatchByHarkonnen.dll won't be loaded.

I recommend to turn AGP on (SMARTGART for ATi cards for example) and set AGP apperture size to maximum in BIOS (if you don't know how, just don't care). Your AGP setting might be off because it helped some people earlier to keep game non-crashing, so they still might have it off.

This patch is primarily for those who have at least 64Mb (better 128Mb) of video memory with preferably TnL card above GeForce2. You may give it a try even with lower specs - some people reported it had effect on very low-end machines.

First of all please follow these steps. Note that some steps are about decreasing graphics quality. This is not required, it is just to make sure that your first start with my memory-fix to be success, so you may increase graphics quality later when you get it running for the first time.

So, let's go:

1) Modify "Civiliation4.ini" - set "D3D9Query = 1", "DynamicAnimPaging = 0". If you have trouble finding/editing this file, don't care and skip to step 2. (CivilizationIV.ini file is in the My Documents\My Games\Sid Meier's Civilization 4 folder) 2) If you have 1 Gb of memory or above, skip past step 9. 3) Run the game (if it doesn't run, follow past step 9) 4) Set it to windowed mode (not must-do, but preferable to get stable first launch) 5) Set anti-aliasing to 0 (also not 100% required) 6) Set all low/high settings on the left to 'low' (same as above) 7) Check 'Low resolution textures' (same as above) 8) Then you may check anything on the right, i.e. effects and animations. 9) Exit the game

If the game hangs during 'Initializing Python' step, just restart it and hold down 'Shift' key, so it updates its files cache. This thing is not about my patch, this is something about fresh python24.dll sources...

If you could do all of these steps, try loading some of your huge savegames. If the game crashed or graphics becomes damanged (main menu globe and sun), set 'insane_mode = 0' in Harkonnen.ini file and try again.


If the game crashes during loading (and crash comes from PatchByHarkonnen.dll if you click details), try recommendation from this post on this thread (post #50): It says to turn off ATI Tray Tools software. RivaTuner appears to be ok with my fix (thanks to Kolyana for pointing that out).

Also, xFire coming with 1.09 patch is also causing this crash according to a lot of data sent by filterban per my mail requests. This will be fixed with the next release, and thanks to filterban for his help! It's enough just to quit xFire, no need to uninsntall it. And, again, it's temporary solution until next release of my fix.


Subscribe this thread if you want to get email notifications about new releases. The first update is on its way.

Some explanations:

Windowed mode increases chances that the game won't crash in 'insane' mode (read below).

Antialiasing = 0 dramatically increases speed - the game uses way too detailed geometry, so it turns out around a triangle per every 3-4 pixels. So setting AA to 4 makes your video card workign at actual ~2048x2048 resolution, no wonder it's so slow... Old cards like GeForece2 always increased resolution (supersampling), modern video-cards increase resolution only in places of triangle edges, but these are just too frequent with this game... so multisampling works like supersampling.

I didn't see textures quality affecting anything except globe in the main menu :) But it allows winning ~50Mb more memory, so I recommend setting them to 'low'. BlueMarble textures might actually suffer with 'low' settings so I leave decision up to you... Just if you have 512Mb or even 256Mb of physical memory, every detail setting counts.

Animations/Effects decrease performance, but they are worth seeing, so turn them on if you want.

Settings described above made my hugest Indian 1961 AD savegame playable with my 512Mb and my patch in insane mode. If you have 1Gb of memory or 256Mb of video memory, you do not need reducing detail level.

If you are interested in my 1961 AD savegame, here is the link:


Now, if the game ran fine, please look at 'Harkonnen.ini' and set 'vid_mem_size' as commented there. Basically you may want to set it to 180 if you have 256Mb of video memory. Also please read attentively comment above 'insane_mode' in Harkonnen.ini. Some old card users (or some not-so-popular cards / drivers users) will probably need settings this to '0'.

Memory savings (as for my 1961 AD savegame, low texture settings):

1) patch_on = 0 - ~700Mb

2) patch_on = 1, vid_mem_usage = 80, insane_mode = 0 - ~600Mb

3) patch_on = 1, vid_mem_usage = 80, insane_mode = 1 - ~520Mb

4) patch_on = 1, vid_mem_usage = 180, insane_mode = 1 - ~420Mb (I didn't try this last one. 256Mb vid-ram people should try that!)

So far, that 1961 AD savegame is the most memory-consuming thing I ever faced, so most

other problematic savegames will work at around ~450Mb even with vid_mem_usage = 80.

I want to thank everyone from Memory Leak? thread for keeping my enthusiasm alive. When I receive some feedback on this patch, I will make final release out of it add all of you guys to CREDITS zone. Thanks! :)

From now on you can play... enjoy! :)

P.S: The most funny thing is that this patch acts as a layer between civilization4.exe and d3d9.dll. I mean it doesn't break any non-disassembly agreement. The only arguable effect on the game is changing window title and some messages I left behind to keep Firaxis/Take2 away from using it until they reply to me. Actually, this patch is rather universal, at least with overuse like that one of civ4. I'd like someone to try it with "Sid Meiers's Pirates". Thanks.

Original 'zlib1.dll' and 'python24.dll' (those you may need to overwrite) are located at:

MrFancypants Forum Admin

The Bad

216,579 XP

7th December 2003

0 Uploads

19,982 Posts

6 Threads

#2 12 years ago

Thanks for the info, I'll try that :)