CIV4 Memory Fix



A lot of us have had problems with CIV4, becuase it takes a lot of ram. I have 1024MB, and it still works hard. Some of my friends can't even run the game. For some of you, the game chrashes. Often while loading. Big loads.

So what are we gonna do? Here is the answer:

Harkonnen sat down, amde a fix for memory. This fix frees up memory, and makes CIV4 use less. Note that this file in NOT official.

Anyway, works very well for me, should with you too!



Fix forum thread (CivFanatics) http://forums.civfanatics.com/showthread.php?t=146309

This patch is primarily for those who have at least 128Mb of video memory with TnL card above GeForce2 and at least 512Mb of physical memory, but you may give it a try even with lower specs.

First of all 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.

2) Run the game (if it doesn't run, follow past step 8)

3) Set it to windowed mode (not must-do, but preferable to get stable first launch)

4) Set anti-aliasing to 0 (also not 100% required)

5) Set all low/high settings on the left to 'low' (same as above)

6) Check 'Low resolution textures' (same as above)

7) Then you may check anything on the right, i.e. effects and animations.

8) 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.


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 recommending setting them to 'low'.

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 may increase detail even more, and it will even more playable.

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 200 if you have 256Mb of video memory.

Also please read attentively comment above 'insane_mode' in Harkonnen.ini. nVidia and 

some ATi users 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!
Though probably only with ATi cards...)

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 maek 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.

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 might have negative effects too, but I don't know for sure about the last one. It is not necessary to uninstall it completely, just turn it off.

There are no comments yet. Be the first!